rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
new BAD_OPERATION("Unable to activate", 0x5004,
new BAD_OPERATION("Unable to activate", Minor.Activation,
public InvokeHandler getHandler(String operation, CookieHolder cookie, boolean forwarding_allowed ) throws gnuForwardRequest { if (servant != null) { return servantToHandler(servant); } else { // Use servant locator to locate the servant. if (poa.servant_locator != null) { try { servant = poa.servant_locator.preinvoke(Id, poa, operation, cookie); return servantToHandler(servant); } catch (org.omg.PortableServer.ForwardRequest forw_ex) { if (forwarding_allowed) { throw new gnuForwardRequest(forw_ex.forward_reference); } else { servant = ForwardedServant.create(forw_ex.forward_reference); return servantToHandler(servant); } } } else // Use servant activator to locate the servant. if (poa.applies(ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION) && poa.applies(ServantRetentionPolicyValue.RETAIN) ) { try { poa.activate_object_with_id(Id, servant, forwarding_allowed); servant = poa.id_to_servant(Id); return servantToHandler(servant); } catch (gnuForwardRequest forwarded) { throw forwarded; } catch (Exception ex) { ex.printStackTrace(); BAD_OPERATION bad = new BAD_OPERATION("Unable to activate", 0x5004, CompletionStatus.COMPLETED_NO ); bad.initCause(ex); throw bad; } } else if (poa.default_servant != null) { servant = poa.default_servant; return servantToHandler(servant); } // No servant and no servant manager - throw exception. else { throw new BAD_OPERATION("Unable to activate", 0x5002, CompletionStatus.COMPLETED_NO ); } } }
throw new BAD_OPERATION("Unable to activate", 0x5002,
throw new BAD_OPERATION("Unable to activate", Minor.Activation,
public InvokeHandler getHandler(String operation, CookieHolder cookie, boolean forwarding_allowed ) throws gnuForwardRequest { if (servant != null) { return servantToHandler(servant); } else { // Use servant locator to locate the servant. if (poa.servant_locator != null) { try { servant = poa.servant_locator.preinvoke(Id, poa, operation, cookie); return servantToHandler(servant); } catch (org.omg.PortableServer.ForwardRequest forw_ex) { if (forwarding_allowed) { throw new gnuForwardRequest(forw_ex.forward_reference); } else { servant = ForwardedServant.create(forw_ex.forward_reference); return servantToHandler(servant); } } } else // Use servant activator to locate the servant. if (poa.applies(ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION) && poa.applies(ServantRetentionPolicyValue.RETAIN) ) { try { poa.activate_object_with_id(Id, servant, forwarding_allowed); servant = poa.id_to_servant(Id); return servantToHandler(servant); } catch (gnuForwardRequest forwarded) { throw forwarded; } catch (Exception ex) { ex.printStackTrace(); BAD_OPERATION bad = new BAD_OPERATION("Unable to activate", 0x5004, CompletionStatus.COMPLETED_NO ); bad.initCause(ex); throw bad; } } else if (poa.default_servant != null) { servant = poa.default_servant; return servantToHandler(servant); } // No servant and no servant manager - throw exception. else { throw new BAD_OPERATION("Unable to activate", 0x5002, CompletionStatus.COMPLETED_NO ); } } }
public boolean equals(Object obj) { if (obj instanceof ActivationGroupID) { ActivationGroupID that = (ActivationGroupID)obj; if (this.system.equals(that.system)) { return (true);
public boolean equals(Object obj) { if (obj instanceof ActivationGroupID) { ActivationGroupID that = (ActivationGroupID) obj; return system.equals(that.system);
public boolean equals(Object obj) { if (obj instanceof ActivationGroupID) { ActivationGroupID that = (ActivationGroupID)obj; if (this.system.equals(that.system)) { return (true); } } return (false);}
return (false); }
public boolean equals(Object obj) { if (obj instanceof ActivationGroupID) { ActivationGroupID that = (ActivationGroupID)obj; if (this.system.equals(that.system)) { return (true); } } return (false);}
public ActivationSystem getSystem() { return (system); }
public ActivationSystem getSystem() { return system; }
public ActivationSystem getSystem() { return (system);}
public int hashCode() { return (system.hashCode()); }
public int hashCode() { return system.hashCode(); }
public int hashCode() { return (system.hashCode());}
if (deviceName.getText() != null)
if (deviceName.getText() != null && !sdn.isSelected())
private static String toArgString() { StringBuffer sb = new StringBuffer(); sb.append(systemId.getText()); // port if (port.getText() != null) if (port.getText().trim().length() > 0) sb.append(" -p " + port.getText().trim()); if (fpn.getText() != null) if (fpn.getText().length() > 0) sb.append(" -f " + fpn.getText()); if (!LangTool.getString("conf.labelDefault").equals( (String)cpb.getSelectedItem())) sb.append(" -cp " + (String)cpb.getSelectedItem()); if (!SSL_TYPE_NONE.equals((String)sslType.getSelectedItem())) sb.append(" -sslType " + (String)sslType.getSelectedItem()); if (ec.isSelected()) sb.append(" -e" ); if (tc.isSelected()) sb.append(" -t" ); if (!sdNormal.isSelected()) sb.append(" -132" ); if (deviceName.getText() != null) if (deviceName.getText().trim().length() > 0) if (deviceName.getText().trim().length() > 10) sb.append(" -dn " + deviceName.getText().trim().substring(0,10).toUpperCase()); else sb.append(" -dn " + deviceName.getText().trim().toUpperCase()); if (useProxy.isSelected()) sb.append(" -usp" ); if (proxyHost.getText() != null) if (proxyHost.getText().length() > 0) sb.append(" -sph " + proxyHost.getText()); if (proxyPort.getText() != null) if (proxyPort.getText().length() > 0) sb.append(" -spp " + proxyPort.getText()); if (noEmbed.isSelected()) sb.append(" -noembed "); if (deamon.isSelected()) sb.append(" -d "); if (newJVM.isSelected()) sb.append(" -nc "); return sb.toString(); }
if (sdn.isSelected()) sb.append(" -dn=hostname");
private static String toArgString() { StringBuffer sb = new StringBuffer(); sb.append(systemId.getText()); // port if (port.getText() != null) if (port.getText().trim().length() > 0) sb.append(" -p " + port.getText().trim()); if (fpn.getText() != null) if (fpn.getText().length() > 0) sb.append(" -f " + fpn.getText()); if (!LangTool.getString("conf.labelDefault").equals( (String)cpb.getSelectedItem())) sb.append(" -cp " + (String)cpb.getSelectedItem()); if (!SSL_TYPE_NONE.equals((String)sslType.getSelectedItem())) sb.append(" -sslType " + (String)sslType.getSelectedItem()); if (ec.isSelected()) sb.append(" -e" ); if (tc.isSelected()) sb.append(" -t" ); if (!sdNormal.isSelected()) sb.append(" -132" ); if (deviceName.getText() != null) if (deviceName.getText().trim().length() > 0) if (deviceName.getText().trim().length() > 10) sb.append(" -dn " + deviceName.getText().trim().substring(0,10).toUpperCase()); else sb.append(" -dn " + deviceName.getText().trim().toUpperCase()); if (useProxy.isSelected()) sb.append(" -usp" ); if (proxyHost.getText() != null) if (proxyHost.getText().length() > 0) sb.append(" -sph " + proxyHost.getText()); if (proxyPort.getText() != null) if (proxyPort.getText().length() > 0) sb.append(" -spp " + proxyPort.getText()); if (noEmbed.isSelected()) sb.append(" -noembed "); if (deamon.isSelected()) sb.append(" -d "); if (newJVM.isSelected()) sb.append(" -nc "); return sb.toString(); }
bad.minor = Minor.Any;
public static AdapterAlreadyExists extract(Any any) { try { EmptyExceptionHolder h = (EmptyExceptionHolder) any.extract_Streamable(); return (AdapterAlreadyExists) h.value; } catch (ClassCastException cex) { BAD_OPERATION bad = new BAD_OPERATION("AdapterAlreadyExists expected"); bad.initCause(cex); throw bad; } }
return null;
if (accessibleContext == null) accessibleContext = new AccessibleJPanel(); return accessibleContext;
public AccessibleContext getAccessibleContext() { return null; }
throw new Error("Not implemented");
return RemoteServer.getClientHost();
public String getClientHost() throws ServerNotActiveException { throw new Error("Not implemented");}
public UnicastRef(ObjID objid) { this.objid = objid;
public UnicastRef() {
public UnicastRef(ObjID objid) { this.objid = objid;}
public static synchronized UnicastConnectionManager getInstance(int port, RMIServerSocketFactory ssf) { if (ssf == null) { ssf = defaultSocketFactory;
public static synchronized UnicastConnectionManager getInstance(String host, int port, RMIClientSocketFactory csf) { if (csf == null) { csf = defaultSocketFactory;
public static synchronized UnicastConnectionManager getInstance(int port, RMIServerSocketFactory ssf) {//System.out.println("getInstance: " + port + "," + ssf); if (ssf == null) { ssf = defaultSocketFactory; } TripleKey key = new TripleKey(localhost, port, ssf); UnicastConnectionManager man = (UnicastConnectionManager)servers.get(key); if (man == null) { man = new UnicastConnectionManager(port, ssf); if (debug) { nsmanager++; System.out.println("\n\n ****** " + nsmanager + " server managers.\n\n"); } // The provided port might not be the set port. key.port = man.serverPort; servers.put(key, man); } return (man);}
TripleKey key = new TripleKey(localhost, port, ssf); UnicastConnectionManager man = (UnicastConnectionManager)servers.get(key);
try{ host = InetAddress.getByName(host).getHostAddress(); }catch(Exception _){} TripleKey key = new TripleKey(host, port, csf); UnicastConnectionManager man = (UnicastConnectionManager)clients.get(key);
public static synchronized UnicastConnectionManager getInstance(int port, RMIServerSocketFactory ssf) {//System.out.println("getInstance: " + port + "," + ssf); if (ssf == null) { ssf = defaultSocketFactory; } TripleKey key = new TripleKey(localhost, port, ssf); UnicastConnectionManager man = (UnicastConnectionManager)servers.get(key); if (man == null) { man = new UnicastConnectionManager(port, ssf); if (debug) { nsmanager++; System.out.println("\n\n ****** " + nsmanager + " server managers.\n\n"); } // The provided port might not be the set port. key.port = man.serverPort; servers.put(key, man); } return (man);}
man = new UnicastConnectionManager(port, ssf);
man = new UnicastConnectionManager(host, port, csf);
public static synchronized UnicastConnectionManager getInstance(int port, RMIServerSocketFactory ssf) {//System.out.println("getInstance: " + port + "," + ssf); if (ssf == null) { ssf = defaultSocketFactory; } TripleKey key = new TripleKey(localhost, port, ssf); UnicastConnectionManager man = (UnicastConnectionManager)servers.get(key); if (man == null) { man = new UnicastConnectionManager(port, ssf); if (debug) { nsmanager++; System.out.println("\n\n ****** " + nsmanager + " server managers.\n\n"); } // The provided port might not be the set port. key.port = man.serverPort; servers.put(key, man); } return (man);}
nsmanager++; System.out.println("\n\n ****** " + nsmanager + " server managers.\n\n");
ncmanager++; System.out.println("\n\n ====== " + ncmanager + " client managers.\n\n");
public static synchronized UnicastConnectionManager getInstance(int port, RMIServerSocketFactory ssf) {//System.out.println("getInstance: " + port + "," + ssf); if (ssf == null) { ssf = defaultSocketFactory; } TripleKey key = new TripleKey(localhost, port, ssf); UnicastConnectionManager man = (UnicastConnectionManager)servers.get(key); if (man == null) { man = new UnicastConnectionManager(port, ssf); if (debug) { nsmanager++; System.out.println("\n\n ****** " + nsmanager + " server managers.\n\n"); } // The provided port might not be the set port. key.port = man.serverPort; servers.put(key, man); } return (man);}
key.port = man.serverPort; servers.put(key, man);
clients.put(key, man); UnicastConnectionManager svrman = (UnicastConnectionManager)servers.get(key); if(svrman != null){ man.serverobj = svrman.serverobj; }
public static synchronized UnicastConnectionManager getInstance(int port, RMIServerSocketFactory ssf) {//System.out.println("getInstance: " + port + "," + ssf); if (ssf == null) { ssf = defaultSocketFactory; } TripleKey key = new TripleKey(localhost, port, ssf); UnicastConnectionManager man = (UnicastConnectionManager)servers.get(key); if (man == null) { man = new UnicastConnectionManager(port, ssf); if (debug) { nsmanager++; System.out.println("\n\n ****** " + nsmanager + " server managers.\n\n"); } // The provided port might not be the set port. key.port = man.serverPort; servers.put(key, man); } return (man);}
public GeneralSecurityException(String msg)
public GeneralSecurityException()
public GeneralSecurityException(String msg) { super(msg); }
super(msg);
public GeneralSecurityException(String msg) { super(msg); }
int sum = 0;
int i = 0; int pos = 0; boolean lengthWritten = false;
public final synchronized void writeUTF(String value) throws IOException { int len = value.length(); int sum = 0; for (int i = 0; i < len && sum <= 65535; ++i) { char c = value.charAt(i); if (c >= '\u0001' && c <= '\u007f') sum += 1; else if (c == '\u0000' || (c >= '\u0080' && c <= '\u07ff')) sum += 2; else sum += 3; } if (sum > 65535) throw new UTFDataFormatException (); int pos = 0; byte[] buf = new byte[sum]; for (int i = 0; i < len; ++i) { char c = value.charAt(i); if (c >= '\u0001' && c <= '\u007f') buf[pos++] = (byte) c; else if (c == '\u0000' || (c >= '\u0080' && c <= '\u07ff')) { buf[pos++] = (byte) (0xc0 | (0x1f & (c >> 6))); buf[pos++] = (byte) (0x80 | (0x3f & c)); } else { // JSL says the first byte should be or'd with 0xc0, but // that is a typo. Unicode says 0xe0, and that is what is // consistent with DataInputStream. buf[pos++] = (byte) (0xe0 | (0x0f & (c >> 12))); buf[pos++] = (byte) (0x80 | (0x3f & (c >> 6))); buf[pos++] = (byte) (0x80 | (0x3f & c)); } } writeShort (sum); write(buf, 0, sum); }
for (int i = 0; i < len && sum <= 65535; ++i)
if (buf == null) buf = new byte[512]; do
public final synchronized void writeUTF(String value) throws IOException { int len = value.length(); int sum = 0; for (int i = 0; i < len && sum <= 65535; ++i) { char c = value.charAt(i); if (c >= '\u0001' && c <= '\u007f') sum += 1; else if (c == '\u0000' || (c >= '\u0080' && c <= '\u07ff')) sum += 2; else sum += 3; } if (sum > 65535) throw new UTFDataFormatException (); int pos = 0; byte[] buf = new byte[sum]; for (int i = 0; i < len; ++i) { char c = value.charAt(i); if (c >= '\u0001' && c <= '\u007f') buf[pos++] = (byte) c; else if (c == '\u0000' || (c >= '\u0080' && c <= '\u07ff')) { buf[pos++] = (byte) (0xc0 | (0x1f & (c >> 6))); buf[pos++] = (byte) (0x80 | (0x3f & c)); } else { // JSL says the first byte should be or'd with 0xc0, but // that is a typo. Unicode says 0xe0, and that is what is // consistent with DataInputStream. buf[pos++] = (byte) (0xe0 | (0x0f & (c >> 12))); buf[pos++] = (byte) (0x80 | (0x3f & (c >> 6))); buf[pos++] = (byte) (0x80 | (0x3f & c)); } } writeShort (sum); write(buf, 0, sum); }
char c = value.charAt(i); if (c >= '\u0001' && c <= '\u007f') sum += 1; else if (c == '\u0000' || (c >= '\u0080' && c <= '\u07ff')) sum += 2; else sum += 3; } if (sum > 65535) throw new UTFDataFormatException (); int pos = 0; byte[] buf = new byte[sum]; for (int i = 0; i < len; ++i) { char c = value.charAt(i);
while (i < len && pos < buf.length - 3) { char c = value.charAt(i++);
public final synchronized void writeUTF(String value) throws IOException { int len = value.length(); int sum = 0; for (int i = 0; i < len && sum <= 65535; ++i) { char c = value.charAt(i); if (c >= '\u0001' && c <= '\u007f') sum += 1; else if (c == '\u0000' || (c >= '\u0080' && c <= '\u07ff')) sum += 2; else sum += 3; } if (sum > 65535) throw new UTFDataFormatException (); int pos = 0; byte[] buf = new byte[sum]; for (int i = 0; i < len; ++i) { char c = value.charAt(i); if (c >= '\u0001' && c <= '\u007f') buf[pos++] = (byte) c; else if (c == '\u0000' || (c >= '\u0080' && c <= '\u07ff')) { buf[pos++] = (byte) (0xc0 | (0x1f & (c >> 6))); buf[pos++] = (byte) (0x80 | (0x3f & c)); } else { // JSL says the first byte should be or'd with 0xc0, but // that is a typo. Unicode says 0xe0, and that is what is // consistent with DataInputStream. buf[pos++] = (byte) (0xe0 | (0x0f & (c >> 12))); buf[pos++] = (byte) (0x80 | (0x3f & (c >> 6))); buf[pos++] = (byte) (0x80 | (0x3f & c)); } } writeShort (sum); write(buf, 0, sum); }
writeShort (sum); write(buf, 0, sum);
if (! lengthWritten) { if (i == len) writeShort(pos); else writeShort(getUTFlength(value, i, pos)); lengthWritten = true; } write(buf, 0, pos); pos = 0; } while (i < len);
public final synchronized void writeUTF(String value) throws IOException { int len = value.length(); int sum = 0; for (int i = 0; i < len && sum <= 65535; ++i) { char c = value.charAt(i); if (c >= '\u0001' && c <= '\u007f') sum += 1; else if (c == '\u0000' || (c >= '\u0080' && c <= '\u07ff')) sum += 2; else sum += 3; } if (sum > 65535) throw new UTFDataFormatException (); int pos = 0; byte[] buf = new byte[sum]; for (int i = 0; i < len; ++i) { char c = value.charAt(i); if (c >= '\u0001' && c <= '\u007f') buf[pos++] = (byte) c; else if (c == '\u0000' || (c >= '\u0080' && c <= '\u07ff')) { buf[pos++] = (byte) (0xc0 | (0x1f & (c >> 6))); buf[pos++] = (byte) (0x80 | (0x3f & c)); } else { // JSL says the first byte should be or'd with 0xc0, but // that is a typo. Unicode says 0xe0, and that is what is // consistent with DataInputStream. buf[pos++] = (byte) (0xe0 | (0x0f & (c >> 12))); buf[pos++] = (byte) (0x80 | (0x3f & (c >> 6))); buf[pos++] = (byte) (0x80 | (0x3f & c)); } } writeShort (sum); write(buf, 0, sum); }
if (m.getModel().isArmed() && (m.getParent() instanceof MenuElement || m.getModel().isPressed()))
if ((m.isSelected() && checkIcon == null) || m.getModel().isArmed() && (m.getParent() instanceof MenuElement))
protected void paintMenuItem(Graphics g, JComponent c, Icon checkIcon, Icon arrowIcon, Color background, Color foreground, int defaultTextIconGap) { JMenuItem m = (JMenuItem) c; Rectangle tr = new Rectangle(); // text rectangle Rectangle ir = new Rectangle(); // icon rectangle Rectangle vr = new Rectangle(); // view rectangle Rectangle br = new Rectangle(); // border rectangle Rectangle ar = new Rectangle(); // accelerator rectangle Rectangle cr = new Rectangle(); // checkIcon rectangle int vertAlign = m.getVerticalAlignment(); int horAlign = m.getHorizontalAlignment(); int vertTextPos = m.getVerticalTextPosition(); int horTextPos = m.getHorizontalTextPosition(); Font f = m.getFont(); g.setFont(f); FontMetrics fm = g.getFontMetrics(f); SwingUtilities.calculateInnerArea(m, br); SwingUtilities.calculateInsetArea(br, m.getInsets(), vr); paintBackground(g, m, m.getBackground()); /* MenuItems insets are equal to menuItems margin, space between text and menuItems border. We need to paint insets region as well. */ Insets insets = m.getInsets(); br.x -= insets.left; br.y -= insets.top; br.width += insets.right + insets.left; br.height += insets.top + insets.bottom; /* Menu item is considered to be highlighted when it is selected. It is considered to be selected if menu item is inside some menu and is armed or if it is both armed and pressed */ if (m.getModel().isArmed() && (m.getParent() instanceof MenuElement || m.getModel().isPressed())) { if (m.isContentAreaFilled()) { g.setColor(selectionBackground); g.fillRect(br.x, br.y, br.width, br.height); } } else { if (m.isContentAreaFilled()) { g.setColor(m.getBackground()); g.fillRect(br.x, br.y, br.width, br.height); } } // If this menu item is a JCheckBoxMenuItem then paint check icon if (checkIcon != null) { SwingUtilities.layoutCompoundLabel(m, fm, null, checkIcon, vertAlign, horAlign, vertTextPos, horTextPos, vr, cr, tr, defaultTextIconGap); checkIcon.paintIcon(m, g, cr.x, cr.y); // We need to calculate position of the menu text and position of // user menu icon if there exists one relative to the check icon. // So we need to adjust view rectangle s.t. its starting point is at // checkIcon.width + defaultTextIconGap. vr.x = cr.x + cr.width + defaultTextIconGap; } // if this is a submenu, then paint arrow icon to indicate it. if (arrowIcon != null && (c instanceof JMenu)) { if (! ((JMenu) c).isTopLevelMenu()) { int width = arrowIcon.getIconWidth(); int height = arrowIcon.getIconHeight(); arrowIcon.paintIcon(m, g, vr.width - width + defaultTextIconGap, vr.y + 2); } } // paint text and user menu icon if it exists Icon i = m.getIcon(); SwingUtilities.layoutCompoundLabel(c, fm, m.getText(), i, vertAlign, horAlign, vertTextPos, horTextPos, vr, ir, tr, defaultTextIconGap); if (i != null) i.paintIcon(c, g, ir.x, ir.y); paintText(g, m, tr, m.getText()); // paint accelerator String acceleratorText = ""; if (m.getAccelerator() != null) { acceleratorText = getAcceleratorText(m.getAccelerator()); fm = g.getFontMetrics(acceleratorFont); ar.width = fm.stringWidth(acceleratorText); ar.x = br.width - ar.width; vr.x = br.width - ar.width; SwingUtilities.layoutCompoundLabel(m, fm, acceleratorText, null, vertAlign, horAlign, vertTextPos, horTextPos, vr, ir, ar, defaultTextIconGap); paintAccelerator(g, m, ar, acceleratorText); } }
if (menuItem.getModel().isArmed() && (menuItem.getParent() instanceof MenuElement || menuItem.getModel().isPressed()))
if ((menuItem.isSelected() && checkIcon == null) || menuItem.getModel().isArmed() && (menuItem.getParent() instanceof MenuElement))
protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text) { Font f = menuItem.getFont(); g.setFont(f); FontMetrics fm = g.getFontMetrics(f); if (text != null && ! text.equals("")) { if (menuItem.isEnabled()) { /* Menu item is considered to be highlighted when it is selected. It is considered to be selected if menu item is inside some menu and is armed or if it is both armed and pressed */ if (menuItem.getModel().isArmed() && (menuItem.getParent() instanceof MenuElement || menuItem.getModel().isPressed())) g.setColor(selectionForeground); else g.setColor(menuItem.getForeground()); } else // FIXME: should fix this to use 'disabledForeground', but its // default value in BasicLookAndFeel is null. g.setColor(Color.gray); int mnemonicIndex = menuItem.getDisplayedMnemonicIndex(); if (mnemonicIndex != -1) BasicGraphicsUtils.drawStringUnderlineCharAt(g, text, mnemonicIndex, textRect.x, textRect.y + fm.getAscent()); else BasicGraphicsUtils.drawString(g, text, 0, textRect.x, textRect.y + fm.getAscent()); } }
KeyStroke[] bothKeys = new KeyStroke[superKeys.length + mapKeys.length]; for (int i = 0; i < superKeys.length; ++i)
int skl = 0; int mkl = 0; if (superKeys != null) skl = superKeys.length; if (mapKeys != null) mkl = mapKeys.length; KeyStroke[] bothKeys = new KeyStroke[skl + mkl]; for (int i = 0; i < skl; ++i)
public KeyStroke[] allKeys() { KeyStroke[] superKeys = super.allKeys(); KeyStroke[] mapKeys = map.getBoundKeyStrokes(); KeyStroke[] bothKeys = new KeyStroke[superKeys.length + mapKeys.length]; for (int i = 0; i < superKeys.length; ++i) bothKeys[i] = superKeys[i]; for (int i = 0; i < mapKeys.length; ++i) bothKeys[i + superKeys.length] = mapKeys[i]; return bothKeys; }
for (int i = 0; i < mapKeys.length; ++i) bothKeys[i + superKeys.length] = mapKeys[i];
for (int i = 0; i < mkl; ++i) bothKeys[i + skl] = mapKeys[i];
public KeyStroke[] allKeys() { KeyStroke[] superKeys = super.allKeys(); KeyStroke[] mapKeys = map.getBoundKeyStrokes(); KeyStroke[] bothKeys = new KeyStroke[superKeys.length + mapKeys.length]; for (int i = 0; i < superKeys.length; ++i) bothKeys[i] = superKeys[i]; for (int i = 0; i < mapKeys.length; ++i) bothKeys[i + superKeys.length] = mapKeys[i]; return bothKeys; }
boolean creatingKeymap = false;
public JTextComponent() { Keymap defkeymap = getKeymap(DEFAULT_KEYMAP); boolean creatingKeymap = false; if (defkeymap == null) { defkeymap = addKeymap(DEFAULT_KEYMAP, null); defkeymap.setDefaultAction(new DefaultEditorKit.DefaultKeyTypedAction()); creatingKeymap = true; } setFocusable(true); setEditable(true); enableEvents(AWTEvent.KEY_EVENT_MASK); updateUI(); // need to do this after updateUI() if (creatingKeymap) loadKeymap( defkeymap, new KeyBinding[] { new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0), DefaultEditorKit.backwardAction), new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0), DefaultEditorKit.forwardAction), new KeyBinding(KeyStroke.getKeyStroke("typed \b"), DefaultEditorKit.deletePrevCharAction), new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_X, KeyEvent.CTRL_DOWN_MASK), DefaultEditorKit.cutAction), new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_C, KeyEvent.CTRL_DOWN_MASK), DefaultEditorKit.copyAction), new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_V, KeyEvent.CTRL_DOWN_MASK), DefaultEditorKit.pasteAction), new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, KeyEvent.SHIFT_DOWN_MASK), DefaultEditorKit.selectionBackwardAction), new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, KeyEvent.SHIFT_DOWN_MASK), DefaultEditorKit.selectionForwardAction), new KeyBinding(KeyStroke.getKeyStroke("typed \u007f"), DefaultEditorKit.deleteNextCharAction) }, getActions()); }
creatingKeymap = true;
public JTextComponent() { Keymap defkeymap = getKeymap(DEFAULT_KEYMAP); boolean creatingKeymap = false; if (defkeymap == null) { defkeymap = addKeymap(DEFAULT_KEYMAP, null); defkeymap.setDefaultAction(new DefaultEditorKit.DefaultKeyTypedAction()); creatingKeymap = true; } setFocusable(true); setEditable(true); enableEvents(AWTEvent.KEY_EVENT_MASK); updateUI(); // need to do this after updateUI() if (creatingKeymap) loadKeymap( defkeymap, new KeyBinding[] { new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0), DefaultEditorKit.backwardAction), new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0), DefaultEditorKit.forwardAction), new KeyBinding(KeyStroke.getKeyStroke("typed \b"), DefaultEditorKit.deletePrevCharAction), new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_X, KeyEvent.CTRL_DOWN_MASK), DefaultEditorKit.cutAction), new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_C, KeyEvent.CTRL_DOWN_MASK), DefaultEditorKit.copyAction), new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_V, KeyEvent.CTRL_DOWN_MASK), DefaultEditorKit.pasteAction), new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, KeyEvent.SHIFT_DOWN_MASK), DefaultEditorKit.selectionBackwardAction), new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, KeyEvent.SHIFT_DOWN_MASK), DefaultEditorKit.selectionForwardAction), new KeyBinding(KeyStroke.getKeyStroke("typed \u007f"), DefaultEditorKit.deleteNextCharAction) }, getActions()); }
if (creatingKeymap) loadKeymap( defkeymap, new KeyBinding[] { new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0), DefaultEditorKit.backwardAction), new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0), DefaultEditorKit.forwardAction), new KeyBinding(KeyStroke.getKeyStroke("typed \b"), DefaultEditorKit.deletePrevCharAction), new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_X, KeyEvent.CTRL_DOWN_MASK), DefaultEditorKit.cutAction), new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_C, KeyEvent.CTRL_DOWN_MASK), DefaultEditorKit.copyAction), new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_V, KeyEvent.CTRL_DOWN_MASK), DefaultEditorKit.pasteAction), new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, KeyEvent.SHIFT_DOWN_MASK), DefaultEditorKit.selectionBackwardAction), new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, KeyEvent.SHIFT_DOWN_MASK), DefaultEditorKit.selectionForwardAction), new KeyBinding(KeyStroke.getKeyStroke("typed \u007f"), DefaultEditorKit.deleteNextCharAction) }, getActions());
public JTextComponent() { Keymap defkeymap = getKeymap(DEFAULT_KEYMAP); boolean creatingKeymap = false; if (defkeymap == null) { defkeymap = addKeymap(DEFAULT_KEYMAP, null); defkeymap.setDefaultAction(new DefaultEditorKit.DefaultKeyTypedAction()); creatingKeymap = true; } setFocusable(true); setEditable(true); enableEvents(AWTEvent.KEY_EVENT_MASK); updateUI(); // need to do this after updateUI() if (creatingKeymap) loadKeymap( defkeymap, new KeyBinding[] { new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0), DefaultEditorKit.backwardAction), new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0), DefaultEditorKit.forwardAction), new KeyBinding(KeyStroke.getKeyStroke("typed \b"), DefaultEditorKit.deletePrevCharAction), new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_X, KeyEvent.CTRL_DOWN_MASK), DefaultEditorKit.cutAction), new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_C, KeyEvent.CTRL_DOWN_MASK), DefaultEditorKit.copyAction), new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_V, KeyEvent.CTRL_DOWN_MASK), DefaultEditorKit.pasteAction), new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, KeyEvent.SHIFT_DOWN_MASK), DefaultEditorKit.selectionBackwardAction), new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, KeyEvent.SHIFT_DOWN_MASK), DefaultEditorKit.selectionForwardAction), new KeyBinding(KeyStroke.getKeyStroke("typed \u007f"), DefaultEditorKit.deleteNextCharAction) }, getActions()); }
return "DERValue [ tag=" + tag + ", class=" + tagClass + ", constructed=" + constructed + ", value=" + value + " ]";
String start = "DERValue ( ["; if (tagClass == DER.UNIVERSAL) start = start + "UNIVERSAL "; else if (tagClass == DER.PRIVATE) start = start + "PRIVATE "; else if (tagClass == DER.APPLICATION) start = start + "APPLICATION "; start = start + tag + "] constructed=" + constructed + ", value="; if (constructed) start = start + "\n" + Util.hexDump(getEncoded(), "\t"); else start = start + value; return start + " )";
public String toString() { return "DERValue [ tag=" + tag + ", class=" + tagClass + ", constructed=" + constructed + ", value=" + value + " ]"; }
checkIsConstructed(derPKI, "Wrong PrivateKeyInfo field");
DerUtil.checkIsConstructed(derPKI, "Wrong PrivateKeyInfo field");
public PrivateKey decodePrivateKey(byte[] input) { if (input == null) throw new InvalidParameterException("Input bytes MUST NOT be null"); BigInteger version, n, e, d, p, q, dP, dQ, qInv; DERReader der = new DERReader(input); try { DERValue derPKI = der.read(); checkIsConstructed(derPKI, "Wrong PrivateKeyInfo field"); DERValue derVersion = der.read(); checkIsBigInteger(derVersion, "Wrong Version field"); version = (BigInteger) derVersion.getValue(); if (version.compareTo(BigInteger.ZERO) != 0) throw new InvalidParameterException("Unexpected Version: " + version); DERValue derAlgoritmID = der.read(); checkIsConstructed(derAlgoritmID, "Wrong AlgorithmIdentifier field"); DERValue derOID = der.read(); OID algOID = (OID) derOID.getValue(); if (! algOID.equals(RSA_ALG_OID)) throw new InvalidParameterException("Unexpected OID: " + algOID); DERValue val = der.read(); byte[] pkBytes = (byte[]) val.getValue(); der = new DERReader(pkBytes); DERValue derRSAPrivateKey = der.read(); checkIsConstructed(derRSAPrivateKey, "Wrong RSAPrivateKey field"); val = der.read(); checkIsBigInteger(val, "Wrong RSAPrivateKey Version field"); version = (BigInteger) val.getValue(); if (version.compareTo(BigInteger.ZERO) != 0) throw new InvalidParameterException("Unexpected RSAPrivateKey Version: " + version); val = der.read(); checkIsBigInteger(val, "Wrong modulus field"); n = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong publicExponent field"); e = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong privateExponent field"); d = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong prime1 field"); p = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong prime2 field"); q = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong exponent1 field"); dP = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong exponent2 field"); dQ = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong coefficient field"); qInv = (BigInteger) val.getValue(); } catch (IOException x) { InvalidParameterException y = new InvalidParameterException(); y.initCause(x); throw y; } return new GnuRSAPrivateKey(Registry.PKCS8_ENCODING_ID, n, e, d, p, q, dP, dQ, qInv); }
checkIsBigInteger(derVersion, "Wrong Version field");
DerUtil.checkIsBigInteger(derVersion, "Wrong Version field");
public PrivateKey decodePrivateKey(byte[] input) { if (input == null) throw new InvalidParameterException("Input bytes MUST NOT be null"); BigInteger version, n, e, d, p, q, dP, dQ, qInv; DERReader der = new DERReader(input); try { DERValue derPKI = der.read(); checkIsConstructed(derPKI, "Wrong PrivateKeyInfo field"); DERValue derVersion = der.read(); checkIsBigInteger(derVersion, "Wrong Version field"); version = (BigInteger) derVersion.getValue(); if (version.compareTo(BigInteger.ZERO) != 0) throw new InvalidParameterException("Unexpected Version: " + version); DERValue derAlgoritmID = der.read(); checkIsConstructed(derAlgoritmID, "Wrong AlgorithmIdentifier field"); DERValue derOID = der.read(); OID algOID = (OID) derOID.getValue(); if (! algOID.equals(RSA_ALG_OID)) throw new InvalidParameterException("Unexpected OID: " + algOID); DERValue val = der.read(); byte[] pkBytes = (byte[]) val.getValue(); der = new DERReader(pkBytes); DERValue derRSAPrivateKey = der.read(); checkIsConstructed(derRSAPrivateKey, "Wrong RSAPrivateKey field"); val = der.read(); checkIsBigInteger(val, "Wrong RSAPrivateKey Version field"); version = (BigInteger) val.getValue(); if (version.compareTo(BigInteger.ZERO) != 0) throw new InvalidParameterException("Unexpected RSAPrivateKey Version: " + version); val = der.read(); checkIsBigInteger(val, "Wrong modulus field"); n = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong publicExponent field"); e = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong privateExponent field"); d = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong prime1 field"); p = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong prime2 field"); q = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong exponent1 field"); dP = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong exponent2 field"); dQ = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong coefficient field"); qInv = (BigInteger) val.getValue(); } catch (IOException x) { InvalidParameterException y = new InvalidParameterException(); y.initCause(x); throw y; } return new GnuRSAPrivateKey(Registry.PKCS8_ENCODING_ID, n, e, d, p, q, dP, dQ, qInv); }
checkIsConstructed(derAlgoritmID, "Wrong AlgorithmIdentifier field");
DerUtil.checkIsConstructed(derAlgoritmID, "Wrong AlgorithmIdentifier field");
public PrivateKey decodePrivateKey(byte[] input) { if (input == null) throw new InvalidParameterException("Input bytes MUST NOT be null"); BigInteger version, n, e, d, p, q, dP, dQ, qInv; DERReader der = new DERReader(input); try { DERValue derPKI = der.read(); checkIsConstructed(derPKI, "Wrong PrivateKeyInfo field"); DERValue derVersion = der.read(); checkIsBigInteger(derVersion, "Wrong Version field"); version = (BigInteger) derVersion.getValue(); if (version.compareTo(BigInteger.ZERO) != 0) throw new InvalidParameterException("Unexpected Version: " + version); DERValue derAlgoritmID = der.read(); checkIsConstructed(derAlgoritmID, "Wrong AlgorithmIdentifier field"); DERValue derOID = der.read(); OID algOID = (OID) derOID.getValue(); if (! algOID.equals(RSA_ALG_OID)) throw new InvalidParameterException("Unexpected OID: " + algOID); DERValue val = der.read(); byte[] pkBytes = (byte[]) val.getValue(); der = new DERReader(pkBytes); DERValue derRSAPrivateKey = der.read(); checkIsConstructed(derRSAPrivateKey, "Wrong RSAPrivateKey field"); val = der.read(); checkIsBigInteger(val, "Wrong RSAPrivateKey Version field"); version = (BigInteger) val.getValue(); if (version.compareTo(BigInteger.ZERO) != 0) throw new InvalidParameterException("Unexpected RSAPrivateKey Version: " + version); val = der.read(); checkIsBigInteger(val, "Wrong modulus field"); n = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong publicExponent field"); e = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong privateExponent field"); d = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong prime1 field"); p = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong prime2 field"); q = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong exponent1 field"); dP = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong exponent2 field"); dQ = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong coefficient field"); qInv = (BigInteger) val.getValue(); } catch (IOException x) { InvalidParameterException y = new InvalidParameterException(); y.initCause(x); throw y; } return new GnuRSAPrivateKey(Registry.PKCS8_ENCODING_ID, n, e, d, p, q, dP, dQ, qInv); }
checkIsConstructed(derRSAPrivateKey, "Wrong RSAPrivateKey field");
DerUtil.checkIsConstructed(derRSAPrivateKey, "Wrong RSAPrivateKey field");
public PrivateKey decodePrivateKey(byte[] input) { if (input == null) throw new InvalidParameterException("Input bytes MUST NOT be null"); BigInteger version, n, e, d, p, q, dP, dQ, qInv; DERReader der = new DERReader(input); try { DERValue derPKI = der.read(); checkIsConstructed(derPKI, "Wrong PrivateKeyInfo field"); DERValue derVersion = der.read(); checkIsBigInteger(derVersion, "Wrong Version field"); version = (BigInteger) derVersion.getValue(); if (version.compareTo(BigInteger.ZERO) != 0) throw new InvalidParameterException("Unexpected Version: " + version); DERValue derAlgoritmID = der.read(); checkIsConstructed(derAlgoritmID, "Wrong AlgorithmIdentifier field"); DERValue derOID = der.read(); OID algOID = (OID) derOID.getValue(); if (! algOID.equals(RSA_ALG_OID)) throw new InvalidParameterException("Unexpected OID: " + algOID); DERValue val = der.read(); byte[] pkBytes = (byte[]) val.getValue(); der = new DERReader(pkBytes); DERValue derRSAPrivateKey = der.read(); checkIsConstructed(derRSAPrivateKey, "Wrong RSAPrivateKey field"); val = der.read(); checkIsBigInteger(val, "Wrong RSAPrivateKey Version field"); version = (BigInteger) val.getValue(); if (version.compareTo(BigInteger.ZERO) != 0) throw new InvalidParameterException("Unexpected RSAPrivateKey Version: " + version); val = der.read(); checkIsBigInteger(val, "Wrong modulus field"); n = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong publicExponent field"); e = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong privateExponent field"); d = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong prime1 field"); p = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong prime2 field"); q = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong exponent1 field"); dP = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong exponent2 field"); dQ = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong coefficient field"); qInv = (BigInteger) val.getValue(); } catch (IOException x) { InvalidParameterException y = new InvalidParameterException(); y.initCause(x); throw y; } return new GnuRSAPrivateKey(Registry.PKCS8_ENCODING_ID, n, e, d, p, q, dP, dQ, qInv); }
checkIsBigInteger(val, "Wrong RSAPrivateKey Version field");
DerUtil.checkIsBigInteger(val, "Wrong RSAPrivateKey Version field");
public PrivateKey decodePrivateKey(byte[] input) { if (input == null) throw new InvalidParameterException("Input bytes MUST NOT be null"); BigInteger version, n, e, d, p, q, dP, dQ, qInv; DERReader der = new DERReader(input); try { DERValue derPKI = der.read(); checkIsConstructed(derPKI, "Wrong PrivateKeyInfo field"); DERValue derVersion = der.read(); checkIsBigInteger(derVersion, "Wrong Version field"); version = (BigInteger) derVersion.getValue(); if (version.compareTo(BigInteger.ZERO) != 0) throw new InvalidParameterException("Unexpected Version: " + version); DERValue derAlgoritmID = der.read(); checkIsConstructed(derAlgoritmID, "Wrong AlgorithmIdentifier field"); DERValue derOID = der.read(); OID algOID = (OID) derOID.getValue(); if (! algOID.equals(RSA_ALG_OID)) throw new InvalidParameterException("Unexpected OID: " + algOID); DERValue val = der.read(); byte[] pkBytes = (byte[]) val.getValue(); der = new DERReader(pkBytes); DERValue derRSAPrivateKey = der.read(); checkIsConstructed(derRSAPrivateKey, "Wrong RSAPrivateKey field"); val = der.read(); checkIsBigInteger(val, "Wrong RSAPrivateKey Version field"); version = (BigInteger) val.getValue(); if (version.compareTo(BigInteger.ZERO) != 0) throw new InvalidParameterException("Unexpected RSAPrivateKey Version: " + version); val = der.read(); checkIsBigInteger(val, "Wrong modulus field"); n = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong publicExponent field"); e = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong privateExponent field"); d = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong prime1 field"); p = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong prime2 field"); q = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong exponent1 field"); dP = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong exponent2 field"); dQ = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong coefficient field"); qInv = (BigInteger) val.getValue(); } catch (IOException x) { InvalidParameterException y = new InvalidParameterException(); y.initCause(x); throw y; } return new GnuRSAPrivateKey(Registry.PKCS8_ENCODING_ID, n, e, d, p, q, dP, dQ, qInv); }
checkIsBigInteger(val, "Wrong modulus field");
DerUtil.checkIsBigInteger(val, "Wrong modulus field");
public PrivateKey decodePrivateKey(byte[] input) { if (input == null) throw new InvalidParameterException("Input bytes MUST NOT be null"); BigInteger version, n, e, d, p, q, dP, dQ, qInv; DERReader der = new DERReader(input); try { DERValue derPKI = der.read(); checkIsConstructed(derPKI, "Wrong PrivateKeyInfo field"); DERValue derVersion = der.read(); checkIsBigInteger(derVersion, "Wrong Version field"); version = (BigInteger) derVersion.getValue(); if (version.compareTo(BigInteger.ZERO) != 0) throw new InvalidParameterException("Unexpected Version: " + version); DERValue derAlgoritmID = der.read(); checkIsConstructed(derAlgoritmID, "Wrong AlgorithmIdentifier field"); DERValue derOID = der.read(); OID algOID = (OID) derOID.getValue(); if (! algOID.equals(RSA_ALG_OID)) throw new InvalidParameterException("Unexpected OID: " + algOID); DERValue val = der.read(); byte[] pkBytes = (byte[]) val.getValue(); der = new DERReader(pkBytes); DERValue derRSAPrivateKey = der.read(); checkIsConstructed(derRSAPrivateKey, "Wrong RSAPrivateKey field"); val = der.read(); checkIsBigInteger(val, "Wrong RSAPrivateKey Version field"); version = (BigInteger) val.getValue(); if (version.compareTo(BigInteger.ZERO) != 0) throw new InvalidParameterException("Unexpected RSAPrivateKey Version: " + version); val = der.read(); checkIsBigInteger(val, "Wrong modulus field"); n = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong publicExponent field"); e = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong privateExponent field"); d = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong prime1 field"); p = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong prime2 field"); q = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong exponent1 field"); dP = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong exponent2 field"); dQ = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong coefficient field"); qInv = (BigInteger) val.getValue(); } catch (IOException x) { InvalidParameterException y = new InvalidParameterException(); y.initCause(x); throw y; } return new GnuRSAPrivateKey(Registry.PKCS8_ENCODING_ID, n, e, d, p, q, dP, dQ, qInv); }
checkIsBigInteger(val, "Wrong publicExponent field");
DerUtil.checkIsBigInteger(val, "Wrong publicExponent field");
public PrivateKey decodePrivateKey(byte[] input) { if (input == null) throw new InvalidParameterException("Input bytes MUST NOT be null"); BigInteger version, n, e, d, p, q, dP, dQ, qInv; DERReader der = new DERReader(input); try { DERValue derPKI = der.read(); checkIsConstructed(derPKI, "Wrong PrivateKeyInfo field"); DERValue derVersion = der.read(); checkIsBigInteger(derVersion, "Wrong Version field"); version = (BigInteger) derVersion.getValue(); if (version.compareTo(BigInteger.ZERO) != 0) throw new InvalidParameterException("Unexpected Version: " + version); DERValue derAlgoritmID = der.read(); checkIsConstructed(derAlgoritmID, "Wrong AlgorithmIdentifier field"); DERValue derOID = der.read(); OID algOID = (OID) derOID.getValue(); if (! algOID.equals(RSA_ALG_OID)) throw new InvalidParameterException("Unexpected OID: " + algOID); DERValue val = der.read(); byte[] pkBytes = (byte[]) val.getValue(); der = new DERReader(pkBytes); DERValue derRSAPrivateKey = der.read(); checkIsConstructed(derRSAPrivateKey, "Wrong RSAPrivateKey field"); val = der.read(); checkIsBigInteger(val, "Wrong RSAPrivateKey Version field"); version = (BigInteger) val.getValue(); if (version.compareTo(BigInteger.ZERO) != 0) throw new InvalidParameterException("Unexpected RSAPrivateKey Version: " + version); val = der.read(); checkIsBigInteger(val, "Wrong modulus field"); n = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong publicExponent field"); e = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong privateExponent field"); d = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong prime1 field"); p = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong prime2 field"); q = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong exponent1 field"); dP = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong exponent2 field"); dQ = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong coefficient field"); qInv = (BigInteger) val.getValue(); } catch (IOException x) { InvalidParameterException y = new InvalidParameterException(); y.initCause(x); throw y; } return new GnuRSAPrivateKey(Registry.PKCS8_ENCODING_ID, n, e, d, p, q, dP, dQ, qInv); }
checkIsBigInteger(val, "Wrong privateExponent field");
DerUtil.checkIsBigInteger(val, "Wrong privateExponent field");
public PrivateKey decodePrivateKey(byte[] input) { if (input == null) throw new InvalidParameterException("Input bytes MUST NOT be null"); BigInteger version, n, e, d, p, q, dP, dQ, qInv; DERReader der = new DERReader(input); try { DERValue derPKI = der.read(); checkIsConstructed(derPKI, "Wrong PrivateKeyInfo field"); DERValue derVersion = der.read(); checkIsBigInteger(derVersion, "Wrong Version field"); version = (BigInteger) derVersion.getValue(); if (version.compareTo(BigInteger.ZERO) != 0) throw new InvalidParameterException("Unexpected Version: " + version); DERValue derAlgoritmID = der.read(); checkIsConstructed(derAlgoritmID, "Wrong AlgorithmIdentifier field"); DERValue derOID = der.read(); OID algOID = (OID) derOID.getValue(); if (! algOID.equals(RSA_ALG_OID)) throw new InvalidParameterException("Unexpected OID: " + algOID); DERValue val = der.read(); byte[] pkBytes = (byte[]) val.getValue(); der = new DERReader(pkBytes); DERValue derRSAPrivateKey = der.read(); checkIsConstructed(derRSAPrivateKey, "Wrong RSAPrivateKey field"); val = der.read(); checkIsBigInteger(val, "Wrong RSAPrivateKey Version field"); version = (BigInteger) val.getValue(); if (version.compareTo(BigInteger.ZERO) != 0) throw new InvalidParameterException("Unexpected RSAPrivateKey Version: " + version); val = der.read(); checkIsBigInteger(val, "Wrong modulus field"); n = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong publicExponent field"); e = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong privateExponent field"); d = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong prime1 field"); p = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong prime2 field"); q = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong exponent1 field"); dP = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong exponent2 field"); dQ = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong coefficient field"); qInv = (BigInteger) val.getValue(); } catch (IOException x) { InvalidParameterException y = new InvalidParameterException(); y.initCause(x); throw y; } return new GnuRSAPrivateKey(Registry.PKCS8_ENCODING_ID, n, e, d, p, q, dP, dQ, qInv); }
checkIsBigInteger(val, "Wrong prime1 field");
DerUtil.checkIsBigInteger(val, "Wrong prime1 field");
public PrivateKey decodePrivateKey(byte[] input) { if (input == null) throw new InvalidParameterException("Input bytes MUST NOT be null"); BigInteger version, n, e, d, p, q, dP, dQ, qInv; DERReader der = new DERReader(input); try { DERValue derPKI = der.read(); checkIsConstructed(derPKI, "Wrong PrivateKeyInfo field"); DERValue derVersion = der.read(); checkIsBigInteger(derVersion, "Wrong Version field"); version = (BigInteger) derVersion.getValue(); if (version.compareTo(BigInteger.ZERO) != 0) throw new InvalidParameterException("Unexpected Version: " + version); DERValue derAlgoritmID = der.read(); checkIsConstructed(derAlgoritmID, "Wrong AlgorithmIdentifier field"); DERValue derOID = der.read(); OID algOID = (OID) derOID.getValue(); if (! algOID.equals(RSA_ALG_OID)) throw new InvalidParameterException("Unexpected OID: " + algOID); DERValue val = der.read(); byte[] pkBytes = (byte[]) val.getValue(); der = new DERReader(pkBytes); DERValue derRSAPrivateKey = der.read(); checkIsConstructed(derRSAPrivateKey, "Wrong RSAPrivateKey field"); val = der.read(); checkIsBigInteger(val, "Wrong RSAPrivateKey Version field"); version = (BigInteger) val.getValue(); if (version.compareTo(BigInteger.ZERO) != 0) throw new InvalidParameterException("Unexpected RSAPrivateKey Version: " + version); val = der.read(); checkIsBigInteger(val, "Wrong modulus field"); n = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong publicExponent field"); e = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong privateExponent field"); d = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong prime1 field"); p = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong prime2 field"); q = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong exponent1 field"); dP = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong exponent2 field"); dQ = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong coefficient field"); qInv = (BigInteger) val.getValue(); } catch (IOException x) { InvalidParameterException y = new InvalidParameterException(); y.initCause(x); throw y; } return new GnuRSAPrivateKey(Registry.PKCS8_ENCODING_ID, n, e, d, p, q, dP, dQ, qInv); }
checkIsBigInteger(val, "Wrong prime2 field");
DerUtil.checkIsBigInteger(val, "Wrong prime2 field");
public PrivateKey decodePrivateKey(byte[] input) { if (input == null) throw new InvalidParameterException("Input bytes MUST NOT be null"); BigInteger version, n, e, d, p, q, dP, dQ, qInv; DERReader der = new DERReader(input); try { DERValue derPKI = der.read(); checkIsConstructed(derPKI, "Wrong PrivateKeyInfo field"); DERValue derVersion = der.read(); checkIsBigInteger(derVersion, "Wrong Version field"); version = (BigInteger) derVersion.getValue(); if (version.compareTo(BigInteger.ZERO) != 0) throw new InvalidParameterException("Unexpected Version: " + version); DERValue derAlgoritmID = der.read(); checkIsConstructed(derAlgoritmID, "Wrong AlgorithmIdentifier field"); DERValue derOID = der.read(); OID algOID = (OID) derOID.getValue(); if (! algOID.equals(RSA_ALG_OID)) throw new InvalidParameterException("Unexpected OID: " + algOID); DERValue val = der.read(); byte[] pkBytes = (byte[]) val.getValue(); der = new DERReader(pkBytes); DERValue derRSAPrivateKey = der.read(); checkIsConstructed(derRSAPrivateKey, "Wrong RSAPrivateKey field"); val = der.read(); checkIsBigInteger(val, "Wrong RSAPrivateKey Version field"); version = (BigInteger) val.getValue(); if (version.compareTo(BigInteger.ZERO) != 0) throw new InvalidParameterException("Unexpected RSAPrivateKey Version: " + version); val = der.read(); checkIsBigInteger(val, "Wrong modulus field"); n = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong publicExponent field"); e = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong privateExponent field"); d = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong prime1 field"); p = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong prime2 field"); q = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong exponent1 field"); dP = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong exponent2 field"); dQ = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong coefficient field"); qInv = (BigInteger) val.getValue(); } catch (IOException x) { InvalidParameterException y = new InvalidParameterException(); y.initCause(x); throw y; } return new GnuRSAPrivateKey(Registry.PKCS8_ENCODING_ID, n, e, d, p, q, dP, dQ, qInv); }
checkIsBigInteger(val, "Wrong exponent1 field");
DerUtil.checkIsBigInteger(val, "Wrong exponent1 field");
public PrivateKey decodePrivateKey(byte[] input) { if (input == null) throw new InvalidParameterException("Input bytes MUST NOT be null"); BigInteger version, n, e, d, p, q, dP, dQ, qInv; DERReader der = new DERReader(input); try { DERValue derPKI = der.read(); checkIsConstructed(derPKI, "Wrong PrivateKeyInfo field"); DERValue derVersion = der.read(); checkIsBigInteger(derVersion, "Wrong Version field"); version = (BigInteger) derVersion.getValue(); if (version.compareTo(BigInteger.ZERO) != 0) throw new InvalidParameterException("Unexpected Version: " + version); DERValue derAlgoritmID = der.read(); checkIsConstructed(derAlgoritmID, "Wrong AlgorithmIdentifier field"); DERValue derOID = der.read(); OID algOID = (OID) derOID.getValue(); if (! algOID.equals(RSA_ALG_OID)) throw new InvalidParameterException("Unexpected OID: " + algOID); DERValue val = der.read(); byte[] pkBytes = (byte[]) val.getValue(); der = new DERReader(pkBytes); DERValue derRSAPrivateKey = der.read(); checkIsConstructed(derRSAPrivateKey, "Wrong RSAPrivateKey field"); val = der.read(); checkIsBigInteger(val, "Wrong RSAPrivateKey Version field"); version = (BigInteger) val.getValue(); if (version.compareTo(BigInteger.ZERO) != 0) throw new InvalidParameterException("Unexpected RSAPrivateKey Version: " + version); val = der.read(); checkIsBigInteger(val, "Wrong modulus field"); n = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong publicExponent field"); e = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong privateExponent field"); d = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong prime1 field"); p = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong prime2 field"); q = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong exponent1 field"); dP = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong exponent2 field"); dQ = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong coefficient field"); qInv = (BigInteger) val.getValue(); } catch (IOException x) { InvalidParameterException y = new InvalidParameterException(); y.initCause(x); throw y; } return new GnuRSAPrivateKey(Registry.PKCS8_ENCODING_ID, n, e, d, p, q, dP, dQ, qInv); }
checkIsBigInteger(val, "Wrong exponent2 field");
DerUtil.checkIsBigInteger(val, "Wrong exponent2 field");
public PrivateKey decodePrivateKey(byte[] input) { if (input == null) throw new InvalidParameterException("Input bytes MUST NOT be null"); BigInteger version, n, e, d, p, q, dP, dQ, qInv; DERReader der = new DERReader(input); try { DERValue derPKI = der.read(); checkIsConstructed(derPKI, "Wrong PrivateKeyInfo field"); DERValue derVersion = der.read(); checkIsBigInteger(derVersion, "Wrong Version field"); version = (BigInteger) derVersion.getValue(); if (version.compareTo(BigInteger.ZERO) != 0) throw new InvalidParameterException("Unexpected Version: " + version); DERValue derAlgoritmID = der.read(); checkIsConstructed(derAlgoritmID, "Wrong AlgorithmIdentifier field"); DERValue derOID = der.read(); OID algOID = (OID) derOID.getValue(); if (! algOID.equals(RSA_ALG_OID)) throw new InvalidParameterException("Unexpected OID: " + algOID); DERValue val = der.read(); byte[] pkBytes = (byte[]) val.getValue(); der = new DERReader(pkBytes); DERValue derRSAPrivateKey = der.read(); checkIsConstructed(derRSAPrivateKey, "Wrong RSAPrivateKey field"); val = der.read(); checkIsBigInteger(val, "Wrong RSAPrivateKey Version field"); version = (BigInteger) val.getValue(); if (version.compareTo(BigInteger.ZERO) != 0) throw new InvalidParameterException("Unexpected RSAPrivateKey Version: " + version); val = der.read(); checkIsBigInteger(val, "Wrong modulus field"); n = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong publicExponent field"); e = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong privateExponent field"); d = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong prime1 field"); p = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong prime2 field"); q = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong exponent1 field"); dP = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong exponent2 field"); dQ = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong coefficient field"); qInv = (BigInteger) val.getValue(); } catch (IOException x) { InvalidParameterException y = new InvalidParameterException(); y.initCause(x); throw y; } return new GnuRSAPrivateKey(Registry.PKCS8_ENCODING_ID, n, e, d, p, q, dP, dQ, qInv); }
checkIsBigInteger(val, "Wrong coefficient field");
DerUtil.checkIsBigInteger(val, "Wrong coefficient field");
public PrivateKey decodePrivateKey(byte[] input) { if (input == null) throw new InvalidParameterException("Input bytes MUST NOT be null"); BigInteger version, n, e, d, p, q, dP, dQ, qInv; DERReader der = new DERReader(input); try { DERValue derPKI = der.read(); checkIsConstructed(derPKI, "Wrong PrivateKeyInfo field"); DERValue derVersion = der.read(); checkIsBigInteger(derVersion, "Wrong Version field"); version = (BigInteger) derVersion.getValue(); if (version.compareTo(BigInteger.ZERO) != 0) throw new InvalidParameterException("Unexpected Version: " + version); DERValue derAlgoritmID = der.read(); checkIsConstructed(derAlgoritmID, "Wrong AlgorithmIdentifier field"); DERValue derOID = der.read(); OID algOID = (OID) derOID.getValue(); if (! algOID.equals(RSA_ALG_OID)) throw new InvalidParameterException("Unexpected OID: " + algOID); DERValue val = der.read(); byte[] pkBytes = (byte[]) val.getValue(); der = new DERReader(pkBytes); DERValue derRSAPrivateKey = der.read(); checkIsConstructed(derRSAPrivateKey, "Wrong RSAPrivateKey field"); val = der.read(); checkIsBigInteger(val, "Wrong RSAPrivateKey Version field"); version = (BigInteger) val.getValue(); if (version.compareTo(BigInteger.ZERO) != 0) throw new InvalidParameterException("Unexpected RSAPrivateKey Version: " + version); val = der.read(); checkIsBigInteger(val, "Wrong modulus field"); n = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong publicExponent field"); e = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong privateExponent field"); d = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong prime1 field"); p = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong prime2 field"); q = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong exponent1 field"); dP = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong exponent2 field"); dQ = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong coefficient field"); qInv = (BigInteger) val.getValue(); } catch (IOException x) { InvalidParameterException y = new InvalidParameterException(); y.initCause(x); throw y; } return new GnuRSAPrivateKey(Registry.PKCS8_ENCODING_ID, n, e, d, p, q, dP, dQ, qInv); }
final VmNormalClass< ? > normalClass = (VmNormalClass) objectClass;
final VmNormalClass< ? > normalClass = (VmNormalClass<?>) objectClass;
public final Object clone(Cloneable object) { testInited(); final VmClassType< ? > objectClass = VmMagic.getObjectType(object); final Address objectPtr = ObjectReference.fromObject(object) .toAddress(); final int size; if (objectClass.isArray()) { final int slotSize = Unsafe.getCurrentProcessor().getArchitecture() .getReferenceSize(); final VmArrayClass< ? > arrayClass = (VmArrayClass< ? >) objectClass; final int length = objectPtr.loadInt(Offset .fromIntSignExtend(VmArray.LENGTH_OFFSET * slotSize)); final int elemSize = arrayClass.getComponentType().getTypeSize(); size = (VmArray.DATA_OFFSET * slotSize) * (length * elemSize); } else { final VmNormalClass< ? > normalClass = (VmNormalClass) objectClass; size = normalClass.getObjectSize(); } final Object newObj = allocObject(objectClass, size); helper.copy(objectPtr, ObjectReference.fromObject(newObj).toAddress(), Extent.fromIntZeroExtend(size)); return newObj; }
cls.initialize();
public final Object newInstance(VmType< ? > cls) { // cls.link(); cls.initialize(); return newInstance(cls, ((VmNormalClass< ? >) cls).getObjectSize()); }
public NegativeArraySizeException(String s) { super(s);
public NegativeArraySizeException() {
public NegativeArraySizeException(String s) { super(s); }
public OutOfMemoryError() { super();
public OutOfMemoryError() {
public OutOfMemoryError() { super(); }
public HostArgument(String name, String description) { super(name, description);
public HostArgument(String name, String description, boolean multi) { super(name, description, multi);
public HostArgument(String name, String description) { super(name, description); }
editor.setBorder(new EmptyBorder(1, 1, 1, 1));
editor.setBorder(null); editor.setColumns(9);
public BasicComboBoxEditor() { editor = new JTextField(); editor.setBorder(new EmptyBorder(1, 1, 1, 1)); }
Window w = base.getAWTComponent(); if(w instanceof Frame){ MenuBar mb = ((Frame)w).getMenuBar(); if(mb != null){ JMenuBar jmb = ((SwingMenuBarPeer)mb.getPeer()).jComponent; Point p = new Point(x,y); SwingUtilities.convertPointFromScreen(p, jmb); comp = SwingUtilities.getDeepestComponentAt(jmb, p.x, p.y); if(comp != null && (comp != jmb || comp == jmb && jmb.contains(p.x,p.y))){ return comp;
if(base.isShowing()){ Window w = base.getAWTComponent(); if(w instanceof Frame){ MenuBar mb = ((Frame)w).getMenuBar(); if(mb != null){ JMenuBar jmb = ((SwingMenuBarPeer)mb.getPeer()).jComponent; Point p = new Point(x,y); SwingUtilities.convertPointFromScreen(p, jmb); comp = SwingUtilities.getDeepestComponentAt(jmb, p.x, p.y); if(comp != null && (comp != jmb || comp == jmb && jmb.contains(p.x,p.y))){ return comp; }
public Component getTopComponentAt(int x, int y) { if(desktopFrame == null){ //no AWT yet, drop the event return null; } Component comp = desktopFrame.getDesktop().getComponentAt(x,y); if(comp instanceof SwingBaseWindow){ SwingBaseWindow base = (SwingBaseWindow) comp; Window w = base.getAWTComponent(); if(w instanceof Frame){ MenuBar mb = ((Frame)w).getMenuBar(); if(mb != null){ JMenuBar jmb = ((SwingMenuBarPeer)mb.getPeer()).jComponent; Point p = new Point(x,y); SwingUtilities.convertPointFromScreen(p, jmb); comp = SwingUtilities.getDeepestComponentAt(jmb, p.x, p.y); if(comp != null && (comp != jmb || comp == jmb && jmb.contains(p.x,p.y))){ return comp; } } } Point p = new Point(x,y); SwingUtilities.convertPointFromScreen(p, w); comp = SwingUtilities.getDeepestComponentAt(w, p.x, p.y); if(comp == w){ p = new Point(x,y); SwingUtilities.convertPointFromScreen(p, base); comp = SwingUtilities.getDeepestComponentAt(base, p.x, p.y); } } else { comp = super.getTopComponentAt(x, y); SwingFrame sfp = (SwingFrame) SwingUtilities.getAncestorOfClass( SwingFrame.class, comp); if (sfp != null) { Rectangle r = sfp.getBounds(); Insets ins = sfp.getSwingPeer().getInsets(); r.x = r.x + ins.left; r.y = r.y + ins.top; r.width = r.width - ins.left - ins.right; r.height = r.height - ins.top - ins.bottom; if (r.contains(x, y)) { Component c = sfp.getAWTComponent().findComponentAt(x, y); if (c != null) { comp = c; } } } } return comp; }
} Point p = new Point(x,y); SwingUtilities.convertPointFromScreen(p, w); comp = SwingUtilities.getDeepestComponentAt(w, p.x, p.y); if(comp == w){ p = new Point(x,y); SwingUtilities.convertPointFromScreen(p, base); comp = SwingUtilities.getDeepestComponentAt(base, p.x, p.y);
Point p = new Point(x,y); SwingUtilities.convertPointFromScreen(p, w); comp = SwingUtilities.getDeepestComponentAt(w, p.x, p.y); if(comp == w){ p = new Point(x,y); SwingUtilities.convertPointFromScreen(p, base); comp = SwingUtilities.getDeepestComponentAt(base, p.x, p.y); }
public Component getTopComponentAt(int x, int y) { if(desktopFrame == null){ //no AWT yet, drop the event return null; } Component comp = desktopFrame.getDesktop().getComponentAt(x,y); if(comp instanceof SwingBaseWindow){ SwingBaseWindow base = (SwingBaseWindow) comp; Window w = base.getAWTComponent(); if(w instanceof Frame){ MenuBar mb = ((Frame)w).getMenuBar(); if(mb != null){ JMenuBar jmb = ((SwingMenuBarPeer)mb.getPeer()).jComponent; Point p = new Point(x,y); SwingUtilities.convertPointFromScreen(p, jmb); comp = SwingUtilities.getDeepestComponentAt(jmb, p.x, p.y); if(comp != null && (comp != jmb || comp == jmb && jmb.contains(p.x,p.y))){ return comp; } } } Point p = new Point(x,y); SwingUtilities.convertPointFromScreen(p, w); comp = SwingUtilities.getDeepestComponentAt(w, p.x, p.y); if(comp == w){ p = new Point(x,y); SwingUtilities.convertPointFromScreen(p, base); comp = SwingUtilities.getDeepestComponentAt(base, p.x, p.y); } } else { comp = super.getTopComponentAt(x, y); SwingFrame sfp = (SwingFrame) SwingUtilities.getAncestorOfClass( SwingFrame.class, comp); if (sfp != null) { Rectangle r = sfp.getBounds(); Insets ins = sfp.getSwingPeer().getInsets(); r.x = r.x + ins.left; r.y = r.y + ins.top; r.width = r.width - ins.left - ins.right; r.height = r.height - ins.top - ins.bottom; if (r.contains(x, y)) { Component c = sfp.getAWTComponent().findComponentAt(x, y); if (c != null) { comp = c; } } } } return comp; }
double tx = (x - getCenterX()) / rx; double ty = (y - getCenterY()) / ry; return tx * tx + ty * ty <= 1.0;
double tx = (x - (getX() + rx)) / rx; double ty = (y - (getY() + ry)) / ry; return tx * tx + ty * ty < 1.0;
public boolean contains(double x, double y) { double rx = getWidth() / 2; double ry = getHeight() / 2; double tx = (x - getCenterX()) / rx; double ty = (y - getCenterY()) / ry; return tx * tx + ty * ty <= 1.0; }
Rectangle2D r = new Rectangle2D.Double(x, y, w, h); if (! r.intersects(getX(), getY(), getWidth(), getHeight())) return false; if (contains(x, y) || contains(x, y + h) || contains(x + w, y) || contains(x + w, y + h)) return true; Line2D l1 = new Line2D.Double(getX(), getY() + (getHeight() / 2), getX() + getWidth(), getY() + (getHeight() / 2)); Line2D l2 = new Line2D.Double(getX() + (getWidth() / 2), getY(), getX() + (getWidth() / 2), getY() + getHeight()); if (l1.intersects(r) || l2.intersects(r)) return true;
public boolean intersects(double x, double y, double w, double h) { // fixme return false; }
dragging = true;
public void mouseDragged(MouseEvent e) { if (slider.isEnabled()) { currentMouseX = e.getX(); currentMouseY = e.getY(); if (slider.getValueIsAdjusting()) { int value; if (slider.getOrientation() == JSlider.HORIZONTAL) value = valueForXPosition(currentMouseX) - offset; else value = valueForYPosition(currentMouseY) - offset; slider.setValue(value); } } }
dragging = false;
public void mouseReleased(MouseEvent e) { if (slider.isEnabled()) { currentMouseX = e.getX(); currentMouseY = e.getY(); if (slider.getValueIsAdjusting()) { slider.setValueIsAdjusting(false); if (slider.getSnapToTicks()) slider.setValue(findClosestTick(slider.getValue())); } if (scrollTimer != null) scrollTimer.stop(); } }
return (value > slider.getValue());
return value > slider.getValue();
public boolean shouldScroll(int direction) { int value; if (slider.getOrientation() == JSlider.HORIZONTAL) value = valueForXPosition(currentMouseX); else value = valueForYPosition(currentMouseY); if (direction == POSITIVE_SCROLL) return (value > slider.getValue()); else return (value < slider.getValue()); }
return (value < slider.getValue());
return value < slider.getValue();
public boolean shouldScroll(int direction) { int value; if (slider.getOrientation() == JSlider.HORIZONTAL) value = valueForXPosition(currentMouseX); else value = valueForYPosition(currentMouseY); if (direction == POSITIVE_SCROLL) return (value > slider.getValue()); else return (value < slider.getValue()); }
labelRect.y = tickRect.y + tickRect.height;
labelRect.y = tickRect.y + tickRect.height - 1;
protected void calculateLabelRect() { if (slider.getOrientation() == JSlider.HORIZONTAL) { labelRect.x = contentRect.x; labelRect.y = tickRect.y + tickRect.height; labelRect.width = contentRect.width; labelRect.height = getHeightOfTallestLabel(); } else { labelRect.x = tickRect.x + tickRect.width; labelRect.y = contentRect.y; labelRect.width = getWidthOfWidestLabel(); labelRect.height = contentRect.height; } }
labelRect.x = tickRect.x + tickRect.width;
if (slider.getPaintLabels()) { labelRect.x = tickRect.x + tickRect.width - 1;
protected void calculateLabelRect() { if (slider.getOrientation() == JSlider.HORIZONTAL) { labelRect.x = contentRect.x; labelRect.y = tickRect.y + tickRect.height; labelRect.width = contentRect.width; labelRect.height = getHeightOfTallestLabel(); } else { labelRect.x = tickRect.x + tickRect.width; labelRect.y = contentRect.y; labelRect.width = getWidthOfWidestLabel(); labelRect.height = contentRect.height; } }
labelRect.width = getWidthOfWidestLabel();
protected void calculateLabelRect() { if (slider.getOrientation() == JSlider.HORIZONTAL) { labelRect.x = contentRect.x; labelRect.y = tickRect.y + tickRect.height; labelRect.width = contentRect.width; labelRect.height = getHeightOfTallestLabel(); } else { labelRect.x = tickRect.x + tickRect.width; labelRect.y = contentRect.y; labelRect.width = getWidthOfWidestLabel(); labelRect.height = contentRect.height; } }
else { labelRect.x = tickRect.x + tickRect.width; labelRect.y = trackRect.y; labelRect.height = trackRect.height; } labelRect.width = getWidthOfWidestLabel(); }
protected void calculateLabelRect() { if (slider.getOrientation() == JSlider.HORIZONTAL) { labelRect.x = contentRect.x; labelRect.y = tickRect.y + tickRect.height; labelRect.width = contentRect.width; labelRect.height = getHeightOfTallestLabel(); } else { labelRect.x = tickRect.x + tickRect.width; labelRect.y = contentRect.y; labelRect.width = getWidthOfWidestLabel(); labelRect.height = contentRect.height; } }
thumbRect.y = trackRect.y;
thumbRect.y = trackRect.y + 1;
protected void calculateThumbLocation() { int value = slider.getValue(); if (slider.getOrientation() == JSlider.HORIZONTAL) { thumbRect.x = xPositionForValue(value) - thumbRect.width / 2; thumbRect.y = trackRect.y; } else { thumbRect.x = trackRect.x; thumbRect.y = yPositionForValue(value) - thumbRect.height / 2; } }
thumbRect.x = trackRect.x;
thumbRect.x = trackRect.x + 1;
protected void calculateThumbLocation() { int value = slider.getValue(); if (slider.getOrientation() == JSlider.HORIZONTAL) { thumbRect.x = xPositionForValue(value) - thumbRect.width / 2; thumbRect.y = trackRect.y; } else { thumbRect.x = trackRect.x; thumbRect.y = yPositionForValue(value) - thumbRect.height / 2; } }
if (slider.getOrientation() == JSlider.HORIZONTAL) thumbRect.y = trackRect.y; else thumbRect.x = trackRect.x;
protected void calculateThumbSize() { Dimension d = getThumbSize(); thumbRect.width = d.width; thumbRect.height = d.height; if (slider.getOrientation() == JSlider.HORIZONTAL) thumbRect.y = trackRect.y; else thumbRect.x = trackRect.x; }
tickRect.height = (slider.getPaintTicks() ? getTickLength() : 0);
tickRect.height = slider.getPaintTicks() ? getTickLength() : 0; if (!slider.getPaintTicks()) tickRect.y--;
protected void calculateTickRect() { if (slider.getOrientation() == JSlider.HORIZONTAL) { tickRect.x = trackRect.x; tickRect.y = trackRect.y + trackRect.height; tickRect.width = trackRect.width; tickRect.height = (slider.getPaintTicks() ? getTickLength() : 0); if (tickRect.y + tickRect.height > contentRect.y + contentRect.height) tickRect.height = contentRect.y + contentRect.height - tickRect.y; } else { tickRect.x = trackRect.x + trackRect.width; tickRect.y = trackRect.y; tickRect.width = (slider.getPaintTicks() ? getTickLength() : 0); tickRect.height = trackRect.height; if (tickRect.x + tickRect.width > contentRect.x + contentRect.width) tickRect.width = contentRect.x + contentRect.width - tickRect.x; } }
tickRect.width = (slider.getPaintTicks() ? getTickLength() : 0);
tickRect.width = slider.getPaintTicks() ? getTickLength() : 0;
protected void calculateTickRect() { if (slider.getOrientation() == JSlider.HORIZONTAL) { tickRect.x = trackRect.x; tickRect.y = trackRect.y + trackRect.height; tickRect.width = trackRect.width; tickRect.height = (slider.getPaintTicks() ? getTickLength() : 0); if (tickRect.y + tickRect.height > contentRect.y + contentRect.height) tickRect.height = contentRect.y + contentRect.height - tickRect.y; } else { tickRect.x = trackRect.x + trackRect.width; tickRect.y = trackRect.y; tickRect.width = (slider.getPaintTicks() ? getTickLength() : 0); tickRect.height = trackRect.height; if (tickRect.x + tickRect.width > contentRect.x + contentRect.width) tickRect.width = contentRect.x + contentRect.width - tickRect.x; } }
if (!slider.getPaintTicks()) tickRect.x--;
protected void calculateTickRect() { if (slider.getOrientation() == JSlider.HORIZONTAL) { tickRect.x = trackRect.x; tickRect.y = trackRect.y + trackRect.height; tickRect.width = trackRect.width; tickRect.height = (slider.getPaintTicks() ? getTickLength() : 0); if (tickRect.y + tickRect.height > contentRect.y + contentRect.height) tickRect.height = contentRect.y + contentRect.height - tickRect.y; } else { tickRect.x = trackRect.x + trackRect.width; tickRect.y = trackRect.y; tickRect.width = (slider.getPaintTicks() ? getTickLength() : 0); tickRect.height = trackRect.height; if (tickRect.x + tickRect.width > contentRect.x + contentRect.width) tickRect.width = contentRect.x + contentRect.width - tickRect.x; } }
Point a = new Point(trackRect.x, trackRect.y);
Point a = new Point(trackRect.x, trackRect.y + 1);
public void paintTrack(Graphics g) { Color saved_color = g.getColor(); int width; int height; Point a = new Point(trackRect.x, trackRect.y); Point b = new Point(a); Point c = new Point(a); Point d = new Point(a); if (slider.getOrientation() == JSlider.HORIZONTAL) { width = trackRect.width; height = (thumbRect.height / 4 == 0) ? 1 : thumbRect.height / 4; a.translate(0, (trackRect.height / 2) - (height / 2)); b.translate(0, (trackRect.height / 2) + (height / 2)); c.translate(trackRect.width, (trackRect.height / 2) + (height / 2)); d.translate(trackRect.width, (trackRect.height / 2) - (height / 2)); } else { width = (thumbRect.width / 4 == 0) ? 1 : thumbRect.width / 4; height = trackRect.height; a.translate((trackRect.width / 2) - (width / 2), 0); b.translate((trackRect.width / 2) - (width / 2), trackRect.height); c.translate((trackRect.width / 2) + (width / 2), trackRect.height); d.translate((trackRect.width / 2) + (width / 2), 0); } g.setColor(Color.GRAY); g.fillRect(a.x, a.y, width, height); g.setColor(getHighlightColor()); g.drawLine(b.x, b.y, c.x, c.y); g.drawLine(c.x, c.y, d.x, d.y); g.setColor(getShadowColor()); g.drawLine(b.x, b.y, a.x, a.y); g.drawLine(a.x, a.y, d.x, d.y); g.setColor(saved_color); }
return ((max - min) / 2);
return (max - min) / 2;
public int valueForXPosition(int xPos) { int min = slider.getMinimum(); int max = slider.getMaximum(); int len = trackRect.width; int value; // If the length is 0, you shouldn't be able to even see where the slider // is. This really shouldn't ever happen, but just in case, we'll return // the middle. if (len == 0) return ((max - min) / 2); if (! drawInverted()) value = ((xPos - trackRect.x) * (max - min) / len + min); else value = ((len - (xPos - trackRect.x)) * (max - min) / len + min); // If this isn't a legal value, then we'll have to move to one now. if (value > max) value = max; else if (value < min) value = min; return value; }
value = ((xPos - trackRect.x) * (max - min) / len + min);
value = (xPos - trackRect.x) * (max - min) / len + min;
public int valueForXPosition(int xPos) { int min = slider.getMinimum(); int max = slider.getMaximum(); int len = trackRect.width; int value; // If the length is 0, you shouldn't be able to even see where the slider // is. This really shouldn't ever happen, but just in case, we'll return // the middle. if (len == 0) return ((max - min) / 2); if (! drawInverted()) value = ((xPos - trackRect.x) * (max - min) / len + min); else value = ((len - (xPos - trackRect.x)) * (max - min) / len + min); // If this isn't a legal value, then we'll have to move to one now. if (value > max) value = max; else if (value < min) value = min; return value; }
value = ((len - (xPos - trackRect.x)) * (max - min) / len + min);
value = (len - (xPos - trackRect.x)) * (max - min) / len + min;
public int valueForXPosition(int xPos) { int min = slider.getMinimum(); int max = slider.getMaximum(); int len = trackRect.width; int value; // If the length is 0, you shouldn't be able to even see where the slider // is. This really shouldn't ever happen, but just in case, we'll return // the middle. if (len == 0) return ((max - min) / 2); if (! drawInverted()) value = ((xPos - trackRect.x) * (max - min) / len + min); else value = ((len - (xPos - trackRect.x)) * (max - min) / len + min); // If this isn't a legal value, then we'll have to move to one now. if (value > max) value = max; else if (value < min) value = min; return value; }
return ((max - min) / 2);
return (max - min) / 2;
public int valueForYPosition(int yPos) { int min = slider.getMinimum(); int max = slider.getMaximum(); int len = trackRect.height; int value; // If the length is 0, you shouldn't be able to even see where the slider // is. This really shouldn't ever happen, but just in case, we'll return // the middle. if (len == 0) return ((max - min) / 2); if (! drawInverted()) value = ((len - (yPos - trackRect.y)) * (max - min) / len + min); else value = ((yPos - trackRect.y) * (max - min) / len + min); // If this isn't a legal value, then we'll have to move to one now. if (value > max) value = max; else if (value < min) value = min; return value; }
value = ((len - (yPos - trackRect.y)) * (max - min) / len + min);
value = (len - (yPos - trackRect.y)) * (max - min) / len + min;
public int valueForYPosition(int yPos) { int min = slider.getMinimum(); int max = slider.getMaximum(); int len = trackRect.height; int value; // If the length is 0, you shouldn't be able to even see where the slider // is. This really shouldn't ever happen, but just in case, we'll return // the middle. if (len == 0) return ((max - min) / 2); if (! drawInverted()) value = ((len - (yPos - trackRect.y)) * (max - min) / len + min); else value = ((yPos - trackRect.y) * (max - min) / len + min); // If this isn't a legal value, then we'll have to move to one now. if (value > max) value = max; else if (value < min) value = min; return value; }
value = ((yPos - trackRect.y) * (max - min) / len + min);
value = (yPos - trackRect.y) * (max - min) / len + min;
public int valueForYPosition(int yPos) { int min = slider.getMinimum(); int max = slider.getMaximum(); int len = trackRect.height; int value; // If the length is 0, you shouldn't be able to even see where the slider // is. This really shouldn't ever happen, but just in case, we'll return // the middle. if (len == 0) return ((max - min) / 2); if (! drawInverted()) value = ((len - (yPos - trackRect.y)) * (max - min) / len + min); else value = ((yPos - trackRect.y) * (max - min) / len + min); // If this isn't a legal value, then we'll have to move to one now. if (value > max) value = max; else if (value < min) value = min; return value; }
public synchronized void write (byte[] buf, int offset, int len) throws IOException
public synchronized void write (int value) throws IOException
public synchronized void write (byte[] buf, int offset, int len) throws IOException { out.write(buf, offset, len); written += len; }
out.write(buf, offset, len); written += len;
out.write (value); ++written;
public synchronized void write (byte[] buf, int offset, int len) throws IOException { out.write(buf, offset, len); written += len; }
this.operand = getOperand(varIndex); refs = new Operand[] { operand };
refs = new Operand[] { getOperand(varIndex) };
public UnaryQuad(int address, IRBasicBlock block, int lhsIndex, int operation, int varIndex) { super(address, block, lhsIndex); this.operation = operation; this.operand = getOperand(varIndex); refs = new Operand[] { operand }; }
operand = operand.simplify(); if (operand instanceof Variable) { Variable v = (Variable) operand;
refs[0] = refs[0].simplify(); if (refs[0] instanceof Variable) { Variable v = (Variable) refs[0];
public void doPass2(BootableHashMap liveVariables) { operand = operand.simplify(); if (operand instanceof Variable) { Variable v = (Variable) operand; v.setLastUseAddress(this.getAddress()); liveVariables.put(v, v); } }
if(operand instanceof Constant){ Constant c = (Constant) operand;
if(refs[0] instanceof Constant){ Constant c = (Constant) refs[0];
private Quad foldConstants() { if(operand instanceof Constant){ Constant c = (Constant) operand; switch (operation) { case I2L: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c.i2l()); case I2F: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c.i2f()); case I2D: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c.i2d()); case L2I: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c.l2i()); case L2F: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c.l2f()); case L2D: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c.l2d()); case F2I: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c.f2i()); case F2L: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c.f2l()); case F2D: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c.f2d()); case D2I: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c.d2i()); case D2L: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c.d2l()); case D2F: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c.d2f()); case I2B: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c.i2b()); case I2C: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c.i2c()); case I2S: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c.i2s()); case INEG: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c.iNeg()); case LNEG: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c.lNeg()); case FNEG: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c.fNeg()); case DNEG: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c.dNeg()); default: throw new IllegalArgumentException("Don't know how to fold those yet..."); } } return this; }
if (operand instanceof Variable) { Variable var = (Variable) operand;
if (refs[0] instanceof Variable) { Variable var = (Variable) refs[0];
public void generateCode(CodeGenerator cg) { Variable lhs = getLHS(); Location lhsLoc = lhs.getLocation(); if (lhsLoc instanceof RegisterLocation) { RegisterLocation regLoc = (RegisterLocation) lhsLoc; Object lhsReg = regLoc.getRegister(); if (operand instanceof Variable) { Variable var = (Variable) operand; Location varLoc = var.getLocation(); if (varLoc instanceof RegisterLocation) { RegisterLocation vregLoc = (RegisterLocation) varLoc; cg.generateCodeFor(this, lhsReg, operation, vregLoc.getRegister()); } else if (varLoc instanceof StackLocation) { StackLocation stackLoc = (StackLocation) varLoc; cg.generateCodeFor(this, lhsReg, operation, stackLoc.getDisplacement()); } else { throw new IllegalArgumentException("Unknown location: " + varLoc); } } else if (operand instanceof Constant) { // this probably won't happen, is should be folded earlier Constant con = (Constant) operand; cg.generateCodeFor(this, lhsReg, operation, con); } else { throw new IllegalArgumentException("Unknown operand: " + operand); } } else if (lhsLoc instanceof StackLocation) { StackLocation lhsStackLoc = (StackLocation) lhsLoc; int lhsDisp = lhsStackLoc.getDisplacement(); if (operand instanceof Variable) { Variable var = (Variable) operand; Location varLoc = var.getLocation(); if (varLoc instanceof RegisterLocation) { RegisterLocation vregLoc = (RegisterLocation) varLoc; cg.generateCodeFor(this, lhsDisp, operation, vregLoc.getRegister()); } else if (varLoc instanceof StackLocation) { StackLocation stackLoc = (StackLocation) varLoc; cg.generateCodeFor(this, lhsDisp, operation, stackLoc.getDisplacement()); } else { throw new IllegalArgumentException("Unknown location: " + varLoc); } } else if (operand instanceof Constant) { Constant con = (Constant) operand; cg.generateCodeFor(this, lhsDisp, operation, con); } else { throw new IllegalArgumentException("Unknown operand: " + operand); } } else { throw new IllegalArgumentException("Unknown location: " + lhsLoc); } }
} else if (operand instanceof Constant) {
} else if (refs[0] instanceof Constant) {
public void generateCode(CodeGenerator cg) { Variable lhs = getLHS(); Location lhsLoc = lhs.getLocation(); if (lhsLoc instanceof RegisterLocation) { RegisterLocation regLoc = (RegisterLocation) lhsLoc; Object lhsReg = regLoc.getRegister(); if (operand instanceof Variable) { Variable var = (Variable) operand; Location varLoc = var.getLocation(); if (varLoc instanceof RegisterLocation) { RegisterLocation vregLoc = (RegisterLocation) varLoc; cg.generateCodeFor(this, lhsReg, operation, vregLoc.getRegister()); } else if (varLoc instanceof StackLocation) { StackLocation stackLoc = (StackLocation) varLoc; cg.generateCodeFor(this, lhsReg, operation, stackLoc.getDisplacement()); } else { throw new IllegalArgumentException("Unknown location: " + varLoc); } } else if (operand instanceof Constant) { // this probably won't happen, is should be folded earlier Constant con = (Constant) operand; cg.generateCodeFor(this, lhsReg, operation, con); } else { throw new IllegalArgumentException("Unknown operand: " + operand); } } else if (lhsLoc instanceof StackLocation) { StackLocation lhsStackLoc = (StackLocation) lhsLoc; int lhsDisp = lhsStackLoc.getDisplacement(); if (operand instanceof Variable) { Variable var = (Variable) operand; Location varLoc = var.getLocation(); if (varLoc instanceof RegisterLocation) { RegisterLocation vregLoc = (RegisterLocation) varLoc; cg.generateCodeFor(this, lhsDisp, operation, vregLoc.getRegister()); } else if (varLoc instanceof StackLocation) { StackLocation stackLoc = (StackLocation) varLoc; cg.generateCodeFor(this, lhsDisp, operation, stackLoc.getDisplacement()); } else { throw new IllegalArgumentException("Unknown location: " + varLoc); } } else if (operand instanceof Constant) { Constant con = (Constant) operand; cg.generateCodeFor(this, lhsDisp, operation, con); } else { throw new IllegalArgumentException("Unknown operand: " + operand); } } else { throw new IllegalArgumentException("Unknown location: " + lhsLoc); } }
Constant con = (Constant) operand;
Constant con = (Constant) refs[0];
public void generateCode(CodeGenerator cg) { Variable lhs = getLHS(); Location lhsLoc = lhs.getLocation(); if (lhsLoc instanceof RegisterLocation) { RegisterLocation regLoc = (RegisterLocation) lhsLoc; Object lhsReg = regLoc.getRegister(); if (operand instanceof Variable) { Variable var = (Variable) operand; Location varLoc = var.getLocation(); if (varLoc instanceof RegisterLocation) { RegisterLocation vregLoc = (RegisterLocation) varLoc; cg.generateCodeFor(this, lhsReg, operation, vregLoc.getRegister()); } else if (varLoc instanceof StackLocation) { StackLocation stackLoc = (StackLocation) varLoc; cg.generateCodeFor(this, lhsReg, operation, stackLoc.getDisplacement()); } else { throw new IllegalArgumentException("Unknown location: " + varLoc); } } else if (operand instanceof Constant) { // this probably won't happen, is should be folded earlier Constant con = (Constant) operand; cg.generateCodeFor(this, lhsReg, operation, con); } else { throw new IllegalArgumentException("Unknown operand: " + operand); } } else if (lhsLoc instanceof StackLocation) { StackLocation lhsStackLoc = (StackLocation) lhsLoc; int lhsDisp = lhsStackLoc.getDisplacement(); if (operand instanceof Variable) { Variable var = (Variable) operand; Location varLoc = var.getLocation(); if (varLoc instanceof RegisterLocation) { RegisterLocation vregLoc = (RegisterLocation) varLoc; cg.generateCodeFor(this, lhsDisp, operation, vregLoc.getRegister()); } else if (varLoc instanceof StackLocation) { StackLocation stackLoc = (StackLocation) varLoc; cg.generateCodeFor(this, lhsDisp, operation, stackLoc.getDisplacement()); } else { throw new IllegalArgumentException("Unknown location: " + varLoc); } } else if (operand instanceof Constant) { Constant con = (Constant) operand; cg.generateCodeFor(this, lhsDisp, operation, con); } else { throw new IllegalArgumentException("Unknown operand: " + operand); } } else { throw new IllegalArgumentException("Unknown location: " + lhsLoc); } }
throw new IllegalArgumentException("Unknown operand: " + operand);
throw new IllegalArgumentException("Unknown operand: " + refs[0]);
public void generateCode(CodeGenerator cg) { Variable lhs = getLHS(); Location lhsLoc = lhs.getLocation(); if (lhsLoc instanceof RegisterLocation) { RegisterLocation regLoc = (RegisterLocation) lhsLoc; Object lhsReg = regLoc.getRegister(); if (operand instanceof Variable) { Variable var = (Variable) operand; Location varLoc = var.getLocation(); if (varLoc instanceof RegisterLocation) { RegisterLocation vregLoc = (RegisterLocation) varLoc; cg.generateCodeFor(this, lhsReg, operation, vregLoc.getRegister()); } else if (varLoc instanceof StackLocation) { StackLocation stackLoc = (StackLocation) varLoc; cg.generateCodeFor(this, lhsReg, operation, stackLoc.getDisplacement()); } else { throw new IllegalArgumentException("Unknown location: " + varLoc); } } else if (operand instanceof Constant) { // this probably won't happen, is should be folded earlier Constant con = (Constant) operand; cg.generateCodeFor(this, lhsReg, operation, con); } else { throw new IllegalArgumentException("Unknown operand: " + operand); } } else if (lhsLoc instanceof StackLocation) { StackLocation lhsStackLoc = (StackLocation) lhsLoc; int lhsDisp = lhsStackLoc.getDisplacement(); if (operand instanceof Variable) { Variable var = (Variable) operand; Location varLoc = var.getLocation(); if (varLoc instanceof RegisterLocation) { RegisterLocation vregLoc = (RegisterLocation) varLoc; cg.generateCodeFor(this, lhsDisp, operation, vregLoc.getRegister()); } else if (varLoc instanceof StackLocation) { StackLocation stackLoc = (StackLocation) varLoc; cg.generateCodeFor(this, lhsDisp, operation, stackLoc.getDisplacement()); } else { throw new IllegalArgumentException("Unknown location: " + varLoc); } } else if (operand instanceof Constant) { Constant con = (Constant) operand; cg.generateCodeFor(this, lhsDisp, operation, con); } else { throw new IllegalArgumentException("Unknown operand: " + operand); } } else { throw new IllegalArgumentException("Unknown location: " + lhsLoc); } }
} else if (operand instanceof Constant) { Constant con = (Constant) operand;
} else if (refs[0] instanceof Constant) { Constant con = (Constant) refs[0];
public void generateCode(CodeGenerator cg) { Variable lhs = getLHS(); Location lhsLoc = lhs.getLocation(); if (lhsLoc instanceof RegisterLocation) { RegisterLocation regLoc = (RegisterLocation) lhsLoc; Object lhsReg = regLoc.getRegister(); if (operand instanceof Variable) { Variable var = (Variable) operand; Location varLoc = var.getLocation(); if (varLoc instanceof RegisterLocation) { RegisterLocation vregLoc = (RegisterLocation) varLoc; cg.generateCodeFor(this, lhsReg, operation, vregLoc.getRegister()); } else if (varLoc instanceof StackLocation) { StackLocation stackLoc = (StackLocation) varLoc; cg.generateCodeFor(this, lhsReg, operation, stackLoc.getDisplacement()); } else { throw new IllegalArgumentException("Unknown location: " + varLoc); } } else if (operand instanceof Constant) { // this probably won't happen, is should be folded earlier Constant con = (Constant) operand; cg.generateCodeFor(this, lhsReg, operation, con); } else { throw new IllegalArgumentException("Unknown operand: " + operand); } } else if (lhsLoc instanceof StackLocation) { StackLocation lhsStackLoc = (StackLocation) lhsLoc; int lhsDisp = lhsStackLoc.getDisplacement(); if (operand instanceof Variable) { Variable var = (Variable) operand; Location varLoc = var.getLocation(); if (varLoc instanceof RegisterLocation) { RegisterLocation vregLoc = (RegisterLocation) varLoc; cg.generateCodeFor(this, lhsDisp, operation, vregLoc.getRegister()); } else if (varLoc instanceof StackLocation) { StackLocation stackLoc = (StackLocation) varLoc; cg.generateCodeFor(this, lhsDisp, operation, stackLoc.getDisplacement()); } else { throw new IllegalArgumentException("Unknown location: " + varLoc); } } else if (operand instanceof Constant) { Constant con = (Constant) operand; cg.generateCodeFor(this, lhsDisp, operation, con); } else { throw new IllegalArgumentException("Unknown operand: " + operand); } } else { throw new IllegalArgumentException("Unknown location: " + lhsLoc); } }
return operand;
return refs[0];
public Operand getOperand() { return operand; }
OP_MAP[operation - I2L] + " " + operand.toString();
OP_MAP[operation - I2L] + " " + refs[0].toString();
public String toString() { return getAddress() + ": " + getLHS().toString() + " = " + OP_MAP[operation - I2L] + " " + operand.toString(); }
public AssignQuad(int address, IRBasicBlock block, int lhsIndex) { this(address, block, block.getVariables()[lhsIndex]);
public AssignQuad(int address, IRBasicBlock block, Variable lhs) { super(address, block); setLHS(lhs);
public AssignQuad(int address, IRBasicBlock block, int lhsIndex) { this(address, block, block.getVariables()[lhsIndex]); }
m.minor = Minor.UserException;
public static ValueMember read(InputStream istream) { try { ValueMember value = new ValueMember(); value.name = istream.read_string(); value.id = istream.read_string(); value.defined_in = istream.read_string(); value.version = istream.read_string(); value.type = TypeCodeHelper.read(istream); value.type_def = IDLTypeHelper.read(istream); value.access = istream.read_short(); return value; } catch (UserException ex) { MARSHAL m = new MARSHAL(); m.initCause(ex); throw m; } }
m.minor = Minor.UserException;
public static void write(OutputStream ostream, ValueMember value) { try { ostream.write_string(value.name); ostream.write_string(value.id); ostream.write_string(value.defined_in); ostream.write_string(value.version); TypeCodeHelper.write(ostream, value.type); IDLTypeHelper.write(ostream, value.type_def); ostream.write_short(value.access); } catch (UserException ex) { MARSHAL m = new MARSHAL(); m.initCause(ex); throw m; } }
NIOSocket socket = (NIOSocket) ((SocketChannelImpl) ch).socket(); return socket.getPlainSocketImpl().getNativeFD();
try { return ((SocketChannelImpl) ch).getVMChannel().getState().getNativeFD(); } catch (IOException ioe) { throw new IllegalStateException(ioe); }
public int getNativeFD() { NIOSocket socket = (NIOSocket) ((SocketChannelImpl) ch).socket(); return socket.getPlainSocketImpl().getNativeFD(); }
if (event.modified)
public void insertString(int offset, String text, AttributeSet attributes) throws BadLocationException { // Just return when no text to insert was given. if (text == null || text.length() == 0) return; DefaultDocumentEvent event = new DefaultDocumentEvent(offset, text.length(), DocumentEvent.EventType.INSERT); writeLock(); UndoableEdit undo = content.insertString(offset, text); insertUpdate(event, attributes); writeUnlock(); if (event.modified) fireInsertUpdate(event); if (undo != null) fireUndoableEditUpdate(new UndoableEditEvent(this, undo)); }
if (appProps.containsKey("defaultPrinter")) { if (getStringProperty("defaultPrinter").equals("Yes")) defaultPrinter = true; else defaultPrinter = false; }
public void loadProps(Properties props) { appProps = props; loadColors(); if (appProps.containsKey("colSeparator")) { if (getStringProperty("colSeparator").equals("Line")) colSepLine = 0; if (getStringProperty("colSeparator").equals("ShortLine")) colSepLine = 1; if (getStringProperty("colSeparator").equals("Dot")) colSepLine = 2; } if (appProps.containsKey("showAttr")) { if (getStringProperty("showAttr").equals("Hex")) showHex = true; } if (appProps.containsKey("guiInterface")) { if (getStringProperty("guiInterface").equals("Yes")) guiInterface = true; else guiInterface = false; } if (appProps.containsKey("guiShowUnderline")) { if (getStringProperty("guiShowUnderline").equals("Yes")) guiShowUnderline = true; else guiShowUnderline = false; } if (appProps.containsKey("hotspots")) { if (getStringProperty("hotspots").equals("Yes")) hotSpots = true; else hotSpots = false; } if (appProps.containsKey("hsMore")) { if (getStringProperty("hsMore").length() > 0) { hsMore.setLength(0); hsMore.append(getStringProperty("hsMore")); } } if (appProps.containsKey("hsBottom")) { if (getStringProperty("hsBottom").length() > 0) { hsBottom.setLength(0); hsBottom.append(getStringProperty("hsBottom")); } } if (appProps.containsKey("colSeparator")) { if (getStringProperty("colSeparator").equals("Line")) colSepLine = 0; if (getStringProperty("colSeparator").equals("ShortLine")) colSepLine = 1; if (getStringProperty("colSeparator").equals("Dot")) colSepLine = 2; } if (appProps.containsKey("cursorSize")) { if (getStringProperty("cursorSize").equals("Full")) cursorSize = 2; if (getStringProperty("cursorSize").equals("Half")) cursorSize = 1; if (getStringProperty("cursorSize").equals("Line")) cursorSize = 0; } if (appProps.containsKey("crossHair")) { if (getStringProperty("crossHair").equals("None")) crossHair = 0; if (getStringProperty("crossHair").equals("Horz")) crossHair = 1; if (getStringProperty("crossHair").equals("Vert")) crossHair = 2; if (getStringProperty("crossHair").equals("Both")) crossHair = 3; } if (appProps.containsKey("fontScaleHeight")) { sfh = getFloatProperty("fontScaleHeight"); } if (appProps.containsKey("fontScaleWidth")) { sfw = getFloatProperty("fontScaleWidth"); } if (appProps.containsKey("fontPointSize")) { ps132 = getFloatProperty("fontPointSize"); } if (appProps.containsKey("cursorBottOffset")) { cursorBottOffset = getIntProperty("cursorBottOffset"); } }
if (pn.equals("defaultPrinter")) { if (pce.getNewValue().equals("Yes")) defaultPrinter = true; else defaultPrinter = false; }
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 (pn.equals("cursorBottOffset")) { cursorBottOffset = getIntProperty("cursorBottOffset"); } 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()); } bi.drawOIA(fmWidth,fmHeight,numRows,numCols,font,colorBg,colorBlue); } gui.validate(); gui.repaint(); }
showMe = new JCheckBox(LangTool.getString("ss.labelShowMe")); if(props.containsKey("emul.showConnectDialog")) showMe.setSelected(true); showMe.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(ItemEvent e) { showMe_itemStateChanged(e); } }); options.add(showMe);
void jbInit() throws Exception { // make it non resizable setResizable(true); this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); // create some reusable borders and layouts Border etchedBorder = BorderFactory.createEtchedBorder(); BorderLayout borderLayout = new BorderLayout(); // get an instance of our table model ctm = new ConfigureTableModel(); // create a table using our custom table model sessions = new JSortTable(ctm); // Add enter as default key for connect with this session Action connect = new AbstractAction("connect") { public void actionPerformed(ActionEvent e) { doActionConnect(); } }; KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0,false); sessions.getInputMap().put(enter,"connect"); sessions.getActionMap().put("connect",connect ); sessions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); sessions.setPreferredScrollableViewportSize(new Dimension(500,200)); sessions.setShowGrid(false); //Create the scroll pane and add the table to it. scrollPane = new JScrollPane(sessions); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); //Setup our selection model listener rowSM = sessions.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { //Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel)e.getSource(); if (lsm.isSelectionEmpty()) { //no rows are selected editButton.setEnabled(false); removeButton.setEnabled(false); connectButton.setEnabled(false); } else { int selectedRow = lsm.getMinSelectionIndex(); //selectedRow is selected editButton.setEnabled(true); removeButton.setEnabled(true); connectButton.setEnabled(true); } } }); // setup the frame interface panel interfacePanel = new JPanel(); TitledBorder tb = BorderFactory.createTitledBorder( LangTool.getString("conf.labelPresentation")); interfacePanel.setBorder(tb); ButtonGroup intGroup = new ButtonGroup(); intTABS = new JRadioButton(LangTool.getString("conf.labelTABS")); intTABS.setSelected(true); intTABS.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(ItemEvent e) { intTABS_itemStateChanged(e); } }); intMDI = new JRadioButton(LangTool.getString("conf.labelMDI")); // add the interface options to the group control intGroup.add(intTABS); intGroup.add(intMDI); if (props.containsKey("emul.interface")) { if (props.getProperty("emul.interface").equalsIgnoreCase("MDI")) intMDI.setSelected(true); } interfacePanel.add(intTABS); interfacePanel.add(intMDI); //Setup panels configOptions.setLayout(borderLayout); sessionPanel.setLayout(borderLayout); configOptions.add(sessionPanel, BorderLayout.CENTER); sessionOpts.add(scrollPane, BorderLayout.CENTER); sessionPanel.add(sessionOpts, BorderLayout.NORTH); sessionPanel.add(sessionOptPanel, BorderLayout.SOUTH); sessionPanel.setBorder(BorderFactory.createRaisedBevelBorder()); // add the option buttons addOptButton(LangTool.getString("ss.optAdd"),"ADD",sessionOptPanel); removeButton = addOptButton(LangTool.getString("ss.optDelete"), "REMOVE", sessionOptPanel, false); editButton = addOptButton(LangTool.getString("ss.optEdit"), "EDIT", sessionOptPanel, false); showMe = new JCheckBox(LangTool.getString("ss.labelShowMe")); if(props.containsKey("emul.showConnectDialog")) showMe.setSelected(true); showMe.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(ItemEvent e) { showMe_itemStateChanged(e); } }); options.add(showMe); connectButton = addOptButton(LangTool.getString("ss.optConnect"), "CONNECT",options,false); applyButton = addOptButton(LangTool.getString("ss.optApply"), "APPLY",options,true); addOptButton(LangTool.getString("ss.optCancel"),"DONE",options); // add the panels to our dialog getContentPane().add(sessionPanel,BorderLayout.CENTER); getContentPane().add(options, BorderLayout.SOUTH); getContentPane().add(interfacePanel,BorderLayout.NORTH); // pack it and center it on the screen pack(); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = getSize(); if (frameSize.height > screenSize.height) frameSize.height = screenSize.height; if (frameSize.width > screenSize.width) frameSize.width = screenSize.width; setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); // set default selection value as the first row or default session if (sessions.getRowCount() > 0) { int selInterval = 0; for (int x = 0; x < sessions.getRowCount(); x++) { if (((Boolean)ctm.getValueAt(x,2)).booleanValue()) selInterval = x; } sessions.getSelectionModel().setSelectionInterval(selInterval,selInterval); } sessions.requestFocus(); // now show the world what we and they can do this.setVisible(true); }
getContentPane().add(interfacePanel,BorderLayout.NORTH);
getContentPane().add(emulOptPanel,BorderLayout.NORTH);
void jbInit() throws Exception { // make it non resizable setResizable(true); this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); // create some reusable borders and layouts Border etchedBorder = BorderFactory.createEtchedBorder(); BorderLayout borderLayout = new BorderLayout(); // get an instance of our table model ctm = new ConfigureTableModel(); // create a table using our custom table model sessions = new JSortTable(ctm); // Add enter as default key for connect with this session Action connect = new AbstractAction("connect") { public void actionPerformed(ActionEvent e) { doActionConnect(); } }; KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0,false); sessions.getInputMap().put(enter,"connect"); sessions.getActionMap().put("connect",connect ); sessions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); sessions.setPreferredScrollableViewportSize(new Dimension(500,200)); sessions.setShowGrid(false); //Create the scroll pane and add the table to it. scrollPane = new JScrollPane(sessions); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); //Setup our selection model listener rowSM = sessions.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { //Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel)e.getSource(); if (lsm.isSelectionEmpty()) { //no rows are selected editButton.setEnabled(false); removeButton.setEnabled(false); connectButton.setEnabled(false); } else { int selectedRow = lsm.getMinSelectionIndex(); //selectedRow is selected editButton.setEnabled(true); removeButton.setEnabled(true); connectButton.setEnabled(true); } } }); // setup the frame interface panel interfacePanel = new JPanel(); TitledBorder tb = BorderFactory.createTitledBorder( LangTool.getString("conf.labelPresentation")); interfacePanel.setBorder(tb); ButtonGroup intGroup = new ButtonGroup(); intTABS = new JRadioButton(LangTool.getString("conf.labelTABS")); intTABS.setSelected(true); intTABS.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(ItemEvent e) { intTABS_itemStateChanged(e); } }); intMDI = new JRadioButton(LangTool.getString("conf.labelMDI")); // add the interface options to the group control intGroup.add(intTABS); intGroup.add(intMDI); if (props.containsKey("emul.interface")) { if (props.getProperty("emul.interface").equalsIgnoreCase("MDI")) intMDI.setSelected(true); } interfacePanel.add(intTABS); interfacePanel.add(intMDI); //Setup panels configOptions.setLayout(borderLayout); sessionPanel.setLayout(borderLayout); configOptions.add(sessionPanel, BorderLayout.CENTER); sessionOpts.add(scrollPane, BorderLayout.CENTER); sessionPanel.add(sessionOpts, BorderLayout.NORTH); sessionPanel.add(sessionOptPanel, BorderLayout.SOUTH); sessionPanel.setBorder(BorderFactory.createRaisedBevelBorder()); // add the option buttons addOptButton(LangTool.getString("ss.optAdd"),"ADD",sessionOptPanel); removeButton = addOptButton(LangTool.getString("ss.optDelete"), "REMOVE", sessionOptPanel, false); editButton = addOptButton(LangTool.getString("ss.optEdit"), "EDIT", sessionOptPanel, false); showMe = new JCheckBox(LangTool.getString("ss.labelShowMe")); if(props.containsKey("emul.showConnectDialog")) showMe.setSelected(true); showMe.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(ItemEvent e) { showMe_itemStateChanged(e); } }); options.add(showMe); connectButton = addOptButton(LangTool.getString("ss.optConnect"), "CONNECT",options,false); applyButton = addOptButton(LangTool.getString("ss.optApply"), "APPLY",options,true); addOptButton(LangTool.getString("ss.optCancel"),"DONE",options); // add the panels to our dialog getContentPane().add(sessionPanel,BorderLayout.CENTER); getContentPane().add(options, BorderLayout.SOUTH); getContentPane().add(interfacePanel,BorderLayout.NORTH); // pack it and center it on the screen pack(); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = getSize(); if (frameSize.height > screenSize.height) frameSize.height = screenSize.height; if (frameSize.width > screenSize.width) frameSize.width = screenSize.width; setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); // set default selection value as the first row or default session if (sessions.getRowCount() > 0) { int selInterval = 0; for (int x = 0; x < sessions.getRowCount(); x++) { if (((Boolean)ctm.getValueAt(x,2)).booleanValue()) selInterval = x; } sessions.getSelectionModel().setSelectionInterval(selInterval,selInterval); } sessions.requestFocus(); // now show the world what we and they can do this.setVisible(true); }
public DebugGraphics(Graphics graphics)
public DebugGraphics()
public DebugGraphics(Graphics graphics) { this.graphics = graphics; }
this.graphics = graphics;
public DebugGraphics(Graphics graphics) { this.graphics = graphics; }
return result;
protected PrivateKey engineGeneratePrivate(KeySpec keySpec) throws InvalidKeySpecException { if (keySpec instanceof DSAPrivateKeySpec) { DSAPrivateKeySpec spec = (DSAPrivateKeySpec) keySpec; BigInteger p = spec.getP(); BigInteger q = spec.getQ(); BigInteger g = spec.getG(); BigInteger x = spec.getX(); return new DSSPrivateKey(Registry.PKCS8_ENCODING_ID, p, q, g, x); } if (keySpec instanceof PKCS8EncodedKeySpec) { PKCS8EncodedKeySpec spec = (PKCS8EncodedKeySpec) keySpec; byte[] encoded = spec.getEncoded(); PrivateKey result; try { result = new DSSKeyPairPKCS8Codec().decodePrivateKey(encoded); } catch (RuntimeException x) { InvalidKeySpecException y = new InvalidKeySpecException(); y.initCause(x); throw y; } } throw new InvalidKeySpecException("Unsupported (private) key specification"); }
return result;
protected PublicKey engineGeneratePublic(KeySpec keySpec) throws InvalidKeySpecException { if (keySpec instanceof DSAPublicKeySpec) { DSAPublicKeySpec spec = (DSAPublicKeySpec) keySpec; BigInteger p = spec.getP(); BigInteger q = spec.getQ(); BigInteger g = spec.getG(); BigInteger y = spec.getY(); return new DSSPublicKey(Registry.X509_ENCODING_ID, p, q, g, y); } if (keySpec instanceof X509EncodedKeySpec) { X509EncodedKeySpec spec = (X509EncodedKeySpec) keySpec; byte[] encoded = spec.getEncoded(); PublicKey result; try { result = new DSSKeyPairX509Codec().decodePublicKey(encoded); } catch (RuntimeException x) { InvalidKeySpecException y = new InvalidKeySpecException(); y.initCause(x); throw y; } } throw new InvalidKeySpecException("Unsupported (public) key specification"); }