rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
System.out.println(date.toLocaleString());
System.out.println(DateFormat.getInstance().format(date));
public static Date getDateForNTFSTimes(long _100ns) { long timeoffset = Math.abs((369 * 365 + 89) * 24 * 3600 * 10000000); long time = (Math.abs(_100ns) - timeoffset); System.out.println("hours" + ((Math.abs(time) / 1000) / 60) / 60); Date date = new Date(time); System.out.println(date.toLocaleString()); return date; }
dirtyComponents = new Hashtable(); invalidComponents = new Vector();
dirtyComponents = new HashMap(); workDirtyComponents = new HashMap(); repaintOrder = new ArrayList(); workRepaintOrder = new ArrayList(); invalidComponents = new ArrayList(); workInvalidComponents = new ArrayList();
public RepaintManager() { dirtyComponents = new Hashtable(); invalidComponents = new Vector(); repaintWorker = new RepaintWorker(); doubleBufferMaximumSize = new Dimension(2000,2000); doubleBufferingEnabled = true; }
if (w == 0 || h == 0)
if (w == 0 || h == 0 || !component.isShowing())
public synchronized void addDirtyRegion(JComponent component, int x, int y, int w, int h) { if (w == 0 || h == 0) return; Rectangle r = new Rectangle(x, y, w, h); if (dirtyComponents.containsKey(component)) r = r.union((Rectangle)dirtyComponents.get(component)); dirtyComponents.put(component, r); if (! repaintWorker.isLive()) { repaintWorker.setLive(true); SwingUtilities.invokeLater(repaintWorker); } }
else insertInRepaintOrder(component);
public synchronized void addDirtyRegion(JComponent component, int x, int y, int w, int h) { if (w == 0 || h == 0) return; Rectangle r = new Rectangle(x, y, w, h); if (dirtyComponents.containsKey(component)) r = r.union((Rectangle)dirtyComponents.get(component)); dirtyComponents.put(component, r); if (! repaintWorker.isLive()) { repaintWorker.setLive(true); SwingUtilities.invokeLater(repaintWorker); } }
return (Rectangle) dirtyComponents.get(component);
Rectangle dirty = (Rectangle) dirtyComponents.get(component); if (dirty == null) dirty = new Rectangle(); return dirty;
public Rectangle getDirtyRegion(JComponent component) { return (Rectangle) dirtyComponents.get(component); }
Rectangle dirty = (Rectangle) dirtyComponents.get(component); if (dirty == null)
if (! dirtyComponents.containsKey(component))
public boolean isCompletelyDirty(JComponent component) { Rectangle dirty = (Rectangle) dirtyComponents.get(component); if (dirty == null) return false; Rectangle r = component.getBounds(); if (r == null) return true; return dirty.contains(r); }
Rectangle r = component.getBounds(); if (r == null) return true; return dirty.contains(r);
return component.isCompletelyDirty;
public boolean isCompletelyDirty(JComponent component) { Rectangle dirty = (Rectangle) dirtyComponents.get(component); if (dirty == null) return false; Rectangle r = component.getBounds(); if (r == null) return true; return dirty.contains(r); }
component.isCompletelyDirty = false; }
public void markCompletelyClean(JComponent component) { dirtyComponents.remove(component); }
component.isCompletelyDirty = true;
public void markCompletelyDirty(JComponent component) { Rectangle r = component.getBounds(); addDirtyRegion(component, r.x, r.y, r.width, r.height); }
public void paintDirtyRegions() { HashMap roots = new HashMap(); for (Enumeration e = dirtyComponents.keys(); e.hasMoreElements(); )
public synchronized void paintDirtyRegions()
public void paintDirtyRegions() { // step 1: pull out roots and calculate spanning damage HashMap roots = new HashMap(); for (Enumeration e = dirtyComponents.keys(); e.hasMoreElements(); ) { JComponent comp = (JComponent) e.nextElement(); if (! (comp.isVisible() && comp.isShowing())) continue; Rectangle damaged = getDirtyRegion(comp); if (damaged.width == 0 || damaged.height == 0) continue; JRootPane root = comp.getRootPane(); // If the component has no root, no repainting will occur. if (root == null) continue; Rectangle rootDamage = SwingUtilities.convertRectangle(comp, damaged, root); if (! roots.containsKey(root)) { roots.put(root, rootDamage); } else { roots.put(root, ((Rectangle)roots.get(root)).union(rootDamage)); } } dirtyComponents.clear(); // step 2: paint those roots Iterator i = roots.entrySet().iterator(); while(i.hasNext()) { Map.Entry ent = (Map.Entry) i.next(); JRootPane root = (JRootPane) ent.getKey(); Rectangle rect = (Rectangle) ent.getValue(); root.paintImmediately(rect); } }
JComponent comp = (JComponent) e.nextElement(); if (! (comp.isVisible() && comp.isShowing()))
synchronized(this) { ArrayList swap = workRepaintOrder; workRepaintOrder = repaintOrder; repaintOrder = swap; HashMap swap2 = workDirtyComponents; workDirtyComponents = dirtyComponents; dirtyComponents = swap2; } for (Iterator i = workRepaintOrder.iterator(); i.hasNext();) { JComponent comp = (JComponent) i.next(); Rectangle damaged = (Rectangle) workDirtyComponents.get(comp); if (damaged == null || damaged.isEmpty())
public void paintDirtyRegions() { // step 1: pull out roots and calculate spanning damage HashMap roots = new HashMap(); for (Enumeration e = dirtyComponents.keys(); e.hasMoreElements(); ) { JComponent comp = (JComponent) e.nextElement(); if (! (comp.isVisible() && comp.isShowing())) continue; Rectangle damaged = getDirtyRegion(comp); if (damaged.width == 0 || damaged.height == 0) continue; JRootPane root = comp.getRootPane(); // If the component has no root, no repainting will occur. if (root == null) continue; Rectangle rootDamage = SwingUtilities.convertRectangle(comp, damaged, root); if (! roots.containsKey(root)) { roots.put(root, rootDamage); } else { roots.put(root, ((Rectangle)roots.get(root)).union(rootDamage)); } } dirtyComponents.clear(); // step 2: paint those roots Iterator i = roots.entrySet().iterator(); while(i.hasNext()) { Map.Entry ent = (Map.Entry) i.next(); JRootPane root = (JRootPane) ent.getKey(); Rectangle rect = (Rectangle) ent.getValue(); root.paintImmediately(rect); } }
Rectangle damaged = getDirtyRegion(comp); if (damaged.width == 0 || damaged.height == 0) continue; JRootPane root = comp.getRootPane(); if (root == null) continue; Rectangle rootDamage = SwingUtilities.convertRectangle(comp, damaged, root); if (! roots.containsKey(root)) { roots.put(root, rootDamage); } else { roots.put(root, ((Rectangle)roots.get(root)).union(rootDamage)); }
comp.paintImmediately(damaged);
public void paintDirtyRegions() { // step 1: pull out roots and calculate spanning damage HashMap roots = new HashMap(); for (Enumeration e = dirtyComponents.keys(); e.hasMoreElements(); ) { JComponent comp = (JComponent) e.nextElement(); if (! (comp.isVisible() && comp.isShowing())) continue; Rectangle damaged = getDirtyRegion(comp); if (damaged.width == 0 || damaged.height == 0) continue; JRootPane root = comp.getRootPane(); // If the component has no root, no repainting will occur. if (root == null) continue; Rectangle rootDamage = SwingUtilities.convertRectangle(comp, damaged, root); if (! roots.containsKey(root)) { roots.put(root, rootDamage); } else { roots.put(root, ((Rectangle)roots.get(root)).union(rootDamage)); } } dirtyComponents.clear(); // step 2: paint those roots Iterator i = roots.entrySet().iterator(); while(i.hasNext()) { Map.Entry ent = (Map.Entry) i.next(); JRootPane root = (JRootPane) ent.getKey(); Rectangle rect = (Rectangle) ent.getValue(); root.paintImmediately(rect); } }
dirtyComponents.clear(); Iterator i = roots.entrySet().iterator(); while(i.hasNext()) { Map.Entry ent = (Map.Entry) i.next(); JRootPane root = (JRootPane) ent.getKey(); Rectangle rect = (Rectangle) ent.getValue(); root.paintImmediately(rect); }
workRepaintOrder.clear(); workDirtyComponents.clear();
public void paintDirtyRegions() { // step 1: pull out roots and calculate spanning damage HashMap roots = new HashMap(); for (Enumeration e = dirtyComponents.keys(); e.hasMoreElements(); ) { JComponent comp = (JComponent) e.nextElement(); if (! (comp.isVisible() && comp.isShowing())) continue; Rectangle damaged = getDirtyRegion(comp); if (damaged.width == 0 || damaged.height == 0) continue; JRootPane root = comp.getRootPane(); // If the component has no root, no repainting will occur. if (root == null) continue; Rectangle rootDamage = SwingUtilities.convertRectangle(comp, damaged, root); if (! roots.containsKey(root)) { roots.put(root, rootDamage); } else { roots.put(root, ((Rectangle)roots.get(root)).union(rootDamage)); } } dirtyComponents.clear(); // step 2: paint those roots Iterator i = roots.entrySet().iterator(); while(i.hasNext()) { Map.Entry ent = (Map.Entry) i.next(); JRootPane root = (JRootPane) ent.getKey(); Rectangle rect = (Rectangle) ent.getValue(); root.paintImmediately(rect); } }
invalidComponents.removeElement(component);
invalidComponents.remove(component);
public synchronized void removeInvalidComponent(JComponent component) { invalidComponents.removeElement(component); }
for (Enumeration e = invalidComponents.elements(); e.hasMoreElements(); )
synchronized(this) { ArrayList swap = invalidComponents; invalidComponents = workInvalidComponents; workInvalidComponents = swap; } for (Iterator i = workInvalidComponents.iterator(); i.hasNext(); )
public void validateInvalidComponents() { for (Enumeration e = invalidComponents.elements(); e.hasMoreElements(); ) { JComponent comp = (JComponent) e.nextElement(); if (! (comp.isVisible() && comp.isShowing())) continue; comp.validate(); } invalidComponents.clear(); }
JComponent comp = (JComponent) e.nextElement();
JComponent comp = (JComponent) i.next();
public void validateInvalidComponents() { for (Enumeration e = invalidComponents.elements(); e.hasMoreElements(); ) { JComponent comp = (JComponent) e.nextElement(); if (! (comp.isVisible() && comp.isShowing())) continue; comp.validate(); } invalidComponents.clear(); }
invalidComponents.clear();
workInvalidComponents.clear();
public void validateInvalidComponents() { for (Enumeration e = invalidComponents.elements(); e.hasMoreElements(); ) { JComponent comp = (JComponent) e.nextElement(); if (! (comp.isVisible() && comp.isShowing())) continue; comp.validate(); } invalidComponents.clear(); }
} else if (name.equals(XMLNS_URIs)) { return uris;
public boolean getFeature (String name) throws SAXNotRecognizedException, SAXNotSupportedException { if (name.equals(NAMESPACES)) { return namespaces; } else if (name.equals(NAMESPACE_PREFIXES)) { return prefixes; } else { throw new SAXNotRecognizedException("Feature: " + name); } }
} else if (name.equals(XMLNS_URIs)) { checkNotParsing("feature", name); uris = value;
public void setFeature (String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException { if (name.equals(NAMESPACES)) { checkNotParsing("feature", name); namespaces = value; if (!namespaces && !prefixes) { prefixes = true; } } else if (name.equals(NAMESPACE_PREFIXES)) { checkNotParsing("feature", name); prefixes = value; if (!prefixes && !namespaces) { namespaces = true; } } else { throw new SAXNotRecognizedException("Feature: " + name); } }
if (uris) nsSupport.setNamespaceDeclUris (true);
private void setupParser () { nsSupport.reset(); if (entityResolver != null) { parser.setEntityResolver(entityResolver); } if (dtdHandler != null) { parser.setDTDHandler(dtdHandler); } if (errorHandler != null) { parser.setErrorHandler(errorHandler); } parser.setDocumentHandler(this); locator = null; }
prefix = attQName.substring(n+1);
prefix = attQName.substring(6);
public void startElement (String qName, AttributeList qAtts) throws SAXException { // These are exceptions from the // first pass; they should be // ignored if there's a second pass, // but reported otherwise. Vector exceptions = null; // If we're not doing Namespace // processing, dispatch this quickly. if (!namespaces) { if (contentHandler != null) { attAdapter.setAttributeList(qAtts); contentHandler.startElement("", "", qName.intern(), attAdapter); } return; } // OK, we're doing Namespace processing. nsSupport.pushContext(); int length = qAtts.getLength(); // First pass: handle NS decls for (int i = 0; i < length; i++) { String attQName = qAtts.getName(i); if (!attQName.startsWith("xmlns")) continue; // Could be a declaration... String prefix; int n = attQName.indexOf(':'); // xmlns=... if (n == -1 && attQName.length () == 5) { prefix = ""; } else if (n != 5) { // XML namespaces spec doesn't discuss "xmlnsf:oo" // (and similarly named) attributes ... at most, warn continue; } else // xmlns:foo=... prefix = attQName.substring(n+1); String value = qAtts.getValue(i); if (!nsSupport.declarePrefix(prefix, value)) { reportError("Illegal Namespace prefix: " + prefix); continue; } if (contentHandler != null) contentHandler.startPrefixMapping(prefix, value); } // Second pass: copy all relevant // attributes into the SAX2 AttributeList // using updated prefix bindings atts.clear(); for (int i = 0; i < length; i++) { String attQName = qAtts.getName(i); String type = qAtts.getType(i); String value = qAtts.getValue(i); // Declaration? if (attQName.startsWith("xmlns")) { String prefix; int n = attQName.indexOf(':'); if (n == -1 && attQName.length () == 5) { prefix = ""; } else if (n != 5) { // XML namespaces spec doesn't discuss "xmlnsf:oo" // (and similarly named) attributes ... ignore prefix = null; } else { prefix = attQName.substring(n+1); } // Yes, decl: report or prune if (prefix != null) { if (prefixes) atts.addAttribute("", "", attQName.intern(), type, value); continue; } } // Not a declaration -- report try { String attName[] = processName(attQName, true, true); atts.addAttribute(attName[0], attName[1], attName[2], type, value); } catch (SAXException e) { if (exceptions == null) exceptions = new Vector(); exceptions.addElement(e); atts.addAttribute("", attQName, attQName, type, value); } } // now handle the deferred exception reports if (exceptions != null && errorHandler != null) { for (int i = 0; i < exceptions.size(); i++) errorHandler.error((SAXParseException) (exceptions.elementAt(i))); } // OK, finally report the event. if (contentHandler != null) { String name[] = processName(qName, false, false); contentHandler.startElement(name[0], name[1], name[2], atts); } }
if (prefixes) atts.addAttribute("", "", attQName.intern(), type, value);
if (prefixes) { if (uris) atts.addAttribute (nsSupport.XMLNS, prefix, attQName.intern(), type, value); else atts.addAttribute ("", "", attQName.intern(), type, value); }
public void startElement (String qName, AttributeList qAtts) throws SAXException { // These are exceptions from the // first pass; they should be // ignored if there's a second pass, // but reported otherwise. Vector exceptions = null; // If we're not doing Namespace // processing, dispatch this quickly. if (!namespaces) { if (contentHandler != null) { attAdapter.setAttributeList(qAtts); contentHandler.startElement("", "", qName.intern(), attAdapter); } return; } // OK, we're doing Namespace processing. nsSupport.pushContext(); int length = qAtts.getLength(); // First pass: handle NS decls for (int i = 0; i < length; i++) { String attQName = qAtts.getName(i); if (!attQName.startsWith("xmlns")) continue; // Could be a declaration... String prefix; int n = attQName.indexOf(':'); // xmlns=... if (n == -1 && attQName.length () == 5) { prefix = ""; } else if (n != 5) { // XML namespaces spec doesn't discuss "xmlnsf:oo" // (and similarly named) attributes ... at most, warn continue; } else // xmlns:foo=... prefix = attQName.substring(n+1); String value = qAtts.getValue(i); if (!nsSupport.declarePrefix(prefix, value)) { reportError("Illegal Namespace prefix: " + prefix); continue; } if (contentHandler != null) contentHandler.startPrefixMapping(prefix, value); } // Second pass: copy all relevant // attributes into the SAX2 AttributeList // using updated prefix bindings atts.clear(); for (int i = 0; i < length; i++) { String attQName = qAtts.getName(i); String type = qAtts.getType(i); String value = qAtts.getValue(i); // Declaration? if (attQName.startsWith("xmlns")) { String prefix; int n = attQName.indexOf(':'); if (n == -1 && attQName.length () == 5) { prefix = ""; } else if (n != 5) { // XML namespaces spec doesn't discuss "xmlnsf:oo" // (and similarly named) attributes ... ignore prefix = null; } else { prefix = attQName.substring(n+1); } // Yes, decl: report or prune if (prefix != null) { if (prefixes) atts.addAttribute("", "", attQName.intern(), type, value); continue; } } // Not a declaration -- report try { String attName[] = processName(attQName, true, true); atts.addAttribute(attName[0], attName[1], attName[2], type, value); } catch (SAXException e) { if (exceptions == null) exceptions = new Vector(); exceptions.addElement(e); atts.addAttribute("", attQName, attQName, type, value); } } // now handle the deferred exception reports if (exceptions != null && errorHandler != null) { for (int i = 0; i < exceptions.size(); i++) errorHandler.error((SAXParseException) (exceptions.elementAt(i))); } // OK, finally report the event. if (contentHandler != null) { String name[] = processName(qName, false, false); contentHandler.startElement(name[0], name[1], name[2], atts); } }
final Class cls = cl.loadClass(className);
final Class<?> cls = cl.loadClass(className);
final void startApp(final String name, final String className) { try { final Runnable runner = new Runnable() { public void run() { try { final ClassLoader cl = Thread.currentThread().getContextClassLoader(); final Class cls = cl.loadClass(className); final Method main = cls.getMethod("main", mainTypes); final Object[] args = { new String[0] }; main.invoke(null, args); } catch (SecurityException ex) { log.error("Security exception in starting class " + className, ex); } catch (ClassNotFoundException ex) { log.error("Cannot find class " + className); } catch (NoSuchMethodException ex) { log.error("Cannot find main method in " + className); } catch (IllegalAccessException ex) { log.error("Cannot access main method in " + className); } catch (InvocationTargetException ex) { log.error("Error in " + className, ex.getTargetException()); } } }; final Thread t = new Thread(runner); t.start(); } catch (SecurityException ex) { log.error("Security exception in starting class " + className, ex); } }
final Class cls = cl.loadClass(className);
final Class<?> cls = cl.loadClass(className);
public void run() { try { final ClassLoader cl = Thread.currentThread().getContextClassLoader(); final Class cls = cl.loadClass(className); final Method main = cls.getMethod("main", mainTypes); final Object[] args = { new String[0] }; main.invoke(null, args); } catch (SecurityException ex) { log.error("Security exception in starting class " + className, ex); } catch (ClassNotFoundException ex) { log.error("Cannot find class " + className); } catch (NoSuchMethodException ex) { log.error("Cannot find main method in " + className); } catch (IllegalAccessException ex) { log.error("Cannot access main method in " + className); } catch (InvocationTargetException ex) { log.error("Error in " + className, ex.getTargetException()); } }
catch(NumberFormatException e) { ; }
catch(NumberFormatException e) { }
public static Font decode (String fontspec){ String name = null; int style = PLAIN; int size = 12; StringTokenizer st = new StringTokenizer(fontspec, "-"); while (st.hasMoreTokens()) { String token = st.nextToken(); if (name == null) { name = token; continue; } if (token.toUpperCase().equals("BOLD")) { style = BOLD; continue; } if (token.toUpperCase().equals("ITALIC")) { style = ITALIC; continue; } if (token.toUpperCase().equals("BOLDITALIC")) { style = BOLD | ITALIC; continue; } int tokenval = 0; try { tokenval = Integer.parseInt(token); } catch(NumberFormatException e) { ; } if (tokenval != 0) size = tokenval; } HashMap attrs = new HashMap(); ClasspathFontPeer.copyStyleToAttrs (style, attrs); ClasspathFontPeer.copySizeToAttrs (size, attrs); return getFontFromToolkit (name, attrs);}
public UnmarshalException(String s, Exception e)
public UnmarshalException(String s)
public UnmarshalException(String s, Exception e) { super(s, e); }
super(s, e);
super(s);
public UnmarshalException(String s, Exception e) { super(s, e); }
File f = new File (url.getFile());
String fn = url.getFile(); fn = gnu.java.net.protocol.file.Connection.unquote(fn); File f = new File (fn);
public static synchronized JarFile get (URL url, boolean useCaches) throws IOException { JarFile jf; if (useCaches) { jf = (JarFile) cache.get (url); if (jf != null) return jf; } if ("file".equals (url.getProtocol())) { File f = new File (url.getFile()); jf = new JarFile (f, true, ZipFile.OPEN_READ); } else { URLConnection urlconn = url.openConnection(); InputStream is = urlconn.getInputStream(); byte[] buf = new byte [READBUFSIZE]; File f = File.createTempFile ("cache", "jar"); FileOutputStream fos = new FileOutputStream (f); int len = 0; while ((len = is.read (buf)) != -1) { fos.write (buf, 0, len); } fos.close(); // Always verify the Manifest, open read only and delete when done. jf = new JarFile (f, true, ZipFile.OPEN_READ | ZipFile.OPEN_DELETE); } if (useCaches) cache.put (url, jf); return jf; }
public INodeTable(Ext2FileSystem fs, int firstBlock) {
public INodeTable(Ext2FileSystem fs, int firstBlock) throws IOException {
public INodeTable(Ext2FileSystem fs, int firstBlock) { this.fs = fs; this.firstBlock = firstBlock; blockSize=fs.getSuperblock().getBlockSize(); blockCount = (int)Math.ceil( (double)(fs.getSuperblock().getINodesCount()*INode.INODE_LENGTH) / (double) blockSize); }
blockSize=fs.getSuperblock().getBlockSize();
blockSize=(int)fs.getBlockSize();
public INodeTable(Ext2FileSystem fs, int firstBlock) { this.fs = fs; this.firstBlock = firstBlock; blockSize=fs.getSuperblock().getBlockSize(); blockCount = (int)Math.ceil( (double)(fs.getSuperblock().getINodesCount()*INode.INODE_LENGTH) / (double) blockSize); }
(double)(fs.getSuperblock().getINodesCount()*INode.INODE_LENGTH) /
(double)(fs.getSuperblock().getINodesPerGroup()*INode.INODE_LENGTH) /
public INodeTable(Ext2FileSystem fs, int firstBlock) { this.fs = fs; this.firstBlock = firstBlock; blockSize=fs.getSuperblock().getBlockSize(); blockCount = (int)Math.ceil( (double)(fs.getSuperblock().getINodesCount()*INode.INODE_LENGTH) / (double) blockSize); }
addCompileHighOptLevel("org.jnode.naming");
protected void setupCompileHighOptLevelPackages() { addCompileHighOptLevel("java.io"); addCompileHighOptLevel("java.lang"); addCompileHighOptLevel("java.lang.ref"); addCompileHighOptLevel("java.lang.reflect"); addCompileHighOptLevel("java.net"); addCompileHighOptLevel("java.security"); addCompileHighOptLevel("java.util"); addCompileHighOptLevel("java.util.jar"); addCompileHighOptLevel("java.util.zip"); addCompileHighOptLevel("javax.naming"); addCompileHighOptLevel("gnu.classpath"); addCompileHighOptLevel("gnu.java.io"); addCompileHighOptLevel("gnu.java.io.decode"); addCompileHighOptLevel("gnu.java.io.encode"); addCompileHighOptLevel("gnu.java.lang"); addCompileHighOptLevel("gnu.java.lang.reflect"); addCompileHighOptLevel("org.jnode.assembler"); addCompileHighOptLevel("org.jnode.boot"); addCompileHighOptLevel("org.jnode.plugin"); addCompileHighOptLevel("org.jnode.plugin.manager"); addCompileHighOptLevel("org.jnode.plugin.model"); addCompileHighOptLevel("org.jnode.protocol.plugin"); addCompileHighOptLevel("org.jnode.protocol.system"); addCompileHighOptLevel("org.jnode.security"); addCompileHighOptLevel("org.jnode.system"); addCompileHighOptLevel("org.jnode.system.event"); addCompileHighOptLevel("org.jnode.system.util"); addCompileHighOptLevel("org.jnode.util"); addCompileHighOptLevel("org.jnode.vm"); addCompileHighOptLevel("org.jnode.vm.bytecode"); addCompileHighOptLevel("org.jnode.vm.classmgr"); addCompileHighOptLevel("org.jnode.vm.compiler"); addCompileHighOptLevel("org.jnode.vm.compiler.ir"); addCompileHighOptLevel("org.jnode.vm.compiler.ir.quad"); addCompileHighOptLevel("org.jnode.vm.memmgr"); addCompileHighOptLevel("org.jnode.vm.memmgr.def"); if (false) { addCompileHighOptLevel("java.awt"); addCompileHighOptLevel("java.awt.event"); addCompileHighOptLevel("java.awt.peer"); addCompileHighOptLevel("java.awt.font"); addCompileHighOptLevel("java.awt.geom"); addPreloadPackage("javax.swing"); addPreloadPackage("javax.swing.border"); addPreloadPackage("javax.swing.event"); addPreloadPackage("javax.swing.plaf"); addPreloadPackage("javax.swing.plaf.basic"); addPreloadPackage("javax.swing.plaf.metal"); } }
boolean hasParent = (currentDirectory.getParentFile() != null);
boolean hasParent = currentDirectory.getParentFile() != null;
public void propertyChange(PropertyChangeEvent e) { JFileChooser filechooser = getFileChooser(); String n = e.getPropertyName(); if (n.equals(JFileChooser.MULTI_SELECTION_ENABLED_CHANGED_PROPERTY)) { int mode = -1; if (filechooser.isMultiSelectionEnabled()) mode = ListSelectionModel.MULTIPLE_INTERVAL_SELECTION; else mode = ListSelectionModel.SINGLE_SELECTION; if (listView) fileList.setSelectionMode(mode); else fileTable.setSelectionMode(mode); } else if (n.equals(JFileChooser.SELECTED_FILE_CHANGED_PROPERTY)) { File file = filechooser.getSelectedFile(); if (file != null && filechooser.getDialogType() == JFileChooser.SAVE_DIALOG) { if (file.isDirectory() && filechooser.isTraversable(file)) { directoryLabel = look; dirLabel.setText(directoryLabel); filechooser.setApproveButtonText(openButtonText); filechooser.setApproveButtonToolTipText(openButtonToolTipText); } else if (file.isFile()) { directoryLabel = save; dirLabel.setText(directoryLabel); filechooser.setApproveButtonText(saveButtonText); filechooser.setApproveButtonToolTipText(saveButtonToolTipText); } } if (file == null) setFileName(null); else setFileName(file.getName()); int index = -1; index = getModel().indexOf(file); if (index >= 0) { if (listView) { fileList.setSelectedIndex(index); fileList.ensureIndexIsVisible(index); fileList.revalidate(); fileList.repaint(); } else { fileTable.getSelectionModel().addSelectionInterval(index, index); fileTable.scrollRectToVisible(fileTable.getCellRect(index, 0, true)); fileTable.revalidate(); fileTable.repaint(); } } } else if (n.equals(JFileChooser.DIRECTORY_CHANGED_PROPERTY)) { if (listView) { fileList.clearSelection(); fileList.revalidate(); fileList.repaint(); } else { fileTable.clearSelection(); fileTable.revalidate(); fileTable.repaint(); } setDirectorySelected(false); File currentDirectory = filechooser.getCurrentDirectory(); setDirectory(currentDirectory); boolean hasParent = (currentDirectory.getParentFile() != null); getChangeToParentDirectoryAction().setEnabled(hasParent); } else if (n.equals(JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY)) { filterModel.propertyChange(e); } else if (n.equals(JFileChooser.FILE_FILTER_CHANGED_PROPERTY)) { filterModel.propertyChange(e); } else if (n.equals(JFileChooser.DIALOG_TYPE_CHANGED_PROPERTY) || n.equals(JFileChooser.DIALOG_TITLE_CHANGED_PROPERTY)) { Window owner = SwingUtilities.windowForComponent(filechooser); if (owner instanceof JDialog) ((JDialog) owner).setTitle(getDialogTitle(filechooser)); approveButton.setText(getApproveButtonText(filechooser)); approveButton.setToolTipText( getApproveButtonToolTipText(filechooser)); approveButton.setMnemonic(getApproveButtonMnemonic(filechooser)); } else if (n.equals(JFileChooser.APPROVE_BUTTON_TEXT_CHANGED_PROPERTY)) approveButton.setText(getApproveButtonText(filechooser)); else if (n.equals( JFileChooser.APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY)) approveButton.setToolTipText(getApproveButtonToolTipText(filechooser)); else if (n.equals(JFileChooser.APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY)) approveButton.setMnemonic(getApproveButtonMnemonic(filechooser)); else if (n.equals( JFileChooser.CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY)) { if (filechooser.getControlButtonsAreShown()) { topPanel.add(controls, BorderLayout.EAST); } else topPanel.remove(controls); topPanel.revalidate(); topPanel.repaint(); topPanel.doLayout(); } else if (n.equals( JFileChooser.ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY)) { if (filechooser.isAcceptAllFileFilterUsed()) filechooser.addChoosableFileFilter( getAcceptAllFileFilter(filechooser)); else filechooser.removeChoosableFileFilter( getAcceptAllFileFilter(filechooser)); } else if (n.equals(JFileChooser.ACCESSORY_CHANGED_PROPERTY)) { JComponent old = (JComponent) e.getOldValue(); if (old != null) getAccessoryPanel().remove(old); JComponent newval = (JComponent) e.getNewValue(); if (newval != null) getAccessoryPanel().add(newval); } if (n.equals(JFileChooser.DIRECTORY_CHANGED_PROPERTY) || n.equals(JFileChooser.FILE_FILTER_CHANGED_PROPERTY) || n.equals(JFileChooser.FILE_HIDING_CHANGED_PROPERTY)) { // Remove editing component if (fileTable != null) fileTable.removeAll(); if (fileList != null) fileList.removeAll(); startEditing = false; // Set text on button back to original. if (filechooser.getDialogType() == JFileChooser.SAVE_DIALOG) { directoryLabel = save; dirLabel.setText(directoryLabel); filechooser.setApproveButtonText(saveButtonText); filechooser.setApproveButtonToolTipText(saveButtonToolTipText); } rescanCurrentDirectory(filechooser); } filechooser.revalidate(); filechooser.repaint(); }
protected int checkHorizontalKey(int key, String exception) { return 0; }
protected int checkHorizontalKey(int key, String exception) { switch (key) { case SwingConstants.RIGHT: case SwingConstants.LEFT: case SwingConstants.CENTER: case SwingConstants.LEADING: case SwingConstants.TRAILING: break; default: throw new IllegalArgumentException(exception); } return key; }
protected int checkHorizontalKey(int key, String exception) { // Verify that key is a legal value for the horizontalAlignment properties. return 0; }
protected int checkVerticalKey(int key, String exception) { return 0; }
protected int checkVerticalKey(int key, String exception) { switch (key) { case SwingConstants.TOP: case SwingConstants.BOTTOM: case SwingConstants.CENTER: break; default: throw new IllegalArgumentException(exception); } return key; }
protected int checkVerticalKey(int key, String exception) { // Ensures that the key is a valid. return 0; }
protected ActionListener createActionListener() { return new ActionListener() { public void actionPerformed(ActionEvent e) { } }; }
protected ActionListener createActionListener() { return new ActionListener() { public void actionPerformed(ActionEvent e) { e.setSource(AbstractButton.this); AbstractButton.this.fireActionPerformed(e); } }; }
protected ActionListener createActionListener() { return new ActionListener() { public void actionPerformed(ActionEvent e) { } }; }
public void actionPerformed(ActionEvent e) { }
public void actionPerformed(ActionEvent e) { e.setSource(AbstractButton.this); AbstractButton.this.fireActionPerformed(e); }
public void actionPerformed(ActionEvent e) { }
protected ChangeListener createChangeListener() { return new ChangeListener() { public void stateChanged(ChangeEvent e) { } }; }
protected ChangeListener createChangeListener() { return new ChangeListener() { public void stateChanged(ChangeEvent e) { AbstractButton.this.fireStateChanged(e); AbstractButton.this.revalidate(); AbstractButton.this.repaint(); } }; }
protected ChangeListener createChangeListener() { // Subclasses that want to handle ChangeEvents differently can override this to return another ChangeListener implementation. return new ChangeListener() { public void stateChanged(ChangeEvent e) { } }; }
protected ItemListener createItemListener() { return new ItemListener() { public void itemStateChanged(ItemEvent e) { } }; }
protected ItemListener createItemListener() { return new ItemListener() { public void itemStateChanged(ItemEvent e) { AbstractButton.this.fireItemStateChanged(e); } }; }
protected ItemListener createItemListener() { return new ItemListener() { public void itemStateChanged(ItemEvent e) { } }; }
protected void fireActionPerformed(ActionEvent event) { getModel().fireActionPerformed(event); }
public void fireActionPerformed(ActionEvent e) { EventListener[] ll = listenerList.getListeners(ActionListener.class); for (int i = 0; i < ll.length; i++) ((ActionListener)ll[i]).actionPerformed(e); }
protected void fireActionPerformed(ActionEvent event) { getModel().fireActionPerformed(event); }
protected void fireItemStateChanged(ItemEvent event) { getModel().fireItemStateChanged(event); }
public void fireItemStateChanged(ItemEvent e) { EventListener[] ll = listenerList.getListeners(ItemListener.class); for (int i = 0; i < ll.length; i++) ((ItemListener)ll[i]).itemStateChanged(e); }
protected void fireItemStateChanged(ItemEvent event) { getModel().fireItemStateChanged(event); }
protected void fireStateChanged(ChangeEvent event) { getModel().fireStateChanged(event); }
public void fireStateChanged(ChangeEvent e) { EventListener[] ll = listenerList.getListeners(ChangeListener.class); for (int i = 0; i < ll.length; i++) ((ChangeListener)ll[i]).stateChanged(e); }
protected void fireStateChanged(ChangeEvent event) { getModel().fireStateChanged(event); }
public Action getAction() { return action_taken; }
public Action getAction() { return action; }
public Action getAction() { return action_taken; }
public void removeActionListener(ActionListener l) { getModel().removeActionListener(l); }
public void removeActionListener(ActionListener l) { listenerList.remove(ActionListener.class, l); }
public void removeActionListener(ActionListener l) { getModel().removeActionListener(l); }
public void removeItemListener(ItemListener l) { getModel().removeItemListener(l); }
public void removeItemListener(ItemListener l) { listenerList.remove(ItemListener.class, l); }
public void removeItemListener(ItemListener l) { getModel().removeItemListener(l); }
firePropertyChange(FOCUS_PAINTED_CHANGED_PROPERTY, old, b); if (hasFocus()) { revalidate(); repaint(); } }
if (old != b) { firePropertyChange(FOCUS_PAINTED_CHANGED_PROPERTY, old, b); revalidate(); repaint(); } }
public void setFocusPainted(boolean b) { boolean old = paint_focus; paint_focus = b; firePropertyChange(FOCUS_PAINTED_CHANGED_PROPERTY, old, b); if (hasFocus()) { revalidate(); repaint(); } }
public void setPressedIcon(Icon pressedIcon) { pressed_button = pressedIcon; revalidate(); repaint(); }
public void setPressedIcon(Icon pressedIcon) { Icon old = pressed_icon; pressed_icon = pressedIcon; if (pressed_icon != old) { firePropertyChange(PRESSED_ICON_CHANGED_PROPERTY, old, pressed_icon); revalidate(); repaint(); } }
public void setPressedIcon(Icon pressedIcon) { pressed_button = pressedIcon; revalidate(); repaint(); }
public void setRolloverIcon(Icon rolloverIcon) { }
public void setRolloverIcon(Icon rolloverIcon) { Icon old = rollover_icon; rollover_icon = rolloverIcon; if (old != rolloverIcon) { firePropertyChange(ROLLOVER_ICON_CHANGED_PROPERTY, old, rolloverIcon); revalidate(); repaint(); } }
public void setRolloverIcon(Icon rolloverIcon) { // Sets the rollover icon for the button. }
public void setRolloverSelectedIcon(Icon rolloverSelectedIcon) { }
public void setRolloverSelectedIcon(Icon rolloverSelectedIcon) { Icon old = rollover_selected_icon; rollover_selected_icon = rolloverSelectedIcon; if (old != rolloverSelectedIcon) { firePropertyChange(ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, old, rolloverSelectedIcon); revalidate(); repaint(); } }
public void setRolloverSelectedIcon(Icon rolloverSelectedIcon) { // Sets the rollover selected icon for the button. }
public void setVerticalAlignment(int alignment) { vert_align = alignment; }
public void setVerticalAlignment(int a) { int old = vert_align; vert_align = a; if (old != a) { firePropertyChange(VERTICAL_ALIGNMENT_CHANGED_PROPERTY, old, a); revalidate(); repaint(); } }
public void setVerticalAlignment(int alignment) { vert_align = alignment; }
public void setVerticalTextPosition(int textPosition) { vert_text_pos = textPosition; }
public void setVerticalTextPosition(int t) { int old = vert_text_pos; vert_text_pos = t; if (old != t) { firePropertyChange(VERTICAL_TEXT_POSITION_CHANGED_PROPERTY, old, t); revalidate(); repaint(); } }
public void setVerticalTextPosition(int textPosition) { vert_text_pos = textPosition; }
setOpaque(true); text = "";
public AbstractButton() { actionListener = createActionListener(); changeListener = createChangeListener(); itemListener = createItemListener(); horizontalAlignment = CENTER; horizontalTextPosition = TRAILING; verticalAlignment = CENTER; verticalTextPosition = CENTER; borderPainted = true; contentAreaFilled = true; focusPainted = true; setFocusable(true); setAlignmentX(CENTER_ALIGNMENT); setAlignmentY(CENTER_ALIGNMENT); setDisplayedMnemonicIndex(-1); updateUI(); }
UIDefaults defaults = UIManager.getLookAndFeelDefaults(); defaults.getBorder("CheckBox.border").paintBorder(m, g, cr.x, cr.y, cr.width, cr.height);
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. // But we don't want to paint the background of JCheckBoxMenuItems if ((m.isSelected() && checkIcon == null) || m.getModel().isArmed() && (m.getParent() instanceof MenuElement)) { 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); if (m.isSelected()) 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); } }
protected JComponent createContentPane()
protected Container createContentPane()
protected JComponent createContentPane() { JPanel p = new JPanel(); p.setName(this.getName() + ".contentPane"); p.setLayout(new BorderLayout()); return p; }
return super.isArmed();
return super.isSelected();
public boolean isSelected() { return super.isArmed(); }
public void insert(Component component, int index) {
public void insert(Action action, int index) {
public void insert(Component component, int index) { // TODO } // insert()
c.setBackground(UIManager.getColor("Viewport.background"));
LookAndFeel.installColorsAndFont(c, "Viewport.background", "Viewport.foreground", "Viewport.font");
protected void installDefaults(JComponent c) { c.setOpaque(true); c.setBackground(UIManager.getColor("Viewport.background")); }
throws java.io.IOException;
throws IOException;
public abstract void parse(Reader reader, ParserCallback callback, boolean ignoreCharSet ) throws java.io.IOException;
super.addAttribute(key.toString().toLowerCase(), value);
if (key instanceof String) super.addAttribute(((String) key).toLowerCase(), value); else super.addAttribute(key, value);
public void addAttribute(Object key, Object value) { super.addAttribute(key.toString().toLowerCase(), value); }
Object v = super.getAttribute(key);
v = super.getAttribute(key);
public Object getAttribute(Object _key) { Object key = _key.toString().toLowerCase(); Object v = super.getAttribute(key); if (v != null) return v; else if (parent != null) return parent.getAttribute(key); else return null; }
else if (parent != null)
key = HTML.getAttributeKey((String) key); v = super.getAttribute(key); if (v != null) return v; if (parent != null)
public Object getAttribute(Object _key) { Object key = _key.toString().toLowerCase(); Object v = super.getAttribute(key); if (v != null) return v; else if (parent != null) return parent.getAttribute(key); else return null; }
else
}
public Enumeration getAttributeNames() { // Replace the string keys by HTML.attribute, where applicable final Enumeration enumeration = super.getAttributeNames(); return new Enumeration() { public boolean hasMoreElements() { return enumeration.hasMoreElements(); } public Object nextElement() { Object key = enumeration.nextElement(); HTML.Attribute hKey = HTML.getAttributeKey((String) key); if (hKey != null) return hKey; else return key; } }; }
else
}
public Object nextElement() { Object key = enumeration.nextElement(); HTML.Attribute hKey = HTML.getAttributeKey((String) key); if (hKey != null) return hKey; else return key; }
Obj(org.omg.CORBA.Object _object, byte[] _key, Servant _servant, POA _poa)
Obj(org.omg.CORBA.Object _object, byte[] _key, Servant _servant, gnuPOA _poa)
Obj(org.omg.CORBA.Object _object, byte[] _key, Servant _servant, POA _poa) { object = _object; key = _key; servant = _servant; poa = _poa; }
public Obj add(org.omg.CORBA.Object object, Servant servant, POA poa)
public Obj add(org.omg.CORBA.Object object, Servant servant, gnuPOA poa)
public Obj add(org.omg.CORBA.Object object, Servant servant, POA poa) { return add(generateObjectKey(object), object, servant, poa); }
BasicListUI.this.list.setSelectedIndex(lead+1);
BasicListUI.this.list.setSelectedIndex(Math.min(lead+1,max));
public void keyPressed( KeyEvent evt ) { if (evt.getKeyCode() == KeyEvent.VK_DOWN) { int lead = BasicListUI.this.list.getLeadSelectionIndex(); if (!evt.isShiftDown()) { BasicListUI.this.list.clearSelection(); BasicListUI.this.list.setSelectedIndex(lead+1); } else { BasicListUI.this.list.getSelectionModel().setLeadSelectionIndex(lead+1); } } else if (evt.getKeyCode() == KeyEvent.VK_UP) { int lead = BasicListUI.this.list.getLeadSelectionIndex(); if (!evt.isShiftDown()) { BasicListUI.this.list.clearSelection(); BasicListUI.this.list.setSelectedIndex(Math.max(lead-1,0)); } else { BasicListUI.this.list.getSelectionModel().setLeadSelectionIndex(Math.max(lead-1,0)); } } }
BasicListUI.this.list.getSelectionModel().setLeadSelectionIndex(lead+1);
BasicListUI.this.list.getSelectionModel(). setLeadSelectionIndex(Math.min(lead+1,max));
public void keyPressed( KeyEvent evt ) { if (evt.getKeyCode() == KeyEvent.VK_DOWN) { int lead = BasicListUI.this.list.getLeadSelectionIndex(); if (!evt.isShiftDown()) { BasicListUI.this.list.clearSelection(); BasicListUI.this.list.setSelectedIndex(lead+1); } else { BasicListUI.this.list.getSelectionModel().setLeadSelectionIndex(lead+1); } } else if (evt.getKeyCode() == KeyEvent.VK_UP) { int lead = BasicListUI.this.list.getLeadSelectionIndex(); if (!evt.isShiftDown()) { BasicListUI.this.list.clearSelection(); BasicListUI.this.list.setSelectedIndex(Math.max(lead-1,0)); } else { BasicListUI.this.list.getSelectionModel().setLeadSelectionIndex(Math.max(lead-1,0)); } } }
boolean controlPressed = event.isControlDown(); if (controlPressed)
if (event.isControlDown())
public void mouseClicked(MouseEvent event) { Point click = event.getPoint(); int index = BasicListUI.this.locationToIndex(list, click); if (index == -1) return; boolean controlPressed = event.isControlDown(); if (controlPressed) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) BasicListUI.this.list.setSelectedIndex(index); else if (BasicListUI.this.list.isSelectedIndex(index)) BasicListUI.this.list.removeSelectionInterval(index,index); else BasicListUI.this.list.addSelectionInterval(index,index); } else BasicListUI.this.list.setSelectedIndex(index); }
else if (event.isShiftDown()) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) BasicListUI.this.list.setSelectedIndex(index); else if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_INTERVAL_SELECTION) BasicListUI.this.list.setSelectionInterval (BasicListUI.this.list.getAnchorSelectionIndex(), index); else BasicListUI.this.list.getSelectionModel(). setLeadSelectionIndex(index); }
public void mouseClicked(MouseEvent event) { Point click = event.getPoint(); int index = BasicListUI.this.locationToIndex(list, click); if (index == -1) return; boolean controlPressed = event.isControlDown(); if (controlPressed) { if (BasicListUI.this.list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) BasicListUI.this.list.setSelectedIndex(index); else if (BasicListUI.this.list.isSelectedIndex(index)) BasicListUI.this.list.removeSelectionInterval(index,index); else BasicListUI.this.list.addSelectionInterval(index,index); } else BasicListUI.this.list.setSelectedIndex(index); }
if (list != null) list.revalidate();
void damageLayout() { updateLayoutStateNeeded = 1; if (list != null) list.revalidate(); }
data[i+offset] = (float) val;
data[i+offset] = val;
public void setElem(int i, int val) { data[i+offset] = (float) val; }
targetClass = target.getClass();
public EventHandler(Object target, String action, String eventPropertyName, String listenerMethodName) { this.target = target; this.action = action; // Turn this into a method or do we wait till // runtime property = eventPropertyName; listenerMethod = listenerMethodName; }
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
private Object[] getProperty(Object o, String prop) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { // Use the event object when the property name to extract is null. if (prop == null) return new Object[] {o, o.getClass()}; // Isolate the first property name from a.b.c. int pos; String rest = null; if ((pos = prop.indexOf('.')) != -1) { rest = prop.substring(pos + 1); prop = prop.substring(0, pos); } // Find a method named getProp. It could be isProp instead. Method getter; try { // Look for boolean property getter isProperty getter = o.getClass().getMethod("is" + capitalize(prop), null); } catch (NoSuchMethodException e) { // Look for regular property getter getProperty getter = o.getClass().getMethod("get" + capitalize(prop), null); } Object val = getter.invoke(o, null); if (rest != null) return getProperty(val, rest); return new Object[] {val, getter.getReturnType()}; }
if (prop == null) return new Object[] {o, o.getClass()};
private Object[] getProperty(Object o, String prop) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { // Use the event object when the property name to extract is null. if (prop == null) return new Object[] {o, o.getClass()}; // Isolate the first property name from a.b.c. int pos; String rest = null; if ((pos = prop.indexOf('.')) != -1) { rest = prop.substring(pos + 1); prop = prop.substring(0, pos); } // Find a method named getProp. It could be isProp instead. Method getter; try { // Look for boolean property getter isProperty getter = o.getClass().getMethod("is" + capitalize(prop), null); } catch (NoSuchMethodException e) { // Look for regular property getter getProperty getter = o.getClass().getMethod("get" + capitalize(prop), null); } Object val = getter.invoke(o, null); if (rest != null) return getProperty(val, rest); return new Object[] {val, getter.getReturnType()}; }
catch (NoSuchMethodException e)
catch (NoSuchMethodException nsme1)
private Object[] getProperty(Object o, String prop) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { // Use the event object when the property name to extract is null. if (prop == null) return new Object[] {o, o.getClass()}; // Isolate the first property name from a.b.c. int pos; String rest = null; if ((pos = prop.indexOf('.')) != -1) { rest = prop.substring(pos + 1); prop = prop.substring(0, pos); } // Find a method named getProp. It could be isProp instead. Method getter; try { // Look for boolean property getter isProperty getter = o.getClass().getMethod("is" + capitalize(prop), null); } catch (NoSuchMethodException e) { // Look for regular property getter getProperty getter = o.getClass().getMethod("get" + capitalize(prop), null); } Object val = getter.invoke(o, null); if (rest != null) return getProperty(val, rest); return new Object[] {val, getter.getReturnType()}; }
} catch(InvocationTargetException ite) { throw new RuntimeException("Method not called: Property or method '" + prop + "' has thrown an exception.", ite); } catch(IllegalAccessException iae) { throw (InternalError) new InternalError("Non-public method was invoked.").initCause(iae); }
private Object[] getProperty(Object o, String prop) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { // Use the event object when the property name to extract is null. if (prop == null) return new Object[] {o, o.getClass()}; // Isolate the first property name from a.b.c. int pos; String rest = null; if ((pos = prop.indexOf('.')) != -1) { rest = prop.substring(pos + 1); prop = prop.substring(0, pos); } // Find a method named getProp. It could be isProp instead. Method getter; try { // Look for boolean property getter isProperty getter = o.getClass().getMethod("is" + capitalize(prop), null); } catch (NoSuchMethodException e) { // Look for regular property getter getProperty getter = o.getClass().getMethod("get" + capitalize(prop), null); } Object val = getter.invoke(o, null); if (rest != null) return getProperty(val, rest); return new Object[] {val, getter.getReturnType()}; }
throws Exception
public Object invoke(Object proxy, Method method, Object[] arguments) throws Exception { // Do we actually need the proxy? if (method == null) throw new RuntimeException("Invoking null method"); // Listener methods that weren't specified are ignored. If listenerMethod // is null, then all listener methods are processed. if (listenerMethod != null && !method.getName().equals(listenerMethod)) return null; // Extract the first arg from arguments and do getProperty on arg if (arguments == null || arguments.length == 0) return null; Object event = arguments[0]; // We hope :-) // Obtain the property XXX propertyType keeps showing up null - why? // because the object inside getProperty changes, but the ref variable // can't change this way, dolt! need a better way to get both values out // - need method and object to do the invoke and get return type Object v[] = getProperty(event, property); Object val = v[0]; Class propertyType = (Class) v[1]; // Find the actual method of target to invoke. We can't do this in the // constructor since we don't know the type of the property we extracted // from the event then. // // action can be either a property or a method. Sun's docs seem to imply // that action should be treated as a property first, and then a method, // but don't specifically say it. // // XXX check what happens with native type wrappers. The better thing to // do is look at the return type of the method Method actionMethod; try { // Look for a property setter for action. actionMethod = target.getClass().getMethod("set" + capitalize(action), new Class[] {propertyType}); } catch (NoSuchMethodException e) { // If action as property didn't work, try as method. try { actionMethod = target.getClass().getMethod(action, new Class[] {propertyType}); } catch (NoSuchMethodException e1) { // When event property is null, we may call action with no args if (property == null) { actionMethod = target.getClass().getMethod(action, null); return actionMethod.invoke(target, null); } else throw e1; } } // Invoke target.action(property) return actionMethod.invoke(target, new Object[] {val}); }
if (method == null) throw new RuntimeException("Invoking null method");
try { Method actionMethod = null;
public Object invoke(Object proxy, Method method, Object[] arguments) throws Exception { // Do we actually need the proxy? if (method == null) throw new RuntimeException("Invoking null method"); // Listener methods that weren't specified are ignored. If listenerMethod // is null, then all listener methods are processed. if (listenerMethod != null && !method.getName().equals(listenerMethod)) return null; // Extract the first arg from arguments and do getProperty on arg if (arguments == null || arguments.length == 0) return null; Object event = arguments[0]; // We hope :-) // Obtain the property XXX propertyType keeps showing up null - why? // because the object inside getProperty changes, but the ref variable // can't change this way, dolt! need a better way to get both values out // - need method and object to do the invoke and get return type Object v[] = getProperty(event, property); Object val = v[0]; Class propertyType = (Class) v[1]; // Find the actual method of target to invoke. We can't do this in the // constructor since we don't know the type of the property we extracted // from the event then. // // action can be either a property or a method. Sun's docs seem to imply // that action should be treated as a property first, and then a method, // but don't specifically say it. // // XXX check what happens with native type wrappers. The better thing to // do is look at the return type of the method Method actionMethod; try { // Look for a property setter for action. actionMethod = target.getClass().getMethod("set" + capitalize(action), new Class[] {propertyType}); } catch (NoSuchMethodException e) { // If action as property didn't work, try as method. try { actionMethod = target.getClass().getMethod(action, new Class[] {propertyType}); } catch (NoSuchMethodException e1) { // When event property is null, we may call action with no args if (property == null) { actionMethod = target.getClass().getMethod(action, null); return actionMethod.invoke(target, null); } else throw e1; } } // Invoke target.action(property) return actionMethod.invoke(target, new Object[] {val}); }
if (arguments == null || arguments.length == 0) return null; Object event = arguments[0];
if(property != null) { Object event = arguments[0];
public Object invoke(Object proxy, Method method, Object[] arguments) throws Exception { // Do we actually need the proxy? if (method == null) throw new RuntimeException("Invoking null method"); // Listener methods that weren't specified are ignored. If listenerMethod // is null, then all listener methods are processed. if (listenerMethod != null && !method.getName().equals(listenerMethod)) return null; // Extract the first arg from arguments and do getProperty on arg if (arguments == null || arguments.length == 0) return null; Object event = arguments[0]; // We hope :-) // Obtain the property XXX propertyType keeps showing up null - why? // because the object inside getProperty changes, but the ref variable // can't change this way, dolt! need a better way to get both values out // - need method and object to do the invoke and get return type Object v[] = getProperty(event, property); Object val = v[0]; Class propertyType = (Class) v[1]; // Find the actual method of target to invoke. We can't do this in the // constructor since we don't know the type of the property we extracted // from the event then. // // action can be either a property or a method. Sun's docs seem to imply // that action should be treated as a property first, and then a method, // but don't specifically say it. // // XXX check what happens with native type wrappers. The better thing to // do is look at the return type of the method Method actionMethod; try { // Look for a property setter for action. actionMethod = target.getClass().getMethod("set" + capitalize(action), new Class[] {propertyType}); } catch (NoSuchMethodException e) { // If action as property didn't work, try as method. try { actionMethod = target.getClass().getMethod(action, new Class[] {propertyType}); } catch (NoSuchMethodException e1) { // When event property is null, we may call action with no args if (property == null) { actionMethod = target.getClass().getMethod(action, null); return actionMethod.invoke(target, null); } else throw e1; } } // Invoke target.action(property) return actionMethod.invoke(target, new Object[] {val}); }
Object val = v[0]; Class propertyType = (Class) v[1];
Object[] args = new Object[] { v[0] };
public Object invoke(Object proxy, Method method, Object[] arguments) throws Exception { // Do we actually need the proxy? if (method == null) throw new RuntimeException("Invoking null method"); // Listener methods that weren't specified are ignored. If listenerMethod // is null, then all listener methods are processed. if (listenerMethod != null && !method.getName().equals(listenerMethod)) return null; // Extract the first arg from arguments and do getProperty on arg if (arguments == null || arguments.length == 0) return null; Object event = arguments[0]; // We hope :-) // Obtain the property XXX propertyType keeps showing up null - why? // because the object inside getProperty changes, but the ref variable // can't change this way, dolt! need a better way to get both values out // - need method and object to do the invoke and get return type Object v[] = getProperty(event, property); Object val = v[0]; Class propertyType = (Class) v[1]; // Find the actual method of target to invoke. We can't do this in the // constructor since we don't know the type of the property we extracted // from the event then. // // action can be either a property or a method. Sun's docs seem to imply // that action should be treated as a property first, and then a method, // but don't specifically say it. // // XXX check what happens with native type wrappers. The better thing to // do is look at the return type of the method Method actionMethod; try { // Look for a property setter for action. actionMethod = target.getClass().getMethod("set" + capitalize(action), new Class[] {propertyType}); } catch (NoSuchMethodException e) { // If action as property didn't work, try as method. try { actionMethod = target.getClass().getMethod(action, new Class[] {propertyType}); } catch (NoSuchMethodException e1) { // When event property is null, we may call action with no args if (property == null) { actionMethod = target.getClass().getMethod(action, null); return actionMethod.invoke(target, null); } else throw e1; } } // Invoke target.action(property) return actionMethod.invoke(target, new Object[] {val}); }
Method actionMethod;
Class[] argTypes = new Class[] { initClass((Class) v[1]) }; while(argTypes[0] != null) {
public Object invoke(Object proxy, Method method, Object[] arguments) throws Exception { // Do we actually need the proxy? if (method == null) throw new RuntimeException("Invoking null method"); // Listener methods that weren't specified are ignored. If listenerMethod // is null, then all listener methods are processed. if (listenerMethod != null && !method.getName().equals(listenerMethod)) return null; // Extract the first arg from arguments and do getProperty on arg if (arguments == null || arguments.length == 0) return null; Object event = arguments[0]; // We hope :-) // Obtain the property XXX propertyType keeps showing up null - why? // because the object inside getProperty changes, but the ref variable // can't change this way, dolt! need a better way to get both values out // - need method and object to do the invoke and get return type Object v[] = getProperty(event, property); Object val = v[0]; Class propertyType = (Class) v[1]; // Find the actual method of target to invoke. We can't do this in the // constructor since we don't know the type of the property we extracted // from the event then. // // action can be either a property or a method. Sun's docs seem to imply // that action should be treated as a property first, and then a method, // but don't specifically say it. // // XXX check what happens with native type wrappers. The better thing to // do is look at the return type of the method Method actionMethod; try { // Look for a property setter for action. actionMethod = target.getClass().getMethod("set" + capitalize(action), new Class[] {propertyType}); } catch (NoSuchMethodException e) { // If action as property didn't work, try as method. try { actionMethod = target.getClass().getMethod(action, new Class[] {propertyType}); } catch (NoSuchMethodException e1) { // When event property is null, we may call action with no args if (property == null) { actionMethod = target.getClass().getMethod(action, null); return actionMethod.invoke(target, null); } else throw e1; } } // Invoke target.action(property) return actionMethod.invoke(target, new Object[] {val}); }
actionMethod = target.getClass().getMethod("set" + capitalize(action), new Class[] {propertyType});
actionMethod = targetClass.getMethod("set" + capitalize(action), argTypes); return actionMethod.invoke(target, args);
public Object invoke(Object proxy, Method method, Object[] arguments) throws Exception { // Do we actually need the proxy? if (method == null) throw new RuntimeException("Invoking null method"); // Listener methods that weren't specified are ignored. If listenerMethod // is null, then all listener methods are processed. if (listenerMethod != null && !method.getName().equals(listenerMethod)) return null; // Extract the first arg from arguments and do getProperty on arg if (arguments == null || arguments.length == 0) return null; Object event = arguments[0]; // We hope :-) // Obtain the property XXX propertyType keeps showing up null - why? // because the object inside getProperty changes, but the ref variable // can't change this way, dolt! need a better way to get both values out // - need method and object to do the invoke and get return type Object v[] = getProperty(event, property); Object val = v[0]; Class propertyType = (Class) v[1]; // Find the actual method of target to invoke. We can't do this in the // constructor since we don't know the type of the property we extracted // from the event then. // // action can be either a property or a method. Sun's docs seem to imply // that action should be treated as a property first, and then a method, // but don't specifically say it. // // XXX check what happens with native type wrappers. The better thing to // do is look at the return type of the method Method actionMethod; try { // Look for a property setter for action. actionMethod = target.getClass().getMethod("set" + capitalize(action), new Class[] {propertyType}); } catch (NoSuchMethodException e) { // If action as property didn't work, try as method. try { actionMethod = target.getClass().getMethod(action, new Class[] {propertyType}); } catch (NoSuchMethodException e1) { // When event property is null, we may call action with no args if (property == null) { actionMethod = target.getClass().getMethod(action, null); return actionMethod.invoke(target, null); } else throw e1; } } // Invoke target.action(property) return actionMethod.invoke(target, new Object[] {val}); }
} argTypes[0] = nextClass(argTypes[0]); } argTypes = new Class[] { initClass((Class) v[1]) }; while(argTypes[0] != null) {
public Object invoke(Object proxy, Method method, Object[] arguments) throws Exception { // Do we actually need the proxy? if (method == null) throw new RuntimeException("Invoking null method"); // Listener methods that weren't specified are ignored. If listenerMethod // is null, then all listener methods are processed. if (listenerMethod != null && !method.getName().equals(listenerMethod)) return null; // Extract the first arg from arguments and do getProperty on arg if (arguments == null || arguments.length == 0) return null; Object event = arguments[0]; // We hope :-) // Obtain the property XXX propertyType keeps showing up null - why? // because the object inside getProperty changes, but the ref variable // can't change this way, dolt! need a better way to get both values out // - need method and object to do the invoke and get return type Object v[] = getProperty(event, property); Object val = v[0]; Class propertyType = (Class) v[1]; // Find the actual method of target to invoke. We can't do this in the // constructor since we don't know the type of the property we extracted // from the event then. // // action can be either a property or a method. Sun's docs seem to imply // that action should be treated as a property first, and then a method, // but don't specifically say it. // // XXX check what happens with native type wrappers. The better thing to // do is look at the return type of the method Method actionMethod; try { // Look for a property setter for action. actionMethod = target.getClass().getMethod("set" + capitalize(action), new Class[] {propertyType}); } catch (NoSuchMethodException e) { // If action as property didn't work, try as method. try { actionMethod = target.getClass().getMethod(action, new Class[] {propertyType}); } catch (NoSuchMethodException e1) { // When event property is null, we may call action with no args if (property == null) { actionMethod = target.getClass().getMethod(action, null); return actionMethod.invoke(target, null); } else throw e1; } } // Invoke target.action(property) return actionMethod.invoke(target, new Object[] {val}); }
actionMethod = target.getClass().getMethod(action, new Class[] {propertyType});
actionMethod = targetClass.getMethod(action, argTypes); return actionMethod.invoke(target, args);
public Object invoke(Object proxy, Method method, Object[] arguments) throws Exception { // Do we actually need the proxy? if (method == null) throw new RuntimeException("Invoking null method"); // Listener methods that weren't specified are ignored. If listenerMethod // is null, then all listener methods are processed. if (listenerMethod != null && !method.getName().equals(listenerMethod)) return null; // Extract the first arg from arguments and do getProperty on arg if (arguments == null || arguments.length == 0) return null; Object event = arguments[0]; // We hope :-) // Obtain the property XXX propertyType keeps showing up null - why? // because the object inside getProperty changes, but the ref variable // can't change this way, dolt! need a better way to get both values out // - need method and object to do the invoke and get return type Object v[] = getProperty(event, property); Object val = v[0]; Class propertyType = (Class) v[1]; // Find the actual method of target to invoke. We can't do this in the // constructor since we don't know the type of the property we extracted // from the event then. // // action can be either a property or a method. Sun's docs seem to imply // that action should be treated as a property first, and then a method, // but don't specifically say it. // // XXX check what happens with native type wrappers. The better thing to // do is look at the return type of the method Method actionMethod; try { // Look for a property setter for action. actionMethod = target.getClass().getMethod("set" + capitalize(action), new Class[] {propertyType}); } catch (NoSuchMethodException e) { // If action as property didn't work, try as method. try { actionMethod = target.getClass().getMethod(action, new Class[] {propertyType}); } catch (NoSuchMethodException e1) { // When event property is null, we may call action with no args if (property == null) { actionMethod = target.getClass().getMethod(action, null); return actionMethod.invoke(target, null); } else throw e1; } } // Invoke target.action(property) return actionMethod.invoke(target, new Object[] {val}); }
catch (NoSuchMethodException e1)
catch (NoSuchMethodException e)
public Object invoke(Object proxy, Method method, Object[] arguments) throws Exception { // Do we actually need the proxy? if (method == null) throw new RuntimeException("Invoking null method"); // Listener methods that weren't specified are ignored. If listenerMethod // is null, then all listener methods are processed. if (listenerMethod != null && !method.getName().equals(listenerMethod)) return null; // Extract the first arg from arguments and do getProperty on arg if (arguments == null || arguments.length == 0) return null; Object event = arguments[0]; // We hope :-) // Obtain the property XXX propertyType keeps showing up null - why? // because the object inside getProperty changes, but the ref variable // can't change this way, dolt! need a better way to get both values out // - need method and object to do the invoke and get return type Object v[] = getProperty(event, property); Object val = v[0]; Class propertyType = (Class) v[1]; // Find the actual method of target to invoke. We can't do this in the // constructor since we don't know the type of the property we extracted // from the event then. // // action can be either a property or a method. Sun's docs seem to imply // that action should be treated as a property first, and then a method, // but don't specifically say it. // // XXX check what happens with native type wrappers. The better thing to // do is look at the return type of the method Method actionMethod; try { // Look for a property setter for action. actionMethod = target.getClass().getMethod("set" + capitalize(action), new Class[] {propertyType}); } catch (NoSuchMethodException e) { // If action as property didn't work, try as method. try { actionMethod = target.getClass().getMethod(action, new Class[] {propertyType}); } catch (NoSuchMethodException e1) { // When event property is null, we may call action with no args if (property == null) { actionMethod = target.getClass().getMethod(action, null); return actionMethod.invoke(target, null); } else throw e1; } } // Invoke target.action(property) return actionMethod.invoke(target, new Object[] {val}); }
if (property == null)
} argTypes[0] = nextClass(argTypes[0]); } throw new RuntimeException("Method not called: Could not find a public method named '" + action + "' in target " + targetClass + " which takes a '" + v[1] + "' argument or a property of this type."); } try
public Object invoke(Object proxy, Method method, Object[] arguments) throws Exception { // Do we actually need the proxy? if (method == null) throw new RuntimeException("Invoking null method"); // Listener methods that weren't specified are ignored. If listenerMethod // is null, then all listener methods are processed. if (listenerMethod != null && !method.getName().equals(listenerMethod)) return null; // Extract the first arg from arguments and do getProperty on arg if (arguments == null || arguments.length == 0) return null; Object event = arguments[0]; // We hope :-) // Obtain the property XXX propertyType keeps showing up null - why? // because the object inside getProperty changes, but the ref variable // can't change this way, dolt! need a better way to get both values out // - need method and object to do the invoke and get return type Object v[] = getProperty(event, property); Object val = v[0]; Class propertyType = (Class) v[1]; // Find the actual method of target to invoke. We can't do this in the // constructor since we don't know the type of the property we extracted // from the event then. // // action can be either a property or a method. Sun's docs seem to imply // that action should be treated as a property first, and then a method, // but don't specifically say it. // // XXX check what happens with native type wrappers. The better thing to // do is look at the return type of the method Method actionMethod; try { // Look for a property setter for action. actionMethod = target.getClass().getMethod("set" + capitalize(action), new Class[] {propertyType}); } catch (NoSuchMethodException e) { // If action as property didn't work, try as method. try { actionMethod = target.getClass().getMethod(action, new Class[] {propertyType}); } catch (NoSuchMethodException e1) { // When event property is null, we may call action with no args if (property == null) { actionMethod = target.getClass().getMethod(action, null); return actionMethod.invoke(target, null); } else throw e1; } } // Invoke target.action(property) return actionMethod.invoke(target, new Object[] {val}); }
actionMethod = target.getClass().getMethod(action, null); return actionMethod.invoke(target, null);
actionMethod = targetClass.getMethod(action, null);
public Object invoke(Object proxy, Method method, Object[] arguments) throws Exception { // Do we actually need the proxy? if (method == null) throw new RuntimeException("Invoking null method"); // Listener methods that weren't specified are ignored. If listenerMethod // is null, then all listener methods are processed. if (listenerMethod != null && !method.getName().equals(listenerMethod)) return null; // Extract the first arg from arguments and do getProperty on arg if (arguments == null || arguments.length == 0) return null; Object event = arguments[0]; // We hope :-) // Obtain the property XXX propertyType keeps showing up null - why? // because the object inside getProperty changes, but the ref variable // can't change this way, dolt! need a better way to get both values out // - need method and object to do the invoke and get return type Object v[] = getProperty(event, property); Object val = v[0]; Class propertyType = (Class) v[1]; // Find the actual method of target to invoke. We can't do this in the // constructor since we don't know the type of the property we extracted // from the event then. // // action can be either a property or a method. Sun's docs seem to imply // that action should be treated as a property first, and then a method, // but don't specifically say it. // // XXX check what happens with native type wrappers. The better thing to // do is look at the return type of the method Method actionMethod; try { // Look for a property setter for action. actionMethod = target.getClass().getMethod("set" + capitalize(action), new Class[] {propertyType}); } catch (NoSuchMethodException e) { // If action as property didn't work, try as method. try { actionMethod = target.getClass().getMethod(action, new Class[] {propertyType}); } catch (NoSuchMethodException e1) { // When event property is null, we may call action with no args if (property == null) { actionMethod = target.getClass().getMethod(action, null); return actionMethod.invoke(target, null); } else throw e1; } } // Invoke target.action(property) return actionMethod.invoke(target, new Object[] {val}); }
else throw e1;
catch(NoSuchMethodException nsme) { if(arguments != null && arguments.length >= 1) { Class[] targetArgTypes = new Class[] { initClass(arguments[0].getClass()) }; while(targetArgTypes[0] != null) { try { actionMethod = targetClass.getMethod(action, targetArgTypes); return actionMethod.invoke(target, new Object[] { arguments[0] }); } catch(NoSuchMethodException nsme2) { } targetArgTypes[0] = nextClass(targetArgTypes[0]); }
public Object invoke(Object proxy, Method method, Object[] arguments) throws Exception { // Do we actually need the proxy? if (method == null) throw new RuntimeException("Invoking null method"); // Listener methods that weren't specified are ignored. If listenerMethod // is null, then all listener methods are processed. if (listenerMethod != null && !method.getName().equals(listenerMethod)) return null; // Extract the first arg from arguments and do getProperty on arg if (arguments == null || arguments.length == 0) return null; Object event = arguments[0]; // We hope :-) // Obtain the property XXX propertyType keeps showing up null - why? // because the object inside getProperty changes, but the ref variable // can't change this way, dolt! need a better way to get both values out // - need method and object to do the invoke and get return type Object v[] = getProperty(event, property); Object val = v[0]; Class propertyType = (Class) v[1]; // Find the actual method of target to invoke. We can't do this in the // constructor since we don't know the type of the property we extracted // from the event then. // // action can be either a property or a method. Sun's docs seem to imply // that action should be treated as a property first, and then a method, // but don't specifically say it. // // XXX check what happens with native type wrappers. The better thing to // do is look at the return type of the method Method actionMethod; try { // Look for a property setter for action. actionMethod = target.getClass().getMethod("set" + capitalize(action), new Class[] {propertyType}); } catch (NoSuchMethodException e) { // If action as property didn't work, try as method. try { actionMethod = target.getClass().getMethod(action, new Class[] {propertyType}); } catch (NoSuchMethodException e1) { // When event property is null, we may call action with no args if (property == null) { actionMethod = target.getClass().getMethod(action, null); return actionMethod.invoke(target, null); } else throw e1; } } // Invoke target.action(property) return actionMethod.invoke(target, new Object[] {val}); }
return actionMethod.invoke(target, new Object[] {val});
return actionMethod.invoke(target, null); } catch(InvocationTargetException ite) { throw new RuntimeException(ite.getCause()); } catch(IllegalAccessException iae) { throw (InternalError) new InternalError("Non-public method was invoked.").initCause(iae); }
public Object invoke(Object proxy, Method method, Object[] arguments) throws Exception { // Do we actually need the proxy? if (method == null) throw new RuntimeException("Invoking null method"); // Listener methods that weren't specified are ignored. If listenerMethod // is null, then all listener methods are processed. if (listenerMethod != null && !method.getName().equals(listenerMethod)) return null; // Extract the first arg from arguments and do getProperty on arg if (arguments == null || arguments.length == 0) return null; Object event = arguments[0]; // We hope :-) // Obtain the property XXX propertyType keeps showing up null - why? // because the object inside getProperty changes, but the ref variable // can't change this way, dolt! need a better way to get both values out // - need method and object to do the invoke and get return type Object v[] = getProperty(event, property); Object val = v[0]; Class propertyType = (Class) v[1]; // Find the actual method of target to invoke. We can't do this in the // constructor since we don't know the type of the property we extracted // from the event then. // // action can be either a property or a method. Sun's docs seem to imply // that action should be treated as a property first, and then a method, // but don't specifically say it. // // XXX check what happens with native type wrappers. The better thing to // do is look at the return type of the method Method actionMethod; try { // Look for a property setter for action. actionMethod = target.getClass().getMethod("set" + capitalize(action), new Class[] {propertyType}); } catch (NoSuchMethodException e) { // If action as property didn't work, try as method. try { actionMethod = target.getClass().getMethod(action, new Class[] {propertyType}); } catch (NoSuchMethodException e1) { // When event property is null, we may call action with no args if (property == null) { actionMethod = target.getClass().getMethod(action, null); return actionMethod.invoke(target, null); } else throw e1; } } // Invoke target.action(property) return actionMethod.invoke(target, new Object[] {val}); }
name = NAMES[type];
public Cursor(int type) { if (type < 0 || type >= PREDEFINED_COUNT) throw new IllegalArgumentException ("invalid cursor " + type); this.type = type; // FIXME: lookup and set name? }
if (approveButtonText == null) return getUI().getApproveButtonText(this); else
public String getApproveButtonText() { return approveButtonText; }
return getInternalFileView().getDescription(f);
return getFileView().getDescription(f);
public String getDescription(File f) { return getInternalFileView().getDescription(f); }
if (dialogTitle == null) return getUI().getDialogTitle(this); else
public String getDialogTitle() { return dialogTitle; }
if (fv == null) return getUI().getFileView(this); else
public FileView getFileView() { return fv; }
return getInternalFileView().getIcon(f);
return getFileView().getIcon(f);
public Icon getIcon(File f) { return getInternalFileView().getIcon(f); }
return getInternalFileView().getName(f);
return getFileView().getName(f);
public String getName(File f) { return getInternalFileView().getName(f); }
return getInternalFileView().getTypeDescription(f);
return getFileView().getTypeDescription(f);
public String getTypeDescription(File f) { return getInternalFileView().getTypeDescription(f); }
protected PropertyEditorSupport() { this.eventSource = this; this.pSupport = new PropertyChangeSupport(this);
public PropertyEditorSupport() { eventSource = this; pSupport = new PropertyChangeSupport(this);
protected PropertyEditorSupport() { this.eventSource = this; this.pSupport = new PropertyChangeSupport(this); }
public void firePropertyChange() { pSupport.firePropertyChange(null,null,val); }
public void firePropertyChange() { pSupport.firePropertyChange(null, null, null); }
public void firePropertyChange() { pSupport.firePropertyChange(null,null,val); }
public String getAsText() { return val != null ? val.toString() : "null"; }
public String getAsText() { return value != null ? value.toString() : "null"; }
public String getAsText() { return val != null ? val.toString() : "null"; }