rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
setDisplayedMnemonic((int) Character.toUpperCase(mnemonic));
if (displayedMnemonic != mnemonic) { firePropertyChange("displayedMnemonic", displayedMnemonic, mnemonic); displayedMnemonic = mnemonic; if (text != null) setDisplayedMnemonicIndex(text.toUpperCase().indexOf(mnemonic)); }
public void setDisplayedMnemonic(char mnemonic) { setDisplayedMnemonic((int) Character.toUpperCase(mnemonic)); }
public JSlider(int orientation, int minimum, int maximum, int value)
public JSlider()
public JSlider(int orientation, int minimum, int maximum, int value) { sliderModel = new DefaultBoundedRangeModel(value, 0, minimum, maximum); if (orientation != HORIZONTAL && orientation != VERTICAL) throw new IllegalArgumentException(orientation + " is not a legal orientation"); this.orientation = orientation; changeListener = createChangeListener(); sliderModel.addChangeListener(changeListener); updateUI(); }
sliderModel = new DefaultBoundedRangeModel(value, 0, minimum, maximum); if (orientation != HORIZONTAL && orientation != VERTICAL) throw new IllegalArgumentException(orientation + " is not a legal orientation"); this.orientation = orientation; changeListener = createChangeListener(); sliderModel.addChangeListener(changeListener); updateUI();
this(HORIZONTAL, 0, 100, 50);
public JSlider(int orientation, int minimum, int maximum, int value) { sliderModel = new DefaultBoundedRangeModel(value, 0, minimum, maximum); if (orientation != HORIZONTAL && orientation != VERTICAL) throw new IllegalArgumentException(orientation + " is not a legal orientation"); this.orientation = orientation; changeListener = createChangeListener(); sliderModel.addChangeListener(changeListener); updateUI(); }
return entry != null ? (ZipEntry) entry.clone() : null;
if (entry == null && !name.endsWith("/")) entry = (ZipEntry) entries.get(name + '/'); return entry != null ? new ZipEntry(entry, name) : null;
public ZipEntry getEntry(String name) { try { HashMap entries = getEntries(); ZipEntry entry = (ZipEntry) entries.get(name); return entry != null ? (ZipEntry) entry.clone() : null; } catch (IOException ioe) { return null; } }
private void checkMethods() throws IntrospectionException { if(!addListenerMethod.getDeclaringClass().isAssignableFrom(removeListenerMethod.getDeclaringClass()) && !removeListenerMethod.getDeclaringClass().isAssignableFrom(addListenerMethod.getDeclaringClass())) { throw new IntrospectionException("add and remove listener methods do not come from the same class. This is bad.");
private void checkMethods() throws IntrospectionException { if (!addListenerMethod.getDeclaringClass() .isAssignableFrom(removeListenerMethod.getDeclaringClass()) && !removeListenerMethod.getDeclaringClass() .isAssignableFrom(addListenerMethod.getDeclaringClass())) { throw new IntrospectionException( "add and remove listener methods do not come from the" + " same class. This is bad.");
private void checkMethods() throws IntrospectionException { if(!addListenerMethod.getDeclaringClass().isAssignableFrom(removeListenerMethod.getDeclaringClass()) && !removeListenerMethod.getDeclaringClass().isAssignableFrom(addListenerMethod.getDeclaringClass())) { throw new IntrospectionException("add and remove listener methods do not come from the same class. This is bad."); } if(!addListenerMethod.getReturnType().equals(java.lang.Void.TYPE) || addListenerMethod.getParameterTypes().length != 1 || !listenerType.equals(addListenerMethod.getParameterTypes()[0]) || !Modifier.isPublic(addListenerMethod.getModifiers())) { throw new IntrospectionException("Add Listener Method invalid."); } if(!removeListenerMethod.getReturnType().equals(java.lang.Void.TYPE) || removeListenerMethod.getParameterTypes().length != 1 || !listenerType.equals(removeListenerMethod.getParameterTypes()[0]) || removeListenerMethod.getExceptionTypes().length > 0 || !Modifier.isPublic(removeListenerMethod.getModifiers())) { throw new IntrospectionException("Remove Listener Method invalid."); } for(int i=0;i<listenerMethods.length;i++) { if(!listenerMethods[i].getReturnType().equals(java.lang.Void.TYPE) || Modifier.isPrivate(listenerMethods[i].getModifiers())) { throw new IntrospectionException("Event Method " + listenerMethods[i].getName() + " non-void or private."); } if(!listenerMethods[i].getDeclaringClass().isAssignableFrom(listenerType)) { throw new IntrospectionException("Event Method " + listenerMethods[i].getName() + " not from class " + listenerType.getName()); } } }
if(this.addListenerMethod == null || !this.addListenerMethod.getReturnType().equals(java.lang.Void.TYPE)) { throw new IntrospectionException("Add listener method does not exist, is not public, or is not void."); }
if (this.addListenerMethod == null || !this.addListenerMethod.getReturnType().equals(java.lang.Void.TYPE)) { throw new IntrospectionException( "Add listener method does not exist, is not public," + " or is not void."); }
private void findMethods(Class eventSourceClass, Class listenerType, String listenerMethodNames[], String addListenerMethodName, String removeListenerMethodName, String absurdEventClassCheckName) throws IntrospectionException { /* Find add listener method and remove listener method. */ Class[] listenerArgList = new Class[1]; listenerArgList[0] = listenerType; try { this.addListenerMethod = eventSourceClass.getMethod(addListenerMethodName,listenerArgList); } catch(SecurityException E) { throw new IntrospectionException("SecurityException trying to access method " + addListenerMethodName + "."); } catch(NoSuchMethodException E) { throw new IntrospectionException("Could not find method " + addListenerMethodName + "."); } if(this.addListenerMethod == null || !this.addListenerMethod.getReturnType().equals(java.lang.Void.TYPE)) { throw new IntrospectionException("Add listener method does not exist, is not public, or is not void."); } try { this.removeListenerMethod = eventSourceClass.getMethod(removeListenerMethodName,listenerArgList); } catch(SecurityException E) { throw new IntrospectionException("SecurityException trying to access method " + removeListenerMethodName + "."); } catch(NoSuchMethodException E) { throw new IntrospectionException("Could not find method " + removeListenerMethodName + "."); } if(this.removeListenerMethod == null || !this.removeListenerMethod.getReturnType().equals(java.lang.Void.TYPE)) { throw new IntrospectionException("Remove listener method does not exist, is not public, or is not void."); } /* Find the listener methods. */ Method[] methods; try { methods = ClassHelper.getAllMethods(listenerType); } catch(SecurityException E) { throw new IntrospectionException("Security: You cannot access fields in this class."); } Vector chosenMethods = new Vector(); boolean[] listenerMethodFound = new boolean[listenerMethodNames.length]; for(int i=0;i<methods.length;i++) { if(Modifier.isPrivate(methods[i].getModifiers())) { continue; } Method currentMethod = methods[i]; Class retval = currentMethod.getReturnType(); if(retval.equals(java.lang.Void.TYPE)) { for(int j=0;j<listenerMethodNames.length;j++) { if(currentMethod.getName().equals(listenerMethodNames[j]) && (absurdEventClassCheckName == null || (currentMethod.getParameterTypes().length == 1 && ((currentMethod.getParameterTypes()[0]).getName().equals(absurdEventClassCheckName) || (currentMethod.getParameterTypes()[0]).getName().endsWith("."+absurdEventClassCheckName) ) ) ) ) { chosenMethods.addElement(currentMethod); listenerMethodFound[j] = true; } } } } /* Make sure we found all the methods we were looking for. */ for(int i=0;i<listenerMethodFound.length;i++) { if(!listenerMethodFound[i]) { throw new IntrospectionException("Could not find event method " + listenerMethodNames[i]); } } /* Now that we've chosen the listener methods we want, store them. */ this.listenerMethods = new Method[chosenMethods.size()]; for(int i=0;i<chosenMethods.size();i++) { this.listenerMethods[i] = (Method)chosenMethods.elementAt(i); } }
try { this.removeListenerMethod = eventSourceClass.getMethod(removeListenerMethodName,listenerArgList); } catch(SecurityException E) { throw new IntrospectionException("SecurityException trying to access method " + removeListenerMethodName + "."); } catch(NoSuchMethodException E) { throw new IntrospectionException("Could not find method " + removeListenerMethodName + "."); } if(this.removeListenerMethod == null || !this.removeListenerMethod.getReturnType().equals(java.lang.Void.TYPE)) { throw new IntrospectionException("Remove listener method does not exist, is not public, or is not void.");
try { this.removeListenerMethod = eventSourceClass.getMethod(removeListenerMethodName, listenerArgList); } catch (SecurityException E) { throw new IntrospectionException( "SecurityException trying to access method " + removeListenerMethodName + "."); } catch (NoSuchMethodException E) { throw new IntrospectionException("Could not find method " + removeListenerMethodName + "."); } if (this.removeListenerMethod == null || !this.removeListenerMethod.getReturnType() .equals(java.lang.Void.TYPE)) { throw new IntrospectionException( "Remove listener method does not exist, is not public," + " or is not void.");
private void findMethods(Class eventSourceClass, Class listenerType, String listenerMethodNames[], String addListenerMethodName, String removeListenerMethodName, String absurdEventClassCheckName) throws IntrospectionException { /* Find add listener method and remove listener method. */ Class[] listenerArgList = new Class[1]; listenerArgList[0] = listenerType; try { this.addListenerMethod = eventSourceClass.getMethod(addListenerMethodName,listenerArgList); } catch(SecurityException E) { throw new IntrospectionException("SecurityException trying to access method " + addListenerMethodName + "."); } catch(NoSuchMethodException E) { throw new IntrospectionException("Could not find method " + addListenerMethodName + "."); } if(this.addListenerMethod == null || !this.addListenerMethod.getReturnType().equals(java.lang.Void.TYPE)) { throw new IntrospectionException("Add listener method does not exist, is not public, or is not void."); } try { this.removeListenerMethod = eventSourceClass.getMethod(removeListenerMethodName,listenerArgList); } catch(SecurityException E) { throw new IntrospectionException("SecurityException trying to access method " + removeListenerMethodName + "."); } catch(NoSuchMethodException E) { throw new IntrospectionException("Could not find method " + removeListenerMethodName + "."); } if(this.removeListenerMethod == null || !this.removeListenerMethod.getReturnType().equals(java.lang.Void.TYPE)) { throw new IntrospectionException("Remove listener method does not exist, is not public, or is not void."); } /* Find the listener methods. */ Method[] methods; try { methods = ClassHelper.getAllMethods(listenerType); } catch(SecurityException E) { throw new IntrospectionException("Security: You cannot access fields in this class."); } Vector chosenMethods = new Vector(); boolean[] listenerMethodFound = new boolean[listenerMethodNames.length]; for(int i=0;i<methods.length;i++) { if(Modifier.isPrivate(methods[i].getModifiers())) { continue; } Method currentMethod = methods[i]; Class retval = currentMethod.getReturnType(); if(retval.equals(java.lang.Void.TYPE)) { for(int j=0;j<listenerMethodNames.length;j++) { if(currentMethod.getName().equals(listenerMethodNames[j]) && (absurdEventClassCheckName == null || (currentMethod.getParameterTypes().length == 1 && ((currentMethod.getParameterTypes()[0]).getName().equals(absurdEventClassCheckName) || (currentMethod.getParameterTypes()[0]).getName().endsWith("."+absurdEventClassCheckName) ) ) ) ) { chosenMethods.addElement(currentMethod); listenerMethodFound[j] = true; } } } } /* Make sure we found all the methods we were looking for. */ for(int i=0;i<listenerMethodFound.length;i++) { if(!listenerMethodFound[i]) { throw new IntrospectionException("Could not find event method " + listenerMethodNames[i]); } } /* Now that we've chosen the listener methods we want, store them. */ this.listenerMethods = new Method[chosenMethods.size()]; for(int i=0;i<chosenMethods.size();i++) { this.listenerMethods[i] = (Method)chosenMethods.elementAt(i); } }
protected final Class defineClass(String name, byte[] data, int offset, int length) { return defineClass(name, data, offset, length, null);
protected final Class defineClass(byte[] data, int offset, int length) { return defineClass(null, data, offset, length, null);
protected final Class defineClass(String name, byte[] data, int offset, int length) { return defineClass(name, data, offset, length, null); }
if (text != null) {
if (bufferedKeys != null) {
public void sendKeys(String text) {// if (text == null) {// return;// } if (isStatusErrorCode() && !resetRequired) { resetError(); if (!cursorActive) setCursorOn(); } if (keyboardLocked) { if(text.equals("[reset]") || text.equals("[sysreq]") || text.equals("[attn]")) { simulateMnemonic(getMnemonicValue(text)); } else { if (isStatusErrorCode()) { Toolkit.getDefaultToolkit().beep(); return; } keysBuffered = true; setKBIndicatorOn(); if(bufferedKeys == null){ bufferedKeys = text; return; } else { bufferedKeys += text; return; } } } else { if (keysBuffered) { if (text != null) { text = bufferedKeys + text; } keysBuffered = false; setKBIndicatorOff(); bufferedKeys = null; } // check to see if position is in a field and if it is then change // current field to that field isInField(lastPos,true); if (text.length() == 1 && !text.equals("[") && !text.equals("]")) { simulateKeyStroke(text.charAt(0)); } else { strokenizer.setKeyStrokes(text); String s; boolean done = false; while (strokenizer.hasMoreKeyStrokes() && !keyboardLocked && !isStatusErrorCode() && !done) { s = strokenizer.nextKeyStroke(); if (s.length() == 1) { simulateKeyStroke(s.charAt(0)); } else { if (s != null) { simulateMnemonic(getMnemonicValue(s)); } else System.out.println(" send keys mnemonic " + s); } if (keyboardLocked) { bufferedKeys = strokenizer.getUnprocessedKeyStroked(); if (bufferedKeys != null) { keysBuffered = true; setKBIndicatorOn(); } done = true; } } } } }
throw new BAD_OPERATION("ServiceContext[] expected.");
BAD_OPERATION bad = new BAD_OPERATION("ServiceContext[] expected"); bad.minor = Minor.Any; bad.initCause(ex); throw bad;
public static ServiceContext[] extract(Any any) { try { ServiceContextListHolder holder = (ServiceContextListHolder) any.extract_Streamable(); return holder.value; } catch (ClassCastException ex) { throw new BAD_OPERATION("ServiceContext[] expected."); } }
this(0, 100, HORIZONTAL);
this(HORIZONTAL, 0, 100);
public JProgressBar() { this(0, 100, HORIZONTAL); }
public final synchronized void draw(Shape shape, AffineTransform tx, Color color, int mode) {
public final synchronized void draw(Shape shape, Shape clip, AffineTransform tx, Color color, int mode) {
public final synchronized void draw(Shape shape, AffineTransform tx, Color color, int mode) { syncFIFO(); super.draw(shape, tx, color, mode); final Rectangle r = getBounds(shape, tx); updateScreen(r.x - 1, r.y - 1, r.width + 2, r.height + 2); }
super.draw(shape, tx, color, mode);
super.draw(shape, clip, tx, color, mode);
public final synchronized void draw(Shape shape, AffineTransform tx, Color color, int mode) { syncFIFO(); super.draw(shape, tx, color, mode); final Rectangle r = getBounds(shape, tx); updateScreen(r.x - 1, r.y - 1, r.width + 2, r.height + 2); }
public final synchronized void fill(Shape shape, AffineTransform tx, Color color, int mode) {
public final synchronized void fill(Shape shape, Shape clip, AffineTransform tx, Color color, int mode) {
public final synchronized void fill(Shape shape, AffineTransform tx, Color color, int mode) { syncFIFO(); super.fill(shape, tx, color, mode); final Rectangle b = getBounds(shape, tx); updateScreen(b.x, b.y, b.width, b.height); }
super.fill(shape, tx, color, mode);
super.fill(shape, clip, tx, color, mode);
public final synchronized void fill(Shape shape, AffineTransform tx, Color color, int mode) { syncFIFO(); super.fill(shape, tx, color, mode); final Rectangle b = getBounds(shape, tx); updateScreen(b.x, b.y, b.width, b.height); }
revalidate(); repaint();
setOpaque(b);
public void setContentAreaFilled(boolean b) { if (contentAreaFilled == b) return; boolean old = contentAreaFilled; contentAreaFilled = b; firePropertyChange(CONTENT_AREA_FILLED_CHANGED_PROPERTY, old, b); revalidate(); repaint(); }
output.write_wstring(value [ i ]);
output.write_string(value [ i ]);
public static void write(OutputStream output, String[] value) { output.write_long(value.length); for (int i = 0; i < value.length; i++) output.write_wstring(value [ i ]); }
public StringSeqHolder(String[] initial_value)
public StringSeqHolder()
public StringSeqHolder(String[] initial_value) { value = initial_value; typecode.setLength(value.length); }
value = initial_value; typecode.setLength(value.length);
public StringSeqHolder(String[] initial_value) { value = initial_value; typecode.setLength(value.length); }
goto_XY(icX,icY);
if (!isStatusErrorCode()) { goto_XY(icX,icY); }
public void setPendingInsert(boolean flag, int icX, int icY) { pendingInsert = flag; if (pendingInsert) { homePos = getPos(icX,icY); } goto_XY(icX,icY); }
return alignmentX;
float ret = alignmentX; if (alignmentX < 0) ret = super.getAlignmentX(); return ret;
public float getAlignmentX() { return alignmentX; }
return alignmentY;
float ret = alignmentY; if (alignmentY < 0) ret = super.getAlignmentY(); return ret;
public float getAlignmentY() { return alignmentY; }
if (a < 0.0F) alignmentX = 0.0F; else if (a > 1.0) alignmentX = 1.0F; else
public void setAlignmentX(float a) { alignmentX = a; }
if (a < 0.0F) alignmentY = 0.0F; else if (a > 1.0) alignmentY = 1.0F; else
public void setAlignmentY(float a) { alignmentY = a; }
maximumSize = max;
maximumSize = new Dimension(max);
public void setMaximumSize(Dimension max) { Dimension oldMaximumSize = maximumSize; maximumSize = max; firePropertyChange("maximumSize", oldMaximumSize, maximumSize); }
minimumSize = min;
minimumSize = new Dimension(min);
public void setMinimumSize(Dimension min) { Dimension oldMinimumSize = minimumSize; minimumSize = min; firePropertyChange("minimumSize", oldMinimumSize, minimumSize); }
preferredSize = pref;
preferredSize = new Dimension(pref);
public void setPreferredSize(Dimension pref) { Dimension oldPreferredSize = preferredSize; preferredSize = pref; firePropertyChange("preferredSize", oldPreferredSize, preferredSize); }
aliasesEP.addListener(this);
public DefaultAliasManager(ExtensionPoint aliasesEP) { this.parent = null; this.aliasesEP = aliasesEP; refreshAliases(); }
System.out.println("Refreshing alias list");
protected void refreshAliases() { if (aliasesEP != null) { aliases.clear(); final Extension[] extensions = aliasesEP.getExtensions(); for (int i = 0; i < extensions.length; i++) { final Extension ext = extensions[i]; final ConfigurationElement[] elements = ext.getConfigurationElements(); for (int j = 0; j < elements.length; j++) { createAlias(aliases, elements[j]); } } } }
childAllocation(i, copy);
public void paint(Graphics g, Shape a) { // Adjust size if the size is changed. Rectangle bounds = a.getBounds(); if (bounds.width != getWidth() || bounds.height != getHeight()) setSize(bounds.width, bounds.height); Rectangle inside = getInsideAllocation(a); Rectangle copy = new Rectangle(inside); int count = getViewCount(); for (int i = 0; i < count; ++i) { // TODO: Figure out if the parameter to paintChild is meant to // be the child allocation or the allocation of this BoxView. // I assume the second option here. // We pass this method a copy of the inside rectangle here because // it modifies the actual values. copy.setBounds(inside); paintChild(g, copy, i); } }
childAllocation(index, alloc);
protected void paintChild(Graphics g, Rectangle alloc, int index) { View child = getView(index); childAllocation(index, alloc); child.paint(g, alloc); }
if (mods)
if (mods) {
public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("DONE")) { if (mods) mapper.saveKeyMap(); setVisible(false); } if (e.getActionCommand().equals("MAP")) { mapIt(); } if (e.getActionCommand().equals("REMOVE")) { removeIt(); } }
mapper.fireKeyChangeEvent(); }
public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("DONE")) { if (mods) mapper.saveKeyMap(); setVisible(false); } if (e.getActionCommand().equals("MAP")) { mapIt(); } if (e.getActionCommand().equals("REMOVE")) { removeIt(); } }
mods = true;
private void removeIt() { if (!macros && !special) { mapper.removeKeyStroke(mnemonicData[functions.getSelectedIndex()]); strokeDesc.setText(mapper.getKeyStrokeDesc( mnemonicData[functions.getSelectedIndex()])); } else { if (macros) { mapper.removeKeyStroke((String)functions.getSelectedValue()); strokeDesc.setText(mapper.getKeyStrokeDesc( (String)functions.getSelectedValue())); } if (special) { String k = ""; k += ((String)functions.getSelectedValue()).charAt(7); mapper.removeKeyStroke((String)functions.getSelectedValue()); strokeDesc.setText(mapper.getKeyStrokeDesc( (String)functions.getSelectedValue())); } } }
mapper.fireKeyChangeEvent();
private void setNewKeyStrokes(KeyEvent ke) { if (!macros && !special) { if (isLinux) mapper.setKeyStroke(mnemonicData[functions.getSelectedIndex()],ke,isAltGr); else mapper.setKeyStroke(mnemonicData[functions.getSelectedIndex()],ke); strokeDesc.setText(mapper.getKeyStrokeDesc( mnemonicData[functions.getSelectedIndex()])); mapper.fireKeyChangeEvent(); } else { if (macros) { System.out.println((String)functions.getSelectedValue()); if (isLinux) mapper.setKeyStroke((String)functions.getSelectedValue(),ke,isAltGr); else mapper.setKeyStroke((String)functions.getSelectedValue(),ke); strokeDesc.setText(mapper.getKeyStrokeDesc( (String)functions.getSelectedValue())); } if (special) { System.out.println((String)functions.getSelectedValue()); String k = ""; k += ((String)functions.getSelectedValue()).charAt(7); if (isLinux) mapper.setKeyStroke(k,ke,isAltGr); else mapper.setKeyStroke(k,ke); strokeDesc.setText(mapper.getKeyStrokeDesc(k)); } } mods = true; }
public static void main(String[] args) {
public static void main(String[] args) throws SyntaxErrorException {
public static void main(String[] args) { try { ParsedArguments cmdLine = HELP_INFO.parse(args); String device = ARG_DEVICE.getValue(cmdLine); String FSType = FS.getValue(cmdLine).intern(); String fsTypeName; Object params; int fatSize = 0; if (FSType == "fat16") { fatSize = Fat.FAT16; fsTypeName = FatFileSystemType.NAME; params = new Integer(fatSize); } else if (FSType == "fat12") { fatSize = Fat.FAT12; fsTypeName = FatFileSystemType.NAME; params = new Integer(fatSize); } else throw new FileSystemException( "Unsupported FS by format command"); DeviceManager dm; dm = (DeviceManager) InitialNaming.lookup(DeviceManager.NAME); Device dev = dm.getDevice(device); FileSystemService fileSystemService = (FileSystemService) InitialNaming .lookup(FileSystemService.NAME); FileSystemType type = fileSystemService .getFileSystemTypeForNameSystemTypes(fsTypeName); type.format(dev, params); // restart the device dm.stop(dev); dm.start(dev); } catch (NameNotFoundException e) { e.printStackTrace(); } catch (DeviceNotFoundException e) { e.printStackTrace(); } catch (DriverException e) { e.printStackTrace(); } catch (FileSystemException e) { // e.printStackTrace(); } }
public AssignQuad(int address, IRBasicBlock block, int lhsIndex) {
public AssignQuad(int address, IRBasicBlock block, Variable lhs) {
public AssignQuad(int address, IRBasicBlock block, int lhsIndex) { super(address, block); this.variables = block.getVariables(); this.lhsIndex = lhsIndex; this.lhs = (Variable) variables[lhsIndex].clone(); lhs.setAssignQuad(this); }
this.variables = block.getVariables(); this.lhsIndex = lhsIndex; this.lhs = (Variable) variables[lhsIndex].clone();
this.lhs = lhs;
public AssignQuad(int address, IRBasicBlock block, int lhsIndex) { super(address, block); this.variables = block.getVariables(); this.lhsIndex = lhsIndex; this.lhs = (Variable) variables[lhsIndex].clone(); lhs.setAssignQuad(this); }
public Parser(String programName, final String versionString, boolean longOnly)
public Parser(String programName, String versionString)
public Parser(String programName, final String versionString, boolean longOnly) { this.programName = programName; this.longOnly = longOnly; // Put standard options in their own section near the end. OptionGroup finalGroup = new OptionGroup(Messages.getString("Parser.StdOptions")); //$NON-NLS-1$ finalGroup.add(new Option("help", Messages.getString("Parser.PrintHelp")) //$NON-NLS-1$ //$NON-NLS-2$ { public void parsed(String argument) throws OptionException { printHelp(System.out); System.exit(0); } }); finalGroup.add(new Option("version", Messages.getString("Parser.PrintVersion")) //$NON-NLS-1$ //$NON-NLS-2$ { public void parsed(String argument) throws OptionException { System.out.println(versionString); System.exit(0); } }); finalGroup.add(new Option('J', Messages.getString("Parser.JArgument"), Messages.getString("Parser.JName")) //$NON-NLS-1$ //$NON-NLS-2$ { public void parsed(String argument) throws OptionException { // -J should be handled by the appletviewer wrapper binary. // We add it here so that it shows up in the --help output. // Note that there is a special case for this in OptionGroup. } }); add(finalGroup); add(defaultGroup); }
this.programName = programName; this.longOnly = longOnly; OptionGroup finalGroup = new OptionGroup(Messages.getString("Parser.StdOptions")); finalGroup.add(new Option("help", Messages.getString("Parser.PrintHelp")) { public void parsed(String argument) throws OptionException { printHelp(System.out); System.exit(0); } }); finalGroup.add(new Option("version", Messages.getString("Parser.PrintVersion")) { public void parsed(String argument) throws OptionException { System.out.println(versionString); System.exit(0); } }); finalGroup.add(new Option('J', Messages.getString("Parser.JArgument"), Messages.getString("Parser.JName")) { public void parsed(String argument) throws OptionException { } }); add(finalGroup); add(defaultGroup);
this(programName, versionString, false);
public Parser(String programName, final String versionString, boolean longOnly) { this.programName = programName; this.longOnly = longOnly; // Put standard options in their own section near the end. OptionGroup finalGroup = new OptionGroup(Messages.getString("Parser.StdOptions")); //$NON-NLS-1$ finalGroup.add(new Option("help", Messages.getString("Parser.PrintHelp")) //$NON-NLS-1$ //$NON-NLS-2$ { public void parsed(String argument) throws OptionException { printHelp(System.out); System.exit(0); } }); finalGroup.add(new Option("version", Messages.getString("Parser.PrintVersion")) //$NON-NLS-1$ //$NON-NLS-2$ { public void parsed(String argument) throws OptionException { System.out.println(versionString); System.exit(0); } }); finalGroup.add(new Option('J', Messages.getString("Parser.JArgument"), Messages.getString("Parser.JName")) //$NON-NLS-1$ //$NON-NLS-2$ { public void parsed(String argument) throws OptionException { // -J should be handled by the appletviewer wrapper binary. // We add it here so that it shows up in the --help output. // Note that there is a special case for this in OptionGroup. } }); add(finalGroup); add(defaultGroup); }
throws NotImplementedException
public void addAccessibleSelection(int i) throws NotImplementedException { // TODO: Implement this properly. }
setSelectedIndex(i);
public void addAccessibleSelection(int i) throws NotImplementedException { // TODO: Implement this properly. }
throws NotImplementedException
public void clearAccessibleSelection() throws NotImplementedException { // TODO: Implement this properly. }
throws NotImplementedException
public Accessible getAccessibleAt(Point p) throws NotImplementedException { return null; }
return null;
int tabIndex = indexAtLocation(p.x, p.y); if (tabIndex >= 0) return getAccessibleChild(tabIndex); else return getAccessibleSelection(0);
public Accessible getAccessibleAt(Point p) throws NotImplementedException { return null; }
throws NotImplementedException
public int getAccessibleChildrenCount() throws NotImplementedException { return 0; }
return 0;
return getTabCount();
public int getAccessibleChildrenCount() throws NotImplementedException { return 0; }
throws NotImplementedException
public AccessibleRole getAccessibleRole() throws NotImplementedException { return null; }
return null;
return AccessibleRole.PAGE_TAB_LIST;
public AccessibleRole getAccessibleRole() throws NotImplementedException { return null; }
throws NotImplementedException
public AccessibleSelection getAccessibleSelection() throws NotImplementedException { return null; }
return null;
return this;
public AccessibleSelection getAccessibleSelection() throws NotImplementedException { return null; }
throws NotImplementedException
public int getAccessibleSelectionCount() throws NotImplementedException { return 0; }
return 0;
return 1;
public int getAccessibleSelectionCount() throws NotImplementedException { return 0; }
throws NotImplementedException
public boolean isAccessibleChildSelected(int i) throws NotImplementedException { return false; }
return false;
return i == getSelectedIndex();
public boolean isAccessibleChildSelected(int i) throws NotImplementedException { return false; }
throws NotImplementedException
public void removeAccessibleSelection(int i) throws NotImplementedException { // TODO: Implement this properly. }
throws NotImplementedException
public void selectAllAccessibleSelection() throws NotImplementedException { // TODO: Implement this properly. }
throws NotImplementedException
public void stateChanged(ChangeEvent e) throws NotImplementedException { // Implement this properly. }
Object source = e.getSource(); firePropertyChange(AccessibleContext.ACCESSIBLE_SELECTION_PROPERTY, null, source);
public void stateChanged(ChangeEvent e) throws NotImplementedException { // Implement this properly. }
throws NotImplementedException
public int getAccessibleIndexInParent() throws NotImplementedException { // FIXME: Implement this properly. return 0; }
return 0;
return indexOfTab(title);
public int getAccessibleIndexInParent() throws NotImplementedException { // FIXME: Implement this properly. return 0; }
throws NotImplementedException
public AccessibleStateSet getAccessibleStateSet() throws NotImplementedException { // FIXME: Implement this properly. return null; }
return null;
AccessibleContext parentCtx = JTabbedPane.this.getAccessibleContext(); AccessibleStateSet state = parentCtx.getAccessibleStateSet(); state.add(AccessibleState.SELECTABLE); if (component == getSelectedComponent()) state.add(AccessibleState.SELECTED); return state;
public AccessibleStateSet getAccessibleStateSet() throws NotImplementedException { // FIXME: Implement this properly. return null; }
accessibleContext = new AccessibleJTabbedPane();
{ AccessibleJTabbedPane ctx = new AccessibleJTabbedPane(); addChangeListener(ctx); accessibleContext = ctx; }
public AccessibleContext getAccessibleContext() { if (accessibleContext == null) accessibleContext = new AccessibleJTabbedPane(); return accessibleContext; }
return "JTabbedPane";
StringBuffer sb = new StringBuffer(super.paramString()); sb.append(",tabPlacement="); if (tabPlacement == TOP) sb.append("TOP"); if (tabPlacement == BOTTOM) sb.append("BOTTOM"); if (tabPlacement == LEFT) sb.append("LEFT"); if (tabPlacement == RIGHT) sb.append("RIGHT"); return sb.toString();
protected String paramString() { return "JTabbedPane"; }
String mc = System.getProperty("http.maxConnections"); maxConnections = (mc != null && mc.length() > 0) ? Math.max(Integer.parseInt(mc), 1) : 5;
public Object run() { proxyHostname = System.getProperty("http.proxyHost"); if (proxyHostname != null && proxyHostname.length() > 0) { String port = System.getProperty("http.proxyPort"); if (port != null && port.length() > 0) { proxyPort = Integer.parseInt(port); } else { proxyHostname = null; proxyPort = -1; } } agent = System.getProperty("http.agent"); String ka = System.getProperty("http.keepAlive"); keepAlive = !(ka != null && "false".equals(ka)); String mc = System.getProperty("http.maxConnections"); maxConnections = (mc != null && mc.length() > 0) ? Math.max(Integer.parseInt(mc), 1) : 5; return null; }
Object key = HTTPConnection.getPoolKey(host, port, secure); synchronized (connectionPool) { connection = (HTTPConnection) connectionPool.remove(key); if (connection == null) { connection = new HTTPConnection(host, port, secure); connection.setPool(connectionPool); } }
connection = HTTPConnection.Pool.instance.get(host, port, secure);
HTTPConnection getConnection(String host, int port, boolean secure) throws IOException { HTTPConnection connection; if (keepAlive) { Object key = HTTPConnection.getPoolKey(host, port, secure); synchronized (connectionPool) { connection = (HTTPConnection) connectionPool.remove(key); if (connection == null) { connection = new HTTPConnection(host, port, secure); connection.setPool(connectionPool); } } } else { connection = new HTTPConnection(host, port, secure); } return connection; }
return offset;
return offset != pos ? offset : -1;
protected int layoutRow(FlowView fv, int rowIndex, int pos) { View row = fv.getView(rowIndex); int axis = fv.getFlowAxis(); int span = fv.getFlowSpan(rowIndex); int x = fv.getFlowStart(rowIndex); int offset = pos; View logicalView = getLogicalView(fv); // Special case when span == 0. We need to layout the row as if it had // a span of Integer.MAX_VALUE. if (span == 0) span = Integer.MAX_VALUE; while (span > 0) { if (logicalView.getViewIndex(offset, Position.Bias.Forward) == -1) break; View view = createView(fv, offset, span, rowIndex); if (view == null) break; int viewSpan = (int) view.getPreferredSpan(axis); row.append(view); int breakWeight = view.getBreakWeight(axis, x, span); if (breakWeight >= View.ForcedBreakWeight) break; x += viewSpan; span -= viewSpan; offset += (view.getEndOffset() - view.getStartOffset()); } if (span < 0) { int flowStart = fv.getFlowStart(axis); int flowSpan = fv.getFlowSpan(axis); adjustRow(fv, rowIndex, flowSpan, flowStart); int rowViewCount = row.getViewCount(); offset = row.getView(rowViewCount - 1).getEndOffset(); } return offset; }
LogicalView(Element el) { super(el); children = new Vector();
LogicalView(Element el, int axis) { super(el, axis);
LogicalView(Element el) { super(el); children = new Vector(); }
layoutPool = new LogicalView(getElement());
layoutPool = new LogicalView(getElement(), getAxis());
protected void loadChildren(ViewFactory vf) { if (layoutPool == null) { layoutPool = new LogicalView(getElement()); layoutPool.setParent(this); Element el = getElement(); int count = el.getElementCount(); for (int i = 0; i < count; ++i) { Element childEl = el.getElement(i); View childView = vf.create(childEl); layoutPool.append(childView); } } }
Element el = getElement(); int count = el.getElementCount(); for (int i = 0; i < count; ++i) { Element childEl = el.getElement(i); View childView = vf.create(childEl); layoutPool.append(childView); }
protected void loadChildren(ViewFactory vf) { if (layoutPool == null) { layoutPool = new LogicalView(getElement()); layoutPool.setParent(this); Element el = getElement(); int count = el.getElementCount(); for (int i = 0; i < count; ++i) { Element childEl = el.getElement(i); View childView = vf.create(childEl); layoutPool.append(childView); } } }
checkIsConstructed(derSPKI, "Wrong SubjectPublicKeyInfo field");
DerUtil.checkIsConstructed(derSPKI, "Wrong SubjectPublicKeyInfo field");
public PublicKey decodePublicKey(byte[] input) { if (input == null) throw new InvalidParameterException("Input bytes MUST NOT be null"); BigInteger n, e; DERReader der = new DERReader(input); try { DERValue derSPKI = der.read(); checkIsConstructed(derSPKI, "Wrong SubjectPublicKeyInfo field"); DERValue derAlgorithmID = der.read(); checkIsConstructed(derAlgorithmID, "Wrong AlgorithmIdentifier field"); DERValue derOID = der.read(); if (! (derOID.getValue() instanceof OID)) throw new InvalidParameterException("Wrong Algorithm field"); OID algOID = (OID) derOID.getValue(); if (! algOID.equals(RSA_ALG_OID)) throw new InvalidParameterException("Unexpected OID: " + algOID); DERValue val = der.read(); if (! (val.getValue() instanceof BitString)) throw new InvalidParameterException("Wrong SubjectPublicKey field"); byte[] spkBytes = ((BitString) val.getValue()).toByteArray(); der = new DERReader(spkBytes); val = der.read(); checkIsConstructed(derAlgorithmID, "Wrong subjectPublicKey field"); val = der.read(); checkIsBigInteger(val, "Wrong modulus field"); n = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong publicExponent field"); e = (BigInteger) val.getValue(); } catch (IOException x) { InvalidParameterException y = new InvalidParameterException(); y.initCause(x); throw y; } return new GnuRSAPublicKey(Registry.X509_ENCODING_ID, n, e); }
checkIsConstructed(derAlgorithmID, "Wrong AlgorithmIdentifier field");
DerUtil.checkIsConstructed(derAlgorithmID, "Wrong AlgorithmIdentifier field");
public PublicKey decodePublicKey(byte[] input) { if (input == null) throw new InvalidParameterException("Input bytes MUST NOT be null"); BigInteger n, e; DERReader der = new DERReader(input); try { DERValue derSPKI = der.read(); checkIsConstructed(derSPKI, "Wrong SubjectPublicKeyInfo field"); DERValue derAlgorithmID = der.read(); checkIsConstructed(derAlgorithmID, "Wrong AlgorithmIdentifier field"); DERValue derOID = der.read(); if (! (derOID.getValue() instanceof OID)) throw new InvalidParameterException("Wrong Algorithm field"); OID algOID = (OID) derOID.getValue(); if (! algOID.equals(RSA_ALG_OID)) throw new InvalidParameterException("Unexpected OID: " + algOID); DERValue val = der.read(); if (! (val.getValue() instanceof BitString)) throw new InvalidParameterException("Wrong SubjectPublicKey field"); byte[] spkBytes = ((BitString) val.getValue()).toByteArray(); der = new DERReader(spkBytes); val = der.read(); checkIsConstructed(derAlgorithmID, "Wrong subjectPublicKey field"); val = der.read(); checkIsBigInteger(val, "Wrong modulus field"); n = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong publicExponent field"); e = (BigInteger) val.getValue(); } catch (IOException x) { InvalidParameterException y = new InvalidParameterException(); y.initCause(x); throw y; } return new GnuRSAPublicKey(Registry.X509_ENCODING_ID, n, e); }
checkIsConstructed(derAlgorithmID, "Wrong subjectPublicKey field");
DerUtil.checkIsConstructed(derAlgorithmID, "Wrong subjectPublicKey field");
public PublicKey decodePublicKey(byte[] input) { if (input == null) throw new InvalidParameterException("Input bytes MUST NOT be null"); BigInteger n, e; DERReader der = new DERReader(input); try { DERValue derSPKI = der.read(); checkIsConstructed(derSPKI, "Wrong SubjectPublicKeyInfo field"); DERValue derAlgorithmID = der.read(); checkIsConstructed(derAlgorithmID, "Wrong AlgorithmIdentifier field"); DERValue derOID = der.read(); if (! (derOID.getValue() instanceof OID)) throw new InvalidParameterException("Wrong Algorithm field"); OID algOID = (OID) derOID.getValue(); if (! algOID.equals(RSA_ALG_OID)) throw new InvalidParameterException("Unexpected OID: " + algOID); DERValue val = der.read(); if (! (val.getValue() instanceof BitString)) throw new InvalidParameterException("Wrong SubjectPublicKey field"); byte[] spkBytes = ((BitString) val.getValue()).toByteArray(); der = new DERReader(spkBytes); val = der.read(); checkIsConstructed(derAlgorithmID, "Wrong subjectPublicKey field"); val = der.read(); checkIsBigInteger(val, "Wrong modulus field"); n = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong publicExponent field"); e = (BigInteger) val.getValue(); } catch (IOException x) { InvalidParameterException y = new InvalidParameterException(); y.initCause(x); throw y; } return new GnuRSAPublicKey(Registry.X509_ENCODING_ID, n, e); }
checkIsBigInteger(val, "Wrong modulus field");
DerUtil.checkIsBigInteger(val, "Wrong modulus field");
public PublicKey decodePublicKey(byte[] input) { if (input == null) throw new InvalidParameterException("Input bytes MUST NOT be null"); BigInteger n, e; DERReader der = new DERReader(input); try { DERValue derSPKI = der.read(); checkIsConstructed(derSPKI, "Wrong SubjectPublicKeyInfo field"); DERValue derAlgorithmID = der.read(); checkIsConstructed(derAlgorithmID, "Wrong AlgorithmIdentifier field"); DERValue derOID = der.read(); if (! (derOID.getValue() instanceof OID)) throw new InvalidParameterException("Wrong Algorithm field"); OID algOID = (OID) derOID.getValue(); if (! algOID.equals(RSA_ALG_OID)) throw new InvalidParameterException("Unexpected OID: " + algOID); DERValue val = der.read(); if (! (val.getValue() instanceof BitString)) throw new InvalidParameterException("Wrong SubjectPublicKey field"); byte[] spkBytes = ((BitString) val.getValue()).toByteArray(); der = new DERReader(spkBytes); val = der.read(); checkIsConstructed(derAlgorithmID, "Wrong subjectPublicKey field"); val = der.read(); checkIsBigInteger(val, "Wrong modulus field"); n = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong publicExponent field"); e = (BigInteger) val.getValue(); } catch (IOException x) { InvalidParameterException y = new InvalidParameterException(); y.initCause(x); throw y; } return new GnuRSAPublicKey(Registry.X509_ENCODING_ID, n, e); }
checkIsBigInteger(val, "Wrong publicExponent field");
DerUtil.checkIsBigInteger(val, "Wrong publicExponent field");
public PublicKey decodePublicKey(byte[] input) { if (input == null) throw new InvalidParameterException("Input bytes MUST NOT be null"); BigInteger n, e; DERReader der = new DERReader(input); try { DERValue derSPKI = der.read(); checkIsConstructed(derSPKI, "Wrong SubjectPublicKeyInfo field"); DERValue derAlgorithmID = der.read(); checkIsConstructed(derAlgorithmID, "Wrong AlgorithmIdentifier field"); DERValue derOID = der.read(); if (! (derOID.getValue() instanceof OID)) throw new InvalidParameterException("Wrong Algorithm field"); OID algOID = (OID) derOID.getValue(); if (! algOID.equals(RSA_ALG_OID)) throw new InvalidParameterException("Unexpected OID: " + algOID); DERValue val = der.read(); if (! (val.getValue() instanceof BitString)) throw new InvalidParameterException("Wrong SubjectPublicKey field"); byte[] spkBytes = ((BitString) val.getValue()).toByteArray(); der = new DERReader(spkBytes); val = der.read(); checkIsConstructed(derAlgorithmID, "Wrong subjectPublicKey field"); val = der.read(); checkIsBigInteger(val, "Wrong modulus field"); n = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong publicExponent field"); e = (BigInteger) val.getValue(); } catch (IOException x) { InvalidParameterException y = new InvalidParameterException(); y.initCause(x); throw y; } return new GnuRSAPublicKey(Registry.X509_ENCODING_ID, n, e); }
final int size = os.getMode().getSize();
final Label label = genLabel("$$class-init");
public final boolean writeClassInitialize(VmMethod method) { // Only for static methods (non <clinit>) if (method.isStatic() && !method.isInitializer()) { // Only when class is not initialize final VmType< ? > cls = method.getDeclaringClass(); if (!cls.isInitialized()) { final GPR aax = this.AAX; final int size = os.getMode().getSize(); // Save eax os.writePUSH(aax); // Do the is initialized test // Move method.declaringClass -> EAX final int typeOfs = getSharedStaticsOffset(method .getDeclaringClass()); os.writeMOV(size, aax, STATICS, typeOfs); // Test declaringClass.modifiers os.writeTEST(BITS32, aax, entryPoints.getVmTypeState() .getOffset(), VmTypeState.ST_INITIALIZED); final Label afterInit = new Label(method.getMangledName() + "$$after-classinit"); os.writeJCC(afterInit, X86Constants.JNZ); // Call cls.initialize os.writePUSH(aax); invokeJavaMethod(entryPoints.getVmTypeInitialize()); os.setObjectRef(afterInit); // Restore eax os.writePOP(aax); return true; } } return false; }
final int typeOfs = getSharedStaticsOffset(method .getDeclaringClass()); os.writeMOV(size, aax, STATICS, typeOfs); os.writeTEST(BITS32, aax, entryPoints.getVmTypeState() .getOffset(), VmTypeState.ST_INITIALIZED); final Label afterInit = new Label(method.getMangledName() + "$$after-classinit"); os.writeJCC(afterInit, X86Constants.JNZ); os.writePUSH(aax); invokeJavaMethod(entryPoints.getVmTypeInitialize()); os.setObjectRef(afterInit);
writeGetStaticsEntry(label, aax, cls); writeClassInitialize(label, aax, cls);
public final boolean writeClassInitialize(VmMethod method) { // Only for static methods (non <clinit>) if (method.isStatic() && !method.isInitializer()) { // Only when class is not initialize final VmType< ? > cls = method.getDeclaringClass(); if (!cls.isInitialized()) { final GPR aax = this.AAX; final int size = os.getMode().getSize(); // Save eax os.writePUSH(aax); // Do the is initialized test // Move method.declaringClass -> EAX final int typeOfs = getSharedStaticsOffset(method .getDeclaringClass()); os.writeMOV(size, aax, STATICS, typeOfs); // Test declaringClass.modifiers os.writeTEST(BITS32, aax, entryPoints.getVmTypeState() .getOffset(), VmTypeState.ST_INITIALIZED); final Label afterInit = new Label(method.getMangledName() + "$$after-classinit"); os.writeJCC(afterInit, X86Constants.JNZ); // Call cls.initialize os.writePUSH(aax); invokeJavaMethod(entryPoints.getVmTypeInitialize()); os.setObjectRef(afterInit); // Restore eax os.writePOP(aax); return true; } } return false; }
os.writeXOR(dst, dst);
Vm.getVm().getCounter("### load " + dst.getName()).inc();
public final void writeLoadIsolatedStatics(Label curInstrLabel, String labelPrefix, GPR dst) { final int offset = entryPoints.getVmProcessorIsolatedStaticsTable() .getOffset(); if (os.isCode32()) { os.writeXOR(dst, dst); os.writePrefix(X86Constants.FS_PREFIX); os.writeMOV(INTSIZE, dst, dst, offset); } else { os.writeMOV(BITS64, dst, PROCESSOR64, offset); } }
os.writeMOV(INTSIZE, dst, dst, offset);
os.writeMOV(dst, offset);
public final void writeLoadIsolatedStatics(Label curInstrLabel, String labelPrefix, GPR dst) { final int offset = entryPoints.getVmProcessorIsolatedStaticsTable() .getOffset(); if (os.isCode32()) { os.writeXOR(dst, dst); os.writePrefix(X86Constants.FS_PREFIX); os.writeMOV(INTSIZE, dst, dst, offset); } else { os.writeMOV(BITS64, dst, PROCESSOR64, offset); } }
list.requestFocusInWindow();
public void mousePressed(MouseEvent event) { // TODO: What should be done here, if anything? }
InputMapUIResource parentInputMap = new InputMapUIResource(); ActionMap parentActionMap = new ActionMapUIResource(); action = new ListAction(); Object keys[] = focusInputMap.allKeys(); for (int i = 0; i < keys.length; i++)
SwingUtilities.replaceUIInputMap(list, JComponent.WHEN_FOCUSED, focusInputMap); ActionMap am = (ActionMap) UIManager.get("List.actionMap"); if (am == null)
protected void installKeyboardActions() { InputMap focusInputMap = (InputMap) UIManager.get("List.focusInputMap"); InputMapUIResource parentInputMap = new InputMapUIResource(); // FIXME: The JDK uses a LazyActionMap for parentActionMap ActionMap parentActionMap = new ActionMapUIResource(); action = new ListAction(); Object keys[] = focusInputMap.allKeys(); // Register key bindings in the UI InputMap-ActionMap pair for (int i = 0; i < keys.length; i++) { KeyStroke stroke = (KeyStroke) keys[i]; String actionString = (String) focusInputMap.get(stroke); parentInputMap.put(KeyStroke.getKeyStroke(stroke.getKeyCode(), stroke.getModifiers()), actionString); parentActionMap.put(actionString, new ActionListenerProxy(action, actionString)); } // Register the new InputMap-ActionMap as the parents of the list's // InputMap and ActionMap parentInputMap.setParent(list.getInputMap().getParent()); parentActionMap.setParent(list.getActionMap().getParent()); list.getInputMap().setParent(parentInputMap); list.getActionMap().setParent(parentActionMap); }
KeyStroke stroke = (KeyStroke) keys[i]; String actionString = (String) focusInputMap.get(stroke); parentInputMap.put(KeyStroke.getKeyStroke(stroke.getKeyCode(), stroke.getModifiers()), actionString);
am = new ActionMapUIResource(); ListAction action; action = new ListAction("selectPreviousRow"); am.put("selectPreviousRow", action); action = new ListAction("selectNextRow"); am.put("selectNextRow", action); action = new ListAction("selectPreviousRowExtendSelection"); am.put("selectPreviousRowExtendSelection", action); action = new ListAction("selectNextRowExtendSelection"); am.put("selectNextRowExtendSelection", action);
protected void installKeyboardActions() { InputMap focusInputMap = (InputMap) UIManager.get("List.focusInputMap"); InputMapUIResource parentInputMap = new InputMapUIResource(); // FIXME: The JDK uses a LazyActionMap for parentActionMap ActionMap parentActionMap = new ActionMapUIResource(); action = new ListAction(); Object keys[] = focusInputMap.allKeys(); // Register key bindings in the UI InputMap-ActionMap pair for (int i = 0; i < keys.length; i++) { KeyStroke stroke = (KeyStroke) keys[i]; String actionString = (String) focusInputMap.get(stroke); parentInputMap.put(KeyStroke.getKeyStroke(stroke.getKeyCode(), stroke.getModifiers()), actionString); parentActionMap.put(actionString, new ActionListenerProxy(action, actionString)); } // Register the new InputMap-ActionMap as the parents of the list's // InputMap and ActionMap parentInputMap.setParent(list.getInputMap().getParent()); parentActionMap.setParent(list.getActionMap().getParent()); list.getInputMap().setParent(parentInputMap); list.getActionMap().setParent(parentActionMap); }
parentActionMap.put(actionString, new ActionListenerProxy(action, actionString));
action = new ListAction("selectPreviousColumn"); am.put("selectPreviousColumn", action); action = new ListAction("selectNextColumn"); am.put("selectNextColumn", action); action = new ListAction("selectPreviousColumnExtendSelection"); am.put("selectPreviousColumnExtendSelection", action); action = new ListAction("selectNextColumnExtendSelection"); am.put("selectNextColumnExtendSelection", action); action = new ListAction("selectFirstRow"); am.put("selectFirstRow", action); action = new ListAction("selectLastRow"); am.put("selectLastRow", action); action = new ListAction("selectFirstRowExtendSelection"); am.put("selectFirstRowExtendSelection", action); action = new ListAction("selectLastRowExtendSelection"); am.put("selectLastRowExtendSelection", action); action = new ListAction("scrollUp"); am.put("scrollUp", action); action = new ListAction("scrollUpExtendSelection"); am.put("scrollUpExtendSelection", action); action = new ListAction("scrollDown"); am.put("scrollDown", action); action = new ListAction("scrollDownExtendSelection"); am.put("scrollDownExtendSelection", action); action = new ListAction("selectAll"); am.put("selectAll", action); action = new ListAction("clearSelection"); am.put("clearSelection", action); am.put("copy", TransferHandler.getCopyAction()); am.put("cut", TransferHandler.getCutAction()); am.put("paste", TransferHandler.getPasteAction()); UIManager.put("List.actionMap", am);
protected void installKeyboardActions() { InputMap focusInputMap = (InputMap) UIManager.get("List.focusInputMap"); InputMapUIResource parentInputMap = new InputMapUIResource(); // FIXME: The JDK uses a LazyActionMap for parentActionMap ActionMap parentActionMap = new ActionMapUIResource(); action = new ListAction(); Object keys[] = focusInputMap.allKeys(); // Register key bindings in the UI InputMap-ActionMap pair for (int i = 0; i < keys.length; i++) { KeyStroke stroke = (KeyStroke) keys[i]; String actionString = (String) focusInputMap.get(stroke); parentInputMap.put(KeyStroke.getKeyStroke(stroke.getKeyCode(), stroke.getModifiers()), actionString); parentActionMap.put(actionString, new ActionListenerProxy(action, actionString)); } // Register the new InputMap-ActionMap as the parents of the list's // InputMap and ActionMap parentInputMap.setParent(list.getInputMap().getParent()); parentActionMap.setParent(list.getActionMap().getParent()); list.getInputMap().setParent(parentInputMap); list.getActionMap().setParent(parentActionMap); }
parentInputMap.setParent(list.getInputMap().getParent()); parentActionMap.setParent(list.getActionMap().getParent()); list.getInputMap().setParent(parentInputMap); list.getActionMap().setParent(parentActionMap);
SwingUtilities.replaceUIActionMap(list, am);
protected void installKeyboardActions() { InputMap focusInputMap = (InputMap) UIManager.get("List.focusInputMap"); InputMapUIResource parentInputMap = new InputMapUIResource(); // FIXME: The JDK uses a LazyActionMap for parentActionMap ActionMap parentActionMap = new ActionMapUIResource(); action = new ListAction(); Object keys[] = focusInputMap.allKeys(); // Register key bindings in the UI InputMap-ActionMap pair for (int i = 0; i < keys.length; i++) { KeyStroke stroke = (KeyStroke) keys[i]; String actionString = (String) focusInputMap.get(stroke); parentInputMap.put(KeyStroke.getKeyStroke(stroke.getKeyCode(), stroke.getModifiers()), actionString); parentActionMap.put(actionString, new ActionListenerProxy(action, actionString)); } // Register the new InputMap-ActionMap as the parents of the list's // InputMap and ActionMap parentInputMap.setParent(list.getInputMap().getParent()); parentActionMap.setParent(list.getActionMap().getParent()); list.getInputMap().setParent(parentInputMap); list.getActionMap().setParent(parentActionMap); }
0, isSel, hasFocus);
row, isSel, hasFocus);
protected void paintCell(Graphics g, int row, Rectangle bounds, ListCellRenderer rend, ListModel data, ListSelectionModel sel, int lead) { boolean isSel = list.isSelectedIndex(row); boolean hasFocus = (list.getLeadSelectionIndex() == row) && BasicListUI.this.list.hasFocus(); Component comp = rend.getListCellRendererComponent(list, data.getElementAt(row), 0, isSel, hasFocus); rendererPane.paintComponent(g, comp, list, bounds); }
InputMap im = SwingUtilities.getUIInputMap(list, JComponent.WHEN_FOCUSED); if (im instanceof UIResource) SwingUtilities.replaceUIInputMap(list, JComponent.WHEN_FOCUSED, null); if (SwingUtilities.getUIActionMap(list) instanceof UIResource) SwingUtilities.replaceUIActionMap(list, null);
protected void uninstallKeyboardActions() throws NotImplementedException { // TODO: Implement this properly. }
if (vector.size() >= 10) {
if (vector.size() >= 20) {
public Object get() throws InterruptedException { synchronized (lock) { // wait until there is something to read while (isEmpty()) lock.wait(); // just something here to try. if (vector.size() >= 10) { vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); } // we have the lock and state we're seeking return vector.remove(0); } }
vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0);
public Object get() throws InterruptedException { synchronized (lock) { // wait until there is something to read while (isEmpty()) lock.wait(); // just something here to try. if (vector.size() >= 10) { vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); } // we have the lock and state we're seeking return vector.remove(0); } }
return new AccessibleStateSet();
AccessibleStateSet state = new AccessibleStateSet(); Rectangle visibleRect = getVisibleRect(); Rectangle cellRect = getCellRect(row, column, false); if (visibleRect.intersects(cellRect)) state.add(AccessibleState.SHOWING); if (isCellSelected(row, column)) state.add(AccessibleState.SELECTED); if (row == getSelectedRow() && column == getSelectedColumn()) state.add(AccessibleState.ACTIVE); state.add(AccessibleState.TRANSIENT); return state;
public AccessibleStateSet getAccessibleStateSet() { // TODO: What state shoiuld be returned here? return new AccessibleStateSet(); }
getCellEditor().addCellEditorListener(this);
lastSelectedRow = getSelectedRow(); lastSelectedColumn = getSelectedColumn(); TableCellEditor editor = getCellEditor(); if (editor != null) editor.addCellEditorListener(this);
protected AccessibleJTable() { getModel().addTableModelListener(this); getSelectionModel().addListSelectionListener(this); getColumnModel().addColumnModelListener(this); getCellEditor().addCellEditorListener(this); }
int r = getAccessibleRowAtIndex(i); int c = getAccessibleColumnAtIndex(i); changeSelection(r, c, true, false);
public void addAccessibleSelection(int i) { // TODO Auto-generated method stub }
clearSelection();
public void clearAccessibleSelection() { // TODO Auto-generated method stub }
firePropertyChange(AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY, null, null); handleColumnChange(AccessibleTableModelChange.INSERT, event.getFromIndex(), event.getToIndex());
public void columnAdded(TableColumnModelEvent event) { // TODO Auto-generated method stub }
firePropertyChange(AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY, null, null);
public void columnMarginChanged(ChangeEvent event) { // TODO Auto-generated method stub }
firePropertyChange(AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY, null, null); handleColumnChange(AccessibleTableModelChange.DELETE, event.getFromIndex(), event.getFromIndex()); handleColumnChange(AccessibleTableModelChange.INSERT, event.getFromIndex(), event.getToIndex());
public void columnMoved(TableColumnModelEvent event) { // TODO Auto-generated method stub }
firePropertyChange(AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY, null, null); handleColumnChange(AccessibleTableModelChange.DELETE, event.getFromIndex(), event.getToIndex());
public void columnRemoved(TableColumnModelEvent event) { // TODO Auto-generated method stub }
firePropertyChange(AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY, null, null);
public void editingStopped(ChangeEvent event) { // TODO Auto-generated method stub }
return null;
return getAccessibleChild(r * getAccessibleColumnCount() + c);
public Accessible getAccessibleAt(int r, int c) { // TODO Auto-generated method stub return null; }
return null;
return caption;
public Accessible getAccessibleCaption() { // TODO Auto-generated method stub return null; }