rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
|
---|---|---|
if (a != TOP && a != CENTER && a != BOTTOM) throw new IllegalArgumentException("Invalid alignment."); | public void setVerticalAlignment(int a) { if (verticalAlignment == a) return; int old = verticalAlignment; verticalAlignment = a; firePropertyChange(VERTICAL_ALIGNMENT_CHANGED_PROPERTY, old, a); revalidate(); repaint(); } |
|
if (t != TOP && t != CENTER && t != BOTTOM) throw new IllegalArgumentException("Invalid alignment."); | public void setVerticalTextPosition(int t) { if (verticalTextPosition == t) return; int old = verticalTextPosition; verticalTextPosition = t; firePropertyChange(VERTICAL_TEXT_POSITION_CHANGED_PROPERTY, old, t); revalidate(); repaint(); } |
|
this.operand1 = getOperand(varIndex1); | public ConditionalBranchQuad(int address, IRBasicBlock block, int varIndex1, int condition, int varIndex2, int targetAddress) { super(address, block, targetAddress); if (condition < IF_ICMPEQ || condition > IF_ACMPNE) { throw new IllegalArgumentException("can't use that condition here"); } this.operand1 = getOperand(varIndex1); this.condition = condition; this.commutative = condition == IF_ICMPEQ || condition == IF_ICMPNE || condition == IF_ACMPEQ || condition == IF_ACMPNE; this.operand2 = getOperand(varIndex2); refs = new Operand[]{operand1, operand2}; } |
|
this.operand2 = getOperand(varIndex2); refs = new Operand[]{operand1, operand2}; | refs = new Operand[]{ getOperand(varIndex1), getOperand(varIndex2) }; | public ConditionalBranchQuad(int address, IRBasicBlock block, int varIndex1, int condition, int varIndex2, int targetAddress) { super(address, block, targetAddress); if (condition < IF_ICMPEQ || condition > IF_ACMPNE) { throw new IllegalArgumentException("can't use that condition here"); } this.operand1 = getOperand(varIndex1); this.condition = condition; this.commutative = condition == IF_ICMPEQ || condition == IF_ICMPNE || condition == IF_ACMPEQ || condition == IF_ACMPNE; this.operand2 = getOperand(varIndex2); refs = new Operand[]{operand1, operand2}; } |
operand1 = operand1.simplify(); if (operand1 instanceof Variable) { Variable v = (Variable) operand1; | refs[0] = refs[0].simplify(); if (refs[0] instanceof Variable) { Variable v = (Variable) refs[0]; | public void doPass2(BootableHashMap liveVariables) { operand1 = operand1.simplify(); if (operand1 instanceof Variable) { Variable v = (Variable) operand1; v.setLastUseAddress(this.getAddress()); liveVariables.put(v, v); } if (operand2 != null) { operand2 = operand2.simplify(); if (operand2 instanceof Variable) { Variable v = (Variable) operand2; v.setLastUseAddress(this.getAddress()); liveVariables.put(v, v); } } } |
if (operand2 != null) { operand2 = operand2.simplify(); if (operand2 instanceof Variable) { Variable v = (Variable) operand2; | if (refs[1] != null) { refs[1] = refs[1].simplify(); if (refs[1] instanceof Variable) { Variable v = (Variable) refs[1]; | public void doPass2(BootableHashMap liveVariables) { operand1 = operand1.simplify(); if (operand1 instanceof Variable) { Variable v = (Variable) operand1; v.setLastUseAddress(this.getAddress()); liveVariables.put(v, v); } if (operand2 != null) { operand2 = operand2.simplify(); if (operand2 instanceof Variable) { Variable v = (Variable) operand2; v.setLastUseAddress(this.getAddress()); liveVariables.put(v, v); } } } |
int op1Mode = operand1.getAddressingMode(); int op2Mode = operand2.getAddressingMode(); | int op1Mode = refs[0].getAddressingMode(); int op2Mode = refs[1].getAddressingMode(); | public void generateCodeForBinary(CodeGenerator cg) { cg.checkLabel(getAddress()); int op1Mode = operand1.getAddressingMode(); int op2Mode = operand2.getAddressingMode(); Object reg2 = null; if (op1Mode == Operand.MODE_REGISTER) { Variable var = (Variable) operand1; RegisterLocation regLoc = (RegisterLocation) var.getLocation(); reg2 = regLoc.getRegister(); } Object reg3 = null; if (op2Mode == Operand.MODE_REGISTER) { Variable var = (Variable) operand2; RegisterLocation regLoc = (RegisterLocation) var.getLocation(); reg3 = regLoc.getRegister(); } int disp2 = 0; if (op1Mode == Operand.MODE_STACK) { Variable var = (Variable) operand1; StackLocation stackLoc = (StackLocation) var.getLocation(); disp2 = stackLoc.getDisplacement(); } int disp3 = 0; if (op2Mode == Operand.MODE_STACK) { Variable var = (Variable) operand2; StackLocation stackLoc = (StackLocation) var.getLocation(); disp3 = stackLoc.getDisplacement(); } Constant c2 = null; if (op1Mode == Operand.MODE_CONSTANT) { c2 = (Constant) operand1; } Constant c3 = null; if (op2Mode == Operand.MODE_CONSTANT) { c3 = (Constant) operand2; } int aMode = (op1Mode << 8) | op2Mode; switch (aMode) { case MODE_CC: cg.generateCodeFor(this, c2, condition, c3); break; case MODE_CR: if (commutative && !cg.supports3AddrOps()) { cg.generateCodeFor(this, reg3, condition, c2); } else { cg.generateCodeFor(this, c2, condition, reg3); } break; case MODE_CS: cg.generateCodeFor(this, c2, condition, disp3); break; case MODE_RC: cg.generateCodeFor(this, reg2, condition, c3); break; case MODE_RR: if (commutative && !cg.supports3AddrOps()) { cg.generateCodeFor(this, reg3, condition, reg2); } else { cg.generateCodeFor(this, reg2, condition, reg3); } break; case MODE_RS: cg.generateCodeFor(this, reg2, condition, disp3); break; case MODE_SC: cg.generateCodeFor(this, disp2, condition, c3); break; case MODE_SR: if (commutative && !cg.supports3AddrOps()) { cg.generateCodeFor(this, reg3, condition, disp2); } else { cg.generateCodeFor(this, disp2, condition, reg3); } break; case MODE_SS: cg.generateCodeFor(this, disp2, condition, disp3); break; default: throw new IllegalArgumentException("Undefined addressing mode: " + aMode); } } |
Variable var = (Variable) operand1; | Variable var = (Variable) refs[0]; | public void generateCodeForBinary(CodeGenerator cg) { cg.checkLabel(getAddress()); int op1Mode = operand1.getAddressingMode(); int op2Mode = operand2.getAddressingMode(); Object reg2 = null; if (op1Mode == Operand.MODE_REGISTER) { Variable var = (Variable) operand1; RegisterLocation regLoc = (RegisterLocation) var.getLocation(); reg2 = regLoc.getRegister(); } Object reg3 = null; if (op2Mode == Operand.MODE_REGISTER) { Variable var = (Variable) operand2; RegisterLocation regLoc = (RegisterLocation) var.getLocation(); reg3 = regLoc.getRegister(); } int disp2 = 0; if (op1Mode == Operand.MODE_STACK) { Variable var = (Variable) operand1; StackLocation stackLoc = (StackLocation) var.getLocation(); disp2 = stackLoc.getDisplacement(); } int disp3 = 0; if (op2Mode == Operand.MODE_STACK) { Variable var = (Variable) operand2; StackLocation stackLoc = (StackLocation) var.getLocation(); disp3 = stackLoc.getDisplacement(); } Constant c2 = null; if (op1Mode == Operand.MODE_CONSTANT) { c2 = (Constant) operand1; } Constant c3 = null; if (op2Mode == Operand.MODE_CONSTANT) { c3 = (Constant) operand2; } int aMode = (op1Mode << 8) | op2Mode; switch (aMode) { case MODE_CC: cg.generateCodeFor(this, c2, condition, c3); break; case MODE_CR: if (commutative && !cg.supports3AddrOps()) { cg.generateCodeFor(this, reg3, condition, c2); } else { cg.generateCodeFor(this, c2, condition, reg3); } break; case MODE_CS: cg.generateCodeFor(this, c2, condition, disp3); break; case MODE_RC: cg.generateCodeFor(this, reg2, condition, c3); break; case MODE_RR: if (commutative && !cg.supports3AddrOps()) { cg.generateCodeFor(this, reg3, condition, reg2); } else { cg.generateCodeFor(this, reg2, condition, reg3); } break; case MODE_RS: cg.generateCodeFor(this, reg2, condition, disp3); break; case MODE_SC: cg.generateCodeFor(this, disp2, condition, c3); break; case MODE_SR: if (commutative && !cg.supports3AddrOps()) { cg.generateCodeFor(this, reg3, condition, disp2); } else { cg.generateCodeFor(this, disp2, condition, reg3); } break; case MODE_SS: cg.generateCodeFor(this, disp2, condition, disp3); break; default: throw new IllegalArgumentException("Undefined addressing mode: " + aMode); } } |
Variable var = (Variable) operand2; | Variable var = (Variable) refs[1]; | public void generateCodeForBinary(CodeGenerator cg) { cg.checkLabel(getAddress()); int op1Mode = operand1.getAddressingMode(); int op2Mode = operand2.getAddressingMode(); Object reg2 = null; if (op1Mode == Operand.MODE_REGISTER) { Variable var = (Variable) operand1; RegisterLocation regLoc = (RegisterLocation) var.getLocation(); reg2 = regLoc.getRegister(); } Object reg3 = null; if (op2Mode == Operand.MODE_REGISTER) { Variable var = (Variable) operand2; RegisterLocation regLoc = (RegisterLocation) var.getLocation(); reg3 = regLoc.getRegister(); } int disp2 = 0; if (op1Mode == Operand.MODE_STACK) { Variable var = (Variable) operand1; StackLocation stackLoc = (StackLocation) var.getLocation(); disp2 = stackLoc.getDisplacement(); } int disp3 = 0; if (op2Mode == Operand.MODE_STACK) { Variable var = (Variable) operand2; StackLocation stackLoc = (StackLocation) var.getLocation(); disp3 = stackLoc.getDisplacement(); } Constant c2 = null; if (op1Mode == Operand.MODE_CONSTANT) { c2 = (Constant) operand1; } Constant c3 = null; if (op2Mode == Operand.MODE_CONSTANT) { c3 = (Constant) operand2; } int aMode = (op1Mode << 8) | op2Mode; switch (aMode) { case MODE_CC: cg.generateCodeFor(this, c2, condition, c3); break; case MODE_CR: if (commutative && !cg.supports3AddrOps()) { cg.generateCodeFor(this, reg3, condition, c2); } else { cg.generateCodeFor(this, c2, condition, reg3); } break; case MODE_CS: cg.generateCodeFor(this, c2, condition, disp3); break; case MODE_RC: cg.generateCodeFor(this, reg2, condition, c3); break; case MODE_RR: if (commutative && !cg.supports3AddrOps()) { cg.generateCodeFor(this, reg3, condition, reg2); } else { cg.generateCodeFor(this, reg2, condition, reg3); } break; case MODE_RS: cg.generateCodeFor(this, reg2, condition, disp3); break; case MODE_SC: cg.generateCodeFor(this, disp2, condition, c3); break; case MODE_SR: if (commutative && !cg.supports3AddrOps()) { cg.generateCodeFor(this, reg3, condition, disp2); } else { cg.generateCodeFor(this, disp2, condition, reg3); } break; case MODE_SS: cg.generateCodeFor(this, disp2, condition, disp3); break; default: throw new IllegalArgumentException("Undefined addressing mode: " + aMode); } } |
c2 = (Constant) operand1; | c2 = (Constant) refs[0]; | public void generateCodeForBinary(CodeGenerator cg) { cg.checkLabel(getAddress()); int op1Mode = operand1.getAddressingMode(); int op2Mode = operand2.getAddressingMode(); Object reg2 = null; if (op1Mode == Operand.MODE_REGISTER) { Variable var = (Variable) operand1; RegisterLocation regLoc = (RegisterLocation) var.getLocation(); reg2 = regLoc.getRegister(); } Object reg3 = null; if (op2Mode == Operand.MODE_REGISTER) { Variable var = (Variable) operand2; RegisterLocation regLoc = (RegisterLocation) var.getLocation(); reg3 = regLoc.getRegister(); } int disp2 = 0; if (op1Mode == Operand.MODE_STACK) { Variable var = (Variable) operand1; StackLocation stackLoc = (StackLocation) var.getLocation(); disp2 = stackLoc.getDisplacement(); } int disp3 = 0; if (op2Mode == Operand.MODE_STACK) { Variable var = (Variable) operand2; StackLocation stackLoc = (StackLocation) var.getLocation(); disp3 = stackLoc.getDisplacement(); } Constant c2 = null; if (op1Mode == Operand.MODE_CONSTANT) { c2 = (Constant) operand1; } Constant c3 = null; if (op2Mode == Operand.MODE_CONSTANT) { c3 = (Constant) operand2; } int aMode = (op1Mode << 8) | op2Mode; switch (aMode) { case MODE_CC: cg.generateCodeFor(this, c2, condition, c3); break; case MODE_CR: if (commutative && !cg.supports3AddrOps()) { cg.generateCodeFor(this, reg3, condition, c2); } else { cg.generateCodeFor(this, c2, condition, reg3); } break; case MODE_CS: cg.generateCodeFor(this, c2, condition, disp3); break; case MODE_RC: cg.generateCodeFor(this, reg2, condition, c3); break; case MODE_RR: if (commutative && !cg.supports3AddrOps()) { cg.generateCodeFor(this, reg3, condition, reg2); } else { cg.generateCodeFor(this, reg2, condition, reg3); } break; case MODE_RS: cg.generateCodeFor(this, reg2, condition, disp3); break; case MODE_SC: cg.generateCodeFor(this, disp2, condition, c3); break; case MODE_SR: if (commutative && !cg.supports3AddrOps()) { cg.generateCodeFor(this, reg3, condition, disp2); } else { cg.generateCodeFor(this, disp2, condition, reg3); } break; case MODE_SS: cg.generateCodeFor(this, disp2, condition, disp3); break; default: throw new IllegalArgumentException("Undefined addressing mode: " + aMode); } } |
c3 = (Constant) operand2; | c3 = (Constant) refs[1]; | public void generateCodeForBinary(CodeGenerator cg) { cg.checkLabel(getAddress()); int op1Mode = operand1.getAddressingMode(); int op2Mode = operand2.getAddressingMode(); Object reg2 = null; if (op1Mode == Operand.MODE_REGISTER) { Variable var = (Variable) operand1; RegisterLocation regLoc = (RegisterLocation) var.getLocation(); reg2 = regLoc.getRegister(); } Object reg3 = null; if (op2Mode == Operand.MODE_REGISTER) { Variable var = (Variable) operand2; RegisterLocation regLoc = (RegisterLocation) var.getLocation(); reg3 = regLoc.getRegister(); } int disp2 = 0; if (op1Mode == Operand.MODE_STACK) { Variable var = (Variable) operand1; StackLocation stackLoc = (StackLocation) var.getLocation(); disp2 = stackLoc.getDisplacement(); } int disp3 = 0; if (op2Mode == Operand.MODE_STACK) { Variable var = (Variable) operand2; StackLocation stackLoc = (StackLocation) var.getLocation(); disp3 = stackLoc.getDisplacement(); } Constant c2 = null; if (op1Mode == Operand.MODE_CONSTANT) { c2 = (Constant) operand1; } Constant c3 = null; if (op2Mode == Operand.MODE_CONSTANT) { c3 = (Constant) operand2; } int aMode = (op1Mode << 8) | op2Mode; switch (aMode) { case MODE_CC: cg.generateCodeFor(this, c2, condition, c3); break; case MODE_CR: if (commutative && !cg.supports3AddrOps()) { cg.generateCodeFor(this, reg3, condition, c2); } else { cg.generateCodeFor(this, c2, condition, reg3); } break; case MODE_CS: cg.generateCodeFor(this, c2, condition, disp3); break; case MODE_RC: cg.generateCodeFor(this, reg2, condition, c3); break; case MODE_RR: if (commutative && !cg.supports3AddrOps()) { cg.generateCodeFor(this, reg3, condition, reg2); } else { cg.generateCodeFor(this, reg2, condition, reg3); } break; case MODE_RS: cg.generateCodeFor(this, reg2, condition, disp3); break; case MODE_SC: cg.generateCodeFor(this, disp2, condition, c3); break; case MODE_SR: if (commutative && !cg.supports3AddrOps()) { cg.generateCodeFor(this, reg3, condition, disp2); } else { cg.generateCodeFor(this, disp2, condition, reg3); } break; case MODE_SS: cg.generateCodeFor(this, disp2, condition, disp3); break; default: throw new IllegalArgumentException("Undefined addressing mode: " + aMode); } } |
if (operand1 instanceof Variable) { Location varLoc = ((Variable) operand1).getLocation(); | if (refs[0] instanceof Variable) { Location varLoc = ((Variable) refs[0]).getLocation(); | public void generateCodeForUnary(CodeGenerator cg) { if (operand1 instanceof Variable) { Location varLoc = ((Variable) operand1).getLocation(); if (varLoc instanceof RegisterLocation) { RegisterLocation vregLoc = (RegisterLocation) varLoc; cg.generateCodeFor(this, condition, vregLoc.getRegister()); } else if (varLoc instanceof StackLocation) { StackLocation stackLoc = (StackLocation) varLoc; cg.generateCodeFor(this, condition, stackLoc.getDisplacement()); } else { throw new IllegalArgumentException("Unknown location: " + varLoc); } } else if (operand1 instanceof Constant) { // this probably won't happen, is should be folded earlier Constant con = (Constant) operand1; cg.generateCodeFor(this, condition, con); } else { throw new IllegalArgumentException("Unknown operand: " + operand1); } } |
} else if (operand1 instanceof Constant) { | } else if (refs[0] instanceof Constant) { | public void generateCodeForUnary(CodeGenerator cg) { if (operand1 instanceof Variable) { Location varLoc = ((Variable) operand1).getLocation(); if (varLoc instanceof RegisterLocation) { RegisterLocation vregLoc = (RegisterLocation) varLoc; cg.generateCodeFor(this, condition, vregLoc.getRegister()); } else if (varLoc instanceof StackLocation) { StackLocation stackLoc = (StackLocation) varLoc; cg.generateCodeFor(this, condition, stackLoc.getDisplacement()); } else { throw new IllegalArgumentException("Unknown location: " + varLoc); } } else if (operand1 instanceof Constant) { // this probably won't happen, is should be folded earlier Constant con = (Constant) operand1; cg.generateCodeFor(this, condition, con); } else { throw new IllegalArgumentException("Unknown operand: " + operand1); } } |
Constant con = (Constant) operand1; | Constant con = (Constant) refs[0]; | public void generateCodeForUnary(CodeGenerator cg) { if (operand1 instanceof Variable) { Location varLoc = ((Variable) operand1).getLocation(); if (varLoc instanceof RegisterLocation) { RegisterLocation vregLoc = (RegisterLocation) varLoc; cg.generateCodeFor(this, condition, vregLoc.getRegister()); } else if (varLoc instanceof StackLocation) { StackLocation stackLoc = (StackLocation) varLoc; cg.generateCodeFor(this, condition, stackLoc.getDisplacement()); } else { throw new IllegalArgumentException("Unknown location: " + varLoc); } } else if (operand1 instanceof Constant) { // this probably won't happen, is should be folded earlier Constant con = (Constant) operand1; cg.generateCodeFor(this, condition, con); } else { throw new IllegalArgumentException("Unknown operand: " + operand1); } } |
throw new IllegalArgumentException("Unknown operand: " + operand1); | throw new IllegalArgumentException("Unknown operand: " + refs[0]); | public void generateCodeForUnary(CodeGenerator cg) { if (operand1 instanceof Variable) { Location varLoc = ((Variable) operand1).getLocation(); if (varLoc instanceof RegisterLocation) { RegisterLocation vregLoc = (RegisterLocation) varLoc; cg.generateCodeFor(this, condition, vregLoc.getRegister()); } else if (varLoc instanceof StackLocation) { StackLocation stackLoc = (StackLocation) varLoc; cg.generateCodeFor(this, condition, stackLoc.getDisplacement()); } else { throw new IllegalArgumentException("Unknown location: " + varLoc); } } else if (operand1 instanceof Constant) { // this probably won't happen, is should be folded earlier Constant con = (Constant) operand1; cg.generateCodeFor(this, condition, con); } else { throw new IllegalArgumentException("Unknown operand: " + operand1); } } |
return operand1; | return refs[0]; | public Operand getOperand1() { return operand1; } |
return operand2; | return refs[1]; | public Operand getOperand2() { return operand2; } |
return getAddress() + ": if " + operand1.toString() + " " + CONDITION_MAP[condition] + " " + operand2.toString() + | return getAddress() + ": if " + refs[0].toString() + " " + CONDITION_MAP[condition] + " " + refs[1].toString() + | public String toString() { if (condition >= IF_ICMPEQ) { return getAddress() + ": if " + operand1.toString() + " " + CONDITION_MAP[condition] + " " + operand2.toString() + " goto " + getTargetAddress(); } else { return getAddress() + ": if " + operand1.toString() + " " + CONDITION_MAP[condition] + " goto " + getTargetAddress(); } } |
return getAddress() + ": if " + operand1.toString() + " " + | return getAddress() + ": if " + refs[0].toString() + " " + | public String toString() { if (condition >= IF_ICMPEQ) { return getAddress() + ": if " + operand1.toString() + " " + CONDITION_MAP[condition] + " " + operand2.toString() + " goto " + getTargetAddress(); } else { return getAddress() + ": if " + operand1.toString() + " " + CONDITION_MAP[condition] + " goto " + getTargetAddress(); } } |
new OpenSameAction(session,keyMap); | void initKeyBindings() { KeyStroke ks; new NewSessionAction(session,keyMap); new ToggleConnectionAction(session,keyMap); new JumpNextAction(session,keyMap); new JumpPrevAction(session,keyMap); new HotspotsAction(session,keyMap); new GuiAction(session,keyMap); new DispMsgsAction(session,keyMap); new AttributesAction(session,keyMap); new PrintAction(session,keyMap); new RulerAction(session,keyMap); new CloseAction(session,keyMap); new TransferAction(session,keyMap); new EmailAction(session,keyMap); new RunScriptAction(session,keyMap); new DebugAction(session,keyMap); new CopyAction(session,keyMap); new SpoolWorkAction(session,keyMap); new QuickEmailAction(session,keyMap); } |
|
keyMap.init(); | KeyMapper.init(); | public KeyboardHandler(Session session) { this.session = session; this.screen = session.getScreen(); String os = System.getProperty("os.name"); if (os.toLowerCase().indexOf("linux") != -1) { System.out.println("using os " + os); isLinux = true; } keyMap = new KeyMapper(); keyMap.init(); keyMap.addKeyChangeListener(this); // initialize the keybingings of the components InputMap initKeyBindings(); } |
keyMap.addKeyChangeListener(this); | KeyMapper.addKeyChangeListener(this); | public KeyboardHandler(Session session) { this.session = session; this.screen = session.getScreen(); String os = System.getProperty("os.name"); if (os.toLowerCase().indexOf("linux") != -1) { System.out.println("using os " + os); isLinux = true; } keyMap = new KeyMapper(); keyMap.init(); keyMap.addKeyChangeListener(this); // initialize the keybingings of the components InputMap initKeyBindings(); } |
public final static String getKeyStrokeText(KeyEvent ke,boolean isAltGr) { if (!workStroke.equals(ke,isAltGr)) { workStroke.setAttributes(ke,isAltGr); lastKeyMnemonic = (String)mappedKeys.get(workStroke); } if (lastKeyMnemonic != null && lastKeyMnemonic.endsWith(".alt2")) { lastKeyMnemonic = lastKeyMnemonic.substring(0,lastKeyMnemonic.indexOf(".alt2")); } return lastKeyMnemonic; | public final static String getKeyStrokeText(KeyEvent ke) { return getKeyStrokeText(ke,false); | public final static String getKeyStrokeText(KeyEvent ke,boolean isAltGr) { if (!workStroke.equals(ke,isAltGr)) { workStroke.setAttributes(ke,isAltGr); lastKeyMnemonic = (String)mappedKeys.get(workStroke); } if (lastKeyMnemonic != null && lastKeyMnemonic.endsWith(".alt2")) { lastKeyMnemonic = lastKeyMnemonic.substring(0,lastKeyMnemonic.indexOf(".alt2")); } return lastKeyMnemonic; } |
public void executeMeMacro(String macro) { | public void executeMeMacro(ActionEvent ae) { | public void executeMeMacro(String macro) { Macronizer.invoke(macro,(Session)this); } |
Macronizer.invoke(macro,(Session)this); | executeMeMacro(ae.getActionCommand()); | public void executeMeMacro(String macro) { Macronizer.invoke(macro,(Session)this); } |
public void setLocationRelativeTo (Component c) { if (c == null || !c.isShowing ()) | public void setLocationRelativeTo(Component c) | public void setLocationRelativeTo (Component c) { if (c == null || !c.isShowing ()) { int x = 0; int y = 0; GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment (); Point center = ge.getCenterPoint (); x = center.x - (width / 2); y = center.y - (height / 2); setLocation (x, y); } else { int x = c.getX(); int y = c.getY(); int cWidth = c.getWidth(); int cHeight = c.getHeight(); Dimension screenSize = getToolkit().getScreenSize(); // If bottom of component is cut off, window placed // on the left or the right side of component if ((y + cHeight) > screenSize.height) { // If the right side of the component is closer to the center if ((screenSize.width / 2 - x) <= 0) { if ((x - width) >= 0) x -= width; else x = 0; } else { if ((x + cWidth + width) <= screenSize.width) x += cWidth; else x = screenSize.width - width; } y = screenSize.height - height; } else if (cWidth > width || cHeight > height) { // If right side of component is cut off if ((x + width) > screenSize.width) x = screenSize.width - width; // If left side of component is cut off else if (x < 0) x = 0; else x += (cWidth - width) / 2; y += (cHeight - height) / 2; } else { // If right side of component is cut off if ((x + width) > screenSize.width) x = screenSize.width - width; // If left side of component is cut off else if (x < 0) x = 0; else x -= (width - cWidth) / 2; y -= (height - cHeight) / 2; } setLocation(x, y); } } |
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment (); Point center = ge.getCenterPoint (); | if (c == null || !c.isShowing()) { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); Point center = ge.getCenterPoint(); | public void setLocationRelativeTo (Component c) { if (c == null || !c.isShowing ()) { int x = 0; int y = 0; GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment (); Point center = ge.getCenterPoint (); x = center.x - (width / 2); y = center.y - (height / 2); setLocation (x, y); } else { int x = c.getX(); int y = c.getY(); int cWidth = c.getWidth(); int cHeight = c.getHeight(); Dimension screenSize = getToolkit().getScreenSize(); // If bottom of component is cut off, window placed // on the left or the right side of component if ((y + cHeight) > screenSize.height) { // If the right side of the component is closer to the center if ((screenSize.width / 2 - x) <= 0) { if ((x - width) >= 0) x -= width; else x = 0; } else { if ((x + cWidth + width) <= screenSize.width) x += cWidth; else x = screenSize.width - width; } y = screenSize.height - height; } else if (cWidth > width || cHeight > height) { // If right side of component is cut off if ((x + width) > screenSize.width) x = screenSize.width - width; // If left side of component is cut off else if (x < 0) x = 0; else x += (cWidth - width) / 2; y += (cHeight - height) / 2; } else { // If right side of component is cut off if ((x + width) > screenSize.width) x = screenSize.width - width; // If left side of component is cut off else if (x < 0) x = 0; else x -= (width - cWidth) / 2; y -= (height - cHeight) / 2; } setLocation(x, y); } } |
setLocation (x, y); | public void setLocationRelativeTo (Component c) { if (c == null || !c.isShowing ()) { int x = 0; int y = 0; GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment (); Point center = ge.getCenterPoint (); x = center.x - (width / 2); y = center.y - (height / 2); setLocation (x, y); } else { int x = c.getX(); int y = c.getY(); int cWidth = c.getWidth(); int cHeight = c.getHeight(); Dimension screenSize = getToolkit().getScreenSize(); // If bottom of component is cut off, window placed // on the left or the right side of component if ((y + cHeight) > screenSize.height) { // If the right side of the component is closer to the center if ((screenSize.width / 2 - x) <= 0) { if ((x - width) >= 0) x -= width; else x = 0; } else { if ((x + cWidth + width) <= screenSize.width) x += cWidth; else x = screenSize.width - width; } y = screenSize.height - height; } else if (cWidth > width || cHeight > height) { // If right side of component is cut off if ((x + width) > screenSize.width) x = screenSize.width - width; // If left side of component is cut off else if (x < 0) x = 0; else x += (cWidth - width) / 2; y += (cHeight - height) / 2; } else { // If right side of component is cut off if ((x + width) > screenSize.width) x = screenSize.width - width; // If left side of component is cut off else if (x < 0) x = 0; else x -= (width - cWidth) / 2; y -= (height - cHeight) / 2; } setLocation(x, y); } } |
|
int x = c.getX(); int y = c.getY(); | public void setLocationRelativeTo (Component c) { if (c == null || !c.isShowing ()) { int x = 0; int y = 0; GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment (); Point center = ge.getCenterPoint (); x = center.x - (width / 2); y = center.y - (height / 2); setLocation (x, y); } else { int x = c.getX(); int y = c.getY(); int cWidth = c.getWidth(); int cHeight = c.getHeight(); Dimension screenSize = getToolkit().getScreenSize(); // If bottom of component is cut off, window placed // on the left or the right side of component if ((y + cHeight) > screenSize.height) { // If the right side of the component is closer to the center if ((screenSize.width / 2 - x) <= 0) { if ((x - width) >= 0) x -= width; else x = 0; } else { if ((x + cWidth + width) <= screenSize.width) x += cWidth; else x = screenSize.width - width; } y = screenSize.height - height; } else if (cWidth > width || cHeight > height) { // If right side of component is cut off if ((x + width) > screenSize.width) x = screenSize.width - width; // If left side of component is cut off else if (x < 0) x = 0; else x += (cWidth - width) / 2; y += (cHeight - height) / 2; } else { // If right side of component is cut off if ((x + width) > screenSize.width) x = screenSize.width - width; // If left side of component is cut off else if (x < 0) x = 0; else x -= (width - cWidth) / 2; y -= (height - cHeight) / 2; } setLocation(x, y); } } |
|
else if (x < 0) | else if (x < 0 || (x - (width - cWidth) / 2) < 0) | public void setLocationRelativeTo (Component c) { if (c == null || !c.isShowing ()) { int x = 0; int y = 0; GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment (); Point center = ge.getCenterPoint (); x = center.x - (width / 2); y = center.y - (height / 2); setLocation (x, y); } else { int x = c.getX(); int y = c.getY(); int cWidth = c.getWidth(); int cHeight = c.getHeight(); Dimension screenSize = getToolkit().getScreenSize(); // If bottom of component is cut off, window placed // on the left or the right side of component if ((y + cHeight) > screenSize.height) { // If the right side of the component is closer to the center if ((screenSize.width / 2 - x) <= 0) { if ((x - width) >= 0) x -= width; else x = 0; } else { if ((x + cWidth + width) <= screenSize.width) x += cWidth; else x = screenSize.width - width; } y = screenSize.height - height; } else if (cWidth > width || cHeight > height) { // If right side of component is cut off if ((x + width) > screenSize.width) x = screenSize.width - width; // If left side of component is cut off else if (x < 0) x = 0; else x += (cWidth - width) / 2; y += (cHeight - height) / 2; } else { // If right side of component is cut off if ((x + width) > screenSize.width) x = screenSize.width - width; // If left side of component is cut off else if (x < 0) x = 0; else x -= (width - cWidth) / 2; y -= (height - cHeight) / 2; } setLocation(x, y); } } |
} | public void setLocationRelativeTo (Component c) { if (c == null || !c.isShowing ()) { int x = 0; int y = 0; GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment (); Point center = ge.getCenterPoint (); x = center.x - (width / 2); y = center.y - (height / 2); setLocation (x, y); } else { int x = c.getX(); int y = c.getY(); int cWidth = c.getWidth(); int cHeight = c.getHeight(); Dimension screenSize = getToolkit().getScreenSize(); // If bottom of component is cut off, window placed // on the left or the right side of component if ((y + cHeight) > screenSize.height) { // If the right side of the component is closer to the center if ((screenSize.width / 2 - x) <= 0) { if ((x - width) >= 0) x -= width; else x = 0; } else { if ((x + cWidth + width) <= screenSize.width) x += cWidth; else x = screenSize.width - width; } y = screenSize.height - height; } else if (cWidth > width || cHeight > height) { // If right side of component is cut off if ((x + width) > screenSize.width) x = screenSize.width - width; // If left side of component is cut off else if (x < 0) x = 0; else x += (cWidth - width) / 2; y += (cHeight - height) / 2; } else { // If right side of component is cut off if ((x + width) > screenSize.width) x = screenSize.width - width; // If left side of component is cut off else if (x < 0) x = 0; else x -= (width - cWidth) / 2; y -= (height - cHeight) / 2; } setLocation(x, y); } } |
|
if (front == null || back == null) throw new IllegalArgumentException(); | public BufferCapabilities(ImageCapabilities front, ImageCapabilities back, FlipContents flip) { this.front = front; this.back = back; this.flip = flip; if (front == null || back == null) throw new IllegalArgumentException(); } |
|
next_out = 0; next_in = oldQueue.length; } notify(); } | next_out = 0; next_in = oldQueue.length; } if (dispatchThread == null || !dispatchThread.isAlive()) { System.out .println("Start new dispatchThread old=" + dispatchThread); dispatchThread = new EventDispatchThread(this); dispatchThread.start(); } if (!isDispatchThread() || (evt.getID() == WindowEvent.WINDOW_CLOSED) || (evt.getID() == WindowEvent.WINDOW_CLOSING)) ((ClasspathToolkit) Toolkit.getDefaultToolkit()).wakeNativeQueue(); notify(); } | public synchronized void postEvent(AWTEvent evt) { if (evt == null) throw new NullPointerException(); if (next != null) { next.postEvent(evt); return; } /* Check for any events already on the queue with the same source and ID. */ int i = next_out; while (i != next_in) { AWTEvent qevt = queue[i]; Object src; if (qevt.id == evt.id && (src = qevt.getSource()) == evt.getSource() && src instanceof Component) { /* If there are, call coalesceEvents on the source component to see if they can be combined. */ Component srccmp = (Component) src; AWTEvent coalesced_evt = srccmp.coalesceEvents(qevt, evt); if (coalesced_evt != null) { /* Yes. Replace the existing event with the combined event. */ queue[i] = coalesced_evt; return; } break; } if (++i == queue.length) i = 0; } queue[next_in] = evt; if (++next_in == queue.length) next_in = 0; if (next_in == next_out) { /* Queue is full. Extend it. */ AWTEvent[] oldQueue = queue; queue = new AWTEvent[queue.length * 2]; int len = oldQueue.length - next_out; System.arraycopy(oldQueue, next_out, queue, 0, len); if (next_out != 0) System.arraycopy(oldQueue, 0, queue, len, next_out); next_out = 0; next_in = oldQueue.length; } notify(); } |
return false; | boolean handled = handleEvent (e); if (!handled && getParent() != null) handled = getParent ().postEvent (e); return handled; | public boolean postEvent(Event e) { // XXX Add backward compatibility handling. return false; } |
switch (evt.id) { case Event.KEY_ACTION: case Event.KEY_PRESS: return keyDown (evt, evt.key); case Event.KEY_ACTION_RELEASE: case Event.KEY_RELEASE: return keyUp (evt, evt.key); case Event.MOUSE_DOWN: return mouseDown (evt, evt.x, evt.y); case Event.MOUSE_UP: return mouseUp (evt, evt.x, evt.y); case Event.MOUSE_MOVE: return mouseMove (evt, evt.x, evt.y); case Event.MOUSE_DRAG: return mouseDrag (evt, evt.x, evt.y); case Event.MOUSE_ENTER: return mouseEnter (evt, evt.x, evt.y); case Event.MOUSE_EXIT: return mouseExit (evt, evt.x, evt.y); case Event.GOT_FOCUS: return gotFocus (evt, evt.arg); case Event.LOST_FOCUS: return lostFocus (evt, evt.arg); case Event.ACTION_EVENT: return action (evt, evt.arg); } | public boolean handleEvent(Event evt) { // XXX Add backward compatibility handling. return false; } |
|
if (instance == null) instance = new MetalRadioButtonUI(); return instance; | return new MetalRadioButtonUI(); | public static ComponentUI createUI(JComponent component) { if (instance == null) instance = new MetalRadioButtonUI(); return instance; } |
MenuBarUI ui = ((MenuBarUI) UIManager.getUI(this)); setUI(ui); | setUI((MenuBarUI) UIManager.getUI(this)); | public void updateUI() { MenuBarUI ui = ((MenuBarUI) UIManager.getUI(this)); setUI(ui); invalidate(); } |
if (tokenizer.hasMoreTokens()) | if (tokenizer.hasMoreTokens()) { | private static void parseKeyStrokes(Properties keystrokes) { String theStringList = ""; String theKey = ""; Enumeration ke = keystrokes.propertyNames(); while (ke.hasMoreElements()) { theKey = (String)ke.nextElement(); theStringList = keystrokes.getProperty(theKey); int x = 0; int kc = 0; boolean is = false; boolean ic = false; boolean ia = false; boolean iag = false; StringTokenizer tokenizer = new StringTokenizer(theStringList, ","); // first is the keycode kc = Integer.parseInt(tokenizer.nextToken()); // isShiftDown if (tokenizer.nextToken().equals("true")) is = true; else is =false; // isControlDown if (tokenizer.nextToken().equals("true")) ic = true; else ic =false; // isAltDown if (tokenizer.nextToken().equals("true")) ia = true; else ia =false; // isAltDown Gr if (tokenizer.hasMoreTokens()) if (tokenizer.nextToken().equals("true")) iag = true; else iag =false; mappedKeys.put(new KeyStroker(kc, is, ic, ia, iag),theKey); } } |
mappedKeys.put(new KeyStroker(kc, is, ic, ia, iag),theKey); | if (tokenizer.hasMoreTokens()) { location = Integer.parseInt(tokenizer.nextToken()); } } mappedKeys.put(newKeyStroker(kc, is, ic, ia, iag,location),theKey); | private static void parseKeyStrokes(Properties keystrokes) { String theStringList = ""; String theKey = ""; Enumeration ke = keystrokes.propertyNames(); while (ke.hasMoreElements()) { theKey = (String)ke.nextElement(); theStringList = keystrokes.getProperty(theKey); int x = 0; int kc = 0; boolean is = false; boolean ic = false; boolean ia = false; boolean iag = false; StringTokenizer tokenizer = new StringTokenizer(theStringList, ","); // first is the keycode kc = Integer.parseInt(tokenizer.nextToken()); // isShiftDown if (tokenizer.nextToken().equals("true")) is = true; else is =false; // isControlDown if (tokenizer.nextToken().equals("true")) ic = true; else ic =false; // isAltDown if (tokenizer.nextToken().equals("true")) ia = true; else ia =false; // isAltDown Gr if (tokenizer.hasMoreTokens()) if (tokenizer.nextToken().equals("true")) iag = true; else iag =false; mappedKeys.put(new KeyStroker(kc, is, ic, ia, iag),theKey); } } |
usingDefaults = true; | public String getConfigurationResource() { if (configurationResource == null || configurationResource == "") { configurationResource = "TN5250JDefaults.props"; } return configurationResource; } |
|
getConfigurationResource()); | getConfigurationResource(),true, "Default Settings"); | private void loadDefaults() { try { sesProps = ConfigureFactory.getInstance().getProperties( "dfltSessionProps", getConfigurationResource()); if (sesProps.size() == 0) { Properties schemaProps = new Properties(); java.net.URL file=null; ClassLoader cl = this.getClass().getClassLoader(); if (cl == null) cl = ClassLoader.getSystemClassLoader(); file = cl.getResource("tn5250jSchemas.properties"); schemaProps.load(file.openStream()); // we will now load the default schema String prefix = schemaProps.getProperty("schemaDefault"); sesProps.setProperty("colorBg",schemaProps.getProperty(prefix + ".colorBg")); sesProps.setProperty("colorRed",schemaProps.getProperty(prefix + ".colorRed")); sesProps.setProperty("colorTurq",schemaProps.getProperty(prefix + ".colorTurq")); sesProps.setProperty("colorCursor",schemaProps.getProperty(prefix + ".colorCursor")); sesProps.setProperty("colorGUIField",schemaProps.getProperty(prefix + ".colorGUIField")); sesProps.setProperty("colorWhite",schemaProps.getProperty(prefix + ".colorWhite")); sesProps.setProperty("colorYellow",schemaProps.getProperty(prefix + ".colorYellow")); sesProps.setProperty("colorGreen",schemaProps.getProperty(prefix + ".colorGreen")); sesProps.setProperty("colorPink",schemaProps.getProperty(prefix + ".colorPink")); sesProps.setProperty("colorBlue",schemaProps.getProperty(prefix + ".colorBlue")); sesProps.setProperty("colorSep",schemaProps.getProperty(prefix + ".colorSep")); sesProps.setProperty("colorHexAttr",schemaProps.getProperty(prefix + ".colorHexAttr")); sesProps.setProperty("font",GUIGraphicsUtils.getDefaultFont()); ConfigureFactory.getInstance().saveSettings("dfltSessionProps", getConfigurationResource(), ""); } } catch (IOException ioe) { System.out.println("Information Message: Properties file is being " + "created for first time use: File name " + getConfigurationResource()); } catch (SecurityException se) { System.out.println(se.getMessage()); } } |
keepTrucking = false; | public final boolean disconnect() { if (me != null && me.isAlive()) { me.interrupt(); pthread.interrupt(); } screen52.setStatus(screen52.STATUS_SYSTEM,screen52.STATUS_VALUE_ON,"X - Disconnected"); screen52.setKeyboardLocked(false); try { if (bin != null) bin.close(); if (bout != null) bout.close(); if (sock != null) { System.out.println("Closing socket"); sock.close(); } connected = false; controller.fireSessionChanged(TN5250jConstants.STATE_DISCONNECTED); } catch(Exception exception) { System.out.println(exception.getMessage()); connected = false; devSeq = -1; return false; } devSeq = -1; return true; } |
|
boolean keepTrucking = true; | public void run () { boolean keepTrucking = true; while (keepTrucking) { try { bk = (Stream5250)dsq.get(); } catch (InterruptedException ie) { System.out.println(" vt thread interrupted and stopping "); keepTrucking = false; continue; } // lets play nicely with the others on the playground// me.yield(); pthread.yield(); invited = false; screen52.setCursorOff();// System.out.println("operation code: " + bk.getOpCode()); if (bk == null) continue; switch (bk.getOpCode()) { case 00:// System.out.println("No operation"); break; case 1:// System.out.println("Invite Operation"); parseIncoming(); screen52.setKeyboardLocked(false); cursorOn = true; setInvited(); break; case 2:// System.out.println("Output Only"); parseIncoming();// System.out.println(screen52.dirty); screen52.updateDirty(); // invited = true; break; case 3:// System.out.println("Put/Get Operation"); parseIncoming();// inviteIt =true; setInvited(); break; case 4:// System.out.println("Save Screen Operation"); parseIncoming(); break; case 5:// System.out.println("Restore Screen Operation"); parseIncoming(); break; case 6:// System.out.println("Read Immediate"); sendAidKey(0); break; case 7:// System.out.println("Reserved"); break; case 8:// System.out.println("Read Screen Operation"); try { readScreen(); } catch (IOException ex) { } break; case 9:// System.out.println("Reserved"); break; case 10:// System.out.println("Cancel Invite Operation"); cancelInvite(); break; case 11:// System.out.println("Turn on message light"); screen52.setMessageLightOn(); screen52.setCursorOn(); break; case 12:// System.out.println("Turn off Message light"); screen52.setMessageLightOff(); screen52.setCursorOn(); break; default: break; } if (screen52.isUsingGuiInterface()) screen52.drawFields();// if (screen52.screen[0][1].getChar() == '#' &&// screen52.screen[0][2].getChar() == '!')// execCmd();// else { if (screen52.isHotSpots()) { screen52.checkHotSpots(); } try { screen52.updateDirty(); } catch (Exception exd ) { System.out.println(" tnvt.run: " + exd.getMessage()); } if (cursorOn && !screen52.isKeyboardLocked()) { screen52.setCursorOn(); cursorOn = false; } // lets play nicely with the others on the playground// me.yield(); pthread.yield(); } } |
|
if (axisId != null) { if (AxisObj.containsKey(axisId)) Log.warnln("More than one axis node with axisId=\""+axisId+"\", using latest node." ); AxisObj.put(axisId, newaxis); } | public Object action (SaxDocumentHandler handler, Attributes attrs) { // create new object appropriately Axis newaxis = new Axis(); newaxis.setXMLAttributes(attrs); // set XML attributes from passed list // Every axis must have *either* axisId *or* an axisIdRef // else, its illegal! String axisId = null; String axisIdRef = null; if ( (axisId = newaxis.getAxisId()) != null || (axisIdRef = newaxis.getAxisIdRef()) != null ) { // add this object to the lookup table, if it has an ID if (axisId != null) { // a warning check, just in case if (AxisObj.containsKey(axisId)) Log.warnln("More than one axis node with axisId=\""+axisId+"\", using latest node." ); // add this into the list of axis objects AxisObj.put(axisId, newaxis); } // If there is a reference object, clone it to get // the new axis if (axisIdRef != null) { if (AxisObj.containsKey(axisIdRef)) { BaseObject refAxisObj = (BaseObject) AxisObj.get(axisIdRef); try { newaxis = (Axis) refAxisObj.clone(); } catch (java.lang.CloneNotSupportedException e) { Log.errorln("Weird error, cannot clone axis object. Aborting read."); System.exit(-1); } // override attrs with those in passed list newaxis.setXMLAttributes(attrs); // give the clone a unique Id and remove IdRef newaxis.setAxisId(findUniqueIdName(AxisObj,newaxis.getAxisId())); newaxis.setAxisIdRef(null); // add this into the list of axis objects AxisObj.put(newaxis.getAxisId(), newaxis); } else { Log.warnln("Error: Reader got an axis with AxisIdRef=\""+axisIdRef+"\" but no previous axis has that id! Ignoring add axis request."); return (Object) null; } } // add this axis to the current array object CurrentArray.addAxis(newaxis); // I dont believe this is actually used // CurrentDatatypeObject = newaxis; } else { Log.errorln("Axis object:"+newaxis+" lacks either axisId or axisIdRef, ignoring!"); } return newaxis; } |
|
newaxis.setAxisId(findUniqueIdName(AxisObj,newaxis.getAxisId())); | newaxis.setAxisId(findUniqueIdName(AxisObj,newaxis.getAxisId(), AxisAliasId)); | public Object action (SaxDocumentHandler handler, Attributes attrs) { // create new object appropriately Axis newaxis = new Axis(); newaxis.setXMLAttributes(attrs); // set XML attributes from passed list // Every axis must have *either* axisId *or* an axisIdRef // else, its illegal! String axisId = null; String axisIdRef = null; if ( (axisId = newaxis.getAxisId()) != null || (axisIdRef = newaxis.getAxisIdRef()) != null ) { // add this object to the lookup table, if it has an ID if (axisId != null) { // a warning check, just in case if (AxisObj.containsKey(axisId)) Log.warnln("More than one axis node with axisId=\""+axisId+"\", using latest node." ); // add this into the list of axis objects AxisObj.put(axisId, newaxis); } // If there is a reference object, clone it to get // the new axis if (axisIdRef != null) { if (AxisObj.containsKey(axisIdRef)) { BaseObject refAxisObj = (BaseObject) AxisObj.get(axisIdRef); try { newaxis = (Axis) refAxisObj.clone(); } catch (java.lang.CloneNotSupportedException e) { Log.errorln("Weird error, cannot clone axis object. Aborting read."); System.exit(-1); } // override attrs with those in passed list newaxis.setXMLAttributes(attrs); // give the clone a unique Id and remove IdRef newaxis.setAxisId(findUniqueIdName(AxisObj,newaxis.getAxisId())); newaxis.setAxisIdRef(null); // add this into the list of axis objects AxisObj.put(newaxis.getAxisId(), newaxis); } else { Log.warnln("Error: Reader got an axis with AxisIdRef=\""+axisIdRef+"\" but no previous axis has that id! Ignoring add axis request."); return (Object) null; } } // add this axis to the current array object CurrentArray.addAxis(newaxis); // I dont believe this is actually used // CurrentDatatypeObject = newaxis; } else { Log.errorln("Axis object:"+newaxis+" lacks either axisId or axisIdRef, ignoring!"); } return newaxis; } |
} if (axisId != null) { if (AxisObj.containsKey(axisId)) Log.warnln("More than one axis node with axisId=\""+axisId+"\", using latest node." ); AxisObj.put(axisId, newaxis); | public Object action (SaxDocumentHandler handler, Attributes attrs) { // create new object appropriately Axis newaxis = new Axis(); newaxis.setXMLAttributes(attrs); // set XML attributes from passed list // Every axis must have *either* axisId *or* an axisIdRef // else, its illegal! String axisId = null; String axisIdRef = null; if ( (axisId = newaxis.getAxisId()) != null || (axisIdRef = newaxis.getAxisIdRef()) != null ) { // add this object to the lookup table, if it has an ID if (axisId != null) { // a warning check, just in case if (AxisObj.containsKey(axisId)) Log.warnln("More than one axis node with axisId=\""+axisId+"\", using latest node." ); // add this into the list of axis objects AxisObj.put(axisId, newaxis); } // If there is a reference object, clone it to get // the new axis if (axisIdRef != null) { if (AxisObj.containsKey(axisIdRef)) { BaseObject refAxisObj = (BaseObject) AxisObj.get(axisIdRef); try { newaxis = (Axis) refAxisObj.clone(); } catch (java.lang.CloneNotSupportedException e) { Log.errorln("Weird error, cannot clone axis object. Aborting read."); System.exit(-1); } // override attrs with those in passed list newaxis.setXMLAttributes(attrs); // give the clone a unique Id and remove IdRef newaxis.setAxisId(findUniqueIdName(AxisObj,newaxis.getAxisId())); newaxis.setAxisIdRef(null); // add this into the list of axis objects AxisObj.put(newaxis.getAxisId(), newaxis); } else { Log.warnln("Error: Reader got an axis with AxisIdRef=\""+axisIdRef+"\" but no previous axis has that id! Ignoring add axis request."); return (Object) null; } } // add this axis to the current array object CurrentArray.addAxis(newaxis); // I dont believe this is actually used // CurrentDatatypeObject = newaxis; } else { Log.errorln("Axis object:"+newaxis+" lacks either axisId or axisIdRef, ignoring!"); } return newaxis; } |
|
formatObj.setIOAxesOrder(AxisReadOrder); | public void action (SaxDocumentHandler handler) { // we stopped reading datanode, lower count by one DataNodeLevel--; // we might still be nested within a data node // if so, return now to accumulate more data within the DATABLOCK if(DataNodeLevel != 0) return; // now we are ready to read in untagged data (both delimited/formmatted styles) // from the DATABLOCK // Note: unfortunately we are reduced to using regex style matching // instead of a buffer read in formatted reads. Come back and // improve this later if possible. XMLDataIOStyle formatObj = CurrentArray.getXMLDataIOStyle(); if ( formatObj instanceof DelimitedXMLDataIOStyle || formatObj instanceof FormattedXMLDataIOStyle ) { // determine the size of the dataFormat (s) in our dataCube if (CurrentArray.hasFieldAxis()) { // if there is a field axis, then its set to the number of fields FieldAxis fieldAxis = CurrentArray.getFieldAxis(); MaxDataFormatIndex = (fieldAxis.getLength()-1); } else { // its homogeneous MaxDataFormatIndex = 0; } Locator myLocator = CurrentArray.createLocator(); myLocator.setIterationOrder(AxisReadOrder); formatObj.setIOAxesOrder(AxisReadOrder);/*Iterator thisIter = AxisReadOrder.iterator();while(thisIter.hasNext()) { Log.debugln("ReadAxis: "+((AxisInterface) thisIter.next()).getAxisId());}*/ CurrentDataFormatIndex = 0; ArrayList strValueList; // set up appropriate instructions for reading if ( formatObj instanceof FormattedXMLDataIOStyle ) { // snag the string representation of the values strValueList = formattedSplitStringIntoStringObjects( DATABLOCK.toString(), ((FormattedXMLDataIOStyle) formatObj) ); if (strValueList.size() == 0) { Log.errorln("Error: XDF Reader is unable to acquire formatted data, bad format?"); System.exit(-1); } } else { // snag the string representation of the values strValueList = splitStringIntoStringObjects( DATABLOCK.toString(), ((DelimitedXMLDataIOStyle) formatObj).getDelimiter(), ((DelimitedXMLDataIOStyle) formatObj).getRepeatable(), ((DelimitedXMLDataIOStyle) formatObj).getRecordTerminator() ); } // fire data into dataCube Iterator iter = strValueList.iterator(); while (iter.hasNext()) { DataFormat CurrentDataFormat = DataFormatList[CurrentDataFormatIndex]; // adding data based on what type.. String thisData = (String) iter.next(); addDataToCurrentArray(myLocator, thisData, CurrentDataFormat, IntRadix[CurrentDataFormatIndex]); // bump up DataFormat appropriately if (MaxDataFormatIndex > 0) { int currentFastAxisCoordinate = myLocator.getAxisIndex(FastestAxis); if ( currentFastAxisCoordinate != LastFastAxisCoordinate ) { LastFastAxisCoordinate = currentFastAxisCoordinate; if (CurrentDataFormatIndex == MaxDataFormatIndex) CurrentDataFormatIndex = 0; else CurrentDataFormatIndex++; } } myLocator.next(); } } else if ( formatObj instanceof TaggedXMLDataIOStyle ) { // Tagged case: do nothing } else { Log.errorln("ERROR: Completely unknown DATA IO style:"+formatObj.toString() +" aborting read!"); System.exit(-1); } } |
|
newfieldaxis.setAxisId(findUniqueIdName(AxisObj, newfieldaxis.getAxisId())); | newfieldaxis.setAxisId(findUniqueIdName(AxisObj, newfieldaxis.getAxisId(), AxisAliasId)); | public Object action (SaxDocumentHandler handler, Attributes attrs) { // create new object appropriately FieldAxis newfieldaxis = new FieldAxis(); newfieldaxis.setXMLAttributes(attrs); // set XML attributes from passed list // Every axis must have *either* axisId *or* an axisIdRef // else, its illegal! String axisId = null; String axisIdRef = null; if ( (axisId = newfieldaxis.getAxisId()) != null || (axisIdRef = newfieldaxis.getAxisIdRef()) != null ) { // add this object to the lookup table, if it has an ID if (axisId != null) { // a warning check, just in case if (AxisObj.containsKey(axisId)) Log.warnln("More than one axis node with axisId=\""+axisId+"\", using latest node." ); // add this into the list of axis objects AxisObj.put(axisId, newfieldaxis); } // If there is a reference object, clone it to get // the new axis if (axisIdRef != null) { if (AxisObj.containsKey(axisIdRef)) { BaseObject refAxisObj = (BaseObject) AxisObj.get(axisIdRef); try { newfieldaxis = (FieldAxis) refAxisObj.clone(); } catch (java.lang.CloneNotSupportedException e) { Log.errorln("Weird error, cannot clone field object. Aborting read."); System.exit(-1); } // override attrs with those in passed list newfieldaxis.setXMLAttributes(attrs); // give the clone a unique Id and remove IdRef newfieldaxis.setAxisId(findUniqueIdName(AxisObj, newfieldaxis.getAxisId())); newfieldaxis.setAxisIdRef(null); // add this into the list of axis objects AxisObj.put(newfieldaxis.getAxisId(), newfieldaxis); } else { Log.warnln("Error: Reader got an fieldaxis with AxisIdRef=\""+axisIdRef+"\" but no previous field axis has that id! Ignoring add fieldAxis request."); return (Object) null; } } // add this axis to the current array object CurrentArray.setFieldAxis(newfieldaxis); } else { Log.errorln("FieldAxis object:"+newfieldaxis+" lacks either axisId or axisIdRef, ignoring!"); } return newfieldaxis; } |
if (AxisReadOrder.size() > 0) { readObj.setIOAxesOrder(AxisReadOrder); } | public void action (SaxDocumentHandler handler) { // obtain the current XMLDataIOStyle Object XMLDataIOStyle readObj = CurrentArray.getXMLDataIOStyle(); // initialization for XDF::Reader specific internal GLOBALS if ( (readObj instanceof TaggedXMLDataIOStyle) ) { // zero out all the tags Enumeration keys = DataTagCount.keys(); // slight departure from Perl while ( keys.hasMoreElements() ) { Object key = keys.nextElement(); DataTagCount.put((String) key, new Integer(0)); } } else if ( (readObj instanceof DelimitedXMLDataIOStyle) || (readObj instanceof FormattedXMLDataIOStyle) ) { // do nothing } else { Log.errorln("ERROR: Dont know what do with this read style ("+readObj+"), aborting read."); System.exit(-1); } } |
|
ArrayList newAxisOrderList = new ArrayList(); Iterator iter = CurrentArray.getAxes().iterator(); while (iter.hasNext()) { AxisInterface arrayAxisObj = (AxisInterface) iter.next(); String refAxisId = (String) AxisAliasId.get(arrayAxisObj.getAxisId()); Iterator iter2 = readObj.getIOAxesOrder().iterator(); while (iter2.hasNext()) { AxisInterface readAxisObj = (AxisInterface) iter2.next(); if (readAxisObj.getAxisId().equals(refAxisId)) { newAxisOrderList.add(arrayAxisObj); break; } } } readObj.setIOAxesOrder(newAxisOrderList); | public Object action (SaxDocumentHandler handler, Attributes attrs) { // save these for later, when we know what kind of dataIOstyle we got // Argh we really need a clone on Attributes. Just dumb copy for now. DataIOStyleAttribs.clear(); // all old values cleared DataIOStyleAttribs = attribListToHashtable(attrs); // clear out the format command object array // (its used by Formatted reads only, but this is reasonable // spot to do this). CurrentFormatObjectList = new ArrayList (); // this will be used in formatted/delimited reads to // set the iteration order of the locator that will populate // the datacube AxisReadOrder = new ArrayList(); // If there is a reference object, clone it to get // the new readObj String readIdRef = (String) DataIOStyleAttribs.get("readIdRef"); if (readIdRef != null) { XMLDataIOStyle readObj = null; if (ReadObj.containsKey(readIdRef)) { XMLDataIOStyle refReadObj = (XMLDataIOStyle) ReadObj.get(readIdRef); try { readObj = (XMLDataIOStyle) refReadObj.clone(); } catch (java.lang.CloneNotSupportedException e) { Log.errorln("Weird error, cannot clone XMLDataIOStyle (read node) object. Aborting read."); System.exit(-1); } // override attrs with those in passed list readObj.hashtableInitXDFAttributes(DataIOStyleAttribs); // give the clone a unique Id and remove IdRef readObj.setReadId(findUniqueIdName(ReadObj, readObj.getReadId())); readObj.setReadIdRef(null); // add this into the list of Read objects ReadObj.put(readObj.getReadId(), readObj); } else { Log.warnln("Error: Reader got a read node with ReadIdRef=\""+readIdRef+"\""); Log.warnln("but no previous read node has that id! Ignoring add request."); return (Object) null; } // add read object to Current Array CurrentArray.setXMLDataIOStyle(readObj); // clear attrib table since we cloned to get values DataIOStyleAttribs.clear(); CurrentFormatObjectList.add(readObj); } return (Object) null; } |
|
/* | private void addDataToCurrentArray ( Locator dataLocator, String thisString, DataFormat CurrentDataFormat, int intRadix ) {/*Log.debug("Add Data:["+thisString+"] (");List axes = dataLocator.getIterationOrder();Iterator liter = axes.iterator();while (liter.hasNext()) { AxisInterface axis = (AxisInterface) liter.next(); Log.debug(dataLocator.getAxisIndex(axis)+ " ["+axis.getAxisId()+"],");}Log.debugln(") ");*/ // Note that we dont treat binary data at all here try { if ( CurrentDataFormat instanceof StringDataFormat) {//Log.debugln("(String)"); CurrentArray.setData(dataLocator, thisString); } else if ( CurrentDataFormat instanceof FloatDataFormat || CurrentDataFormat instanceof BinaryFloatDataFormat) {//Log.debugln("(Double)"); Double number = new Double (thisString); CurrentArray.setData(dataLocator, number.doubleValue()); } else if ( CurrentDataFormat instanceof IntegerDataFormat || CurrentDataFormat instanceof BinaryIntegerDataFormat) { // Integer number = new Integer (thisString);//Log.debugln("(Integer)"); if (intRadix == 16) // peal off leading "0x" thisString = thisString.substring(2); int thisInt = Integer.parseInt(thisString, intRadix); CurrentArray.setData(dataLocator, thisInt); } else { Log.warnln("Unknown data format, unable to setData:["+thisString+"], ignoring request"); } } catch (SetDataException e) { // bizarre error. Cant add data (out of memory??) :P Log.errorln("Unable to setData:["+thisString+"], ignoring request"); Log.printStackTrace(e); } } |
|
*/ | private void addDataToCurrentArray ( Locator dataLocator, String thisString, DataFormat CurrentDataFormat, int intRadix ) {/*Log.debug("Add Data:["+thisString+"] (");List axes = dataLocator.getIterationOrder();Iterator liter = axes.iterator();while (liter.hasNext()) { AxisInterface axis = (AxisInterface) liter.next(); Log.debug(dataLocator.getAxisIndex(axis)+ " ["+axis.getAxisId()+"],");}Log.debugln(") ");*/ // Note that we dont treat binary data at all here try { if ( CurrentDataFormat instanceof StringDataFormat) {//Log.debugln("(String)"); CurrentArray.setData(dataLocator, thisString); } else if ( CurrentDataFormat instanceof FloatDataFormat || CurrentDataFormat instanceof BinaryFloatDataFormat) {//Log.debugln("(Double)"); Double number = new Double (thisString); CurrentArray.setData(dataLocator, number.doubleValue()); } else if ( CurrentDataFormat instanceof IntegerDataFormat || CurrentDataFormat instanceof BinaryIntegerDataFormat) { // Integer number = new Integer (thisString);//Log.debugln("(Integer)"); if (intRadix == 16) // peal off leading "0x" thisString = thisString.substring(2); int thisInt = Integer.parseInt(thisString, intRadix); CurrentArray.setData(dataLocator, thisInt); } else { Log.warnln("Unknown data format, unable to setData:["+thisString+"], ignoring request"); } } catch (SetDataException e) { // bizarre error. Cant add data (out of memory??) :P Log.errorln("Unable to setData:["+thisString+"], ignoring request"); Log.printStackTrace(e); } } |
|
public String findUniqueIdName( Hashtable list, String baseIdName) { | public String findUniqueIdName( Hashtable idTable, String baseIdName) { | public String findUniqueIdName( Hashtable list, String baseIdName) { StringBuffer testName = new StringBuffer(baseIdName); while (list.containsKey(testName.toString())) { testName.append("0"); // isnt there something better to append here?? } return testName.toString(); } |
while (list.containsKey(testName.toString())) { | while (idTable.containsKey(testName.toString())) { | public String findUniqueIdName( Hashtable list, String baseIdName) { StringBuffer testName = new StringBuffer(baseIdName); while (list.containsKey(testName.toString())) { testName.append("0"); // isnt there something better to append here?? } return testName.toString(); } |
buttons.addElement(b); | else b.setSelected(false); } buttons.addElement(b); | public void add(AbstractButton b) { b.getModel().setGroup(this); if (b.isSelected()) sel = b.getModel(); buttons.addElement(b); } |
if (runCount > tabRuns.length) expandTabRunsArray(); | protected void calculateTabRects(int tabPlacement, int tabCount) { if (tabCount == 0) return; FontMetrics fm = getFontMetrics(); SwingUtilities.calculateInnerArea(tabPane, calcRect); Insets tabAreaInsets = getTabAreaInsets(tabPlacement); Insets insets = tabPane.getInsets(); int max = 0; int runs = 0; int start = getTabRunIndent(tabPlacement, 1); if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM) { int maxHeight = calculateMaxTabHeight(tabPlacement); calcRect.width -= tabAreaInsets.left + tabAreaInsets.right; max = calcRect.width + tabAreaInsets.left + insets.left; start += tabAreaInsets.left + insets.left; int width = 0; int runWidth = start; for (int i = 0; i < tabCount; i++) { width = calculateTabWidth(tabPlacement, i, fm); if (runWidth + width > max) { runWidth = tabAreaInsets.left + insets.left + getTabRunIndent(tabPlacement, ++runs); rects[i] = new Rectangle(runWidth, insets.top + tabAreaInsets.top, width, maxHeight); runWidth += width; if (runs > tabRuns.length - 1) expandTabRunsArray(); tabRuns[runs] = i; } else { rects[i] = new Rectangle(runWidth, insets.top + tabAreaInsets.top, width, maxHeight); runWidth += width; } } runs++; tabAreaRect.width = tabPane.getWidth() - insets.left - insets.right; tabAreaRect.height = runs * maxTabHeight - (runs - 1) * tabRunOverlay + tabAreaInsets.top + tabAreaInsets.bottom; contentRect.width = tabAreaRect.width; contentRect.height = tabPane.getHeight() - insets.top - insets.bottom - tabAreaRect.height; contentRect.x = insets.left; tabAreaRect.x = insets.left; if (tabPlacement == SwingConstants.BOTTOM) { contentRect.y = insets.top; tabAreaRect.y = contentRect.y + contentRect.height; } else { tabAreaRect.y = insets.top; contentRect.y = tabAreaRect.y + tabAreaRect.height; } } else { int maxWidth = calculateMaxTabWidth(tabPlacement); calcRect.height -= tabAreaInsets.top + tabAreaInsets.bottom; max = calcRect.height + tabAreaInsets.top + insets.top; int height = 0; start += tabAreaInsets.top + insets.top; int runHeight = start; int fontHeight = fm.getHeight(); for (int i = 0; i < tabCount; i++) { height = calculateTabHeight(tabPlacement, i, fontHeight); if (runHeight + height > max) { runHeight = tabAreaInsets.top + insets.top + getTabRunIndent(tabPlacement, ++runs); rects[i] = new Rectangle(insets.left + tabAreaInsets.left, runHeight, maxWidth, height); runHeight += height; if (runs > tabRuns.length - 1) expandTabRunsArray(); tabRuns[runs] = i; } else { rects[i] = new Rectangle(insets.left + tabAreaInsets.left, runHeight, maxWidth, height); runHeight += height; } } runs++; tabAreaRect.width = runs * maxTabWidth - (runs - 1) * tabRunOverlay + tabAreaInsets.left + tabAreaInsets.right; tabAreaRect.height = tabPane.getHeight() - insets.top - insets.bottom; tabAreaRect.y = insets.top; contentRect.width = tabPane.getWidth() - insets.left - insets.right - tabAreaRect.width; contentRect.height = tabAreaRect.height; contentRect.y = insets.top; if (tabPlacement == SwingConstants.LEFT) { tabAreaRect.x = insets.left; contentRect.x = tabAreaRect.x + tabAreaRect.width; } else { contentRect.x = insets.left; tabAreaRect.x = contentRect.x + contentRect.width; } } runCount = runs; tabRuns[0] = 0; normalizeTabRuns(tabPlacement, tabCount, start, max); selectedRun = getRunForTab(tabCount, tabPane.getSelectedIndex()); if (shouldRotateTabRuns(tabPlacement)) rotateTabRuns(tabPlacement, selectedRun); // Need to pad the runs and move them to the correct location. for (int i = 0; i < runCount; i++) { int first = lastTabInRun(tabCount, getPreviousTabRun(i)) + 1; if (first == tabCount) first = 0; int last = lastTabInRun(tabCount, i); if (shouldPadTabRun(tabPlacement, i)) padTabRun(tabPlacement, first, last, max); // Done padding, now need to move it. if (tabPlacement == SwingConstants.TOP && i > 0) { for (int j = first; j <= last; j++) rects[j].y += (runCount - i) * maxTabHeight - (runCount - i) * tabRunOverlay; } if (tabPlacement == SwingConstants.BOTTOM) { int height = tabPane.getBounds().height - insets.bottom - tabAreaInsets.bottom; int adjustment; if (i == 0) adjustment = height - maxTabHeight; else adjustment = height - (runCount - i + 1) * maxTabHeight - (runCount - i) * tabRunOverlay; for (int j = first; j <= last; j++) rects[j].y = adjustment; } if (tabPlacement == SwingConstants.LEFT && i > 0) { for (int j = first; j <= last; j++) rects[j].x += (runCount - i) * maxTabWidth - (runCount - i) * tabRunOverlay; } if (tabPlacement == SwingConstants.RIGHT) { int width = tabPane.getBounds().width - insets.right - tabAreaInsets.right; int adjustment; if (i == 0) adjustment = width - maxTabWidth; else adjustment = width - (runCount - i + 1) * maxTabWidth + (runCount - i) * tabRunOverlay; for (int j = first; j <= last; j++) rects[j].x = adjustment; } } padSelectedTab(tabPlacement, tabPane.getSelectedIndex()); } |
|
if (runCount > tabRuns.length) expandTabRunsArray(); | protected void calculateTabRects(int tabPlacement, int tabCount) { if (tabCount == 0) return; FontMetrics fm = getFontMetrics(); SwingUtilities.calculateInnerArea(tabPane, calcRect); Insets tabAreaInsets = getTabAreaInsets(tabPlacement); Insets insets = tabPane.getInsets(); int runs = 1; int start = 0; int top = 0; if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM) { int maxHeight = calculateMaxTabHeight(tabPlacement); calcRect.width -= tabAreaInsets.left + tabAreaInsets.right; start = tabAreaInsets.left + insets.left; int width = 0; int runWidth = start; top = insets.top + tabAreaInsets.top; for (int i = 0; i < tabCount; i++) { width = calculateTabWidth(tabPlacement, i, fm); rects[i] = new Rectangle(runWidth, top, width, maxHeight); runWidth += width; } tabAreaRect.width = tabPane.getWidth() - insets.left - insets.right; tabAreaRect.height = runs * maxTabHeight - (runs - 1) * tabRunOverlay + tabAreaInsets.top + tabAreaInsets.bottom; contentRect.width = tabAreaRect.width; contentRect.height = tabPane.getHeight() - insets.top - insets.bottom - tabAreaRect.height; contentRect.x = insets.left; tabAreaRect.x = insets.left; if (tabPlacement == SwingConstants.BOTTOM) { contentRect.y = insets.top; tabAreaRect.y = contentRect.y + contentRect.height; } else { tabAreaRect.y = insets.top; contentRect.y = tabAreaRect.y + tabAreaRect.height; } } else { int maxWidth = calculateMaxTabWidth(tabPlacement); calcRect.height -= tabAreaInsets.top + tabAreaInsets.bottom; int height = 0; start = tabAreaInsets.top + insets.top; int runHeight = start; int fontHeight = fm.getHeight(); top = insets.left + tabAreaInsets.left; for (int i = 0; i < tabCount; i++) { height = calculateTabHeight(tabPlacement, i, fontHeight); rects[i] = new Rectangle(top, runHeight, maxWidth, height); runHeight += height; } tabAreaRect.width = runs * maxTabWidth - (runs - 1) * tabRunOverlay + tabAreaInsets.left + tabAreaInsets.right; tabAreaRect.height = tabPane.getHeight() - insets.top - insets.bottom; tabAreaRect.y = insets.top; contentRect.width = tabPane.getWidth() - insets.left - insets.right - tabAreaRect.width; contentRect.height = tabAreaRect.height; contentRect.y = insets.top; if (tabPlacement == SwingConstants.LEFT) { tabAreaRect.x = insets.left; contentRect.x = tabAreaRect.x + tabAreaRect.width; } else { contentRect.x = insets.left; tabAreaRect.x = contentRect.x + contentRect.width; } } runCount = runs; padSelectedTab(tabPlacement, tabPane.getSelectedIndex()); } |
|
if (tabCount > runCount) runCount = tabCount; | protected void paintTabArea(Graphics g, int tabPlacement, int selectedIndex) { Rectangle ir = new Rectangle(); Rectangle tr = new Rectangle(); boolean isScroll = tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT; // Please note: the ordering of the painting is important. // we WANT to paint the outermost run first and then work our way in. int tabCount = tabPane.getTabCount(); int currRun = 1; if (tabCount > runCount) runCount = tabCount; if (tabCount < 1) return; if (runCount > 1) currRun = 0; for (int i = 0; i < runCount; i++) { int first = lastTabInRun(tabCount, getPreviousTabRun(currRun)) + 1; if (isScroll) first = currentScrollLocation; else if (first == tabCount) first = 0; int last = lastTabInRun(tabCount, currRun); if (isScroll) { for (int k = first; k < tabCount; k++) { if (rects[k].x + rects[k].width - rects[first].x > viewport .getWidth()) { last = k; break; } } } for (int j = first; j <= last; j++) { if (j != selectedIndex || isScroll) paintTab(g, tabPlacement, rects, j, ir, tr); } currRun = getPreviousTabRun(currRun); } if (! isScroll) paintTab(g, tabPlacement, rects, selectedIndex, ir, tr); } |
|
if (pendingInsert) { | if (pendingInsert && homePos > 0) { | public void goHome() { // now we try to move to first input field according to // 14.6 WRITE TO DISPLAY Command // If the WTD command is valid, after the command is processed, // the cursor moves to one of three locations: // - The location set by an insert cursor order (unless control // character byte 1, bit 1 is equal to B'1'.) // - The start of the first non-bypass input field defined in the // format table // - A default starting address of row 1 column 1. if (pendingInsert) { goto_XY(getRow(homePos),getCol(homePos)); isInField(); // we now check if we are in a field } else { if(!gotoField(1)) { homePos = getPos(1,1); goto_XY(1,1); isInField(0,0); // we now check if we are in a field } else { homePos = getPos(getCurrentRow(),getCurrentCol()); } } } |
restriction = new Rectangle(0,0); | void jbInit() throws Exception { if (!appProps.containsKey("font")) { font = new Font("dialoginput",Font.BOLD,14); appProps.setProperty("font","dialoginput"); } else { font = new Font(getStringProperty("font"),Font.PLAIN,14); } gui.setFont(font); lastAttr = 32; // default number of rows and columns numRows = 24; numCols = 80; goto_XY(1,1); // set initial cursor position errorLineNum = numRows; updateCursorLoc = false; FontRenderContext frc = new FontRenderContext(font.getTransform(),true,true); lm = font.getLineMetrics("Wy",frc); fmWidth = (int)font.getStringBounds("W",frc).getWidth() + 1; fmHeight = (int)(font.getStringBounds("g",frc).getHeight() + lm.getDescent() + lm.getLeading()); keyboardLocked = true; checkOffScreenImage(); lenScreen = numRows * numCols; screen = new ScreenChar[lenScreen]; for (int y = 0;y < lenScreen; y++) { screen[y] = new ScreenChar(this); screen[y].setCharAndAttr(' ',initAttr,false); screen[y].setRowCol(getRow(y),getCol(y)); } screenFields = new ScreenFields(this); strokenizer = new KeyStrokenizer(); } |
|
if (resetAttr) | if (resetAttr) { | public void propertyChange(PropertyChangeEvent pce) { String pn = pce.getPropertyName(); boolean resetAttr = false; if (pn.equals("colorBg")) { colorBg = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("colorBlue")) { colorBlue = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("colorTurq")) { colorTurq = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("colorRed")) { colorRed = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("colorWhite")) { colorWhite = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("colorYellow")) { colorYellow = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("colorGreen")) { colorGreen = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("colorPink")) { colorPink = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("colorGUIField")) { colorGUIField = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("colorCursor")) { colorCursor = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("colorSep")) { colorSep = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("colorHexAttr")) { colorHexAttr = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("cursorSize")) { if (pce.getNewValue().equals("Full")) cursorSize = 2; if (pce.getNewValue().equals("Half")) cursorSize = 1; if (pce.getNewValue().equals("Line")) cursorSize = 0; } if (pn.equals("crossHair")) { if (pce.getNewValue().equals("None")) crossHair = 0; if (pce.getNewValue().equals("Horz")) crossHair = 1; if (pce.getNewValue().equals("Vert")) crossHair = 2; if (pce.getNewValue().equals("Both")) crossHair = 3; } if (pn.equals("colSeparator")) { if (pce.getNewValue().equals("Line")) colSepLine = 0; if (pce.getNewValue().equals("ShortLine")) colSepLine = 1; if (pce.getNewValue().equals("Dot")) colSepLine = 2; } if (pn.equals("showAttr")) { if (pce.getNewValue().equals("Hex")) showHex = true; else showHex= false; } if (pn.equals("guiInterface")) { if (pce.getNewValue().equals("Yes")) guiInterface = true; else guiInterface = false; } if (pn.equals("guiShowUnderline")) { if (pce.getNewValue().equals("Yes")) guiShowUnderline = true; else guiShowUnderline = false; } if (pn.equals("hotspots")) { if (pce.getNewValue().equals("Yes")) hotSpots = true; else hotSpots = false; } if (pn.equals("hsMore")) { hsMore.setLength(0); hsMore.append((String)pce.getNewValue()); } if (pn.equals("hsBottom")) { hsBottom.setLength(0); hsBottom.append((String)pce.getNewValue()); } if (pn.equals("font")) { font = new Font((String)pce.getNewValue(),Font.PLAIN,14); updateFont = true; } if (pn.equals("fontScaleHeight")) {// try { sfh = Float.parseFloat((String)pce.getNewValue()); updateFont = true;// } } if (pn.equals("fontScaleWidth")) {// try { sfw = Float.parseFloat((String)pce.getNewValue()); updateFont = true;// } } if (pn.equals("fontPointSize")) {// try { ps132 = Float.parseFloat((String)pce.getNewValue()); updateFont = true;// } } if (updateFont) { Rectangle r = gui.getDrawingBounds(); resizeScreenArea(r.width,r.height); updateFont = false; } if (resetAttr) for (int y = 0;y < lenScreen; y++) { screen[y].setAttribute(screen[y].getCharAttr()); } gui.repaint(); gui.revalidate(); } |
bi.drawOIA(fmWidth,fmHeight,numRows,numCols,font,colorBg,colorBlue); } | public void propertyChange(PropertyChangeEvent pce) { String pn = pce.getPropertyName(); boolean resetAttr = false; if (pn.equals("colorBg")) { colorBg = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("colorBlue")) { colorBlue = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("colorTurq")) { colorTurq = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("colorRed")) { colorRed = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("colorWhite")) { colorWhite = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("colorYellow")) { colorYellow = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("colorGreen")) { colorGreen = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("colorPink")) { colorPink = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("colorGUIField")) { colorGUIField = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("colorCursor")) { colorCursor = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("colorSep")) { colorSep = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("colorHexAttr")) { colorHexAttr = (Color)pce.getNewValue(); resetAttr = true; } if (pn.equals("cursorSize")) { if (pce.getNewValue().equals("Full")) cursorSize = 2; if (pce.getNewValue().equals("Half")) cursorSize = 1; if (pce.getNewValue().equals("Line")) cursorSize = 0; } if (pn.equals("crossHair")) { if (pce.getNewValue().equals("None")) crossHair = 0; if (pce.getNewValue().equals("Horz")) crossHair = 1; if (pce.getNewValue().equals("Vert")) crossHair = 2; if (pce.getNewValue().equals("Both")) crossHair = 3; } if (pn.equals("colSeparator")) { if (pce.getNewValue().equals("Line")) colSepLine = 0; if (pce.getNewValue().equals("ShortLine")) colSepLine = 1; if (pce.getNewValue().equals("Dot")) colSepLine = 2; } if (pn.equals("showAttr")) { if (pce.getNewValue().equals("Hex")) showHex = true; else showHex= false; } if (pn.equals("guiInterface")) { if (pce.getNewValue().equals("Yes")) guiInterface = true; else guiInterface = false; } if (pn.equals("guiShowUnderline")) { if (pce.getNewValue().equals("Yes")) guiShowUnderline = true; else guiShowUnderline = false; } if (pn.equals("hotspots")) { if (pce.getNewValue().equals("Yes")) hotSpots = true; else hotSpots = false; } if (pn.equals("hsMore")) { hsMore.setLength(0); hsMore.append((String)pce.getNewValue()); } if (pn.equals("hsBottom")) { hsBottom.setLength(0); hsBottom.append((String)pce.getNewValue()); } if (pn.equals("font")) { font = new Font((String)pce.getNewValue(),Font.PLAIN,14); updateFont = true; } if (pn.equals("fontScaleHeight")) {// try { sfh = Float.parseFloat((String)pce.getNewValue()); updateFont = true;// } } if (pn.equals("fontScaleWidth")) {// try { sfw = Float.parseFloat((String)pce.getNewValue()); updateFont = true;// } } if (pn.equals("fontPointSize")) {// try { ps132 = Float.parseFloat((String)pce.getNewValue()); updateFont = true;// } } if (updateFont) { Rectangle r = gui.getDrawingBounds(); resizeScreenArea(r.width,r.height); updateFont = false; } if (resetAttr) for (int y = 0;y < lenScreen; y++) { screen[y].setAttribute(screen[y].getCharAttr()); } gui.repaint(); gui.revalidate(); } |
|
goto_XY(icX,icY); | public void setPendingInsert(boolean flag, int icX, int icY) { pendingInsert = flag; if (pendingInsert) { homePos = getPos(icX,icY); } } |
|
case DUP_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.isCurrentFieldDupEnabled()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().setFieldChar(lastPos,(char)0x1C); screenFields.setCurrentFieldMDT(); gotoFieldNext(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_DUP_KEY_NOT_ALLOWED); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case NEW_LINE : if (screenFields.getSize() > 0) { int startRow = getRow(lastPos) + 1; int startPos = lastPos; boolean isthere = false; setCursorOff(); if (startRow == getRows()) startRow = 0; goto_XY(++startRow,1); if (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { while (!isInField() && screenFields.getCurrentField() != null && !screenFields.isCurrentFieldBypassField()) { advancePos(); if (lastPos == startPos) { goto_XY(startPos); break; } } } setCursorOn(); } simulated = true; break; | protected boolean simulateMnemonic(int mnem){ boolean simulated = false; switch (mnem) { case AID_CLEAR : case AID_ENTER : case AID_PF1 : case AID_PF2 : case AID_PF3 : case AID_PF4 : case AID_PF5 : case AID_PF6 : case AID_PF7 : case AID_PF8 : case AID_PF9 : case AID_PF10 : case AID_PF11 : case AID_PF12 : case AID_PF13 : case AID_PF14 : case AID_PF15 : case AID_PF16 : case AID_PF17 : case AID_PF18 : case AID_PF19 : case AID_PF20 : case AID_PF21 : case AID_PF22 : case AID_PF23 : case AID_PF24 : case AID_ROLL_DOWN : case AID_ROLL_UP : case AID_ROLL_LEFT : case AID_ROLL_RIGHT : sendAid(mnem); simulated = true; break; case AID_HELP : sessionVT.sendHelpRequest(); simulated = true; break; case AID_PRINT : sessionVT.hostPrint(1); simulated = true; break; case BACK_SPACE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { if (screenFields.getCurrentField().startPos() == lastPos) displayError(ERR_CURSOR_PROTECTED); else { setCursorOff(); screenFields.getCurrentField().getKeyPos(lastPos); screenFields.getCurrentField().changePos(-1); resetDirty(screenFields.getCurrentField().getCurrentPos()); shiftLeft(screenFields.getCurrentField().getCurrentPos()); updateDirty(); setCursorOn(); screenFields.setCurrentFieldMDT(); simulated = true; } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BACK_TAB : if (screenFields.getCurrentField() != null && screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldPrev(); updateDirty(); } else gotoFieldPrev(); if (screenFields.isCurrentFieldContinued()) { do { gotoFieldPrev(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } isInField(lastPos); simulated = true; break; case UP : case MARK_UP : process_XY(lastPos - numCols); simulated = true; break; case DOWN : case MARK_DOWN : process_XY(lastPos + numCols); simulated = true; break; case LEFT : case MARK_LEFT : process_XY(lastPos - 1); simulated = true; break; case RIGHT : case MARK_RIGHT : process_XY(lastPos + 1); simulated = true; break; case NEXTWORD : gotoNextWord(); simulated = true; break; case PREVWORD : gotoPrevWord(); simulated = true; break; case DELETE : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); screenFields.getCurrentField().getKeyPos(lastPos); shiftLeft(screenFields.getCurrentFieldPos()); screenFields.setCurrentFieldMDT(); updateDirty(); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case TAB : if (screenFields.getCurrentField() != null && !screenFields.isCurrentFieldContinued()) { if (screenFields.isCurrentFieldHighlightedEntry()) { resetDirty(screenFields.getCurrentField().startPos); gotoFieldNext(); updateDirty(); } else gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.getCurrentField() != null && (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast())); } isInField(lastPos); simulated = true; break; case EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = endOfField(screenFields.getCurrentField().startPos(),true); if (where > 0) { goto_XY((where / numCols) + 1,(where % numCols) + 1); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case ERASE_EOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case ERASE_FIELD : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); int where = lastPos; lastPos = screenFields.getCurrentField().startPos(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); goto_XY(where); setCursorOn(); simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } break; case INSERT : setCursorOff(); // we toggle it insertMode = insertMode ? false : true; setCursorOn(); break; case HOME : // position to the home position set if (lastPos + numCols + 1 != homePos) { goto_XY(homePos - numCols - 1); // now check if we are in a field isInField(lastPos); } else gotoField(1); break; case KEYPAD_0 : simulated = simulateKeyStroke('0'); break; case KEYPAD_1 : simulated = simulateKeyStroke('1'); break; case KEYPAD_2 : simulated = simulateKeyStroke('2'); break; case KEYPAD_3 : simulated = simulateKeyStroke('3'); break; case KEYPAD_4 : simulated = simulateKeyStroke('4'); break; case KEYPAD_5 : simulated = simulateKeyStroke('5'); break; case KEYPAD_6 : simulated = simulateKeyStroke('6'); break; case KEYPAD_7 : simulated = simulateKeyStroke('7'); break; case KEYPAD_8 : simulated = simulateKeyStroke('8'); break; case KEYPAD_9 : simulated = simulateKeyStroke('9'); break; case KEYPAD_PERIOD : simulated = simulateKeyStroke('.'); break; case KEYPAD_COMMA : simulated = simulateKeyStroke(','); break; case KEYPAD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } simulated = true; updateDirty(); if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_EXIT : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); if (screenFields.isCurrentFieldContinued()) fieldExit(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_PLUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { setCursorOff(); resetDirty(lastPos); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_CURSOR_PROTECTED); } break; case FIELD_MINUS : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int s = screenFields.getCurrentField().getFieldShift(); if (s == 3 || s == 5 || s == 7) { setCursorOff(); screen[lastPos].setChar('-'); resetDirty(lastPos); advancePos(); if (fieldExit()) { screenFields.setCurrentFieldMDT(); if (!screenFields.isCurrentFieldContinued()) { gotoFieldNext(); } else { do { gotoFieldNext(); } while (screenFields.isCurrentFieldContinuedMiddle() || screenFields.isCurrentFieldContinuedLast()); } } updateDirty(); setCursorOn(); simulated = true; if (screenFields.isCurrentFieldAutoEnter()) sendAid(AID_ENTER); } else { displayError(ERR_FIELD_MINUS); } } else { displayError(ERR_CURSOR_PROTECTED); } break; case BOF : if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { int where = screenFields.getCurrentField().startPos(); if (where > 0) { goto_XY(where); } simulated = true; } else { displayError(ERR_CURSOR_PROTECTED); } resetDirty(lastPos); break; case SYSREQ : sessionVT.systemRequest(); simulated = true; break; case RESET : if (isStatusErrorCode()) { restoreErrorLine(); setStatus(STATUS_ERROR_CODE,STATUS_VALUE_OFF,""); isInField(lastPos); updateDirty(); } setKBIndicatorOff(); simulated = true; break; case COPY : copyMe(); break; case PASTE : pasteMe(false); break; case ATTN : sessionVT.sendAttentionKey(); simulated = true; break; default : System.out.println(" Mnemonic not supported " + mnem); break; } return simulated; } |
|
ClassLoader cl = VMSecurityManager.currentClassLoader(); return cl != null ? cl.getPackage(name) : null; | ClassLoader cl = VMStackWalker.getCallingClassLoader(); return cl != null ? cl.getPackage(name) : VMClassLoader.getPackage(name); | public static Package getPackage(String name) { // Get the caller's classloader ClassLoader cl = VMSecurityManager.currentClassLoader(); return cl != null ? cl.getPackage(name) : null; } |
Class c = VMSecurityManager.getClassContext()[1]; ClassLoader cl = c.getClassLoader(); return cl != null ? cl.getPackages() : new Package[0]; | ClassLoader cl = VMStackWalker.getCallingClassLoader(); return cl != null ? cl.getPackages() : VMClassLoader.getPackages(); | public static Package[] getPackages() { // Get the caller's classloader Class c = VMSecurityManager.getClassContext()[1]; ClassLoader cl = c.getClassLoader(); // Sun's implementation returns the packages loaded by the bootstrap // classloader if cl is null, but right now our bootstrap classloader // does not create any Packages. return cl != null ? cl.getPackages() : new Package[0]; } |
breaker.setText(s.toString()); | breaker.setText(s); | public static final int getBreakLocation(Segment s, FontMetrics metrics, int x0, int x, TabExpander e, int startOffset) { int mark = Utilities.getTabbedTextOffset(s, metrics, x0, x, e, startOffset); BreakIterator breaker = BreakIterator.getWordInstance(); breaker.setText(s.toString()); // If mark is equal to the end of the string, just use that position if (mark == s.count) return mark; // Try to find a word boundary previous to the mark at which we // can break the text int preceding = breaker.preceding(mark + 1); if (preceding != 0) return preceding; else // If preceding is 0 we couldn't find a suitable word-boundary so // just break it on the character boundary return mark; } |
if (Math.abs(offsX-x) < Math.abs(offsXNext-x)) | if (Math.abs(offsX-x) <= Math.abs(offsXNext-x)) | public static final int getPositionAbove(JTextComponent c, int offset, int x) throws BadLocationException { int offs = getRowStart(c, offset); if(offs == -1) return -1; // Effectively calculates the y value of the previous line. Point pt = c.modelToView(offs-1).getLocation(); pt.x = x; // Calculate a simple fitting offset. offs = c.viewToModel(pt); // Find out the real x positions of the calculated character and its // neighbour. int offsX = c.modelToView(offs).getLocation().x; int offsXNext = c.modelToView(offs+1).getLocation().x; // Chose the one which is nearer to us and return its offset. if (Math.abs(offsX-x) < Math.abs(offsXNext-x)) return offs; else return offs+1; } |
if (Math.abs(offsX-x) < Math.abs(offsXNext-x)) | if (Math.abs(offsX-x) <= Math.abs(offsXNext-x)) | public static final int getPositionBelow(JTextComponent c, int offset, int x) throws BadLocationException { int offs = getRowEnd(c, offset); if(offs == -1) return -1; // Effectively calculates the y value of the previous line. Point pt = c.modelToView(offs+1).getLocation(); pt.x = x; // Calculate a simple fitting offset. offs = c.viewToModel(pt); if (offs == c.getDocument().getLength()) return offs; // Find out the real x positions of the calculated character and its // neighbour. int offsX = c.modelToView(offs).getLocation().x; int offsXNext = c.modelToView(offs+1).getLocation().x; // Chose the one which is nearer to us and return its offset. if (Math.abs(offsX-x) < Math.abs(offsXNext-x)) return offs; else return offs+1; } |
System.out.println(tFile.substring(0,memberOffset)); | protected boolean getFileInfo(String tFile, boolean useInternal) { int memberOffset = tFile.indexOf("."); String file2 = null; String member2 = null; if (memberOffset > 0) { System.out.println(tFile.substring(0,memberOffset)); file2 = tFile.substring(0,memberOffset); member2 = tFile.substring(memberOffset + 1); } else { file2 = tFile; } final String file = file2; final String member = member2; final boolean internal = useInternal; Runnable getInfo = new Runnable () { // set the thread to run. public void run() { executeCommand("RCMD","dspffd FILE(" + file + ") OUTPUT(*OUTFILE) " + "OUTFILE(QTEMP/FFD) "); if (lastResponse.startsWith("2")) { if (loadFFD(internal)) { if (lastResponse.startsWith("2")) { if (getMbrInfo(file,member)) { fireInfoEvent(); } } } } } }; Thread infoThread = new Thread(getInfo); infoThread.start(); return true; } |
|
if (member == null && fileSize == 0) { fileSize = packed2int(abyte0,345,5); status.setFileLength(fileSize); member = sb.toString(); } else { if (sb.toString().equalsIgnoreCase(member)) { fileSize = packed2int(abyte0,345,5); status.setFileLength(fileSize); | members.add(new MemberInfo(sb.toString(),packed2int(abyte0,345,5))); | private boolean getMbrSize(String member) { boolean flag = true; if(ftpOutputStream == null) { printFTPInfo("Not connected to any server!"); return false; } if(!loggedIn) { printFTPInfo("Login was not successful! Aborting!"); return false; } Socket socket = null; DataInputStream datainputstream = null; executeCommand("TYPE","I"); String remoteFile = "QTEMP/FML"; try { socket = createPassiveSocket("RETR " + remoteFile); if(socket != null) { datainputstream = new DataInputStream(socket.getInputStream()); byte abyte0[] = new byte[858]; int c = 0; int kj = 0; int len = 0; StringBuffer sb = new StringBuffer(10); printFTPInfo("<----------------- Member Information ---------------->"); for(int j = 0; j != -1 && !aborted;) { j = datainputstream.read(); if(j == -1) break; c ++; abyte0[len++] = (byte)j; if (len == abyte0.length) { sb.setLength(0); // the offset for member name MBNAME is 164 with offset of 1 but // we have to offset the buffer by 0 which makes it 164 - 1 // or 163 for (int f = 0;f < 10; f++) { sb.append(vt.getASCIIChar(abyte0[163 + f] & 0xff)); } printFTPInfo(sb + " " + packed2int(abyte0,345,5)); if (member == null && fileSize == 0) { // get current number of records fileSize = packed2int(abyte0,345,5); status.setFileLength(fileSize); member = sb.toString(); } else { if (sb.toString().equalsIgnoreCase(member)) { // get current number of records fileSize = packed2int(abyte0,345,5); status.setFileLength(fileSize); } else { fileSize = packed2int(abyte0,345,5); status.setFileLength(fileSize); } } len =0; } } printFTPInfo("Member list Transfer complete!"); } else flag = false; } catch(Exception _ex) { printFTPInfo("Error! " + _ex); return false; } finally { try { socket.close(); } catch(Exception _ex) { } try { datainputstream.close(); } catch(Exception _ex) { } } parseResponse(); return flag; } |
} else { fileSize = packed2int(abyte0,345,5); status.setFileLength(fileSize); } } | private boolean getMbrSize(String member) { boolean flag = true; if(ftpOutputStream == null) { printFTPInfo("Not connected to any server!"); return false; } if(!loggedIn) { printFTPInfo("Login was not successful! Aborting!"); return false; } Socket socket = null; DataInputStream datainputstream = null; executeCommand("TYPE","I"); String remoteFile = "QTEMP/FML"; try { socket = createPassiveSocket("RETR " + remoteFile); if(socket != null) { datainputstream = new DataInputStream(socket.getInputStream()); byte abyte0[] = new byte[858]; int c = 0; int kj = 0; int len = 0; StringBuffer sb = new StringBuffer(10); printFTPInfo("<----------------- Member Information ---------------->"); for(int j = 0; j != -1 && !aborted;) { j = datainputstream.read(); if(j == -1) break; c ++; abyte0[len++] = (byte)j; if (len == abyte0.length) { sb.setLength(0); // the offset for member name MBNAME is 164 with offset of 1 but // we have to offset the buffer by 0 which makes it 164 - 1 // or 163 for (int f = 0;f < 10; f++) { sb.append(vt.getASCIIChar(abyte0[163 + f] & 0xff)); } printFTPInfo(sb + " " + packed2int(abyte0,345,5)); if (member == null && fileSize == 0) { // get current number of records fileSize = packed2int(abyte0,345,5); status.setFileLength(fileSize); member = sb.toString(); } else { if (sb.toString().equalsIgnoreCase(member)) { // get current number of records fileSize = packed2int(abyte0,345,5); status.setFileLength(fileSize); } else { fileSize = packed2int(abyte0,345,5); status.setFileLength(fileSize); } } len =0; } } printFTPInfo("Member list Transfer complete!"); } else flag = false; } catch(Exception _ex) { printFTPInfo("Error! " + _ex); return false; } finally { try { socket.close(); } catch(Exception _ex) { } try { datainputstream.close(); } catch(Exception _ex) { } } parseResponse(); return flag; } |
|
SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkAccept(impl.getInetAddress().getHostAddress(), impl.getLocalPort()); | public Socket accept() throws IOException { SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkAccept(impl.getInetAddress().getHostAddress(), impl.getLocalPort()); Socket socket = new Socket(); try { implAccept(socket); } catch (IOException e) { try { socket.close(); } catch (IOException e2) { // Ignore. } throw e; } return socket; } |
|
public Gui5250(SessionConfig config) { propFileName = config.getConfigurationResource(); sesConfig = config; enableEvents(AWTEvent.WINDOW_EVENT_MASK | AWTEvent.KEY_EVENT_MASK); try { jbInit(); } catch(Exception e) { e.printStackTrace(); } | public Gui5250 () { | public Gui5250(SessionConfig config) { propFileName = config.getConfigurationResource(); sesConfig = config; enableEvents(AWTEvent.WINDOW_EVENT_MASK | AWTEvent.KEY_EVENT_MASK); try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } |
public Bus(Bus parent) { this.parent = parent; this.parentDevice = null; | Bus() { this.parent = null; this.parentDevice = null; | public Bus(Bus parent) { this.parent = parent; this.parentDevice = null; } |
public DeviceException(String s) { super(s); | public DeviceException() { super(); | public DeviceException(String s) { super(s); } |
private FloatItem(int kind, Register reg, int offsetToFP, float value) { super(kind, reg, offsetToFP); this.value = value; | FloatItem(ItemFactory factory) { super(factory); | private FloatItem(int kind, Register reg, int offsetToFP, float value) { super(kind, reg, offsetToFP); this.value = value; } |
return createConst(getValue()); | return factory.createFConst(getValue()); | protected WordItem cloneConstant() { return createConst(getValue()); } |
simulateMnemonic(getMnemonicValue(text)); | public void sendKeys(String text) { if (keyboardLocked) { if(text.equals("[reset]") || text.equals("[sysreq]") || text.equals("[attn]")) { bufferedKeys = ""; keysBuffered = false; } else { keysBuffered = true; if(bufferedKeys == null){ bufferedKeys = text; return; } else { bufferedKeys += text; return; } } } else { if (keysBuffered) { text = bufferedKeys + text; keysBuffered = false; bufferedKeys = ""; } // check to see if position is in a field and if it is then change // current field to that field isInField(lastPos,true); if (text.length() == 1 && !text.equals("[") && !text.equals("]")) { simulateKeyStroke(text.charAt(0)); } else { strokenizer.setKeyStrokes(text); String s; boolean done = false; while (strokenizer.hasMoreKeyStrokes() && !done) { s = strokenizer.nextKeyStroke(); if (s.length() == 1) { simulateKeyStroke(s.charAt(0)); } else { if (s != null) simulateMnemonic(getMnemonicValue(s)); else System.out.println(" mnemonic " + s); } if (keyboardLocked) { bufferedKeys = strokenizer.getUnprocessedKeyStroked(); if (bufferedKeys != null) keysBuffered = true; done = true; } } } } } |
|
Graphics2D g2d = getWritingArea(); | public void setStatus(byte attr,byte value,String s) { Graphics2D g2d = getWritingArea(); statusString = s; if (g2d == null) return; try { g2d.setColor(colorBg); g2d.fill(sArea); float Y = ((int)sArea.getY() + fmHeight)- (lm.getLeading() + lm.getDescent()); switch (attr) { case STATUS_SYSTEM: if (value == STATUS_VALUE_ON) { statusXSystem =true; g2d.setColor(colorWhite); if (s != null) g2d.drawString(s,(float)sArea.getX(),Y); else g2d.drawString(xSystem,(float)sArea.getX(),Y); } else statusXSystem = false; break; case STATUS_ERROR_CODE: if (value == STATUS_VALUE_ON) { g2d.setColor(colorRed); if (s != null) g2d.drawString(s,(float)sArea.getX(),Y); else g2d.drawString(xError,(float)sArea.getX(),Y); statusErrorCode = true; setKeyboardLocked(true); Toolkit.getDefaultToolkit().beep(); } else { statusErrorCode = false; setKeyboardLocked(false); homePos = saveHomePos; saveHomePos = 0; pendingInsert = false; } break; } updateImage(sArea.getBounds()); g2d.dispose(); } catch (Exception e) { System.out.println(" setStatus " + e.getMessage()); } } |
|
if (g2d == null) return; try { g2d.setColor(colorBg); g2d.fill(sArea); | bi.setStatus(attr,value,s, fmWidth, fmHeight, lm, font, colorBg, colorRed, colorWhite); | public void setStatus(byte attr,byte value,String s) { Graphics2D g2d = getWritingArea(); statusString = s; if (g2d == null) return; try { g2d.setColor(colorBg); g2d.fill(sArea); float Y = ((int)sArea.getY() + fmHeight)- (lm.getLeading() + lm.getDescent()); switch (attr) { case STATUS_SYSTEM: if (value == STATUS_VALUE_ON) { statusXSystem =true; g2d.setColor(colorWhite); if (s != null) g2d.drawString(s,(float)sArea.getX(),Y); else g2d.drawString(xSystem,(float)sArea.getX(),Y); } else statusXSystem = false; break; case STATUS_ERROR_CODE: if (value == STATUS_VALUE_ON) { g2d.setColor(colorRed); if (s != null) g2d.drawString(s,(float)sArea.getX(),Y); else g2d.drawString(xError,(float)sArea.getX(),Y); statusErrorCode = true; setKeyboardLocked(true); Toolkit.getDefaultToolkit().beep(); } else { statusErrorCode = false; setKeyboardLocked(false); homePos = saveHomePos; saveHomePos = 0; pendingInsert = false; } break; } updateImage(sArea.getBounds()); g2d.dispose(); } catch (Exception e) { System.out.println(" setStatus " + e.getMessage()); } } |
float Y = ((int)sArea.getY() + fmHeight)- (lm.getLeading() + lm.getDescent()); switch (attr) { | switch (attr) { | public void setStatus(byte attr,byte value,String s) { Graphics2D g2d = getWritingArea(); statusString = s; if (g2d == null) return; try { g2d.setColor(colorBg); g2d.fill(sArea); float Y = ((int)sArea.getY() + fmHeight)- (lm.getLeading() + lm.getDescent()); switch (attr) { case STATUS_SYSTEM: if (value == STATUS_VALUE_ON) { statusXSystem =true; g2d.setColor(colorWhite); if (s != null) g2d.drawString(s,(float)sArea.getX(),Y); else g2d.drawString(xSystem,(float)sArea.getX(),Y); } else statusXSystem = false; break; case STATUS_ERROR_CODE: if (value == STATUS_VALUE_ON) { g2d.setColor(colorRed); if (s != null) g2d.drawString(s,(float)sArea.getX(),Y); else g2d.drawString(xError,(float)sArea.getX(),Y); statusErrorCode = true; setKeyboardLocked(true); Toolkit.getDefaultToolkit().beep(); } else { statusErrorCode = false; setKeyboardLocked(false); homePos = saveHomePos; saveHomePos = 0; pendingInsert = false; } break; } updateImage(sArea.getBounds()); g2d.dispose(); } catch (Exception e) { System.out.println(" setStatus " + e.getMessage()); } } |
case STATUS_SYSTEM: if (value == STATUS_VALUE_ON) { statusXSystem =true; g2d.setColor(colorWhite); | case STATUS_SYSTEM: if (value == STATUS_VALUE_ON) { statusXSystem =true; } else statusXSystem = false; break; | public void setStatus(byte attr,byte value,String s) { Graphics2D g2d = getWritingArea(); statusString = s; if (g2d == null) return; try { g2d.setColor(colorBg); g2d.fill(sArea); float Y = ((int)sArea.getY() + fmHeight)- (lm.getLeading() + lm.getDescent()); switch (attr) { case STATUS_SYSTEM: if (value == STATUS_VALUE_ON) { statusXSystem =true; g2d.setColor(colorWhite); if (s != null) g2d.drawString(s,(float)sArea.getX(),Y); else g2d.drawString(xSystem,(float)sArea.getX(),Y); } else statusXSystem = false; break; case STATUS_ERROR_CODE: if (value == STATUS_VALUE_ON) { g2d.setColor(colorRed); if (s != null) g2d.drawString(s,(float)sArea.getX(),Y); else g2d.drawString(xError,(float)sArea.getX(),Y); statusErrorCode = true; setKeyboardLocked(true); Toolkit.getDefaultToolkit().beep(); } else { statusErrorCode = false; setKeyboardLocked(false); homePos = saveHomePos; saveHomePos = 0; pendingInsert = false; } break; } updateImage(sArea.getBounds()); g2d.dispose(); } catch (Exception e) { System.out.println(" setStatus " + e.getMessage()); } } |
if (s != null) g2d.drawString(s,(float)sArea.getX(),Y); else g2d.drawString(xSystem,(float)sArea.getX(),Y); } else statusXSystem = false; break; case STATUS_ERROR_CODE: if (value == STATUS_VALUE_ON) { g2d.setColor(colorRed); if (s != null) g2d.drawString(s,(float)sArea.getX(),Y); else g2d.drawString(xError,(float)sArea.getX(),Y); statusErrorCode = true; setKeyboardLocked(true); Toolkit.getDefaultToolkit().beep(); } else { statusErrorCode = false; setKeyboardLocked(false); homePos = saveHomePos; saveHomePos = 0; pendingInsert = false; } break; } updateImage(sArea.getBounds()); g2d.dispose(); } catch (Exception e) { System.out.println(" setStatus " + e.getMessage()); | case STATUS_ERROR_CODE: if (value == STATUS_VALUE_ON) { statusErrorCode = true; setKeyboardLocked(true); Toolkit.getDefaultToolkit().beep(); } else { statusErrorCode = false; setKeyboardLocked(false); homePos = saveHomePos; saveHomePos = 0; pendingInsert = false; } break; | public void setStatus(byte attr,byte value,String s) { Graphics2D g2d = getWritingArea(); statusString = s; if (g2d == null) return; try { g2d.setColor(colorBg); g2d.fill(sArea); float Y = ((int)sArea.getY() + fmHeight)- (lm.getLeading() + lm.getDescent()); switch (attr) { case STATUS_SYSTEM: if (value == STATUS_VALUE_ON) { statusXSystem =true; g2d.setColor(colorWhite); if (s != null) g2d.drawString(s,(float)sArea.getX(),Y); else g2d.drawString(xSystem,(float)sArea.getX(),Y); } else statusXSystem = false; break; case STATUS_ERROR_CODE: if (value == STATUS_VALUE_ON) { g2d.setColor(colorRed); if (s != null) g2d.drawString(s,(float)sArea.getX(),Y); else g2d.drawString(xError,(float)sArea.getX(),Y); statusErrorCode = true; setKeyboardLocked(true); Toolkit.getDefaultToolkit().beep(); } else { statusErrorCode = false; setKeyboardLocked(false); homePos = saveHomePos; saveHomePos = 0; pendingInsert = false; } break; } updateImage(sArea.getBounds()); g2d.dispose(); } catch (Exception e) { System.out.println(" setStatus " + e.getMessage()); } } |
updateImage(sArea.getBounds()); | public void setStatus(byte attr,byte value,String s) { Graphics2D g2d = getWritingArea(); statusString = s; if (g2d == null) return; try { g2d.setColor(colorBg); g2d.fill(sArea); float Y = ((int)sArea.getY() + fmHeight)- (lm.getLeading() + lm.getDescent()); switch (attr) { case STATUS_SYSTEM: if (value == STATUS_VALUE_ON) { statusXSystem =true; g2d.setColor(colorWhite); if (s != null) g2d.drawString(s,(float)sArea.getX(),Y); else g2d.drawString(xSystem,(float)sArea.getX(),Y); } else statusXSystem = false; break; case STATUS_ERROR_CODE: if (value == STATUS_VALUE_ON) { g2d.setColor(colorRed); if (s != null) g2d.drawString(s,(float)sArea.getX(),Y); else g2d.drawString(xError,(float)sArea.getX(),Y); statusErrorCode = true; setKeyboardLocked(true); Toolkit.getDefaultToolkit().beep(); } else { statusErrorCode = false; setKeyboardLocked(false); homePos = saveHomePos; saveHomePos = 0; pendingInsert = false; } break; } updateImage(sArea.getBounds()); g2d.dispose(); } catch (Exception e) { System.out.println(" setStatus " + e.getMessage()); } } |
|
protected void resolve() | protected void resolve(PluginRegistryModel registry) | protected void resolve() throws PluginException { if (getDeclaringPluginDescriptor().getPluginRegistry().getPluginDescriptor(plugin) == null) { throw new PluginException("Unknown plugin " + plugin + " in import of " + getDeclaringPluginDescriptor().getId()); } } |
if (getDeclaringPluginDescriptor().getPluginRegistry().getPluginDescriptor(plugin) == null) { | if (registry.getPluginDescriptor(plugin) == null) { | protected void resolve() throws PluginException { if (getDeclaringPluginDescriptor().getPluginRegistry().getPluginDescriptor(plugin) == null) { throw new PluginException("Unknown plugin " + plugin + " in import of " + getDeclaringPluginDescriptor().getId()); } } |
protected void unresolve() throws PluginException { | protected void unresolve(PluginRegistryModel registry) throws PluginException { | protected void unresolve() throws PluginException { // Nothing to do } |
int value = layoutManager.getInitialLocation(jc.getInsets()); if (layoutManager.components[0] != null) value += layoutManager.minimumSizeOfComponent(0); | int value = layoutManager.getInitialLocation(jc.getInsets()) - layoutManager.getAvailableSize(jc.getSize(), jc.getInsets()) + splitPane.getDividerSize(); if (layoutManager.components[1] != null) value += layoutManager.minimumSizeOfComponent(1); | public int getMinimumDividerLocation(JSplitPane jc) { int value = layoutManager.getInitialLocation(jc.getInsets()); if (layoutManager.components[0] != null) value += layoutManager.minimumSizeOfComponent(0); return value; } |
Hashtable table; | String property; | public static String getLocalizedString(Locale inLocale, String key, String name, boolean checkEnglish, boolean checkRoot) { String localizedString; Hashtable table; if (key.equals("")) return ""; /* Localize to inLocale */ try { table = (Hashtable) ResourceBundle.getBundle("gnu.java.locale.LocaleInformation", inLocale).getObject(name); localizedString = (String) table.get(key); } catch (MissingResourceException exception) { localizedString = null; } /* Localize to default locale */ if (localizedString == null) { try { ResourceBundle bundle; bundle = ResourceBundle.getBundle("gnu.java.locale.LocaleInformation"); table = (Hashtable) bundle.getObject(name); localizedString = (String) table.get(key); } catch (MissingResourceException exception) { localizedString = null; } } /* Localize to English */ if (localizedString == null && checkEnglish) { try { table = (Hashtable) ResourceBundle.getBundle("gnu.java.locale.LocaleInformation", Locale.ENGLISH).getObject(name); localizedString= (String) table.get(key); } catch (MissingResourceException exception) { localizedString = null; } } /* Return unlocalized version */ if (localizedString == null && checkRoot) { try { table = (Hashtable) ResourceBundle.getBundle("gnu.java.locale.LocaleInformation", new Locale("","","")).getObject(name); localizedString= (String) table.get(key); } catch (MissingResourceException exception) { localizedString = null; } } /* Return original input string */ if (localizedString == null) { localizedString = key; } return localizedString; } |
table = (Hashtable) | localizedString = | public static String getLocalizedString(Locale inLocale, String key, String name, boolean checkEnglish, boolean checkRoot) { String localizedString; Hashtable table; if (key.equals("")) return ""; /* Localize to inLocale */ try { table = (Hashtable) ResourceBundle.getBundle("gnu.java.locale.LocaleInformation", inLocale).getObject(name); localizedString = (String) table.get(key); } catch (MissingResourceException exception) { localizedString = null; } /* Localize to default locale */ if (localizedString == null) { try { ResourceBundle bundle; bundle = ResourceBundle.getBundle("gnu.java.locale.LocaleInformation"); table = (Hashtable) bundle.getObject(name); localizedString = (String) table.get(key); } catch (MissingResourceException exception) { localizedString = null; } } /* Localize to English */ if (localizedString == null && checkEnglish) { try { table = (Hashtable) ResourceBundle.getBundle("gnu.java.locale.LocaleInformation", Locale.ENGLISH).getObject(name); localizedString= (String) table.get(key); } catch (MissingResourceException exception) { localizedString = null; } } /* Return unlocalized version */ if (localizedString == null && checkRoot) { try { table = (Hashtable) ResourceBundle.getBundle("gnu.java.locale.LocaleInformation", new Locale("","","")).getObject(name); localizedString= (String) table.get(key); } catch (MissingResourceException exception) { localizedString = null; } } /* Return original input string */ if (localizedString == null) { localizedString = key; } return localizedString; } |
inLocale).getObject(name); localizedString = (String) table.get(key); | inLocale).getString(property); | public static String getLocalizedString(Locale inLocale, String key, String name, boolean checkEnglish, boolean checkRoot) { String localizedString; Hashtable table; if (key.equals("")) return ""; /* Localize to inLocale */ try { table = (Hashtable) ResourceBundle.getBundle("gnu.java.locale.LocaleInformation", inLocale).getObject(name); localizedString = (String) table.get(key); } catch (MissingResourceException exception) { localizedString = null; } /* Localize to default locale */ if (localizedString == null) { try { ResourceBundle bundle; bundle = ResourceBundle.getBundle("gnu.java.locale.LocaleInformation"); table = (Hashtable) bundle.getObject(name); localizedString = (String) table.get(key); } catch (MissingResourceException exception) { localizedString = null; } } /* Localize to English */ if (localizedString == null && checkEnglish) { try { table = (Hashtable) ResourceBundle.getBundle("gnu.java.locale.LocaleInformation", Locale.ENGLISH).getObject(name); localizedString= (String) table.get(key); } catch (MissingResourceException exception) { localizedString = null; } } /* Return unlocalized version */ if (localizedString == null && checkRoot) { try { table = (Hashtable) ResourceBundle.getBundle("gnu.java.locale.LocaleInformation", new Locale("","","")).getObject(name); localizedString= (String) table.get(key); } catch (MissingResourceException exception) { localizedString = null; } } /* Return original input string */ if (localizedString == null) { localizedString = key; } return localizedString; } |
table = (Hashtable) bundle.getObject(name); localizedString = (String) table.get(key); | localizedString = bundle.getString(property); | public static String getLocalizedString(Locale inLocale, String key, String name, boolean checkEnglish, boolean checkRoot) { String localizedString; Hashtable table; if (key.equals("")) return ""; /* Localize to inLocale */ try { table = (Hashtable) ResourceBundle.getBundle("gnu.java.locale.LocaleInformation", inLocale).getObject(name); localizedString = (String) table.get(key); } catch (MissingResourceException exception) { localizedString = null; } /* Localize to default locale */ if (localizedString == null) { try { ResourceBundle bundle; bundle = ResourceBundle.getBundle("gnu.java.locale.LocaleInformation"); table = (Hashtable) bundle.getObject(name); localizedString = (String) table.get(key); } catch (MissingResourceException exception) { localizedString = null; } } /* Localize to English */ if (localizedString == null && checkEnglish) { try { table = (Hashtable) ResourceBundle.getBundle("gnu.java.locale.LocaleInformation", Locale.ENGLISH).getObject(name); localizedString= (String) table.get(key); } catch (MissingResourceException exception) { localizedString = null; } } /* Return unlocalized version */ if (localizedString == null && checkRoot) { try { table = (Hashtable) ResourceBundle.getBundle("gnu.java.locale.LocaleInformation", new Locale("","","")).getObject(name); localizedString= (String) table.get(key); } catch (MissingResourceException exception) { localizedString = null; } } /* Return original input string */ if (localizedString == null) { localizedString = key; } return localizedString; } |
Locale.ENGLISH).getObject(name); localizedString= (String) table.get(key); | Locale.ENGLISH).getString(property); | public static String getLocalizedString(Locale inLocale, String key, String name, boolean checkEnglish, boolean checkRoot) { String localizedString; Hashtable table; if (key.equals("")) return ""; /* Localize to inLocale */ try { table = (Hashtable) ResourceBundle.getBundle("gnu.java.locale.LocaleInformation", inLocale).getObject(name); localizedString = (String) table.get(key); } catch (MissingResourceException exception) { localizedString = null; } /* Localize to default locale */ if (localizedString == null) { try { ResourceBundle bundle; bundle = ResourceBundle.getBundle("gnu.java.locale.LocaleInformation"); table = (Hashtable) bundle.getObject(name); localizedString = (String) table.get(key); } catch (MissingResourceException exception) { localizedString = null; } } /* Localize to English */ if (localizedString == null && checkEnglish) { try { table = (Hashtable) ResourceBundle.getBundle("gnu.java.locale.LocaleInformation", Locale.ENGLISH).getObject(name); localizedString= (String) table.get(key); } catch (MissingResourceException exception) { localizedString = null; } } /* Return unlocalized version */ if (localizedString == null && checkRoot) { try { table = (Hashtable) ResourceBundle.getBundle("gnu.java.locale.LocaleInformation", new Locale("","","")).getObject(name); localizedString= (String) table.get(key); } catch (MissingResourceException exception) { localizedString = null; } } /* Return original input string */ if (localizedString == null) { localizedString = key; } return localizedString; } |
new Locale("","","")).getObject(name); localizedString= (String) table.get(key); | new Locale("","","") ).getString(property); | public static String getLocalizedString(Locale inLocale, String key, String name, boolean checkEnglish, boolean checkRoot) { String localizedString; Hashtable table; if (key.equals("")) return ""; /* Localize to inLocale */ try { table = (Hashtable) ResourceBundle.getBundle("gnu.java.locale.LocaleInformation", inLocale).getObject(name); localizedString = (String) table.get(key); } catch (MissingResourceException exception) { localizedString = null; } /* Localize to default locale */ if (localizedString == null) { try { ResourceBundle bundle; bundle = ResourceBundle.getBundle("gnu.java.locale.LocaleInformation"); table = (Hashtable) bundle.getObject(name); localizedString = (String) table.get(key); } catch (MissingResourceException exception) { localizedString = null; } } /* Localize to English */ if (localizedString == null && checkEnglish) { try { table = (Hashtable) ResourceBundle.getBundle("gnu.java.locale.LocaleInformation", Locale.ENGLISH).getObject(name); localizedString= (String) table.get(key); } catch (MissingResourceException exception) { localizedString = null; } } /* Return unlocalized version */ if (localizedString == null && checkRoot) { try { table = (Hashtable) ResourceBundle.getBundle("gnu.java.locale.LocaleInformation", new Locale("","","")).getObject(name); localizedString= (String) table.get(key); } catch (MissingResourceException exception) { localizedString = null; } } /* Return original input string */ if (localizedString == null) { localizedString = key; } return localizedString; } |
Map.Entry e = (Map.Entry) it.next(); | Map.Entry e = (Map.Entry) it2.next(); | private void encodeDer() { ArrayList name = new ArrayList(components.size()); for (Iterator it = components.iterator(); it.hasNext(); ) { Map m = (Map) it.next(); if (m.isEmpty()) continue; Set rdn = new HashSet(); for (Iterator it2 = m.entrySet().iterator(); it2.hasNext(); ) { Map.Entry e = (Map.Entry) it.next(); ArrayList atav = new ArrayList(2); atav.add(new DERValue(DER.OBJECT_IDENTIFIER, e.getKey())); atav.add(new DERValue(DER.UTF8_STRING, e.getValue())); rdn.add(new DERValue(DER.SEQUENCE|DER.CONSTRUCTED, atav)); } name.add(new DERValue(DER.SET|DER.CONSTRUCTED, rdn)); } DERValue val = new DERValue(DER.SEQUENCE|DER.CONSTRUCTED, name); encoded = val.getEncoded(); } |
if (sep == -1) break; | private void parseString(String str) throws IOException { Reader in = new StringReader(str); while (true) { String key = readAttributeType(in); if (key == null) break; String value = readAttributeValue(in); putComponent(key, value); if (sep == ',') newRelativeDistinguishedName(); } } |
|
throw new EOFException(); | throw new EOFException("partial name read: " + buf); | private String readAttributeType(Reader in) throws IOException { StringBuffer buf = new StringBuffer(); int ch; while ((ch = in.read()) != '=') { if (ch == -1) { if (buf.length() > 0) throw new EOFException(); return null; } if (ch > 127) throw new IOException("Invalid char: " + (char) ch); if (Character.isLetterOrDigit((char) ch) || ch == '-' || ch == '.') buf.append((char) ch); else throw new IOException("Invalid char: " + (char) ch); } return buf.toString(); } |
throw new EOFException(); | sep = -1; return buf.toString (); | private String readAttributeValue(Reader in) throws IOException { StringBuffer buf = new StringBuffer(); int ch = in.read(); if (ch == '#') { while (true) { ch = in.read(); if (('a' <= ch && ch <= 'f') || ('A' <= ch && ch <= 'F') || Character.isDigit((char) ch)) buf.append((char) ch); else if (ch == '+' || ch == ',') { sep = ch; String hex = buf.toString(); return new String(toByteArray(hex)); } else throw new IOException("illegal character: " + (char) ch); } } else if (ch == '"') { while (true) { ch = in.read(); if (ch == '"') break; else if (ch == '\\') { ch = in.read(); if (ch == -1) throw new EOFException(); if (('a' <= ch && ch <= 'f') || ('A' <= ch && ch <= 'F') || Character.isDigit((char) ch)) { int i = Character.digit((char) ch, 16) << 4; ch = in.read(); if (!(('a' <= ch && ch <= 'f') || ('A' <= ch && ch <= 'F') || Character.isDigit((char) ch))) throw new IOException("illegal hex char"); i |= Character.digit((char) ch, 16); buf.append((char) i); } else buf.append((char) ch); } else buf.append((char) ch); } sep = in.read(); if (sep != '+' || sep != ',') throw new IOException("illegal character: " + (char) ch); return buf.toString(); } else { while (true) { switch (ch) { case '+': case ',': sep = ch; return buf.toString(); case '\\': ch = in.read(); if (ch == -1) throw new EOFException(); if (('a' <= ch && ch <= 'f') || ('A' <= ch && ch <= 'F') || Character.isDigit((char) ch)) { int i = Character.digit((char) ch, 16) << 4; ch = in.read(); if (!(('a' <= ch && ch <= 'f') || ('A' <= ch && ch <= 'F') || Character.isDigit((char) ch))) throw new IOException("illegal hex char"); i |= Character.digit((char) ch, 16); buf.append((char) i); } else buf.append((char) ch); break; case '=': case '<': case '>': case '#': case ';': throw new IOException("illegal character: " + (char) ch); case -1: throw new EOFException(); default: buf.append((char) ch); } } } } |
ch = in.read (); | private String readAttributeValue(Reader in) throws IOException { StringBuffer buf = new StringBuffer(); int ch = in.read(); if (ch == '#') { while (true) { ch = in.read(); if (('a' <= ch && ch <= 'f') || ('A' <= ch && ch <= 'F') || Character.isDigit((char) ch)) buf.append((char) ch); else if (ch == '+' || ch == ',') { sep = ch; String hex = buf.toString(); return new String(toByteArray(hex)); } else throw new IOException("illegal character: " + (char) ch); } } else if (ch == '"') { while (true) { ch = in.read(); if (ch == '"') break; else if (ch == '\\') { ch = in.read(); if (ch == -1) throw new EOFException(); if (('a' <= ch && ch <= 'f') || ('A' <= ch && ch <= 'F') || Character.isDigit((char) ch)) { int i = Character.digit((char) ch, 16) << 4; ch = in.read(); if (!(('a' <= ch && ch <= 'f') || ('A' <= ch && ch <= 'F') || Character.isDigit((char) ch))) throw new IOException("illegal hex char"); i |= Character.digit((char) ch, 16); buf.append((char) i); } else buf.append((char) ch); } else buf.append((char) ch); } sep = in.read(); if (sep != '+' || sep != ',') throw new IOException("illegal character: " + (char) ch); return buf.toString(); } else { while (true) { switch (ch) { case '+': case ',': sep = ch; return buf.toString(); case '\\': ch = in.read(); if (ch == -1) throw new EOFException(); if (('a' <= ch && ch <= 'f') || ('A' <= ch && ch <= 'F') || Character.isDigit((char) ch)) { int i = Character.digit((char) ch, 16) << 4; ch = in.read(); if (!(('a' <= ch && ch <= 'f') || ('A' <= ch && ch <= 'F') || Character.isDigit((char) ch))) throw new IOException("illegal hex char"); i |= Character.digit((char) ch, 16); buf.append((char) i); } else buf.append((char) ch); break; case '=': case '<': case '>': case '#': case ';': throw new IOException("illegal character: " + (char) ch); case -1: throw new EOFException(); default: buf.append((char) ch); } } } } |
Subsets and Splits