rem stringlengths 0 477k | add stringlengths 0 313k | context stringlengths 6 599k |
|---|---|---|
int ord1 = cei1.next(); int ord2 = cei2.next(); | int ord1; int ord2; | compare(String s1, String s2){ CollationElementIterator cei1 = getCollationElementIterator(s1); CollationElementIterator cei2 = getCollationElementIterator(s2); for(;;) { int ord1 = cei1.next(); int ord2 = cei2.next(); // Check for end of string if (ord1 == CollationElementIterator.NULLORDER) if (ord2 == CollationElementIterator.NULLORDER) return(0); else return(-1); else if (ord2 == CollationElementIterator.NULLORDER) return(1); // We know chars are totally equal, so skip if (ord1 == ord2) continue; // Check for primary strength differences int prim1 = CollationElementIterator.primaryOrder(ord1); int prim2 = CollationElementIterator.primaryOrder(ord2); if (prim1 < prim2) return(-1); else if (prim1 > prim2) return(1); else if (getStrength() == PRIMARY) continue; // Check for secondary strength differences int sec1 = CollationElementIterator.secondaryOrder(ord1); int sec2 = CollationElementIterator.secondaryOrder(ord2); if (sec1 < sec2) return(-1); else if (sec1 > sec2) return(1); else if (getStrength() == SECONDARY) continue; // Check for tertiary differences int tert1 = CollationElementIterator.tertiaryOrder(ord1); int tert2 = CollationElementIterator.tertiaryOrder(ord1); if (tert1 < tert2) return(-1); else if (tert1 > tert2) return(1); }} |
if (ord1 == CollationElementIterator.NULLORDER) if (ord2 == CollationElementIterator.NULLORDER) return(0); | if (advance_block_1) { ord1block = cs.nextBlock(); if (ord1block != null && ord1block.ignore) continue; } if (advance_block_2) { ord2block = ct.nextBlock(); if (ord2block != null && ord2block.ignore) { advance_block_1 = false; continue; } } else advance_block_2 = true; if (!advance_block_1) advance_block_1 = true; if (ord1block != null) ord1 = ord1block.getValue(); | compare(String s1, String s2){ CollationElementIterator cei1 = getCollationElementIterator(s1); CollationElementIterator cei2 = getCollationElementIterator(s2); for(;;) { int ord1 = cei1.next(); int ord2 = cei2.next(); // Check for end of string if (ord1 == CollationElementIterator.NULLORDER) if (ord2 == CollationElementIterator.NULLORDER) return(0); else return(-1); else if (ord2 == CollationElementIterator.NULLORDER) return(1); // We know chars are totally equal, so skip if (ord1 == ord2) continue; // Check for primary strength differences int prim1 = CollationElementIterator.primaryOrder(ord1); int prim2 = CollationElementIterator.primaryOrder(ord2); if (prim1 < prim2) return(-1); else if (prim1 > prim2) return(1); else if (getStrength() == PRIMARY) continue; // Check for secondary strength differences int sec1 = CollationElementIterator.secondaryOrder(ord1); int sec2 = CollationElementIterator.secondaryOrder(ord2); if (sec1 < sec2) return(-1); else if (sec1 > sec2) return(1); else if (getStrength() == SECONDARY) continue; // Check for tertiary differences int tert1 = CollationElementIterator.tertiaryOrder(ord1); int tert2 = CollationElementIterator.tertiaryOrder(ord1); if (tert1 < tert2) return(-1); else if (tert1 > tert2) return(1); }} |
return(-1); else if (ord2 == CollationElementIterator.NULLORDER) return(1); | { if (ord2block == null) return 0; return -1; } if (ord2block == null) return 1; ord2 = ord2block.getValue(); | compare(String s1, String s2){ CollationElementIterator cei1 = getCollationElementIterator(s1); CollationElementIterator cei2 = getCollationElementIterator(s2); for(;;) { int ord1 = cei1.next(); int ord2 = cei2.next(); // Check for end of string if (ord1 == CollationElementIterator.NULLORDER) if (ord2 == CollationElementIterator.NULLORDER) return(0); else return(-1); else if (ord2 == CollationElementIterator.NULLORDER) return(1); // We know chars are totally equal, so skip if (ord1 == ord2) continue; // Check for primary strength differences int prim1 = CollationElementIterator.primaryOrder(ord1); int prim2 = CollationElementIterator.primaryOrder(ord2); if (prim1 < prim2) return(-1); else if (prim1 > prim2) return(1); else if (getStrength() == PRIMARY) continue; // Check for secondary strength differences int sec1 = CollationElementIterator.secondaryOrder(ord1); int sec2 = CollationElementIterator.secondaryOrder(ord2); if (sec1 < sec2) return(-1); else if (sec1 > sec2) return(1); else if (getStrength() == SECONDARY) continue; // Check for tertiary differences int tert1 = CollationElementIterator.tertiaryOrder(ord1); int tert2 = CollationElementIterator.tertiaryOrder(ord1); if (tert1 < tert2) return(-1); else if (tert1 > tert2) return(1); }} |
return(-1); | return -1; | compare(String s1, String s2){ CollationElementIterator cei1 = getCollationElementIterator(s1); CollationElementIterator cei2 = getCollationElementIterator(s2); for(;;) { int ord1 = cei1.next(); int ord2 = cei2.next(); // Check for end of string if (ord1 == CollationElementIterator.NULLORDER) if (ord2 == CollationElementIterator.NULLORDER) return(0); else return(-1); else if (ord2 == CollationElementIterator.NULLORDER) return(1); // We know chars are totally equal, so skip if (ord1 == ord2) continue; // Check for primary strength differences int prim1 = CollationElementIterator.primaryOrder(ord1); int prim2 = CollationElementIterator.primaryOrder(ord2); if (prim1 < prim2) return(-1); else if (prim1 > prim2) return(1); else if (getStrength() == PRIMARY) continue; // Check for secondary strength differences int sec1 = CollationElementIterator.secondaryOrder(ord1); int sec2 = CollationElementIterator.secondaryOrder(ord2); if (sec1 < sec2) return(-1); else if (sec1 > sec2) return(1); else if (getStrength() == SECONDARY) continue; // Check for tertiary differences int tert1 = CollationElementIterator.tertiaryOrder(ord1); int tert2 = CollationElementIterator.tertiaryOrder(ord1); if (tert1 < tert2) return(-1); else if (tert1 > tert2) return(1); }} |
return(1); | return 1; | compare(String s1, String s2){ CollationElementIterator cei1 = getCollationElementIterator(s1); CollationElementIterator cei2 = getCollationElementIterator(s2); for(;;) { int ord1 = cei1.next(); int ord2 = cei2.next(); // Check for end of string if (ord1 == CollationElementIterator.NULLORDER) if (ord2 == CollationElementIterator.NULLORDER) return(0); else return(-1); else if (ord2 == CollationElementIterator.NULLORDER) return(1); // We know chars are totally equal, so skip if (ord1 == ord2) continue; // Check for primary strength differences int prim1 = CollationElementIterator.primaryOrder(ord1); int prim2 = CollationElementIterator.primaryOrder(ord2); if (prim1 < prim2) return(-1); else if (prim1 > prim2) return(1); else if (getStrength() == PRIMARY) continue; // Check for secondary strength differences int sec1 = CollationElementIterator.secondaryOrder(ord1); int sec2 = CollationElementIterator.secondaryOrder(ord2); if (sec1 < sec2) return(-1); else if (sec1 > sec2) return(1); else if (getStrength() == SECONDARY) continue; // Check for tertiary differences int tert1 = CollationElementIterator.tertiaryOrder(ord1); int tert2 = CollationElementIterator.tertiaryOrder(ord1); if (tert1 < tert2) return(-1); else if (tert1 > tert2) return(1); }} |
int tert2 = CollationElementIterator.tertiaryOrder(ord1); | int tert2 = CollationElementIterator.tertiaryOrder(ord2); | compare(String s1, String s2){ CollationElementIterator cei1 = getCollationElementIterator(s1); CollationElementIterator cei2 = getCollationElementIterator(s2); for(;;) { int ord1 = cei1.next(); int ord2 = cei2.next(); // Check for end of string if (ord1 == CollationElementIterator.NULLORDER) if (ord2 == CollationElementIterator.NULLORDER) return(0); else return(-1); else if (ord2 == CollationElementIterator.NULLORDER) return(1); // We know chars are totally equal, so skip if (ord1 == ord2) continue; // Check for primary strength differences int prim1 = CollationElementIterator.primaryOrder(ord1); int prim2 = CollationElementIterator.primaryOrder(ord2); if (prim1 < prim2) return(-1); else if (prim1 > prim2) return(1); else if (getStrength() == PRIMARY) continue; // Check for secondary strength differences int sec1 = CollationElementIterator.secondaryOrder(ord1); int sec2 = CollationElementIterator.secondaryOrder(ord2); if (sec1 < sec2) return(-1); else if (sec1 > sec2) return(1); else if (getStrength() == SECONDARY) continue; // Check for tertiary differences int tert1 = CollationElementIterator.tertiaryOrder(ord1); int tert2 = CollationElementIterator.tertiaryOrder(ord1); if (tert1 < tert2) return(-1); else if (tert1 > tert2) return(1); }} |
return(1); | return 1; else if (getStrength() == TERTIARY) continue; return ord1block.key.compareTo(ord2block.key); | compare(String s1, String s2){ CollationElementIterator cei1 = getCollationElementIterator(s1); CollationElementIterator cei2 = getCollationElementIterator(s2); for(;;) { int ord1 = cei1.next(); int ord2 = cei2.next(); // Check for end of string if (ord1 == CollationElementIterator.NULLORDER) if (ord2 == CollationElementIterator.NULLORDER) return(0); else return(-1); else if (ord2 == CollationElementIterator.NULLORDER) return(1); // We know chars are totally equal, so skip if (ord1 == ord2) continue; // Check for primary strength differences int prim1 = CollationElementIterator.primaryOrder(ord1); int prim2 = CollationElementIterator.primaryOrder(ord2); if (prim1 < prim2) return(-1); else if (prim1 > prim2) return(1); else if (getStrength() == PRIMARY) continue; // Check for secondary strength differences int sec1 = CollationElementIterator.secondaryOrder(ord1); int sec2 = CollationElementIterator.secondaryOrder(ord2); if (sec1 < sec2) return(-1); else if (sec1 > sec2) return(1); else if (getStrength() == SECONDARY) continue; // Check for tertiary differences int tert1 = CollationElementIterator.tertiaryOrder(ord1); int tert2 = CollationElementIterator.tertiaryOrder(ord1); if (tert1 < tert2) return(-1); else if (tert1 > tert2) return(1); }} |
equals(Object obj) { if (obj == this) return(true); else return(false); } | public boolean equals(Object obj) { if (obj == this) return true; else return false; } | equals(Object obj){ if (obj == this) return(true); else return(false);} |
getCollationElementIterator(String str) { return(new CollationElementIterator(this, str)); } | public CollationElementIterator getCollationElementIterator(String source) { return new CollationElementIterator(this, source); } | getCollationElementIterator(String str){ return(new CollationElementIterator(this, str));} |
getCollationKey(String str) { CollationElementIterator cei = getCollationElementIterator(str); Vector vect = new Vector(25); | public CollationKey getCollationKey(String source) { CollationElementIterator cei = getCollationElementIterator(source); ArrayList vect = new ArrayList(); | getCollationKey(String str){ CollationElementIterator cei = getCollationElementIterator(str); Vector vect = new Vector(25); int ord = cei.next(); while (ord != CollationElementIterator.NULLORDER) { switch (getStrength()) { case PRIMARY: ord = CollationElementIterator.primaryOrder(ord); break; case SECONDARY: ord = CollationElementIterator.secondaryOrder(ord); default: break; } vect.add(new Integer(ord)); } Object[] objarr = vect.toArray(); byte[] key = new byte[objarr.length * 4]; for (int i = 0; i < key.length; i++) { int j = ((Integer)objarr[i]).intValue(); key[i++] = (byte)((j & 0xFF000000) >> 24); key[i++] = (byte)((j & 0x00FF0000) >> 16); key[i++] = (byte)((j & 0x0000FF00) >> 8); key[i++] = (byte)(j & 0x000000FF); } return(new CollationKey(this, str, key));} |
ord = CollationElementIterator.secondaryOrder(ord); | ord = CollationElementIterator.primaryOrder(ord) << 8; ord |= CollationElementIterator.secondaryOrder(ord); | getCollationKey(String str){ CollationElementIterator cei = getCollationElementIterator(str); Vector vect = new Vector(25); int ord = cei.next(); while (ord != CollationElementIterator.NULLORDER) { switch (getStrength()) { case PRIMARY: ord = CollationElementIterator.primaryOrder(ord); break; case SECONDARY: ord = CollationElementIterator.secondaryOrder(ord); default: break; } vect.add(new Integer(ord)); } Object[] objarr = vect.toArray(); byte[] key = new byte[objarr.length * 4]; for (int i = 0; i < key.length; i++) { int j = ((Integer)objarr[i]).intValue(); key[i++] = (byte)((j & 0xFF000000) >> 24); key[i++] = (byte)((j & 0x00FF0000) >> 16); key[i++] = (byte)((j & 0x0000FF00) >> 8); key[i++] = (byte)(j & 0x000000FF); } return(new CollationKey(this, str, key));} |
for (int i = 0; i < key.length; i++) | for (int i = 0; i < objarr.length; i++) | getCollationKey(String str){ CollationElementIterator cei = getCollationElementIterator(str); Vector vect = new Vector(25); int ord = cei.next(); while (ord != CollationElementIterator.NULLORDER) { switch (getStrength()) { case PRIMARY: ord = CollationElementIterator.primaryOrder(ord); break; case SECONDARY: ord = CollationElementIterator.secondaryOrder(ord); default: break; } vect.add(new Integer(ord)); } Object[] objarr = vect.toArray(); byte[] key = new byte[objarr.length * 4]; for (int i = 0; i < key.length; i++) { int j = ((Integer)objarr[i]).intValue(); key[i++] = (byte)((j & 0xFF000000) >> 24); key[i++] = (byte)((j & 0x00FF0000) >> 16); key[i++] = (byte)((j & 0x0000FF00) >> 8); key[i++] = (byte)(j & 0x000000FF); } return(new CollationKey(this, str, key));} |
int j = ((Integer)objarr[i]).intValue(); key[i++] = (byte)((j & 0xFF000000) >> 24); key[i++] = (byte)((j & 0x00FF0000) >> 16); key[i++] = (byte)((j & 0x0000FF00) >> 8); key[i++] = (byte)(j & 0x000000FF); | int j = ((Integer) objarr[i]).intValue(); key [i * 4] = (byte) ((j & 0xFF000000) >> 24); key [i * 4 + 1] = (byte) ((j & 0x00FF0000) >> 16); key [i * 4 + 2] = (byte) ((j & 0x0000FF00) >> 8); key [i * 4 + 3] = (byte) (j & 0x000000FF); | getCollationKey(String str){ CollationElementIterator cei = getCollationElementIterator(str); Vector vect = new Vector(25); int ord = cei.next(); while (ord != CollationElementIterator.NULLORDER) { switch (getStrength()) { case PRIMARY: ord = CollationElementIterator.primaryOrder(ord); break; case SECONDARY: ord = CollationElementIterator.secondaryOrder(ord); default: break; } vect.add(new Integer(ord)); } Object[] objarr = vect.toArray(); byte[] key = new byte[objarr.length * 4]; for (int i = 0; i < key.length; i++) { int j = ((Integer)objarr[i]).intValue(); key[i++] = (byte)((j & 0xFF000000) >> 24); key[i++] = (byte)((j & 0x00FF0000) >> 16); key[i++] = (byte)((j & 0x0000FF00) >> 8); key[i++] = (byte)(j & 0x000000FF); } return(new CollationKey(this, str, key));} |
return(new CollationKey(this, str, key)); } | return new CollationKey(this, source, key); } | getCollationKey(String str){ CollationElementIterator cei = getCollationElementIterator(str); Vector vect = new Vector(25); int ord = cei.next(); while (ord != CollationElementIterator.NULLORDER) { switch (getStrength()) { case PRIMARY: ord = CollationElementIterator.primaryOrder(ord); break; case SECONDARY: ord = CollationElementIterator.secondaryOrder(ord); default: break; } vect.add(new Integer(ord)); } Object[] objarr = vect.toArray(); byte[] key = new byte[objarr.length * 4]; for (int i = 0; i < key.length; i++) { int j = ((Integer)objarr[i]).intValue(); key[i++] = (byte)((j & 0xFF000000) >> 24); key[i++] = (byte)((j & 0x00FF0000) >> 16); key[i++] = (byte)((j & 0x0000FF00) >> 8); key[i++] = (byte)(j & 0x000000FF); } return(new CollationKey(this, str, key));} |
getRules() { return(rules); } | public String getRules() { return rules; } | getRules(){ return(rules);} |
hashCode() { return(System.identityHashCode(this)); } | public int hashCode() { return System.identityHashCode(this); } | hashCode(){ return(System.identityHashCode(this));} |
CollationElementIterator(RuleBasedCollator rbc, String str) { this.rbc = rbc; this.str = str; } | CollationElementIterator(RuleBasedCollator collator, String text) { this.collator = collator; setText (text); } | CollationElementIterator(RuleBasedCollator rbc, String str){ this.rbc = rbc; this.str = str;} |
next() { ++pos; if (pos >= str.length()) return(NULLORDER); | public int next() { RuleBasedCollator.CollationElement e = nextBlock(); | next(){ ++pos; if (pos >= str.length()) return(NULLORDER); String s = str.charAt(pos) + ""; return(rbc.getCollationElementValue(s));} |
String s = str.charAt(pos) + ""; return(rbc.getCollationElementValue(s)); } | if (e == null) return NULLORDER; return e.getValue(); } | next(){ ++pos; if (pos >= str.length()) return(NULLORDER); String s = str.charAt(pos) + ""; return(rbc.getCollationElementValue(s));} |
reset() { pos = 0; } | public void reset() { index = 0; textIndex = 0; } | reset(){ pos = 0;} |
CollationKey(Collator collator, String str, byte[] key) { | CollationKey (Collator collator, String originalText, byte[] key) { | CollationKey(Collator collator, String str, byte[] key){ this.collator = collator; this.str = str; this.key = key;} |
this.str = str; | this.originalText = originalText; | CollationKey(Collator collator, String str, byte[] key){ this.collator = collator; this.str = str; this.key = key;} |
ActionMap createActionMap() | private ActionMap createActionMap() | ActionMap createActionMap() { Action[] actions = textComponent.getActions(); ActionMap am = new ActionMapUIResource(); for (int i = 0; i < actions.length; ++i) { String name = (String) actions[i].getValue(Action.NAME); if (name != null) am.put(name, actions[i]); } return am; } |
ActionMap am = new ActionMapUIResource(); for (int i = 0; i < actions.length; ++i) | for (int i = actions.length - 1; i >= 0; i--) | ActionMap createActionMap() { Action[] actions = textComponent.getActions(); ActionMap am = new ActionMapUIResource(); for (int i = 0; i < actions.length; ++i) { String name = (String) actions[i].getValue(Action.NAME); if (name != null) am.put(name, actions[i]); } return am; } |
String name = (String) actions[i].getValue(Action.NAME); if (name != null) am.put(name, actions[i]); | Action action = actions[i]; am.put(action.getValue(Action.NAME), action); | ActionMap createActionMap() { Action[] actions = textComponent.getActions(); ActionMap am = new ActionMapUIResource(); for (int i = 0; i < actions.length; ++i) { String name = (String) actions[i].getValue(Action.NAME); if (name != null) am.put(name, actions[i]); } return am; } |
Action copyAction = TransferHandler.getCopyAction(); am.put(copyAction.getValue(Action.NAME), copyAction); Action cutAction = TransferHandler.getCutAction(); am.put(cutAction.getValue(Action.NAME), cutAction); Action pasteAction = TransferHandler.getPasteAction(); am.put(pasteAction.getValue(Action.NAME), pasteAction); | ActionMap createActionMap() { Action[] actions = textComponent.getActions(); ActionMap am = new ActionMapUIResource(); for (int i = 0; i < actions.length; ++i) { String name = (String) actions[i].getValue(Action.NAME); if (name != null) am.put(name, actions[i]); } return am; } | |
InputMap getInputMap(int condition) | private InputMap getInputMap() | InputMap getInputMap(int condition) { String prefix = getPropertyPrefix(); switch (condition) { case JComponent.WHEN_IN_FOCUSED_WINDOW: // FIXME: is this the right string? nobody seems to use it. return (InputMap) UIManager.get(prefix + ".windowInputMap"); case JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT: return (InputMap) UIManager.get(prefix + ".ancestorInputMap"); default: case JComponent.WHEN_FOCUSED: return (InputMap) UIManager.get(prefix + ".focusInputMap"); } } |
switch (condition) { case JComponent.WHEN_IN_FOCUSED_WINDOW: return (InputMap) UIManager.get(prefix + ".windowInputMap"); case JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT: return (InputMap) UIManager.get(prefix + ".ancestorInputMap"); default: case JComponent.WHEN_FOCUSED: return (InputMap) UIManager.get(prefix + ".focusInputMap"); } | InputMap shared = (InputMap) SharedUIDefaults.get(prefix + ".focusInputMap"); if (shared != null) im.setParent(shared); return im; | InputMap getInputMap(int condition) { String prefix = getPropertyPrefix(); switch (condition) { case JComponent.WHEN_IN_FOCUSED_WINDOW: // FIXME: is this the right string? nobody seems to use it. return (InputMap) UIManager.get(prefix + ".windowInputMap"); case JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT: return (InputMap) UIManager.get(prefix + ".ancestorInputMap"); default: case JComponent.WHEN_FOCUSED: return (InputMap) UIManager.get(prefix + ".focusInputMap"); } } |
getInputMap(JComponent.WHEN_FOCUSED)); SwingUtilities.replaceUIActionMap(textComponent, createActionMap()); ActionMap parentActionMap = new ActionMapUIResource(); Action[] actions = textComponent.getActions(); for (int j = 0; j < actions.length; j++) { Action currAction = actions[j]; parentActionMap.put(currAction.getValue(Action.NAME), currAction); } SwingUtilities.replaceUIActionMap(textComponent, parentActionMap); | getInputMap()); SwingUtilities.replaceUIActionMap(textComponent, getActionMap()); | protected void installKeyboardActions() { // This is only there for backwards compatibility. textComponent.setKeymap(createKeymap()); // load any bindings for the newer InputMap / ActionMap interface SwingUtilities.replaceUIInputMap(textComponent, JComponent.WHEN_FOCUSED, getInputMap(JComponent.WHEN_FOCUSED)); SwingUtilities.replaceUIActionMap(textComponent, createActionMap()); ActionMap parentActionMap = new ActionMapUIResource(); Action[] actions = textComponent.getActions(); for (int j = 0; j < actions.length; j++) { Action currAction = actions[j]; parentActionMap.put(currAction.getValue(Action.NAME), currAction); } SwingUtilities.replaceUIActionMap(textComponent, parentActionMap); } |
public void repaint(Rectangle r) | public void repaint(long tm, int x, int y, int width, int height) | public void repaint(Rectangle r) { repaint((long) 0, (int) r.getX(), (int) r.getY(), (int) r.getWidth(), (int) r.getHeight()); } |
repaint((long) 0, (int) r.getX(), (int) r.getY(), (int) r.getWidth(), (int) r.getHeight()); | Rectangle dirty = new Rectangle(x, y, width, height); Rectangle vis = getVisibleRect(); dirty = dirty.intersection(vis); RepaintManager.currentManager(this).addDirtyRegion(this, dirty.x, dirty.y, dirty.width, dirty.height); | public void repaint(Rectangle r) { repaint((long) 0, (int) r.getX(), (int) r.getY(), (int) r.getWidth(), (int) r.getHeight()); } |
out.println("Memory size: " + rt.totalMemory()); out.println("Free memory: " + rt.freeMemory()); | out.println("Memory size: " + NumberUtils.size(rt.totalMemory())); out.println("Free memory: " + NumberUtils.size(rt.freeMemory())); | public void execute( CommandLine cmdLine, InputStream in, PrintStream out, PrintStream err) throws Exception { final Runtime rt = Runtime.getRuntime(); out.println("Memory size: " + rt.totalMemory()); out.println("Free memory: " + rt.freeMemory()); out.println("Starting gc..."); long start = System.currentTimeMillis(); rt.gc(); GCStatistics stats = Vm.getHeapManager().getStatistics(); Thread.yield(); long end = System.currentTimeMillis(); out.println("Memory size: " + rt.totalMemory()); out.println("Free memory: " + rt.freeMemory()); out.println("Time taken : " + (end-start) + "ms"); out.println("Stats : " + stats.toString()); } |
protected AccessibleAbstractButton(AbstractButton component) { super(component); } | protected AccessibleAbstractButton(JComponent c) { super(c); } | protected AccessibleAbstractButton(AbstractButton component) { super(component); // TODO } // AccessibleAbstractButton() |
protected void configurePropertiesFromAction(Action a) { } | protected void configurePropertiesFromAction(Action a) { if (a == null) { setText(null); setIcon(null); setEnabled(true); setToolTipText(null); } else { setText((String)(a.getValue(Action.NAME))); setIcon((Icon)(a.getValue(Action.SMALL_ICON))); setEnabled(a.isEnabled()); setToolTipText((String)(a.getValue(Action.SHORT_DESCRIPTION))); setMnemonic(((Integer)(a.getValue(Action.MNEMONIC_KEY))).intValue()); setActionCommand((String)(a.getValue(Action.ACTION_COMMAND_KEY))); } } | protected void configurePropertiesFromAction(Action a) { //Factory method which sets the ActionEvent source's properties according to values from the Action instance. } |
protected PropertyChangeListener createActionPropertyChangeListener(Action a) { return null; } | protected PropertyChangeListener createActionPropertyChangeListener(Action a) { return new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { Action act = (Action)(e.getSource()); AbstractButton.this.configurePropertiesFromAction(act); } }; } | protected PropertyChangeListener createActionPropertyChangeListener(Action a) { //Factory method which creates the PropertyChangeListener used to update the ActionEvent source as properties change on its Action instance. return null; } |
public abstract Component getComponent(); | Component getComponent(); | public abstract Component getComponent(); |
public abstract MenuElement[] getSubElements(); | MenuElement[] getSubElements(); | public abstract MenuElement[] getSubElements(); |
public abstract void menuSelectionChanged(boolean included); | void menuSelectionChanged(boolean included); | public abstract void menuSelectionChanged(boolean included); |
public abstract void processKeyEvent(KeyEvent event, | void processKeyEvent(KeyEvent event, | public abstract void processKeyEvent(KeyEvent event, MenuElement[] path, MenuSelectionManager manager); |
public void processMouseEvent(MouseEvent event, | void processMouseEvent(MouseEvent event, | public void processMouseEvent(MouseEvent event, MenuElement[] path, MenuSelectionManager manager); |
public GetDelegateInstanceException(String msg, Throwable next) | public GetDelegateInstanceException(String msg) | public GetDelegateInstanceException(String msg, Throwable next) { super(msg, next); } |
super(msg, next); | super(msg); | public GetDelegateInstanceException(String msg, Throwable next) { super(msg, next); } |
public Text createTextNode(char[] buf, int off, int len) | public Text createTextNode(String value) | public Text createTextNode(char[] buf, int off, int len) { if (checkingCharacters) { checkChar(buf, off, len, "1.1".equals(version)); } return new DomText(this, buf, off, len); } |
checkChar(buf, off, len, "1.1".equals(version)); | checkChar(value, "1.1".equals(version)); | public Text createTextNode(char[] buf, int off, int len) { if (checkingCharacters) { checkChar(buf, off, len, "1.1".equals(version)); } return new DomText(this, buf, off, len); } |
return new DomText(this, buf, off, len); | return new DomText(this, value); | public Text createTextNode(char[] buf, int off, int len) { if (checkingCharacters) { checkChar(buf, off, len, "1.1".equals(version)); } return new DomText(this, buf, off, len); } |
Object val = (arg == null) ? null : arg.evaluate(context, pos, len); | Object val = (arg == null) ? Collections.singleton(context) : arg.evaluate(context, pos, len); | public Object evaluate(Node context, int pos, int len) { Object val = (arg == null) ? null : arg.evaluate(context, pos, len); return _name(context, (Collection) val); } |
public boolean isSelected(); | boolean isSelected(); | public boolean isSelected(); |
public void setSelectedIndex(int index); | void setSelectedIndex(int index); | public void setSelectedIndex(int index); |
Name add(int posn, String comp) throws InvalidNameException; | Name add(String comp) throws InvalidNameException; | Name add(int posn, String comp) throws InvalidNameException; |
Name addAll(int posn, Name n) throws InvalidNameException; | Name addAll(Name suffix) throws InvalidNameException; | Name addAll(int posn, Name n) throws InvalidNameException; |
invalidate(); | comp.invalidate(); | protected void addImpl(Component comp, Object constraints, int index) { synchronized (getTreeLock ()) { if (index > ncomponents || (index < 0 && index != -1) || comp instanceof Window || (comp instanceof Container && ((Container) comp).isAncestorOf(this))) throw new IllegalArgumentException(); // Reparent component, and make sure component is instantiated if // we are. if (comp.parent != null) comp.parent.remove(comp); comp.parent = this; if (peer != null) { if (comp.isLightweight ()) { enableEvents (comp.eventMask); if (!isLightweight ()) enableEvents (AWTEvent.PAINT_EVENT_MASK); } } invalidate(); if (component == null) component = new Component[4]; // FIXME, better initial size? // This isn't the most efficient implementation. We could do less // copying when growing the array. It probably doesn't matter. if (ncomponents >= component.length) { int nl = component.length * 2; Component[] c = new Component[nl]; System.arraycopy(component, 0, c, 0, ncomponents); component = c; } if (index == -1) component[ncomponents++] = comp; else { System.arraycopy(component, index, component, index + 1, ncomponents - index); component[index] = comp; ++ncomponents; } // Notify the layout manager. if (layoutMgr != null) { if (layoutMgr instanceof LayoutManager2) { LayoutManager2 lm2 = (LayoutManager2) layoutMgr; lm2.addLayoutComponent(comp, constraints); } else if (constraints instanceof String) layoutMgr.addLayoutComponent((String) constraints, comp); else layoutMgr.addLayoutComponent(null, comp); } if (isShowing ()) { // Post event to notify of adding the component. ContainerEvent ce = new ContainerEvent(this, ContainerEvent.COMPONENT_ADDED, comp); getToolkit().getSystemEventQueue().postEvent(ce); } } } |
repaint(); | protected void addImpl(Component comp, Object constraints, int index) { synchronized (getTreeLock ()) { if (index > ncomponents || (index < 0 && index != -1) || comp instanceof Window || (comp instanceof Container && ((Container) comp).isAncestorOf(this))) throw new IllegalArgumentException(); // Reparent component, and make sure component is instantiated if // we are. if (comp.parent != null) comp.parent.remove(comp); comp.parent = this; if (peer != null) { if (comp.isLightweight ()) { enableEvents (comp.eventMask); if (!isLightweight ()) enableEvents (AWTEvent.PAINT_EVENT_MASK); } } invalidate(); if (component == null) component = new Component[4]; // FIXME, better initial size? // This isn't the most efficient implementation. We could do less // copying when growing the array. It probably doesn't matter. if (ncomponents >= component.length) { int nl = component.length * 2; Component[] c = new Component[nl]; System.arraycopy(component, 0, c, 0, ncomponents); component = c; } if (index == -1) component[ncomponents++] = comp; else { System.arraycopy(component, index, component, index + 1, ncomponents - index); component[index] = comp; ++ncomponents; } // Notify the layout manager. if (layoutMgr != null) { if (layoutMgr instanceof LayoutManager2) { LayoutManager2 lm2 = (LayoutManager2) layoutMgr; lm2.addLayoutComponent(comp, constraints); } else if (constraints instanceof String) layoutMgr.addLayoutComponent((String) constraints, comp); else layoutMgr.addLayoutComponent(null, comp); } if (isShowing ()) { // Post event to notify of adding the component. ContainerEvent ce = new ContainerEvent(this, ContainerEvent.COMPONENT_ADDED, comp); getToolkit().getSystemEventQueue().postEvent(ce); } } } | |
if (! this.isLightweight()) { if (dispatcher == null) | if (!this.isLightweight() && dispatcher == null) | private void addNotifyContainerChildren() { synchronized (getTreeLock ()) { for (int i = ncomponents; --i >= 0; ) { component[i].addNotify(); if (component[i].isLightweight ()) { // If we're not lightweight, and we just got a lightweight // child, we need a lightweight dispatcher to feed it events. if (! this.isLightweight()) { if (dispatcher == null) dispatcher = new LightweightDispatcher (this); } enableEvents(component[i].eventMask); if (peer != null && !isLightweight ()) enableEvents (AWTEvent.PAINT_EVENT_MASK); } } } } |
} | private void addNotifyContainerChildren() { synchronized (getTreeLock ()) { for (int i = ncomponents; --i >= 0; ) { component[i].addNotify(); if (component[i].isLightweight ()) { // If we're not lightweight, and we just got a lightweight // child, we need a lightweight dispatcher to feed it events. if (! this.isLightweight()) { if (dispatcher == null) dispatcher = new LightweightDispatcher (this); } enableEvents(component[i].eventMask); if (peer != null && !isLightweight ()) enableEvents (AWTEvent.PAINT_EVENT_MASK); } } } } | |
if (dispatcher != null) dispatcher.enableEvents(component[i].eventMask); | private void addNotifyContainerChildren() { synchronized (getTreeLock ()) { for (int i = ncomponents; --i >= 0; ) { component[i].addNotify(); if (component[i].isLightweight ()) { // If we're not lightweight, and we just got a lightweight // child, we need a lightweight dispatcher to feed it events. if (! this.isLightweight()) { if (dispatcher == null) dispatcher = new LightweightDispatcher (this); } enableEvents(component[i].eventMask); if (peer != null && !isLightweight ()) enableEvents (AWTEvent.PAINT_EVENT_MASK); } } } } | |
if (eventTypeEnabled (e.id) && dispatcher != null && dispatcher.handleEvent (e)) | if (dispatcher != null && dispatcher.handleEvent (e)) | void dispatchEventImpl(AWTEvent e) { // Give lightweight dispatcher a chance to handle it. if (eventTypeEnabled (e.id) && dispatcher != null && dispatcher.handleEvent (e)) return; if ((e.id <= ContainerEvent.CONTAINER_LAST && e.id >= ContainerEvent.CONTAINER_FIRST) && (containerListener != null || (eventMask & AWTEvent.CONTAINER_EVENT_MASK) != 0)) processEvent(e); else super.dispatchEventImpl(e); } |
if (layoutMgr instanceof LayoutManager2) { LayoutManager2 lm2 = (LayoutManager2) layoutMgr; return lm2.getLayoutAlignmentX(this); } else | public float getAlignmentX() { if (layoutMgr instanceof LayoutManager2) { LayoutManager2 lm2 = (LayoutManager2) layoutMgr; return lm2.getLayoutAlignmentX(this); } else return super.getAlignmentX(); } | |
if (layoutMgr instanceof LayoutManager2) { LayoutManager2 lm2 = (LayoutManager2) layoutMgr; return lm2.getLayoutAlignmentY(this); } else | public float getAlignmentY() { if (layoutMgr instanceof LayoutManager2) { LayoutManager2 lm2 = (LayoutManager2) layoutMgr; return lm2.getLayoutAlignmentY(this); } else return super.getAlignmentY(); } | |
if (layoutMgr != null && layoutMgr instanceof LayoutManager2) | if (valid && maxSize != null) return new Dimension(maxSize); LayoutManager layout = getLayout(); if (layout != null && layout instanceof LayoutManager2) | public Dimension getMaximumSize() { if (layoutMgr != null && layoutMgr instanceof LayoutManager2) { LayoutManager2 lm2 = (LayoutManager2) layoutMgr; return lm2.maximumLayoutSize(this); } else return super.getMaximumSize(); } |
LayoutManager2 lm2 = (LayoutManager2) layoutMgr; return lm2.maximumLayoutSize(this); | LayoutManager2 lm2 = (LayoutManager2) layout; maxSize = lm2.maximumLayoutSize(this); return maxSize; | public Dimension getMaximumSize() { if (layoutMgr != null && layoutMgr instanceof LayoutManager2) { LayoutManager2 lm2 = (LayoutManager2) layoutMgr; return lm2.maximumLayoutSize(this); } else return super.getMaximumSize(); } |
if (layoutMgr != null && layoutMgr instanceof LayoutManager2) { LayoutManager2 lm2 = (LayoutManager2) layoutMgr; lm2.invalidateLayout(this); } | public void invalidate() { super.invalidate(); } | |
if (layoutMgr != null && layoutMgr instanceof LayoutManager2) { LayoutManager2 lm2 = (LayoutManager2) layoutMgr; lm2.invalidateLayout(this); } | void invalidateTree() { for (int i = 0; i < ncomponents; i++) { Component comp = component[i]; comp.invalidate(); if (comp instanceof Container) ((Container) comp).invalidateTree(); } } | |
if (layoutMgr != null) return layoutMgr.minimumLayoutSize (this); | if(valid && minSize != null) return new Dimension(minSize); LayoutManager layout = getLayout(); if (layout != null) { minSize = layout.minimumLayoutSize (this); return minSize; } | public Dimension minimumSize() { if (layoutMgr != null) return layoutMgr.minimumLayoutSize (this); else return super.minimumSize (); } |
super.paint(g); | public void paint(Graphics g) { if (!isShowing()) return; // Paint self first. super.paint(g); // Visit heavyweights as well, in case they were // erased when we cleared the background for this container. visitChildren(g, GfxPaintVisitor.INSTANCE, false); } | |
if (layoutMgr != null) return layoutMgr.preferredLayoutSize (this); | synchronized(treeLock) { if(valid && prefSize != null) return new Dimension(prefSize); LayoutManager layout = getLayout(); if (layout != null) { Dimension layoutSize = layout.preferredLayoutSize(this); if(valid) prefSize = layoutSize; return new Dimension(layoutSize); } | public Dimension preferredSize() { if (layoutMgr != null) return layoutMgr.preferredLayoutSize (this); else return super.preferredSize (); } |
} | public Dimension preferredSize() { if (layoutMgr != null) return layoutMgr.preferredLayoutSize (this); else return super.preferredSize (); } | |
repaint(); | public void remove(int index) { synchronized (getTreeLock ()) { Component r = component[index]; r.removeNotify(); System.arraycopy(component, index + 1, component, index, ncomponents - index - 1); component[--ncomponents] = null; invalidate(); if (layoutMgr != null) layoutMgr.removeLayoutComponent(r); r.parent = null; if (isShowing ()) { // Post event to notify of removing the component. ContainerEvent ce = new ContainerEvent(this, ContainerEvent.COMPONENT_REMOVED, r); getToolkit().getSystemEventQueue().postEvent(ce); } } } | |
focusTraversalKeys = new Set[3]; | focusTraversalKeys = new Set[4]; | public void setFocusTraversalKeys(int id, Set keystrokes) { if (id != KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS && id != KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS && id != KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS && id != KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS) throw new IllegalArgumentException (); if (keystrokes == null) { Container parent = getParent (); while (parent != null) { if (parent.areFocusTraversalKeysSet (id)) { keystrokes = parent.getFocusTraversalKeys (id); break; } parent = parent.getParent (); } if (keystrokes == null) keystrokes = KeyboardFocusManager.getCurrentKeyboardFocusManager (). getDefaultFocusTraversalKeys (id); } Set sa; Set sb; Set sc; String name; switch (id) { case KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS: sa = getFocusTraversalKeys (KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS); sb = getFocusTraversalKeys (KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS); sc = getFocusTraversalKeys (KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS); name = "forwardFocusTraversalKeys"; break; case KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS: sa = getFocusTraversalKeys (KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS); sb = getFocusTraversalKeys (KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS); sc = getFocusTraversalKeys (KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS); name = "backwardFocusTraversalKeys"; break; case KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS: sa = getFocusTraversalKeys (KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS); sb = getFocusTraversalKeys (KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS); sc = getFocusTraversalKeys (KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS); name = "upCycleFocusTraversalKeys"; break; case KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS: sa = getFocusTraversalKeys (KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS); sb = getFocusTraversalKeys (KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS); sc = getFocusTraversalKeys (KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS); name = "downCycleFocusTraversalKeys"; break; default: throw new IllegalArgumentException (); } int i = keystrokes.size (); Iterator iter = keystrokes.iterator (); while (--i >= 0) { Object o = iter.next (); if (!(o instanceof AWTKeyStroke) || sa.contains (o) || sb.contains (o) || sc.contains (o) || ((AWTKeyStroke) o).keyCode == KeyEvent.VK_UNDEFINED) throw new IllegalArgumentException (); } if (focusTraversalKeys == null) focusTraversalKeys = new Set[3]; keystrokes = Collections.unmodifiableSet (new HashSet (keystrokes)); firePropertyChange (name, focusTraversalKeys[id], keystrokes); focusTraversalKeys[id] = keystrokes; } |
} | public void setFont(Font f) { super.setFont(f); // FIXME: Although it might make more sense to invalidate only // those children whose font == null, Sun invalidates all children. // So we'll do the same. invalidateTree(); } | |
super.update(g); | ComponentPeer p = peer; if (p != null && !(p instanceof LightweightPeer)) g.clearRect(0, 0, getWidth(), getHeight()); paint(g); | public void update(Graphics g) { super.update(g); } |
&& (comp.isLightweight() || !lightweightOnly && ! (comp instanceof Container)); | && (comp.isLightweight() || !lightweightOnly); | private void visitChildren(Graphics gfx, GfxVisitor visitor, boolean lightweightOnly) { synchronized (getTreeLock ()) { for (int i = ncomponents - 1; i >= 0; --i) { Component comp = component[i]; // If we're visiting heavyweights as well, // don't recurse into Containers here. This avoids // painting the same nested child multiple times. boolean applicable = comp.isVisible() && (comp.isLightweight() || !lightweightOnly && ! (comp instanceof Container)); if (applicable) visitChild(gfx, visitor, comp); } } } |
void acquireComponentForMouseEvent(MouseEvent me) | Component acquireComponentForMouseEvent(MouseEvent me) | void acquireComponentForMouseEvent(MouseEvent me) { int x = me.getX (); int y = me.getY (); // Find the candidate which should receive this event. Component parent = nativeContainer; Component candidate = null; Point p = me.getPoint(); while (candidate == null && parent != null) { candidate = SwingUtilities.getDeepestComponentAt(parent, p.x, p.y); if (candidate == null || (candidate.eventMask & me.getID()) == 0) { candidate = null; p = SwingUtilities.convertPoint(parent, p.x, p.y, parent.parent); parent = parent.parent; } } // If the only candidate we found was the native container itself, // don't dispatch any event at all. We only care about the lightweight // children here. if (candidate == nativeContainer) candidate = null; // If our candidate is new, inform the old target we're leaving. if (lastComponentEntered != null && lastComponentEntered.isShowing() && lastComponentEntered != candidate) { // Old candidate could have been removed from // the nativeContainer so we check first. if (SwingUtilities.isDescendingFrom(lastComponentEntered, nativeContainer)) { Point tp = SwingUtilities.convertPoint(nativeContainer, x, y, lastComponentEntered); MouseEvent exited = new MouseEvent (lastComponentEntered, MouseEvent.MOUSE_EXITED, me.getWhen (), me.getModifiersEx (), tp.x, tp.y, me.getClickCount (), me.isPopupTrigger (), me.getButton ()); tempComponent = lastComponentEntered; lastComponentEntered = null; tempComponent.dispatchEvent(exited); } lastComponentEntered = null; } // If we have a candidate, maybe enter it. if (candidate != null) { mouseEventTarget = candidate; if (candidate.isLightweight() && candidate.isShowing() && candidate != nativeContainer && candidate != lastComponentEntered) { lastComponentEntered = mouseEventTarget; Point cp = SwingUtilities.convertPoint(nativeContainer, x, y, lastComponentEntered); MouseEvent entered = new MouseEvent (lastComponentEntered, MouseEvent.MOUSE_ENTERED, me.getWhen (), me.getModifiersEx (), cp.x, cp.y, me.getClickCount (), me.isPopupTrigger (), me.getButton ()); lastComponentEntered.dispatchEvent (entered); } } if (me.getID() == MouseEvent.MOUSE_RELEASED || me.getID() == MouseEvent.MOUSE_PRESSED && pressCount > 0 || me.getID() == MouseEvent.MOUSE_DRAGGED) // If any of the following events occur while a button is held down, // they should be dispatched to the same component to which the // original MOUSE_PRESSED event was dispatched: // - MOUSE_RELEASED // - MOUSE_PRESSED: another button pressed while the first is held down // - MOUSE_DRAGGED if (SwingUtilities.isDescendingFrom(pressedComponent, nativeContainer)) mouseEventTarget = pressedComponent; else if (me.getID() == MouseEvent.MOUSE_CLICKED) { // Don't dispatch CLICKED events whose target is not the same as the // target for the original PRESSED event. if (candidate != pressedComponent) mouseEventTarget = null; else if (pressCount == 0) pressedComponent = null; } } |
SwingUtilities.getDeepestComponentAt(parent, p.x, p.y); | getDeepestComponentForMouseEventAt(parent, p.x, p.y); | void acquireComponentForMouseEvent(MouseEvent me) { int x = me.getX (); int y = me.getY (); // Find the candidate which should receive this event. Component parent = nativeContainer; Component candidate = null; Point p = me.getPoint(); while (candidate == null && parent != null) { candidate = SwingUtilities.getDeepestComponentAt(parent, p.x, p.y); if (candidate == null || (candidate.eventMask & me.getID()) == 0) { candidate = null; p = SwingUtilities.convertPoint(parent, p.x, p.y, parent.parent); parent = parent.parent; } } // If the only candidate we found was the native container itself, // don't dispatch any event at all. We only care about the lightweight // children here. if (candidate == nativeContainer) candidate = null; // If our candidate is new, inform the old target we're leaving. if (lastComponentEntered != null && lastComponentEntered.isShowing() && lastComponentEntered != candidate) { // Old candidate could have been removed from // the nativeContainer so we check first. if (SwingUtilities.isDescendingFrom(lastComponentEntered, nativeContainer)) { Point tp = SwingUtilities.convertPoint(nativeContainer, x, y, lastComponentEntered); MouseEvent exited = new MouseEvent (lastComponentEntered, MouseEvent.MOUSE_EXITED, me.getWhen (), me.getModifiersEx (), tp.x, tp.y, me.getClickCount (), me.isPopupTrigger (), me.getButton ()); tempComponent = lastComponentEntered; lastComponentEntered = null; tempComponent.dispatchEvent(exited); } lastComponentEntered = null; } // If we have a candidate, maybe enter it. if (candidate != null) { mouseEventTarget = candidate; if (candidate.isLightweight() && candidate.isShowing() && candidate != nativeContainer && candidate != lastComponentEntered) { lastComponentEntered = mouseEventTarget; Point cp = SwingUtilities.convertPoint(nativeContainer, x, y, lastComponentEntered); MouseEvent entered = new MouseEvent (lastComponentEntered, MouseEvent.MOUSE_ENTERED, me.getWhen (), me.getModifiersEx (), cp.x, cp.y, me.getClickCount (), me.isPopupTrigger (), me.getButton ()); lastComponentEntered.dispatchEvent (entered); } } if (me.getID() == MouseEvent.MOUSE_RELEASED || me.getID() == MouseEvent.MOUSE_PRESSED && pressCount > 0 || me.getID() == MouseEvent.MOUSE_DRAGGED) // If any of the following events occur while a button is held down, // they should be dispatched to the same component to which the // original MOUSE_PRESSED event was dispatched: // - MOUSE_RELEASED // - MOUSE_PRESSED: another button pressed while the first is held down // - MOUSE_DRAGGED if (SwingUtilities.isDescendingFrom(pressedComponent, nativeContainer)) mouseEventTarget = pressedComponent; else if (me.getID() == MouseEvent.MOUSE_CLICKED) { // Don't dispatch CLICKED events whose target is not the same as the // target for the original PRESSED event. if (candidate != pressedComponent) mouseEventTarget = null; else if (pressCount == 0) pressedComponent = null; } } |
p = SwingUtilities.convertPoint(parent, p.x, p.y, parent.parent); | p = AWTUtilities.convertPoint(parent, p.x, p.y, parent.parent); | void acquireComponentForMouseEvent(MouseEvent me) { int x = me.getX (); int y = me.getY (); // Find the candidate which should receive this event. Component parent = nativeContainer; Component candidate = null; Point p = me.getPoint(); while (candidate == null && parent != null) { candidate = SwingUtilities.getDeepestComponentAt(parent, p.x, p.y); if (candidate == null || (candidate.eventMask & me.getID()) == 0) { candidate = null; p = SwingUtilities.convertPoint(parent, p.x, p.y, parent.parent); parent = parent.parent; } } // If the only candidate we found was the native container itself, // don't dispatch any event at all. We only care about the lightweight // children here. if (candidate == nativeContainer) candidate = null; // If our candidate is new, inform the old target we're leaving. if (lastComponentEntered != null && lastComponentEntered.isShowing() && lastComponentEntered != candidate) { // Old candidate could have been removed from // the nativeContainer so we check first. if (SwingUtilities.isDescendingFrom(lastComponentEntered, nativeContainer)) { Point tp = SwingUtilities.convertPoint(nativeContainer, x, y, lastComponentEntered); MouseEvent exited = new MouseEvent (lastComponentEntered, MouseEvent.MOUSE_EXITED, me.getWhen (), me.getModifiersEx (), tp.x, tp.y, me.getClickCount (), me.isPopupTrigger (), me.getButton ()); tempComponent = lastComponentEntered; lastComponentEntered = null; tempComponent.dispatchEvent(exited); } lastComponentEntered = null; } // If we have a candidate, maybe enter it. if (candidate != null) { mouseEventTarget = candidate; if (candidate.isLightweight() && candidate.isShowing() && candidate != nativeContainer && candidate != lastComponentEntered) { lastComponentEntered = mouseEventTarget; Point cp = SwingUtilities.convertPoint(nativeContainer, x, y, lastComponentEntered); MouseEvent entered = new MouseEvent (lastComponentEntered, MouseEvent.MOUSE_ENTERED, me.getWhen (), me.getModifiersEx (), cp.x, cp.y, me.getClickCount (), me.isPopupTrigger (), me.getButton ()); lastComponentEntered.dispatchEvent (entered); } } if (me.getID() == MouseEvent.MOUSE_RELEASED || me.getID() == MouseEvent.MOUSE_PRESSED && pressCount > 0 || me.getID() == MouseEvent.MOUSE_DRAGGED) // If any of the following events occur while a button is held down, // they should be dispatched to the same component to which the // original MOUSE_PRESSED event was dispatched: // - MOUSE_RELEASED // - MOUSE_PRESSED: another button pressed while the first is held down // - MOUSE_DRAGGED if (SwingUtilities.isDescendingFrom(pressedComponent, nativeContainer)) mouseEventTarget = pressedComponent; else if (me.getID() == MouseEvent.MOUSE_CLICKED) { // Don't dispatch CLICKED events whose target is not the same as the // target for the original PRESSED event. if (candidate != pressedComponent) mouseEventTarget = null; else if (pressCount == 0) pressedComponent = null; } } |
if (SwingUtilities.isDescendingFrom(lastComponentEntered, nativeContainer)) | if (AWTUtilities.isDescendingFrom(lastComponentEntered, nativeContainer)) | void acquireComponentForMouseEvent(MouseEvent me) { int x = me.getX (); int y = me.getY (); // Find the candidate which should receive this event. Component parent = nativeContainer; Component candidate = null; Point p = me.getPoint(); while (candidate == null && parent != null) { candidate = SwingUtilities.getDeepestComponentAt(parent, p.x, p.y); if (candidate == null || (candidate.eventMask & me.getID()) == 0) { candidate = null; p = SwingUtilities.convertPoint(parent, p.x, p.y, parent.parent); parent = parent.parent; } } // If the only candidate we found was the native container itself, // don't dispatch any event at all. We only care about the lightweight // children here. if (candidate == nativeContainer) candidate = null; // If our candidate is new, inform the old target we're leaving. if (lastComponentEntered != null && lastComponentEntered.isShowing() && lastComponentEntered != candidate) { // Old candidate could have been removed from // the nativeContainer so we check first. if (SwingUtilities.isDescendingFrom(lastComponentEntered, nativeContainer)) { Point tp = SwingUtilities.convertPoint(nativeContainer, x, y, lastComponentEntered); MouseEvent exited = new MouseEvent (lastComponentEntered, MouseEvent.MOUSE_EXITED, me.getWhen (), me.getModifiersEx (), tp.x, tp.y, me.getClickCount (), me.isPopupTrigger (), me.getButton ()); tempComponent = lastComponentEntered; lastComponentEntered = null; tempComponent.dispatchEvent(exited); } lastComponentEntered = null; } // If we have a candidate, maybe enter it. if (candidate != null) { mouseEventTarget = candidate; if (candidate.isLightweight() && candidate.isShowing() && candidate != nativeContainer && candidate != lastComponentEntered) { lastComponentEntered = mouseEventTarget; Point cp = SwingUtilities.convertPoint(nativeContainer, x, y, lastComponentEntered); MouseEvent entered = new MouseEvent (lastComponentEntered, MouseEvent.MOUSE_ENTERED, me.getWhen (), me.getModifiersEx (), cp.x, cp.y, me.getClickCount (), me.isPopupTrigger (), me.getButton ()); lastComponentEntered.dispatchEvent (entered); } } if (me.getID() == MouseEvent.MOUSE_RELEASED || me.getID() == MouseEvent.MOUSE_PRESSED && pressCount > 0 || me.getID() == MouseEvent.MOUSE_DRAGGED) // If any of the following events occur while a button is held down, // they should be dispatched to the same component to which the // original MOUSE_PRESSED event was dispatched: // - MOUSE_RELEASED // - MOUSE_PRESSED: another button pressed while the first is held down // - MOUSE_DRAGGED if (SwingUtilities.isDescendingFrom(pressedComponent, nativeContainer)) mouseEventTarget = pressedComponent; else if (me.getID() == MouseEvent.MOUSE_CLICKED) { // Don't dispatch CLICKED events whose target is not the same as the // target for the original PRESSED event. if (candidate != pressedComponent) mouseEventTarget = null; else if (pressCount == 0) pressedComponent = null; } } |
Point tp = SwingUtilities.convertPoint(nativeContainer, | Point tp = AWTUtilities.convertPoint(nativeContainer, | void acquireComponentForMouseEvent(MouseEvent me) { int x = me.getX (); int y = me.getY (); // Find the candidate which should receive this event. Component parent = nativeContainer; Component candidate = null; Point p = me.getPoint(); while (candidate == null && parent != null) { candidate = SwingUtilities.getDeepestComponentAt(parent, p.x, p.y); if (candidate == null || (candidate.eventMask & me.getID()) == 0) { candidate = null; p = SwingUtilities.convertPoint(parent, p.x, p.y, parent.parent); parent = parent.parent; } } // If the only candidate we found was the native container itself, // don't dispatch any event at all. We only care about the lightweight // children here. if (candidate == nativeContainer) candidate = null; // If our candidate is new, inform the old target we're leaving. if (lastComponentEntered != null && lastComponentEntered.isShowing() && lastComponentEntered != candidate) { // Old candidate could have been removed from // the nativeContainer so we check first. if (SwingUtilities.isDescendingFrom(lastComponentEntered, nativeContainer)) { Point tp = SwingUtilities.convertPoint(nativeContainer, x, y, lastComponentEntered); MouseEvent exited = new MouseEvent (lastComponentEntered, MouseEvent.MOUSE_EXITED, me.getWhen (), me.getModifiersEx (), tp.x, tp.y, me.getClickCount (), me.isPopupTrigger (), me.getButton ()); tempComponent = lastComponentEntered; lastComponentEntered = null; tempComponent.dispatchEvent(exited); } lastComponentEntered = null; } // If we have a candidate, maybe enter it. if (candidate != null) { mouseEventTarget = candidate; if (candidate.isLightweight() && candidate.isShowing() && candidate != nativeContainer && candidate != lastComponentEntered) { lastComponentEntered = mouseEventTarget; Point cp = SwingUtilities.convertPoint(nativeContainer, x, y, lastComponentEntered); MouseEvent entered = new MouseEvent (lastComponentEntered, MouseEvent.MOUSE_ENTERED, me.getWhen (), me.getModifiersEx (), cp.x, cp.y, me.getClickCount (), me.isPopupTrigger (), me.getButton ()); lastComponentEntered.dispatchEvent (entered); } } if (me.getID() == MouseEvent.MOUSE_RELEASED || me.getID() == MouseEvent.MOUSE_PRESSED && pressCount > 0 || me.getID() == MouseEvent.MOUSE_DRAGGED) // If any of the following events occur while a button is held down, // they should be dispatched to the same component to which the // original MOUSE_PRESSED event was dispatched: // - MOUSE_RELEASED // - MOUSE_PRESSED: another button pressed while the first is held down // - MOUSE_DRAGGED if (SwingUtilities.isDescendingFrom(pressedComponent, nativeContainer)) mouseEventTarget = pressedComponent; else if (me.getID() == MouseEvent.MOUSE_CLICKED) { // Don't dispatch CLICKED events whose target is not the same as the // target for the original PRESSED event. if (candidate != pressedComponent) mouseEventTarget = null; else if (pressCount == 0) pressedComponent = null; } } |
tempComponent = lastComponentEntered; lastComponentEntered = null; tempComponent.dispatchEvent(exited); | lastComponentEntered.dispatchEvent (exited); | void acquireComponentForMouseEvent(MouseEvent me) { int x = me.getX (); int y = me.getY (); // Find the candidate which should receive this event. Component parent = nativeContainer; Component candidate = null; Point p = me.getPoint(); while (candidate == null && parent != null) { candidate = SwingUtilities.getDeepestComponentAt(parent, p.x, p.y); if (candidate == null || (candidate.eventMask & me.getID()) == 0) { candidate = null; p = SwingUtilities.convertPoint(parent, p.x, p.y, parent.parent); parent = parent.parent; } } // If the only candidate we found was the native container itself, // don't dispatch any event at all. We only care about the lightweight // children here. if (candidate == nativeContainer) candidate = null; // If our candidate is new, inform the old target we're leaving. if (lastComponentEntered != null && lastComponentEntered.isShowing() && lastComponentEntered != candidate) { // Old candidate could have been removed from // the nativeContainer so we check first. if (SwingUtilities.isDescendingFrom(lastComponentEntered, nativeContainer)) { Point tp = SwingUtilities.convertPoint(nativeContainer, x, y, lastComponentEntered); MouseEvent exited = new MouseEvent (lastComponentEntered, MouseEvent.MOUSE_EXITED, me.getWhen (), me.getModifiersEx (), tp.x, tp.y, me.getClickCount (), me.isPopupTrigger (), me.getButton ()); tempComponent = lastComponentEntered; lastComponentEntered = null; tempComponent.dispatchEvent(exited); } lastComponentEntered = null; } // If we have a candidate, maybe enter it. if (candidate != null) { mouseEventTarget = candidate; if (candidate.isLightweight() && candidate.isShowing() && candidate != nativeContainer && candidate != lastComponentEntered) { lastComponentEntered = mouseEventTarget; Point cp = SwingUtilities.convertPoint(nativeContainer, x, y, lastComponentEntered); MouseEvent entered = new MouseEvent (lastComponentEntered, MouseEvent.MOUSE_ENTERED, me.getWhen (), me.getModifiersEx (), cp.x, cp.y, me.getClickCount (), me.isPopupTrigger (), me.getButton ()); lastComponentEntered.dispatchEvent (entered); } } if (me.getID() == MouseEvent.MOUSE_RELEASED || me.getID() == MouseEvent.MOUSE_PRESSED && pressCount > 0 || me.getID() == MouseEvent.MOUSE_DRAGGED) // If any of the following events occur while a button is held down, // they should be dispatched to the same component to which the // original MOUSE_PRESSED event was dispatched: // - MOUSE_RELEASED // - MOUSE_PRESSED: another button pressed while the first is held down // - MOUSE_DRAGGED if (SwingUtilities.isDescendingFrom(pressedComponent, nativeContainer)) mouseEventTarget = pressedComponent; else if (me.getID() == MouseEvent.MOUSE_CLICKED) { // Don't dispatch CLICKED events whose target is not the same as the // target for the original PRESSED event. if (candidate != pressedComponent) mouseEventTarget = null; else if (pressCount == 0) pressedComponent = null; } } |
Point cp = SwingUtilities.convertPoint(nativeContainer, | Point cp = AWTUtilities.convertPoint(nativeContainer, | void acquireComponentForMouseEvent(MouseEvent me) { int x = me.getX (); int y = me.getY (); // Find the candidate which should receive this event. Component parent = nativeContainer; Component candidate = null; Point p = me.getPoint(); while (candidate == null && parent != null) { candidate = SwingUtilities.getDeepestComponentAt(parent, p.x, p.y); if (candidate == null || (candidate.eventMask & me.getID()) == 0) { candidate = null; p = SwingUtilities.convertPoint(parent, p.x, p.y, parent.parent); parent = parent.parent; } } // If the only candidate we found was the native container itself, // don't dispatch any event at all. We only care about the lightweight // children here. if (candidate == nativeContainer) candidate = null; // If our candidate is new, inform the old target we're leaving. if (lastComponentEntered != null && lastComponentEntered.isShowing() && lastComponentEntered != candidate) { // Old candidate could have been removed from // the nativeContainer so we check first. if (SwingUtilities.isDescendingFrom(lastComponentEntered, nativeContainer)) { Point tp = SwingUtilities.convertPoint(nativeContainer, x, y, lastComponentEntered); MouseEvent exited = new MouseEvent (lastComponentEntered, MouseEvent.MOUSE_EXITED, me.getWhen (), me.getModifiersEx (), tp.x, tp.y, me.getClickCount (), me.isPopupTrigger (), me.getButton ()); tempComponent = lastComponentEntered; lastComponentEntered = null; tempComponent.dispatchEvent(exited); } lastComponentEntered = null; } // If we have a candidate, maybe enter it. if (candidate != null) { mouseEventTarget = candidate; if (candidate.isLightweight() && candidate.isShowing() && candidate != nativeContainer && candidate != lastComponentEntered) { lastComponentEntered = mouseEventTarget; Point cp = SwingUtilities.convertPoint(nativeContainer, x, y, lastComponentEntered); MouseEvent entered = new MouseEvent (lastComponentEntered, MouseEvent.MOUSE_ENTERED, me.getWhen (), me.getModifiersEx (), cp.x, cp.y, me.getClickCount (), me.isPopupTrigger (), me.getButton ()); lastComponentEntered.dispatchEvent (entered); } } if (me.getID() == MouseEvent.MOUSE_RELEASED || me.getID() == MouseEvent.MOUSE_PRESSED && pressCount > 0 || me.getID() == MouseEvent.MOUSE_DRAGGED) // If any of the following events occur while a button is held down, // they should be dispatched to the same component to which the // original MOUSE_PRESSED event was dispatched: // - MOUSE_RELEASED // - MOUSE_PRESSED: another button pressed while the first is held down // - MOUSE_DRAGGED if (SwingUtilities.isDescendingFrom(pressedComponent, nativeContainer)) mouseEventTarget = pressedComponent; else if (me.getID() == MouseEvent.MOUSE_CLICKED) { // Don't dispatch CLICKED events whose target is not the same as the // target for the original PRESSED event. if (candidate != pressedComponent) mouseEventTarget = null; else if (pressCount == 0) pressedComponent = null; } } |
|| me.getID() == MouseEvent.MOUSE_PRESSED && pressCount > 0 | || me.getID() == MouseEvent.MOUSE_PRESSED && modifiers > 0 | void acquireComponentForMouseEvent(MouseEvent me) { int x = me.getX (); int y = me.getY (); // Find the candidate which should receive this event. Component parent = nativeContainer; Component candidate = null; Point p = me.getPoint(); while (candidate == null && parent != null) { candidate = SwingUtilities.getDeepestComponentAt(parent, p.x, p.y); if (candidate == null || (candidate.eventMask & me.getID()) == 0) { candidate = null; p = SwingUtilities.convertPoint(parent, p.x, p.y, parent.parent); parent = parent.parent; } } // If the only candidate we found was the native container itself, // don't dispatch any event at all. We only care about the lightweight // children here. if (candidate == nativeContainer) candidate = null; // If our candidate is new, inform the old target we're leaving. if (lastComponentEntered != null && lastComponentEntered.isShowing() && lastComponentEntered != candidate) { // Old candidate could have been removed from // the nativeContainer so we check first. if (SwingUtilities.isDescendingFrom(lastComponentEntered, nativeContainer)) { Point tp = SwingUtilities.convertPoint(nativeContainer, x, y, lastComponentEntered); MouseEvent exited = new MouseEvent (lastComponentEntered, MouseEvent.MOUSE_EXITED, me.getWhen (), me.getModifiersEx (), tp.x, tp.y, me.getClickCount (), me.isPopupTrigger (), me.getButton ()); tempComponent = lastComponentEntered; lastComponentEntered = null; tempComponent.dispatchEvent(exited); } lastComponentEntered = null; } // If we have a candidate, maybe enter it. if (candidate != null) { mouseEventTarget = candidate; if (candidate.isLightweight() && candidate.isShowing() && candidate != nativeContainer && candidate != lastComponentEntered) { lastComponentEntered = mouseEventTarget; Point cp = SwingUtilities.convertPoint(nativeContainer, x, y, lastComponentEntered); MouseEvent entered = new MouseEvent (lastComponentEntered, MouseEvent.MOUSE_ENTERED, me.getWhen (), me.getModifiersEx (), cp.x, cp.y, me.getClickCount (), me.isPopupTrigger (), me.getButton ()); lastComponentEntered.dispatchEvent (entered); } } if (me.getID() == MouseEvent.MOUSE_RELEASED || me.getID() == MouseEvent.MOUSE_PRESSED && pressCount > 0 || me.getID() == MouseEvent.MOUSE_DRAGGED) // If any of the following events occur while a button is held down, // they should be dispatched to the same component to which the // original MOUSE_PRESSED event was dispatched: // - MOUSE_RELEASED // - MOUSE_PRESSED: another button pressed while the first is held down // - MOUSE_DRAGGED if (SwingUtilities.isDescendingFrom(pressedComponent, nativeContainer)) mouseEventTarget = pressedComponent; else if (me.getID() == MouseEvent.MOUSE_CLICKED) { // Don't dispatch CLICKED events whose target is not the same as the // target for the original PRESSED event. if (candidate != pressedComponent) mouseEventTarget = null; else if (pressCount == 0) pressedComponent = null; } } |
if (SwingUtilities.isDescendingFrom(pressedComponent, nativeContainer)) | if (AWTUtilities.isDescendingFrom(pressedComponent, nativeContainer)) | void acquireComponentForMouseEvent(MouseEvent me) { int x = me.getX (); int y = me.getY (); // Find the candidate which should receive this event. Component parent = nativeContainer; Component candidate = null; Point p = me.getPoint(); while (candidate == null && parent != null) { candidate = SwingUtilities.getDeepestComponentAt(parent, p.x, p.y); if (candidate == null || (candidate.eventMask & me.getID()) == 0) { candidate = null; p = SwingUtilities.convertPoint(parent, p.x, p.y, parent.parent); parent = parent.parent; } } // If the only candidate we found was the native container itself, // don't dispatch any event at all. We only care about the lightweight // children here. if (candidate == nativeContainer) candidate = null; // If our candidate is new, inform the old target we're leaving. if (lastComponentEntered != null && lastComponentEntered.isShowing() && lastComponentEntered != candidate) { // Old candidate could have been removed from // the nativeContainer so we check first. if (SwingUtilities.isDescendingFrom(lastComponentEntered, nativeContainer)) { Point tp = SwingUtilities.convertPoint(nativeContainer, x, y, lastComponentEntered); MouseEvent exited = new MouseEvent (lastComponentEntered, MouseEvent.MOUSE_EXITED, me.getWhen (), me.getModifiersEx (), tp.x, tp.y, me.getClickCount (), me.isPopupTrigger (), me.getButton ()); tempComponent = lastComponentEntered; lastComponentEntered = null; tempComponent.dispatchEvent(exited); } lastComponentEntered = null; } // If we have a candidate, maybe enter it. if (candidate != null) { mouseEventTarget = candidate; if (candidate.isLightweight() && candidate.isShowing() && candidate != nativeContainer && candidate != lastComponentEntered) { lastComponentEntered = mouseEventTarget; Point cp = SwingUtilities.convertPoint(nativeContainer, x, y, lastComponentEntered); MouseEvent entered = new MouseEvent (lastComponentEntered, MouseEvent.MOUSE_ENTERED, me.getWhen (), me.getModifiersEx (), cp.x, cp.y, me.getClickCount (), me.isPopupTrigger (), me.getButton ()); lastComponentEntered.dispatchEvent (entered); } } if (me.getID() == MouseEvent.MOUSE_RELEASED || me.getID() == MouseEvent.MOUSE_PRESSED && pressCount > 0 || me.getID() == MouseEvent.MOUSE_DRAGGED) // If any of the following events occur while a button is held down, // they should be dispatched to the same component to which the // original MOUSE_PRESSED event was dispatched: // - MOUSE_RELEASED // - MOUSE_PRESSED: another button pressed while the first is held down // - MOUSE_DRAGGED if (SwingUtilities.isDescendingFrom(pressedComponent, nativeContainer)) mouseEventTarget = pressedComponent; else if (me.getID() == MouseEvent.MOUSE_CLICKED) { // Don't dispatch CLICKED events whose target is not the same as the // target for the original PRESSED event. if (candidate != pressedComponent) mouseEventTarget = null; else if (pressCount == 0) pressedComponent = null; } } |
return mouseEventTarget; | void acquireComponentForMouseEvent(MouseEvent me) { int x = me.getX (); int y = me.getY (); // Find the candidate which should receive this event. Component parent = nativeContainer; Component candidate = null; Point p = me.getPoint(); while (candidate == null && parent != null) { candidate = SwingUtilities.getDeepestComponentAt(parent, p.x, p.y); if (candidate == null || (candidate.eventMask & me.getID()) == 0) { candidate = null; p = SwingUtilities.convertPoint(parent, p.x, p.y, parent.parent); parent = parent.parent; } } // If the only candidate we found was the native container itself, // don't dispatch any event at all. We only care about the lightweight // children here. if (candidate == nativeContainer) candidate = null; // If our candidate is new, inform the old target we're leaving. if (lastComponentEntered != null && lastComponentEntered.isShowing() && lastComponentEntered != candidate) { // Old candidate could have been removed from // the nativeContainer so we check first. if (SwingUtilities.isDescendingFrom(lastComponentEntered, nativeContainer)) { Point tp = SwingUtilities.convertPoint(nativeContainer, x, y, lastComponentEntered); MouseEvent exited = new MouseEvent (lastComponentEntered, MouseEvent.MOUSE_EXITED, me.getWhen (), me.getModifiersEx (), tp.x, tp.y, me.getClickCount (), me.isPopupTrigger (), me.getButton ()); tempComponent = lastComponentEntered; lastComponentEntered = null; tempComponent.dispatchEvent(exited); } lastComponentEntered = null; } // If we have a candidate, maybe enter it. if (candidate != null) { mouseEventTarget = candidate; if (candidate.isLightweight() && candidate.isShowing() && candidate != nativeContainer && candidate != lastComponentEntered) { lastComponentEntered = mouseEventTarget; Point cp = SwingUtilities.convertPoint(nativeContainer, x, y, lastComponentEntered); MouseEvent entered = new MouseEvent (lastComponentEntered, MouseEvent.MOUSE_ENTERED, me.getWhen (), me.getModifiersEx (), cp.x, cp.y, me.getClickCount (), me.isPopupTrigger (), me.getButton ()); lastComponentEntered.dispatchEvent (entered); } } if (me.getID() == MouseEvent.MOUSE_RELEASED || me.getID() == MouseEvent.MOUSE_PRESSED && pressCount > 0 || me.getID() == MouseEvent.MOUSE_DRAGGED) // If any of the following events occur while a button is held down, // they should be dispatched to the same component to which the // original MOUSE_PRESSED event was dispatched: // - MOUSE_RELEASED // - MOUSE_PRESSED: another button pressed while the first is held down // - MOUSE_DRAGGED if (SwingUtilities.isDescendingFrom(pressedComponent, nativeContainer)) mouseEventTarget = pressedComponent; else if (me.getID() == MouseEvent.MOUSE_CLICKED) { // Don't dispatch CLICKED events whose target is not the same as the // target for the original PRESSED event. if (candidate != pressedComponent) mouseEventTarget = null; else if (pressCount == 0) pressedComponent = null; } } | |
acquireComponentForMouseEvent(me); | Component mouseEventTarget = acquireComponentForMouseEvent(me); | boolean handleEvent(AWTEvent e) { if (e instanceof MouseEvent) { MouseEvent me = (MouseEvent) e; acquireComponentForMouseEvent(me); // Avoid dispatching ENTERED and EXITED events twice. if (mouseEventTarget != null && mouseEventTarget.isShowing() && e.getID() != MouseEvent.MOUSE_ENTERED && e.getID() != MouseEvent.MOUSE_EXITED) { MouseEvent newEvt = SwingUtilities.convertMouseEvent(nativeContainer, me, mouseEventTarget); mouseEventTarget.dispatchEvent(newEvt); switch (e.getID()) { case MouseEvent.MOUSE_PRESSED: if (pressCount++ == 0) pressedComponent = mouseEventTarget; break; case MouseEvent.MOUSE_RELEASED: // Clear our memory of the original PRESSED event, only if // we're not expecting a CLICKED event after this. If // there is a CLICKED event after this, it will do clean up. if (--pressCount == 0 && mouseEventTarget != pressedComponent) pressedComponent = null; break; } if (newEvt.isConsumed()) e.consume(); } } return e.isConsumed(); } |
MouseEvent newEvt = SwingUtilities.convertMouseEvent(nativeContainer, me, mouseEventTarget); mouseEventTarget.dispatchEvent(newEvt); | boolean handleEvent(AWTEvent e) { if (e instanceof MouseEvent) { MouseEvent me = (MouseEvent) e; acquireComponentForMouseEvent(me); // Avoid dispatching ENTERED and EXITED events twice. if (mouseEventTarget != null && mouseEventTarget.isShowing() && e.getID() != MouseEvent.MOUSE_ENTERED && e.getID() != MouseEvent.MOUSE_EXITED) { MouseEvent newEvt = SwingUtilities.convertMouseEvent(nativeContainer, me, mouseEventTarget); mouseEventTarget.dispatchEvent(newEvt); switch (e.getID()) { case MouseEvent.MOUSE_PRESSED: if (pressCount++ == 0) pressedComponent = mouseEventTarget; break; case MouseEvent.MOUSE_RELEASED: // Clear our memory of the original PRESSED event, only if // we're not expecting a CLICKED event after this. If // there is a CLICKED event after this, it will do clean up. if (--pressCount == 0 && mouseEventTarget != pressedComponent) pressedComponent = null; break; } if (newEvt.isConsumed()) e.consume(); } } return e.isConsumed(); } | |
MouseEvent newEvt = AWTUtilities.convertMouseEvent(nativeContainer, me, mouseEventTarget); mouseEventTarget.dispatchEvent(newEvt); | boolean handleEvent(AWTEvent e) { if (e instanceof MouseEvent) { MouseEvent me = (MouseEvent) e; acquireComponentForMouseEvent(me); // Avoid dispatching ENTERED and EXITED events twice. if (mouseEventTarget != null && mouseEventTarget.isShowing() && e.getID() != MouseEvent.MOUSE_ENTERED && e.getID() != MouseEvent.MOUSE_EXITED) { MouseEvent newEvt = SwingUtilities.convertMouseEvent(nativeContainer, me, mouseEventTarget); mouseEventTarget.dispatchEvent(newEvt); switch (e.getID()) { case MouseEvent.MOUSE_PRESSED: if (pressCount++ == 0) pressedComponent = mouseEventTarget; break; case MouseEvent.MOUSE_RELEASED: // Clear our memory of the original PRESSED event, only if // we're not expecting a CLICKED event after this. If // there is a CLICKED event after this, it will do clean up. if (--pressCount == 0 && mouseEventTarget != pressedComponent) pressedComponent = null; break; } if (newEvt.isConsumed()) e.consume(); } } return e.isConsumed(); } | |
catch (Exception ignored) {} | catch (Exception e) { } | static Policy getCurrentPolicy() { // FIXME: The class name of the Policy provider should really be sourced // from the "java.security" configuration file. For now, just hard-code // a stub implementation. if (currentPolicy == null) { String pp = System.getProperty ("policy.provider"); if (pp != null) try { currentPolicy = (Policy) Class.forName(pp).newInstance(); } catch (Exception ignored) {} if (currentPolicy == null) currentPolicy = new gnu.java.security.provider.DefaultPolicy(); } return currentPolicy; } |
public void add(Permission perm) { if (isReadOnly()) { throw new SecurityException( "PermissionCollection is read only"); } final Class permClass = perm.getClass(); if (perm instanceof AllPermission) { if (allPermission == null) { | public void add(Permission perm) { if (isReadOnly()) throw new SecurityException("PermissionCollection is read only"); if (perm instanceof AllPermission) { if (allPermission == null) { | public void add(Permission perm) { if (isReadOnly()) { throw new SecurityException( "PermissionCollection is read only"); } final Class permClass = perm.getClass(); if (perm instanceof AllPermission) { if (allPermission == null) { allPermission = perm.newPermissionCollection(); allPermission.add(perm); perms.put(permClass, allPermission); } } else { PermissionCollection pc = (PermissionCollection) perms .get(permClass); if (pc == null) { pc = perm.newPermissionCollection(); if (pc == null) { pc = new PermissionsHash(); } perms.put(permClass, pc); } pc.add(perm); } } |
perms.put(permClass, allPermission); | perms.put(perm.getClass(), allPermission); } | public void add(Permission perm) { if (isReadOnly()) { throw new SecurityException( "PermissionCollection is read only"); } final Class permClass = perm.getClass(); if (perm instanceof AllPermission) { if (allPermission == null) { allPermission = perm.newPermissionCollection(); allPermission.add(perm); perms.put(permClass, allPermission); } } else { PermissionCollection pc = (PermissionCollection) perms .get(permClass); if (pc == null) { pc = perm.newPermissionCollection(); if (pc == null) { pc = new PermissionsHash(); } perms.put(permClass, pc); } pc.add(perm); } } |
} else { PermissionCollection pc = (PermissionCollection) perms .get(permClass); if (pc == null) { | else { PermissionCollection pc = (PermissionCollection) perms.get(perm.getClass()); if (pc == null) { | public void add(Permission perm) { if (isReadOnly()) { throw new SecurityException( "PermissionCollection is read only"); } final Class permClass = perm.getClass(); if (perm instanceof AllPermission) { if (allPermission == null) { allPermission = perm.newPermissionCollection(); allPermission.add(perm); perms.put(permClass, allPermission); } } else { PermissionCollection pc = (PermissionCollection) perms .get(permClass); if (pc == null) { pc = perm.newPermissionCollection(); if (pc == null) { pc = new PermissionsHash(); } perms.put(permClass, pc); } pc.add(perm); } } |
if (pc == null) { | if (pc == null) | public void add(Permission perm) { if (isReadOnly()) { throw new SecurityException( "PermissionCollection is read only"); } final Class permClass = perm.getClass(); if (perm instanceof AllPermission) { if (allPermission == null) { allPermission = perm.newPermissionCollection(); allPermission.add(perm); perms.put(permClass, allPermission); } } else { PermissionCollection pc = (PermissionCollection) perms .get(permClass); if (pc == null) { pc = perm.newPermissionCollection(); if (pc == null) { pc = new PermissionsHash(); } perms.put(permClass, pc); } pc.add(perm); } } |
} perms.put(permClass, pc); | perms.put(perm.getClass(), pc); | public void add(Permission perm) { if (isReadOnly()) { throw new SecurityException( "PermissionCollection is read only"); } final Class permClass = perm.getClass(); if (perm instanceof AllPermission) { if (allPermission == null) { allPermission = perm.newPermissionCollection(); allPermission.add(perm); perms.put(permClass, allPermission); } } else { PermissionCollection pc = (PermissionCollection) perms .get(permClass); if (pc == null) { pc = perm.newPermissionCollection(); if (pc == null) { pc = new PermissionsHash(); } perms.put(permClass, pc); } pc.add(perm); } } |
throw new IOException("BlockDeviceAPI not found on device", ex); | final IOException ioe = new IOException("BlockDeviceAPI not found on device"); ioe.initCause(ex); throw ioe; | public void createImage() throws IOException, DriverException, FileSystemException { final FileDevice newFd = new FileDevice(destFile, "rw"); try { newFd.setLength(getDeviceLength()); formatDevice(newFd); final Device sysDev = getSystemDevice(newFd); final BlockDeviceAPI sysDevApi = (BlockDeviceAPI) sysDev .getAPI(BlockDeviceAPI.class); copySystemFiles(sysDev); sysDevApi.flush(); } catch (ApiNotFoundException ex) { throw new IOException("BlockDeviceAPI not found on device", ex); } finally { newFd.close(); } } |
throw new IOException("Cannot find BlockDeviceAPI", ex); | final IOException ioe = new IOException("BlockDeviceAPI not found on device"); ioe.initCause(ex); throw ioe; | protected void formatDevice(Device dev) throws IOException { GrubFatFormatter ff = createFormatter(); try { ff.format((BlockDeviceAPI) dev.getAPI(BlockDeviceAPI.class)); } catch (ApiNotFoundException ex) { throw new IOException("Cannot find BlockDeviceAPI", ex); } } |
public static String dumpString(byte[] data, String m) | public static String dumpString(byte[] data, int offset, int length, String m) | public static String dumpString(byte[] data, String m) { return (data == null) ? "null\n" : dumpString(data, 0, data.length, m); } |
return (data == null) ? "null\n" : dumpString(data, 0, data.length, m); | if (data == null) return m + "null\n"; StringBuffer sb = new StringBuffer(length * 3); if (length > 32) sb.append(m).append("Hexadecimal dump of ") .append(length).append(" bytes...\n"); int end = offset + length; String s; int l = Integer.toString(length).length(); if (l < 4) l = 4; for (; offset < end; offset += 32) { if (length > 32) { s = " " + offset; sb.append(m).append(s.substring(s.length() - l)).append(": "); } int i = 0; for (; i < 32 && offset + i + 7 < end; i += 8) sb.append(toString(data, offset + i, 8)).append(' '); if (i < 32) for (; i < 32 && offset + i < end; i++) sb.append(byteToString(data[offset + i])); sb.append('\n'); } return sb.toString(); | public static String dumpString(byte[] data, String m) { return (data == null) ? "null\n" : dumpString(data, 0, data.length, m); } |
{ | public static final byte[] fromBase64(String str) { int len = str.length(); if (len == 0) { throw new NumberFormatException("Empty string"); } byte[] a = new byte[len + 1]; int i, j; for (i = 0; i < len; i++) { try { a[i] = (byte) BASE64_CHARS.indexOf(str.charAt(i)); } catch (ArrayIndexOutOfBoundsException x) { throw new NumberFormatException("Illegal character at #" + i); } } i = len - 1; j = len; try { while (true) { a[j] = a[i]; if (--i < 0) { break; } a[j] |= (a[i] & 0x03) << 6; j--; a[j] = (byte) ((a[i] & 0x3C) >>> 2); if (--i < 0) { break; } a[j] |= (a[i] & 0x0F) << 4; j--; a[j] = (byte) ((a[i] & 0x30) >>> 4); if (--i < 0) { break; } a[j] |= (a[i] << 2); j--; a[j] = 0; if (--i < 0) { break; } } } catch (Exception ignored) { } try { // ignore leading 0-bytes while (a[j] == 0) { j++; } } catch (Exception x) { return new byte[1]; // one 0-byte } byte[] result = new byte[len - j + 1]; System.arraycopy(a, j, result, 0, len - j + 1); return result; } | |
} | public static final byte[] fromBase64(String str) { int len = str.length(); if (len == 0) { throw new NumberFormatException("Empty string"); } byte[] a = new byte[len + 1]; int i, j; for (i = 0; i < len; i++) { try { a[i] = (byte) BASE64_CHARS.indexOf(str.charAt(i)); } catch (ArrayIndexOutOfBoundsException x) { throw new NumberFormatException("Illegal character at #" + i); } } i = len - 1; j = len; try { while (true) { a[j] = a[i]; if (--i < 0) { break; } a[j] |= (a[i] & 0x03) << 6; j--; a[j] = (byte) ((a[i] & 0x3C) >>> 2); if (--i < 0) { break; } a[j] |= (a[i] & 0x0F) << 4; j--; a[j] = (byte) ((a[i] & 0x30) >>> 4); if (--i < 0) { break; } a[j] |= (a[i] << 2); j--; a[j] = 0; if (--i < 0) { break; } } } catch (Exception ignored) { } try { // ignore leading 0-bytes while (a[j] == 0) { j++; } } catch (Exception x) { return new byte[1]; // one 0-byte } byte[] result = new byte[len - j + 1]; System.arraycopy(a, j, result, 0, len - j + 1); return result; } | |
{ | public static int fromDigit(char c) { if (c >= '0' && c <= '9') { return c - '0'; } else if (c >= 'A' && c <= 'F') { return c - 'A' + 10; } else if (c >= 'a' && c <= 'f') { return c - 'a' + 10; } else throw new IllegalArgumentException("Invalid hexadecimal digit: " + c); } | |
} | public static int fromDigit(char c) { if (c >= '0' && c <= '9') { return c - '0'; } else if (c >= 'A' && c <= 'F') { return c - 'A' + 10; } else if (c >= 'a' && c <= 'f') { return c - 'a' + 10; } else throw new IllegalArgumentException("Invalid hexadecimal digit: " + c); } | |
{ | public static final String toBase64(byte[] buffer) { int len = buffer.length, pos = len % 3; byte b0 = 0, b1 = 0, b2 = 0; switch (pos) { case 1: b2 = buffer[0]; break; case 2: b1 = buffer[0]; b2 = buffer[1]; break; } StringBuffer sb = new StringBuffer(); int c; boolean notleading = false; do { c = (b0 & 0xFC) >>> 2; if (notleading || c != 0) { sb.append(BASE64_CHARSET[c]); notleading = true; } c = ((b0 & 0x03) << 4) | ((b1 & 0xF0) >>> 4); if (notleading || c != 0) { sb.append(BASE64_CHARSET[c]); notleading = true; } c = ((b1 & 0x0F) << 2) | ((b2 & 0xC0) >>> 6); if (notleading || c != 0) { sb.append(BASE64_CHARSET[c]); notleading = true; } c = b2 & 0x3F; if (notleading || c != 0) { sb.append(BASE64_CHARSET[c]); notleading = true; } if (pos >= len) { break; } else { try { b0 = buffer[pos++]; b1 = buffer[pos++]; b2 = buffer[pos++]; } catch (ArrayIndexOutOfBoundsException x) { break; } } } while (true); if (notleading) { return sb.toString(); } return "0"; } | |
} | public static final String toBase64(byte[] buffer) { int len = buffer.length, pos = len % 3; byte b0 = 0, b1 = 0, b2 = 0; switch (pos) { case 1: b2 = buffer[0]; break; case 2: b1 = buffer[0]; b2 = buffer[1]; break; } StringBuffer sb = new StringBuffer(); int c; boolean notleading = false; do { c = (b0 & 0xFC) >>> 2; if (notleading || c != 0) { sb.append(BASE64_CHARSET[c]); notleading = true; } c = ((b0 & 0x03) << 4) | ((b1 & 0xF0) >>> 4); if (notleading || c != 0) { sb.append(BASE64_CHARSET[c]); notleading = true; } c = ((b1 & 0x0F) << 2) | ((b2 & 0xC0) >>> 6); if (notleading || c != 0) { sb.append(BASE64_CHARSET[c]); notleading = true; } c = b2 & 0x3F; if (notleading || c != 0) { sb.append(BASE64_CHARSET[c]); notleading = true; } if (pos >= len) { break; } else { try { b0 = buffer[pos++]; b1 = buffer[pos++]; b2 = buffer[pos++]; } catch (ArrayIndexOutOfBoundsException x) { break; } } } while (true); if (notleading) { return sb.toString(); } return "0"; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.