bugged
stringlengths
6
599k
fixed
stringlengths
10
599k
__index_level_0__
int64
0
1.13M
public Object narrow(Object narrowFrom, Class narrowTo) throws ClassCastException { if (narrowTo == null) throw new ClassCastException("Can't narrow to null class"); if (narrowFrom == null) return null; Class fromClass = narrowFrom.getClass(); Object result = null; try { if (narrowTo.isAssignableFrom(fromClass)) result = narrowFrom; else { System.out.println("We still haven't implement this case: narrow " + narrowFrom + " of type " + fromClass + " to " + narrowTo); Class[] cs = fromClass.getInterfaces(); for (int i = 0; i < cs.length; i++) System.out.println(cs[i]); Exception e1 = new Exception(); try { throw e1; } catch(Exception ee) { ee.printStackTrace(); } System.exit(2); //throw new Error("We still haven't implement this case: narrow " // + narrowFrom + " of type " + fromClass + " to " // + narrowTo); /* ObjectImpl objimpl = (ObjectImpl)narrowFrom; if(objimpl._is_a(PortableServer.getTypeName(narrowTo))) result = PortableServer.getStubFromObjectImpl(objimpl, narrowTo); */ } } catch(Exception e) { result = null; } if (result == null) throw new ClassCastException("Can't narrow from " + fromClass + " to " + narrowTo); return result; }
public Object narrow(Object narrowFrom, Class narrowTo) throws ClassCastException { if (narrowTo == null) throw new ClassCastException("Can't narrow to null class"); if (narrowFrom == null) return null; Class fromClass = narrowFrom.getClass(); Object result = null; try { if (narrowTo.isAssignableFrom(fromClass)) result = narrowFrom; else { System.out.println("We still haven't implement this case: narrow " + narrowFrom + " of type " + fromClass + " to " + narrowTo); Class[] cs = fromClass.getInterfaces(); for (int i = 0; i < cs.length; i++) System.out.println(cs[i]); Exception e1 = new Exception(); try { throw e1; } catch(Exception ee) { ee.printStackTrace(); } System.exit(2); //throw new Error("We still haven't implement this case: narrow " // + narrowFrom + " of type " + fromClass + " to " // + narrowTo); /* ObjectImpl objimpl = (ObjectImpl)narrowFrom; if(objimpl._is_a(PortableServer.getTypeName(narrowTo))) result = PortableServer.getStubFromObjectImpl(objimpl, narrowTo); */ } } catch(Exception e) { result = null; } if (result == null) throw new ClassCastException("Can't narrow from " + fromClass + " to " + narrowTo); return result; }
5,236
public Object narrow(Object narrowFrom, Class narrowTo) throws ClassCastException { if (narrowTo == null) throw new ClassCastException("Can't narrow to null class"); if (narrowFrom == null) return null; Class fromClass = narrowFrom.getClass(); Object result = null; try { if (narrowTo.isAssignableFrom(fromClass)) result = narrowFrom; else { System.out.println("We still haven't implement this case: narrow " + narrowFrom + " of type " + fromClass + " to " + narrowTo); Class[] cs = fromClass.getInterfaces(); for (int i = 0; i < cs.length; i++) System.out.println(cs[i]); Exception e1 = new Exception(); try { throw e1; } catch(Exception ee) { ee.printStackTrace(); } System.exit(2); //throw new Error("We still haven't implement this case: narrow " // + narrowFrom + " of type " + fromClass + " to " // + narrowTo); /* ObjectImpl objimpl = (ObjectImpl)narrowFrom; if(objimpl._is_a(PortableServer.getTypeName(narrowTo))) result = PortableServer.getStubFromObjectImpl(objimpl, narrowTo); */ } } catch(Exception e) { result = null; } if (result == null) throw new ClassCastException("Can't narrow from " + fromClass + " to " + narrowTo); return result; }
public Object narrow(Object narrowFrom, Class narrowTo) throws ClassCastException { if (narrowTo == null) throw new ClassCastException("Can't narrow to null class"); if (narrowFrom == null) return null; Class fromClass = narrowFrom.getClass(); Object result = null; try { if (narrowTo.isAssignableFrom(fromClass)) result = narrowFrom; else { System.out.println("We still haven't implement this case: narrow " + narrowFrom + " of type " + fromClass + " to " + narrowTo); Class[] cs = fromClass.getInterfaces(); for (int i = 0; i < cs.length; i++) System.out.println(cs[i]); Exception e1 = new Exception(); try { throw e1; } catch(Exception ee) { ee.printStackTrace(); } System.exit(2); //throw new Error("We still haven't implement this case: narrow " // + narrowFrom + " of type " + fromClass + " to " // + narrowTo); /* ObjectImpl objimpl = (ObjectImpl)narrowFrom; if(objimpl._is_a(PortableServer.getTypeName(narrowTo))) result = PortableServer.getStubFromObjectImpl(objimpl, narrowTo); */ } } catch(Exception e) { result = null; } if (result == null) throw new ClassCastException("Can't narrow from " + fromClass + " to " + narrowTo); return result; }
5,237
public Object narrow(Object narrowFrom, Class narrowTo) throws ClassCastException { if (narrowTo == null) throw new ClassCastException("Can't narrow to null class"); if (narrowFrom == null) return null; Class fromClass = narrowFrom.getClass(); Object result = null; try { if (narrowTo.isAssignableFrom(fromClass)) result = narrowFrom; else { System.out.println("We still haven't implement this case: narrow " + narrowFrom + " of type " + fromClass + " to " + narrowTo); Class[] cs = fromClass.getInterfaces(); for (int i = 0; i < cs.length; i++) System.out.println(cs[i]); Exception e1 = new Exception(); try { throw e1; } catch(Exception ee) { ee.printStackTrace(); } System.exit(2); //throw new Error("We still haven't implement this case: narrow " // + narrowFrom + " of type " + fromClass + " to " // + narrowTo); /* ObjectImpl objimpl = (ObjectImpl)narrowFrom; if(objimpl._is_a(PortableServer.getTypeName(narrowTo))) result = PortableServer.getStubFromObjectImpl(objimpl, narrowTo); */ } } catch(Exception e) { result = null; } if (result == null) throw new ClassCastException("Can't narrow from " + fromClass + " to " + narrowTo); return result; }
public Object narrow(Object narrowFrom, Class narrowTo) throws ClassCastException { if (narrowTo == null) throw new ClassCastException("Can't narrow to null class"); if (narrowFrom == null) return null; Class fromClass = narrowFrom.getClass(); Object result = null; try { if (narrowTo.isAssignableFrom(fromClass)) result = narrowFrom; else { System.out.println("We still haven't implement this case: narrow " + narrowFrom + " of type " + fromClass + " to " + narrowTo); Class[] cs = fromClass.getInterfaces(); for (int i = 0; i < cs.length; i++) System.out.println(cs[i]); Exception e1 = new Exception(); try { throw e1; } catch(Exception ee) { ee.printStackTrace(); } System.exit(2); //throw new Error("We still haven't implement this case: narrow " // + narrowFrom + " of type " + fromClass + " to " // + narrowTo); /* ObjectImpl objimpl = (ObjectImpl)narrowFrom; if(objimpl._is_a(PortableServer.getTypeName(narrowTo))) result = PortableServer.getStubFromObjectImpl(objimpl, narrowTo); */ } } catch(Exception e) { result = null; } if (result == null) throw new ClassCastException("Can't narrow from " + fromClass + " to " + narrowTo); return result; }
5,238
public Object narrow(Object narrowFrom, Class narrowTo) throws ClassCastException { if (narrowTo == null) throw new ClassCastException("Can't narrow to null class"); if (narrowFrom == null) return null; Class fromClass = narrowFrom.getClass(); Object result = null; try { if (narrowTo.isAssignableFrom(fromClass)) result = narrowFrom; else { System.out.println("We still haven't implement this case: narrow " + narrowFrom + " of type " + fromClass + " to " + narrowTo); Class[] cs = fromClass.getInterfaces(); for (int i = 0; i < cs.length; i++) System.out.println(cs[i]); Exception e1 = new Exception(); try { throw e1; } catch(Exception ee) { ee.printStackTrace(); } System.exit(2); //throw new Error("We still haven't implement this case: narrow " // + narrowFrom + " of type " + fromClass + " to " // + narrowTo); /* ObjectImpl objimpl = (ObjectImpl)narrowFrom; if(objimpl._is_a(PortableServer.getTypeName(narrowTo))) result = PortableServer.getStubFromObjectImpl(objimpl, narrowTo); */ } } catch(Exception e) { result = null; } if (result == null) throw new ClassCastException("Can't narrow from " + fromClass + " to " + narrowTo); return result; }
public Object narrow(Object narrowFrom, Class narrowTo) throws ClassCastException { if (narrowTo == null) throw new ClassCastException("Can't narrow to null class"); if (narrowFrom == null) return null; Class fromClass = narrowFrom.getClass(); Object ClassCastException cex = new ClassCastException("Cannot instantiate " + narrowTo.getName()); cex.initCause(e); throw cex; try { if (narrowTo.isAssignableFrom(fromClass)) result = narrowFrom; else { System.out.println("We still haven't implement this case: narrow " + narrowFrom + " of type " + fromClass + " to " + narrowTo); Class[] cs = fromClass.getInterfaces(); for (int i = 0; i < cs.length; i++) System.out.println(cs[i]); Exception e1 = new Exception(); try { throw e1; } catch(Exception ee) { ee.printStackTrace(); } System.exit(2); //throw new Error("We still haven't implement this case: narrow " // + narrowFrom + " of type " + fromClass + " to " // + narrowTo); /* ObjectImpl objimpl = (ObjectImpl)narrowFrom; if(objimpl._is_a(PortableServer.getTypeName(narrowTo))) result = PortableServer.getStubFromObjectImpl(objimpl, narrowTo); */ } } catch(Exception e) { ClassCastException cex = new ClassCastException("Cannot instantiate " + narrowTo.getName()); cex.initCause(e); throw cex; } if (result == null) throw new ClassCastException("Can't narrow from " + fromClass + " to " + narrowTo); return result; }
5,239
public Object narrow(Object narrowFrom, Class narrowTo) throws ClassCastException { if (narrowTo == null) throw new ClassCastException("Can't narrow to null class"); if (narrowFrom == null) return null; Class fromClass = narrowFrom.getClass(); Object result = null; try { if (narrowTo.isAssignableFrom(fromClass)) result = narrowFrom; else { System.out.println("We still haven't implement this case: narrow " + narrowFrom + " of type " + fromClass + " to " + narrowTo); Class[] cs = fromClass.getInterfaces(); for (int i = 0; i < cs.length; i++) System.out.println(cs[i]); Exception e1 = new Exception(); try { throw e1; } catch(Exception ee) { ee.printStackTrace(); } System.exit(2); //throw new Error("We still haven't implement this case: narrow " // + narrowFrom + " of type " + fromClass + " to " // + narrowTo); /* ObjectImpl objimpl = (ObjectImpl)narrowFrom; if(objimpl._is_a(PortableServer.getTypeName(narrowTo))) result = PortableServer.getStubFromObjectImpl(objimpl, narrowTo); */ } } catch(Exception e) { result = null; } if (result == null) throw new ClassCastException("Can't narrow from " + fromClass + " to " + narrowTo); return result; }
public Object narrow(Object narrowFrom, Class narrowTo) throws ClassCastException { if (narrowTo == null) throw new ClassCastException("Can't narrow to null class"); if (narrowFrom == null) return null; Class fromClass = narrowFrom.getClass(); Object result = null; try { if (narrowTo.isAssignableFrom(fromClass)) result = narrowFrom; else { System.out.println("We still haven't implement this case: narrow " + narrowFrom + " of type " + fromClass + " to " + narrowTo); Class[] cs = fromClass.getInterfaces(); for (int i = 0; i < cs.length; i++) System.out.println(cs[i]); Exception e1 = new Exception(); try { throw e1; } catch(Exception ee) { ee.printStackTrace(); } System.exit(2); //throw new Error("We still haven't implement this case: narrow " // + narrowFrom + " of type " + fromClass + " to " // + narrowTo); /* ObjectImpl objimpl = (ObjectImpl)narrowFrom; if(objimpl._is_a(PortableServer.getTypeName(narrowTo))) result = PortableServer.getStubFromObjectImpl(objimpl, narrowTo); */ } } catch(Exception e) { result = null; } if (result == null) throw new ClassCastException("Can't narrow from " + fromClass + " to " + narrowTo); return result; }
5,240
public Remote toStub(Remote obj) throws NoSuchObjectException { return PortableServer.toStub(obj); }
public Remote toStub(Remote ObjImpl) throws NoSuchObjectException { return PortableServer.toStub(obj); }
5,241
public Remote toStub(Remote obj) throws NoSuchObjectException { return PortableServer.toStub(obj); }
public Remote toStub(Remote obj) throws NoSuchObjectException { String icn = ObjImpl.getClass().getName(); if (!icn.endsWith("Impl")) throw new BAD_PARAM("Invalid class name '" + icn + "', must end with 'Impl'"); String sn = "_" + icn.substring(0, icn.length() - "Impl".length()) + "_Stub"; Class stubClass; Object o_stub; try { stubClass = RMIClassLoader.loadClass(sn); o_stub = stubClass.newInstance(); } catch (Exception e) { NoSuchObjectException n = new NoSuchObjectException(sn); n.initCause(e); throw n; } if (!Remote.class.isAssignableFrom(stubClass)) throw new ClassCastException(stubClass.getName() + " exists but cannot be returned as it does not inherit from " + Remote.class.getName()); return (Remote) o_stub; }
5,242
public void unexportObject(Remote obj) throws NoSuchObjectException { PortableServer.unexportObject(obj); }
public void unexportObject(Remote obj) throws NoSuchObjectException { Util.unexportObject(obj); }
5,243
public void mouseWheelMoved(MouseWheelEvent e) { if (scrollpane.getViewport().getComponentCount() == 0) return; Component target = scrollpane.getViewport().getComponent(0); JScrollBar bar = scrollpane.getVerticalScrollBar(); Scrollable scrollable = (target instanceof Scrollable) ? (Scrollable) target : null; boolean tracksHeight = scrollable != null && scrollable.getScrollableTracksViewportHeight(); int wheel = e.getWheelRotation() * ROWS_PER_WHEEL_CLICK; int delta; // If possible, scroll vertically. if (bar != null && ! tracksHeight) { if (scrollable != null) { bounds(target); delta = scrollable.getScrollableUnitIncrement( rect, SwingConstants.VERTICAL, wheel); } else { // Scroll non scrollables. delta = wheel * SCROLL_NON_SCROLLABLES; } scroll(bar, delta); } // If not, try to scroll horizontally else { bar = scrollpane.getHorizontalScrollBar(); boolean tracksWidth = scrollable != null && scrollable.getScrollableTracksViewportWidth(); if (bar != null && ! tracksWidth) { if (scrollable != null) { bounds(target); delta = scrollable.getScrollableUnitIncrement( rect, SwingConstants.HORIZONTAL, wheel); } else { // Scroll non scrollables. delta = wheel * SCROLL_NON_SCROLLABLES; } scroll(bar, delta); } } }
public void mouseWheelMoved(MouseWheelEvent e) { if (scrollpane.getViewport().getComponentCount() == 0) return; Component target = scrollpane.getViewport().getComponent(0); JScrollBar bar = scrollpane.getVerticalScrollBar(); Scrollable scrollable = (target instanceof Scrollable) ? (Scrollable) target : null; boolean tracksHeight = scrollable != null && scrollable.getScrollableTracksViewportHeight(); int wheel = e.getWheelRotation() * ROWS_PER_WHEEL_CLICK; int delta; // If possible, scroll vertically. if (bar != null && ! tracksHeight) { if (scrollable != null) { bounds(target); delta = scrollable.getScrollableUnitIncrement( rect, SwingConstants.VERTICAL, wheel); } else { // Scroll non scrollables. delta = wheel * SCROLL_NON_SCROLLABLES; } scroll(bar, wheel > 0 ? delta : -delta); } // If not, try to scroll horizontally else { bar = scrollpane.getHorizontalScrollBar(); boolean tracksWidth = scrollable != null && scrollable.getScrollableTracksViewportWidth(); if (bar != null && ! tracksWidth) { if (scrollable != null) { bounds(target); delta = scrollable.getScrollableUnitIncrement( rect, SwingConstants.HORIZONTAL, wheel); } else { // Scroll non scrollables. delta = wheel * SCROLL_NON_SCROLLABLES; } scroll(bar, wheel > 0 ? delta : -delta); } } }
5,244
protected void uninstallDefaults(JScrollPane p) { p.setForeground(null); p.setBackground(null); p.setFont(null); p.setBorder(null); scrollpane = null; }
protected void uninstallDefaults(JScrollPane p) { p.setForeground(null); p.setBackground(null); p.setFont(null); p.setBorder(null); scrollpane = null; }
5,247
public void popupMenuWillBecomeInvisible(PopupMenuEvent event) { // remove listener that listens to component events fired // by the top - level window that this popup belongs to. Component invoker = popupMenu.getInvoker(); Container rootContainer = (Container) SwingUtilities.getRoot(invoker); rootContainer.removeComponentListener(topWindowListener); }
public void popupMenuWillBecomeInvisible(PopupMenuEvent event) { // remove listener that listens to component events fired // by the top - level window that this popup belongs to. Component invoker = popupMenu.getInvoker(); Container rootContainer = (Container) SwingUtilities.getRoot(invoker); rootContainer.removeComponentListener(topWindowListener); }
5,255
public void popupMenuWillBecomeVisible(PopupMenuEvent event) { // Adds topWindowListener to top-level window to listener to // ComponentEvents fired by it. We need to cancel this popup menu // if topWindow to which this popup belongs was resized or moved. Component invoker = popupMenu.getInvoker(); Container rootContainer = (Container) SwingUtilities.getRoot(invoker); rootContainer.addComponentListener(topWindowListener); // if this popup menu is a free floating popup menu, // then by default its first element should be always selected when // this popup menu becomes visible. MenuSelectionManager manager = MenuSelectionManager.defaultManager(); if (manager.getSelectedPath().length == 0) { // Set selected path to point to the first item in the popup menu MenuElement[] path = new MenuElement[2]; path[0] = popupMenu; Component[] comps = popupMenu.getComponents(); if (comps.length != 0 && comps[0] instanceof MenuElement) { path[1] = (MenuElement) comps[0]; manager.setSelectedPath(path); } } }
public void popupMenuWillBecomeVisible(PopupMenuEvent event) { // Adds topWindowListener to top-level window to listener to // ComponentEvents fired by it. We need to cancel this popup menu // if topWindow to which this popup belongs was resized or moved. Component invoker = popupMenu.getInvoker(); Container rootContainer = (Container) SwingUtilities.getRoot(invoker); rootContainer.addComponentListener(topWindowListener); // if this popup menu is a free floating popup menu, // then by default its first element should be always selected when // this popup menu becomes visible. MenuSelectionManager manager = MenuSelectionManager.defaultManager(); if (manager.getSelectedPath().length == 0) { // Set selected path to point to the first item in the popup menu MenuElement[] path = new MenuElement[2]; path[0] = popupMenu; Component[] comps = popupMenu.getComponents(); if (comps.length != 0 && comps[0] instanceof MenuElement) { path[1] = (MenuElement) comps[0]; manager.setSelectedPath(path); } } }
5,256
public BasicPopupMenuUI() { popupMenuListener = new PopupMenuHandler(); mouseInputListener = new MouseInputHandler(); topWindowListener = new TopWindowListener(); }
public BasicPopupMenuUI() { popupMenuListener = new PopupMenuHandler(); topWindowListener = new TopWindowListener(); }
5,257
protected void installListeners() { popupMenu.addMouseListener(mouseInputListener); popupMenu.addMouseMotionListener(mouseInputListener); popupMenu.addPopupMenuListener(popupMenuListener); }
protected void installListeners() { popupMenu.addMouseListener(mouseInputListener); popupMenu.addMouseMotionListener(mouseInputListener); popupMenu.addPopupMenuListener(popupMenuListener); }
5,258
protected void uninstallListeners() { popupMenu.removeMouseListener(mouseInputListener); popupMenu.removeMouseMotionListener(mouseInputListener); popupMenu.removePopupMenuListener(popupMenuListener); }
protected void uninstallListeners() { popupMenu.removeMouseListener(mouseInputListener); popupMenu.removeMouseMotionListener(mouseInputListener); popupMenu.removePopupMenuListener(popupMenuListener); }
5,259
public void menuDragMouseDragged(MenuDragMouseEvent e) { MenuSelectionManager manager = MenuSelectionManager.defaultManager(); manager.setSelectedPath(e.getPath()); }
public void menuDragMouseDragged(MenuDragMouseEvent e) { MenuSelectionManager manager = MenuSelectionManager.defaultManager(); manager.setSelectedPath(e.getPath()); }
5,261
public void menuDragMouseEntered(MenuDragMouseEvent e) { MenuSelectionManager manager = MenuSelectionManager.defaultManager(); manager.setSelectedPath(e.getPath()); }
public void menuDragMouseEntered(MenuDragMouseEvent e) { MenuSelectionManager manager = MenuSelectionManager.defaultManager(); manager.setSelectedPath(e.getPath()); }
5,262
public void mouseClicked(MouseEvent e) { MenuSelectionManager manager = MenuSelectionManager.defaultManager(); manager.processMouseEvent(e); }
public void mouseClicked(MouseEvent e) { MenuSelectionManager manager = MenuSelectionManager.defaultManager(); manager.processMouseEvent(e); }
5,264
public void mouseEntered(MouseEvent e) { /* When mouse enters menu item, it should be considered selected if (i) if this menu is a submenu in some other menu (ii) or if this menu is in a menu bar and some other menu in a menu bar was just selected and has its popup menu visible. (If nothing was selected, menu should be pressed before it will be selected) */ JMenu menu = (JMenu) menuItem; // NOTE: the following if used to require !menu.isArmed but I could find // no reason for this and it was preventing some JDK-compatible behaviour. // Specifically, if a menu is selected but its popup menu not visible, // and then another menu is selected whose popup menu IS visible, when // the mouse is moved over the first menu, its popup menu should become // visible. if (! menu.isTopLevelMenu() || popupVisible()) { // set new selection and forward this event to MenuSelectionManager MenuSelectionManager manager = MenuSelectionManager.defaultManager(); manager.setSelectedPath(getPath()); manager.processMouseEvent(e); } }
public void mouseEntered(MouseEvent e) { /* When mouse enters menu item, it should be considered selected if (i) if this menu is a submenu in some other menu (ii) or if this menu is in a menu bar and some other menu in a menu bar was just selected and has its popup menu visible. (If nothing was selected, menu should be pressed before it will be selected) */ JMenu menu = (JMenu) menuItem; // NOTE: the following if used to require !menu.isArmed but I could find // no reason for this and it was preventing some JDK-compatible behaviour. // Specifically, if a menu is selected but its popup menu not visible, // and then another menu is selected whose popup menu IS visible, when // the mouse is moved over the first menu, its popup menu should become // visible. if (menu.isEnabled()) { // set new selection and forward this event to MenuSelectionManager MenuSelectionManager manager = MenuSelectionManager.defaultManager(); manager.setSelectedPath(getPath()); manager.processMouseEvent(e); } }
5,265
public void mouseEntered(MouseEvent e) { /* When mouse enters menu item, it should be considered selected if (i) if this menu is a submenu in some other menu (ii) or if this menu is in a menu bar and some other menu in a menu bar was just selected and has its popup menu visible. (If nothing was selected, menu should be pressed before it will be selected) */ JMenu menu = (JMenu) menuItem; // NOTE: the following if used to require !menu.isArmed but I could find // no reason for this and it was preventing some JDK-compatible behaviour. // Specifically, if a menu is selected but its popup menu not visible, // and then another menu is selected whose popup menu IS visible, when // the mouse is moved over the first menu, its popup menu should become // visible. if (! menu.isTopLevelMenu() || popupVisible()) { // set new selection and forward this event to MenuSelectionManager MenuSelectionManager manager = MenuSelectionManager.defaultManager(); manager.setSelectedPath(getPath()); manager.processMouseEvent(e); } }
public void mouseEntered(MouseEvent e) { /* When mouse enters menu item, it should be considered selected if (i) if this menu is a submenu in some other menu (ii) or if this menu is in a menu bar and some other menu in a menu bar was just selected and has its popup menu visible. (If nothing was selected, menu should be pressed before it will be selected) */ JMenu menu = (JMenu) menuItem; // NOTE: the following if used to require !menu.isArmed but I could find // no reason for this and it was preventing some JDK-compatible behaviour. // Specifically, if a menu is selected but its popup menu not visible, // and then another menu is selected whose popup menu IS visible, when // the mouse is moved over the first menu, its popup menu should become // visible. if (! menu.isTopLevelMenu() || popupVisible()) { // set new selection and forward this event to MenuSelectionManager MenuSelectionManager manager = MenuSelectionManager.defaultManager(); MenuElement[] selectedPath = manager.getSelectedPath(); if (! menu.isTopLevelMenu()) { if(! (selectedPath.length > 0 && selectedPath[selectedPath.length - 1] == menu.getPopupMenu())) { if(menu.getDelay() == 0) { MenuElement[] path = getPath(); MenuElement[] newPath = new MenuElement[path.length + 1]; System.arraycopy(path, 0, newPath, 0, path.length); newPath[path.length] = menu.getPopupMenu(); manager.setSelectedPath(newPath); } else { manager.setSelectedPath(getPath()); manager.processMouseEvent(e); } }
5,266
public void mouseEntered(MouseEvent e) { /* When mouse enters menu item, it should be considered selected if (i) if this menu is a submenu in some other menu (ii) or if this menu is in a menu bar and some other menu in a menu bar was just selected and has its popup menu visible. (If nothing was selected, menu should be pressed before it will be selected) */ JMenu menu = (JMenu) menuItem; // NOTE: the following if used to require !menu.isArmed but I could find // no reason for this and it was preventing some JDK-compatible behaviour. // Specifically, if a menu is selected but its popup menu not visible, // and then another menu is selected whose popup menu IS visible, when // the mouse is moved over the first menu, its popup menu should become // visible. if (! menu.isTopLevelMenu() || popupVisible()) { // set new selection and forward this event to MenuSelectionManager MenuSelectionManager manager = MenuSelectionManager.defaultManager(); manager.setSelectedPath(getPath()); manager.processMouseEvent(e); } }
public void mouseEntered(MouseEvent e) { /* When mouse enters menu item, it should be considered selected if (i) if this menu is a submenu in some other menu (ii) or if this menu is in a menu bar and some other menu in a menu bar was just selected and has its popup menu visible. (If nothing was selected, menu should be pressed before it will be selected) */ JMenu menu = (JMenu) menuItem; // NOTE: the following if used to require !menu.isArmed but I could find // no reason for this and it was preventing some JDK-compatible behaviour. // Specifically, if a menu is selected but its popup menu not visible, // and then another menu is selected whose popup menu IS visible, when // the mouse is moved over the first menu, its popup menu should become // visible. if (! menu.isTopLevelMenu() || popupVisible()) { // set new selection and forward this event to MenuSelectionManager MenuSelectionManager manager = MenuSelectionManager.defaultManager(); manager.setSelectedPath(getPath()); setupPostTimer(menu); } } } else { if(selectedPath.length > 0 && selectedPath[0] == menu.getParent()) { MenuElement[] newPath = new MenuElement[3]; newPath[0] = (MenuElement) menu.getParent(); newPath[1] = menu; newPath[2] = menu.getPopupMenu(); manager.setSelectedPath(newPath); } } } }
5,267
public void mousePressed(MouseEvent e) { MenuSelectionManager manager = MenuSelectionManager.defaultManager(); JMenu menu = (JMenu) menuItem; manager.processMouseEvent(e); // Menu should be displayed when the menu is pressed only if // it is top-level menu if (menu.isTopLevelMenu()) { if (menu.getPopupMenu().isVisible()) // If menu is visible and menu button was pressed.. // then need to cancel the menu manager.clearSelectedPath(); else { // Display the menu int x = 0; int y = menu.getHeight(); manager.setSelectedPath(getPath()); JMenuBar mb = (JMenuBar) menu.getParent(); // set selectedIndex of the selectionModel of a menuBar mb.getSelectionModel().setSelectedIndex(mb.getComponentIndex(menu)); } } }
public void mousePressed(MouseEvent e) { MenuSelectionManager manager = MenuSelectionManager.defaultManager(); JMenu menu = (JMenu) menuItem; if (menu.isEnabled()) { // Menu should be displayed when the menu is pressed only if // it is top-level menu if (menu.isTopLevelMenu()) { if (menu.getPopupMenu().isVisible()) // If menu is visible and menu button was pressed.. // then need to cancel the menu manager.clearSelectedPath(); else { // Display the menu int x = 0; int y = menu.getHeight(); manager.setSelectedPath(getPath()); JMenuBar mb = (JMenuBar) menu.getParent(); // set selectedIndex of the selectionModel of a menuBar mb.getSelectionModel().setSelectedIndex(mb.getComponentIndex(menu)); } } }
5,268
public void mousePressed(MouseEvent e) { MenuSelectionManager manager = MenuSelectionManager.defaultManager(); JMenu menu = (JMenu) menuItem; manager.processMouseEvent(e); // Menu should be displayed when the menu is pressed only if // it is top-level menu if (menu.isTopLevelMenu()) { if (menu.getPopupMenu().isVisible()) // If menu is visible and menu button was pressed.. // then need to cancel the menu manager.clearSelectedPath(); else { // Display the menu int x = 0; int y = menu.getHeight(); manager.setSelectedPath(getPath()); JMenuBar mb = (JMenuBar) menu.getParent(); // set selectedIndex of the selectionModel of a menuBar mb.getSelectionModel().setSelectedIndex(mb.getComponentIndex(menu)); } } }
public void mousePressed(MouseEvent e) { MenuSelectionManager manager = MenuSelectionManager.defaultManager(); JMenu menu = (JMenu) menuItem; manager.processMouseEvent(e); // Menu should be displayed when the menu is pressed only if // it is top-level menu if (menu.isTopLevelMenu()) { if (menu.isSelected()) // If menu is visible and menu button was pressed.. // then need to cancel the menu manager.clearSelectedPath(); else { // Display the menu int x = 0; int y = menu.getHeight(); manager.setSelectedPath(getPath()); JMenuBar mb = (JMenuBar) menu.getParent(); // set selectedIndex of the selectionModel of a menuBar mb.getSelectionModel().setSelectedIndex(mb.getComponentIndex(menu)); } } }
5,269
public void mousePressed(MouseEvent e) { MenuSelectionManager manager = MenuSelectionManager.defaultManager(); JMenu menu = (JMenu) menuItem; manager.processMouseEvent(e); // Menu should be displayed when the menu is pressed only if // it is top-level menu if (menu.isTopLevelMenu()) { if (menu.getPopupMenu().isVisible()) // If menu is visible and menu button was pressed.. // then need to cancel the menu manager.clearSelectedPath(); else { // Display the menu int x = 0; int y = menu.getHeight(); manager.setSelectedPath(getPath()); JMenuBar mb = (JMenuBar) menu.getParent(); // set selectedIndex of the selectionModel of a menuBar mb.getSelectionModel().setSelectedIndex(mb.getComponentIndex(menu)); } } }
public void mousePressed(MouseEvent e) { MenuSelectionManager manager = MenuSelectionManager.defaultManager(); JMenu menu = (JMenu) menuItem; manager.processMouseEvent(e); // Menu should be displayed when the menu is pressed only if // it is top-level menu if (menu.isTopLevelMenu()) { if (menu.getPopupMenu().isVisible()) // If menu is visible and menu button was pressed.. // then need to cancel the menu manager.clearSelectedPath(); else { // Display the menu int x = 0; int y = menu.getHeight(); manager.setSelectedPath(getPath()); JMenuBar mb = (JMenuBar) menu.getParent(); // set selectedIndex of the selectionModel of a menuBar mb.getSelectionModel().setSelectedIndex(mb.getComponentIndex(menu)); } } }
5,270
public void mousePressed(MouseEvent e) { MenuSelectionManager manager = MenuSelectionManager.defaultManager(); JMenu menu = (JMenu) menuItem; manager.processMouseEvent(e); // Menu should be displayed when the menu is pressed only if // it is top-level menu if (menu.isTopLevelMenu()) { if (menu.getPopupMenu().isVisible()) // If menu is visible and menu button was pressed.. // then need to cancel the menu manager.clearSelectedPath(); else { // Display the menu int x = 0; int y = menu.getHeight(); manager.setSelectedPath(getPath()); JMenuBar mb = (JMenuBar) menu.getParent(); // set selectedIndex of the selectionModel of a menuBar mb.getSelectionModel().setSelectedIndex(mb.getComponentIndex(menu)); } } }
public void mousePressed(MouseEvent e) { MenuSelectionManager manager = MenuSelectionManager.defaultManager(); JMenu menu = (JMenu) menuItem; manager.processMouseEvent(e); // Menu should be displayed when the menu is pressed only if // it is top-level menu if (menu.isTopLevelMenu()) { if (menu.getPopupMenu().isVisible()) // If menu is visible and menu button was pressed.. // then need to cancel the menu manager.clearSelectedPath(); else { // Display the menu int x = 0; int y = menu.getHeight(); MenuElement[] selectedPath = manager.getSelectedPath(); if (selectedPath.length > 0 && selectedPath[selectedPath.length - 1] != menu.getPopupMenu()) { if(menu.isTopLevelMenu() || menu.getDelay() == 0) { MenuElement[] newPath = new MenuElement[selectedPath.length + 1]; System.arraycopy(selectedPath, 0, newPath, 0, selectedPath.length); newPath[selectedPath.length] = menu.getPopupMenu(); manager.setSelectedPath(newPath); } else { setupPostTimer(menu); } } JMenuBar mb = (JMenuBar) menu.getParent(); // set selectedIndex of the selectionModel of a menuBar mb.getSelectionModel().setSelectedIndex(mb.getComponentIndex(menu)); } } }
5,271
public void mousePressed(MouseEvent e) { MenuSelectionManager manager = MenuSelectionManager.defaultManager(); JMenu menu = (JMenu) menuItem; manager.processMouseEvent(e); // Menu should be displayed when the menu is pressed only if // it is top-level menu if (menu.isTopLevelMenu()) { if (menu.getPopupMenu().isVisible()) // If menu is visible and menu button was pressed.. // then need to cancel the menu manager.clearSelectedPath(); else { // Display the menu int x = 0; int y = menu.getHeight(); manager.setSelectedPath(getPath()); JMenuBar mb = (JMenuBar) menu.getParent(); // set selectedIndex of the selectionModel of a menuBar mb.getSelectionModel().setSelectedIndex(mb.getComponentIndex(menu)); } } }
public void mousePressed(MouseEvent e) { MenuSelectionManager manager = MenuSelectionManager.defaultManager(); JMenu menu = (JMenu) menuItem; manager.processMouseEvent(e); // Menu should be displayed when the menu is pressed only if // it is top-level menu if (menu.isTopLevelMenu()) { if (menu.getPopupMenu().isVisible()) // If menu is visible and menu button was pressed.. // then need to cancel the menu manager.clearSelectedPath(); else { // Display the menu int x = 0; int y = menu.getHeight(); manager.setSelectedPath(getPath()); JMenuBar mb = (JMenuBar) menu.getParent(); // set selectedIndex of the selectionModel of a menuBar mb.getSelectionModel().setSelectedIndex(mb.getComponentIndex(menu)); } } }
5,272
protected void installKeyboardActions() throws NotImplementedException { // FIXME: Need to implement }
protected void installKeyboardActions() { // FIXME: Need to implement }
5,274
protected void installListeners() { ((JMenu) menuItem).addMouseListener(mouseInputListener); ((JMenu) menuItem).addMouseMotionListener(mouseInputListener); ((JMenu) menuItem).addMenuListener(menuListener); ((JMenu) menuItem).addMenuDragMouseListener(menuDragMouseListener); }
protected void installListeners() { ((JMenu) menuItem).addMouseListener(mouseInputListener); ((JMenu) menuItem).addMouseMotionListener(mouseInputListener); ((JMenu) menuItem).addMenuListener(menuListener); ((JMenu) menuItem).addMenuDragMouseListener(menuDragMouseListener); }
5,276
protected void installListeners() { ((JMenu) menuItem).addMouseListener(mouseInputListener); ((JMenu) menuItem).addMouseMotionListener(mouseInputListener); ((JMenu) menuItem).addMenuListener(menuListener); ((JMenu) menuItem).addMenuDragMouseListener(menuDragMouseListener); }
protected void installListeners() { ((JMenu) menuItem).addMouseListener(mouseInputListener); ((JMenu) menuItem).addMouseMotionListener(mouseInputListener); ((JMenu) menuItem).addMenuListener(menuListener); }
5,277
protected void uninstallKeyboardActions() throws NotImplementedException { // FIXME: Need to implement }
protected void uninstallKeyboardActions() { // FIXME: Need to implement }
5,279
protected void uninstallListeners() { ((JMenu) menuItem).removeMouseListener(mouseInputListener); ((JMenu) menuItem).removeMenuListener(menuListener); ((JMenu) menuItem).removePropertyChangeListener(propertyChangeListener); }
protected void uninstallListeners() { super.uninstallListeners(); ((JMenu) menuItem).removeMenuListener(menuListener); ((JMenu) menuItem).removePropertyChangeListener(propertyChangeListener); }
5,281
protected void uninstallListeners() { ((JMenu) menuItem).removeMouseListener(mouseInputListener); ((JMenu) menuItem).removeMenuListener(menuListener); ((JMenu) menuItem).removePropertyChangeListener(propertyChangeListener); }
protected void uninstallListeners() { ((JMenu) menuItem).removeMouseListener(mouseInputListener); ((JMenu) menuItem).removeMenuListener(menuListener); }
5,282
static String absolutize(String base, String href) { if (href == null) return null; int ci = href.indexOf(':'); if (ci > 1 && isLowercaseAscii(href.substring(0, ci))) { // href is absolute already return href; } if (base == null) base = ""; else { int i = base.lastIndexOf('/'); if (i != -1) base = base.substring(0, i + 1); else base = ""; } if ("".equals(base)) { // assume file URL relative to current directory base = System.getProperty("user.dir"); if (base.charAt(0) == '/') base = base.substring(1); base = "file:///" + base.replace(File.separatorChar, '/'); if (!base.endsWith("/")) base += "/"; } if (href.startsWith("/")) { if (base.startsWith("file:")) return "file://" + href; int i = base.indexOf("://"); if (i != -1) { i = base.indexOf('/', i + 3); if (i != -1) base = base.substring(0, i); } } else { while (href.startsWith("..")) { int i = base.lastIndexOf('/', base.length() - 2); if (i != -1) base = base.substring(0, i + 1); href = href.substring(2); if (href.startsWith("/")) href = href.substring(1); } } return base + href; }
public static String absolutize(String base, String href) throws MalformedURLException { if (href == null) return null; int ci = href.indexOf(':'); if (ci > 1 && isLowercaseAscii(href.substring(0, ci))) { // href is absolute already return href; } if (base == null) base = ""; else { int i = base.lastIndexOf('/'); if (i != -1) base = base.substring(0, i + 1); else base = ""; } if ("".equals(base)) { // assume file URL relative to current directory base = System.getProperty("user.dir"); if (base.charAt(0) == '/') base = base.substring(1); base = "file:///" + base.replace(File.separatorChar, '/'); if (!base.endsWith("/")) base += "/"; } if (href.startsWith("/")) { if (base.startsWith("file:")) return "file://" + href; int i = base.indexOf("://"); if (i != -1) { i = base.indexOf('/', i + 3); if (i != -1) base = base.substring(0, i); } } else { while (href.startsWith("..")) { int i = base.lastIndexOf('/', base.length() - 2); if (i != -1) base = base.substring(0, i + 1); href = href.substring(2); if (href.startsWith("/")) href = href.substring(1); } } return base + href; }
5,283
static String absolutize(String base, String href) { if (href == null) return null; int ci = href.indexOf(':'); if (ci > 1 && isLowercaseAscii(href.substring(0, ci))) { // href is absolute already return href; } if (base == null) base = ""; else { int i = base.lastIndexOf('/'); if (i != -1) base = base.substring(0, i + 1); else base = ""; } if ("".equals(base)) { // assume file URL relative to current directory base = System.getProperty("user.dir"); if (base.charAt(0) == '/') base = base.substring(1); base = "file:///" + base.replace(File.separatorChar, '/'); if (!base.endsWith("/")) base += "/"; } if (href.startsWith("/")) { if (base.startsWith("file:")) return "file://" + href; int i = base.indexOf("://"); if (i != -1) { i = base.indexOf('/', i + 3); if (i != -1) base = base.substring(0, i); } } else { while (href.startsWith("..")) { int i = base.lastIndexOf('/', base.length() - 2); if (i != -1) base = base.substring(0, i + 1); href = href.substring(2); if (href.startsWith("/")) href = href.substring(1); } } return base + href; }
static String absolutize(String base, String href) { if (href == null) return null; int ci = href.indexOf(':'); if (ci > 1 && isURLScheme(href.substring(0, ci))) { // href is absolute already return href; } if (base == null) base = ""; else { int i = base.lastIndexOf('/'); if (i != -1) base = base.substring(0, i + 1); else base = ""; } if ("".equals(base)) { // assume file URL relative to current directory base = System.getProperty("user.dir"); if (base.charAt(0) == '/') base = base.substring(1); base = "file:///" + base.replace(File.separatorChar, '/'); if (!base.endsWith("/")) base += "/"; } if (href.startsWith("/")) { if (base.startsWith("file:")) return "file://" + href; int i = base.indexOf("://"); if (i != -1) { i = base.indexOf('/', i + 3); if (i != -1) base = base.substring(0, i); } } else { while (href.startsWith("..")) { int i = base.lastIndexOf('/', base.length() - 2); if (i != -1) base = base.substring(0, i + 1); href = href.substring(2); if (href.startsWith("/")) href = href.substring(1); } } return base + href; }
5,284
static String absolutize(String base, String href) { if (href == null) return null; int ci = href.indexOf(':'); if (ci > 1 && isLowercaseAscii(href.substring(0, ci))) { // href is absolute already return href; } if (base == null) base = ""; else { int i = base.lastIndexOf('/'); if (i != -1) base = base.substring(0, i + 1); else base = ""; } if ("".equals(base)) { // assume file URL relative to current directory base = System.getProperty("user.dir"); if (base.charAt(0) == '/') base = base.substring(1); base = "file:///" + base.replace(File.separatorChar, '/'); if (!base.endsWith("/")) base += "/"; } if (href.startsWith("/")) { if (base.startsWith("file:")) return "file://" + href; int i = base.indexOf("://"); if (i != -1) { i = base.indexOf('/', i + 3); if (i != -1) base = base.substring(0, i); } } else { while (href.startsWith("..")) { int i = base.lastIndexOf('/', base.length() - 2); if (i != -1) base = base.substring(0, i + 1); href = href.substring(2); if (href.startsWith("/")) href = href.substring(1); } } return base + href; }
static String absolutize(String base, String href) { if (href == null) return null; int ci = href.indexOf(':'); if (ci > 1 && isLowercaseAscii(href.substring(0, ci))) { // href is absolute already return href; } if (base == null) base = ""; else { int i = base.lastIndexOf('/'); if (i != -1) base = base.substring(0, i + 1); else base = ""; } if ("".equals(base)) { // assume file URL relative to current directory base = System.getProperty("user.dir"); if (base.charAt(0) == '/') base = base.substring(1); base = "file:///" + base.replace(File.separatorChar, '/'); if (!base.endsWith("/")) base += "/"; } if (href.startsWith("/")) { if (base.startsWith("file:")) return "file://" + href; int i = base.indexOf("://"); if (i != -1) { i = base.indexOf('/', i + 3); if (i != -1) base = base.substring(0, i); } } else { while (href.startsWith("..")) { int i = base.lastIndexOf('/', base.length() - 2); if (i != -1) base = base.substring(0, i + 1); href = href.substring(2); if (href.startsWith("/")) href = href.substring(1); } } return base + href; }
5,285
private InputStream resolve(String url) throws IOException { try { return new URL(url).openStream(); } catch (MalformedURLException e) { return null; } }
static InputStream resolve(String url) throws IOException { try { return new URL(url).openStream(); } catch (MalformedURLException e) { return null; } }
5,286
protected Dimension getPreferredMenuItemSize(JComponent c, Icon checkIcon, Icon arrowIcon, int defaultTextIconGap) { JMenuItem m = (JMenuItem) c; Dimension d = BasicGraphicsUtils.getPreferredButtonSize(m, defaultTextIconGap); // if menu item has accelerator then take accelerator's size into account // when calculating preferred size. KeyStroke accelerator = m.getAccelerator(); Rectangle rect; if (accelerator != null) { rect = getAcceleratorRect( accelerator, m.getToolkit().getFontMetrics(acceleratorFont)); // add width of accelerator's text d.width = d.width + rect.width + defaultAcceleratorLabelGap; // adjust the heigth of the preferred size if necessary if (d.height < rect.height) d.height = rect.height; } if (checkIcon != null) { d.width = d.width + checkIcon.getIconWidth() + defaultTextIconGap; if (checkIcon.getIconHeight() > d.height) d.height = checkIcon.getIconHeight(); } if (arrowIcon != null && (c instanceof JMenu)) { d.width = d.width + arrowIcon.getIconWidth() + defaultTextIconGap; if (arrowIcon.getIconHeight() > d.height) d.height = arrowIcon.getIconHeight(); } return d; }
protected Dimension getPreferredMenuItemSize(JComponent c, Icon checkIcon, Icon arrowIcon, int defaultTextIconGap) { JMenuItem m = (JMenuItem) c; Dimension d = BasicGraphicsUtils.getPreferredButtonSize(m, defaultTextIconGap); // if menu item has accelerator then take accelerator's size into account // when calculating preferred size. KeyStroke accelerator = m.getAccelerator(); Rectangle rect; if (accelerator != null) { rect = getAcceleratorRect( accelerator, m.getToolkit().getFontMetrics(acceleratorFont)); // add width of accelerator's text d.width += rect.width + defaultAcceleratorLabelGap; // adjust the heigth of the preferred size if necessary if (d.height < rect.height) d.height = rect.height; } if (checkIcon != null) { d.width = d.width + checkIcon.getIconWidth() + defaultTextIconGap; if (checkIcon.getIconHeight() > d.height) d.height = checkIcon.getIconHeight(); } if (arrowIcon != null && (c instanceof JMenu)) { d.width = d.width + arrowIcon.getIconWidth() + defaultTextIconGap; if (arrowIcon.getIconHeight() > d.height) d.height = arrowIcon.getIconHeight(); } return d; }
5,289
protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text) { Font f = menuItem.getFont(); g.setFont(f); FontMetrics fm = g.getFontMetrics(f); if (text != null && !text.equals("")) { if (menuItem.isEnabled()) { // Menu item is considered to be highlighted when it is selected. // But not if it's a JCheckBoxMenuItem if ((menuItem.isSelected() && checkIcon == null) || menuItem.getModel().isArmed() && (menuItem.getParent() instanceof MenuElement)) g.setColor(selectionForeground); else g.setColor(menuItem.getForeground()); } else // FIXME: should fix this to use 'disabledForeground', but its // default value in BasicLookAndFeel is null. // FIXME: should there be different foreground colours for selected // or deselected, when disabled? g.setColor(Color.gray); int mnemonicIndex = menuItem.getDisplayedMnemonicIndex(); if (mnemonicIndex != -1) BasicGraphicsUtils.drawStringUnderlineCharAt(g, text, mnemonicIndex, textRect.x, textRect.y + fm.getAscent()); else BasicGraphicsUtils.drawString(g, text, 0, textRect.x, textRect.y + fm.getAscent()); } }
protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text) { Font f = menuItem.getFont(); g.setFont(f); FontMetrics fm = g.getFontMetrics(f); if (text != null && !text.equals("")) { if (menuItem.isEnabled()) { // Menu item is considered to be highlighted when it is selected. // But not if it's a JCheckBoxMenuItem if ((menuItem.isSelected() && checkIcon == null) || menuItem.getModel().isArmed() && (menuItem.getParent() instanceof MenuElement)) g.setColor(selectionForeground); else g.setColor(menuItem.getForeground()); } else // FIXME: should fix this to use 'disabledForeground', but its // default value in BasicLookAndFeel is null. // FIXME: should there be different foreground colours for selected // or deselected, when disabled? g.setColor(Color.gray); int mnemonicIndex = menuItem.getDisplayedMnemonicIndex(); if (mnemonicIndex != -1) BasicGraphicsUtils.drawStringUnderlineCharAt(g, text, mnemonicIndex, textRect.x, textRect.y + fm.getAscent()); else BasicGraphicsUtils.drawString(g, text, 0, textRect.x, textRect.y + fm.getAscent()); } }
5,290
protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text) { Font f = menuItem.getFont(); g.setFont(f); FontMetrics fm = g.getFontMetrics(f); if (text != null && !text.equals("")) { if (menuItem.isEnabled()) { // Menu item is considered to be highlighted when it is selected. // But not if it's a JCheckBoxMenuItem if ((menuItem.isSelected() && checkIcon == null) || menuItem.getModel().isArmed() && (menuItem.getParent() instanceof MenuElement)) g.setColor(selectionForeground); else g.setColor(menuItem.getForeground()); } else // FIXME: should fix this to use 'disabledForeground', but its // default value in BasicLookAndFeel is null. // FIXME: should there be different foreground colours for selected // or deselected, when disabled? g.setColor(Color.gray); int mnemonicIndex = menuItem.getDisplayedMnemonicIndex(); if (mnemonicIndex != -1) BasicGraphicsUtils.drawStringUnderlineCharAt(g, text, mnemonicIndex, textRect.x, textRect.y + fm.getAscent()); else BasicGraphicsUtils.drawString(g, text, 0, textRect.x, textRect.y + fm.getAscent()); } }
protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text) { Font f = menuItem.getFont(); g.setFont(f); FontMetrics fm = g.getFontMetrics(f); if (text != null && !text.equals("")) { if (menuItem.isEnabled()) { // Menu item is considered to be highlighted when it is selected. // But not if it's a JCheckBoxMenuItem if ((menuItem.isSelected() && checkIcon == null) || menuItem.getModel().isArmed() && (menuItem.getParent() instanceof MenuElement)) g.setColor(selectionForeground); else g.setColor(menuItem.getForeground()); else // FIXME: should fix this to use 'disabledForeground', but its // default value in BasicLookAndFeel is null. // FIXME: should there be different foreground colours for selected // or deselected, when disabled? g.setColor(Color.gray); int mnemonicIndex = menuItem.getDisplayedMnemonicIndex(); if (mnemonicIndex != -1) BasicGraphicsUtils.drawStringUnderlineCharAt(g, text, mnemonicIndex, textRect.x, textRect.y + fm.getAscent()); else BasicGraphicsUtils.drawString(g, text, 0, textRect.x, textRect.y + fm.getAscent());
5,291
public void run() { try { synchronized (queueLock) { try { queueLock.wait(initialDelay); } catch (InterruptedException e) { // Ignored } if (!running) return; queueEvent(); if (repeats) while (running) { try { queueLock.wait(delay); } catch (InterruptedException e) { // Ignored } if (!running) break; queueEvent(); if (logTimers) System.out.println("javax.swing.Timer -> clocktick"); if ( ! repeats) break; } running = false; } } finally { // The timer is no longer running. running = false; } }
public void run() { try { synchronized (queueLock) { try { queueLock.wait(initialDelay); } catch (InterruptedException e) { // Ignored } if (!running) return; queueEvent(); if (repeats) while (running) { try { queueLock.wait(delay); } catch (InterruptedException e) { // Ignored } if (!running) break; queueEvent(); if (logTimers) System.out.println("javax.swing.Timer -> clocktick"); if ( ! repeats) break; } running = false; } } finally { // The timer is no longer running. running = false; } }
5,292
public void run() { try { synchronized (queueLock) { try { queueLock.wait(initialDelay); } catch (InterruptedException e) { // Ignored } if (!running) return; queueEvent(); if (repeats) while (running) { try { queueLock.wait(delay); } catch (InterruptedException e) { // Ignored } if (!running) break; queueEvent(); if (logTimers) System.out.println("javax.swing.Timer -> clocktick"); if ( ! repeats) break; } running = false; } } finally { // The timer is no longer running. running = false; } }
public void run() { try { synchronized (queueLock) { try { queueLock.wait(initialDelay); } catch (InterruptedException e) { // Ignored } if (!running) return; queueEvent(); if (repeats) while (running) { try { queueLock.wait(delay); } catch (InterruptedException e) { // Ignored } if (!running) break; queueEvent(); if (logTimers) System.out.println("javax.swing.Timer -> clocktick"); if ( ! repeats) break; } running = false; } } finally { // The timer is no longer running. running = false; } }
5,293
void queueEvent() { synchronized (queueLock) { queue++; if (queue == 1) SwingUtilities.invokeLater(drainer); } }
void queueEvent() { synchronized (queueLock) { queue++; if (queue == 1) SwingUtilities.invokeLater(drainer); } }
5,295
void queueEvent() { synchronized (queueLock) { queue++; if (queue == 1) SwingUtilities.invokeLater(drainer); } }
void queueEvent() { synchronized (queueLock) { queue++; if (queue == 1) SwingUtilities.invokeLater(drainer);
5,296
public void start() { synchronized (queueLock) { if (waker != null) return; waker = new Waker(); waker.start(); } }
public void start() { synchronized (queueLock) { if (waker != null) return; waker = new Waker(); waker.start(); } }
5,297
public void stop() { synchronized (queueLock) { running = false; queue = 0; if (waker != null) queueLock.notifyAll(); waker = null; } }
public void stop() { synchronized (queueLock) { running = false; queue = 0; queueLock.notifyAll(); waker = null; } }
5,299
public Area(Shape s) { }
public Area() { }
5,300
public void transform(AffineTransform at) { // XXX Implement. throw new Error("not implemented"); }
public void transform(AffineTransform at) { // XXX Implement. for (int i = 0; i < solids.size(); i++) ((Segment) solids.elementAt(i)).transformSegmentList(at); for (int i = 0; i < holes.size(); i++) ((Segment) holes.elementAt(i)).transformSegmentList(at); if ((at.getType() & AffineTransform.TYPE_FLIP) != 0) { setDirection(holes, false); setDirection(solids, true); }
5,302
public boolean contains(double x, double y) { // XXX Implement. throw new Error("not implemented"); }
public boolean contains(double x, double y) { // XXX Implement. int n = 0; for (int i = 0; i < solids.size(); i++) if (((Segment) solids.elementAt(i)).contains(x, y)) n++; for (int i = 0; i < holes.size(); i++) if (((Segment) holes.elementAt(i)).contains(x, y)) n--; return (n != 0); }
5,304
public boolean equals(Object obj) { if (obj instanceof UID) { UID uid = (UID)obj; if (this.unique == uid.unique && this.time == uid.time && this.count == uid.count) { return (true); } } return (false);}
public boolean equals(Object obj) { if (obj instanceof UID) { UID uid = (UID)obj; if (this.unique == uid.unique && this.time == uid.time && this.count == uid.count) { return (true); } } return (false);}
5,305
public int hashCode() { return (unique);}
public int hashCode() { return (unique);}
5,306
public int signum() { int top = words == null ? ival : words[ival-1]; if (top == 0 && words == null) return 0; return top < 0 ? -1 : 1; }
public int signum() { int top = words == null ? ival : words[ival-1]; if (top == 0 && words == null) return 0; return top < 0 ? -1 : 1; }
5,310
private void writeObject(ObjectOutputStream s) throws IOException, ClassNotFoundException { signum = signum(); magnitude = toByteArray(); s.defaultWriteObject(); }
private void writeObject(ObjectOutputStream s) throws IOException, ClassNotFoundException { signum = signum(); magnitude = signum == 0 ? new byte[0] : toByteArray(); s.defaultWriteObject(); }
5,311
public EmulatorAction(Session session, String name, KeyStroke ks, KeyMapper keyMap) { this(session,name); setKeyStroke(name, ks, keyMap); }
public EmulatorAction(Session session, String name) { this(session,name); setKeyStroke(name, ks, keyMap); }
5,312
public EmulatorAction(Session session, String name, KeyStroke ks, KeyMapper keyMap) { this(session,name); setKeyStroke(name, ks, keyMap); }
public EmulatorAction(Session session, String name, KeyStroke ks, KeyMapper keyMap) { this(session,name); setKeyStroke(name, ks, keyMap); }
5,313
protected void startPlugin() throws PluginException { try { final DeviceManager dm = DeviceUtils.getDeviceManager(); dm.addListener(this); final Collection devs = dm.getDevices(); for (Iterator i = devs.iterator(); i.hasNext();) { addListeners((Device) i.next()); } } catch (NameNotFoundException ex) { throw new PluginException(ex); } }
protected void startPlugin() throws PluginException { try { final DeviceManager dm = DeviceUtils.getDeviceManager(); dm.addListener(this); final Collection devs = new ArrayList(dm.getDevices()); for (Iterator i = devs.iterator(); i.hasNext();) { addListeners((Device) i.next()); } } catch (NameNotFoundException ex) { throw new PluginException(ex); } }
5,314
public Object action (SaxDocumentHandler handler, Attributes attrs) throws SAXException { // we only need to do these things for the first time we enter // a data node if (DataNodeLevel == 0) { // A little 'pre-handling' as href is a specialattribute // that will hold an (Href) object rather than string value Entity hrefObj = null; String hrefValue = getAttributesValueByName(attrs,"href"); if (hrefValue != null ) { // now we look up the href from the entity list gathered by // the parser and transfer relevant info to our Href object hrefObj = new Entity(); Hashtable hrefInfo = (Hashtable) UnParsedEntity.get(hrefValue);/*Log.errorln("Href Entity has following keys:");java.util.Set keys = hrefInfo.keySet();Iterator iter = keys.iterator();while (iter.hasNext()) { Log.errorln(" Key:"+iter.next().toString());}*/ if (UnParsedEntity.containsKey(hrefValue)) { hrefObj.setName((String) hrefInfo.get("name"));/* if (hrefInfo.containsKey("base")) hrefObj.setBase((String) hrefInfo.get("base"));*/ if (hrefInfo.containsKey("systemId")) hrefObj.setSystemId((String) hrefInfo.get("systemId")); if (hrefInfo.containsKey("publicId")) hrefObj.setPublicId((String) hrefInfo.get("publicId")); if (hrefInfo.containsKey("ndata")) hrefObj.setNdata((String) hrefInfo.get("ndata")); } else { // bizarre. It usually means that the unparsed entity handler // isnt working like it should Log.error("Error: UnParsedEntity list lacks entry for :"+hrefValue); Log.errorln(" ignoring request to read data."); } } // update the array dataCube with passed attributes CurrentArray.getDataCube().setAttributes(attrs); // Clean up. We override the string value of Href and set it as // the Href object , if we created it (yeh, sloppy). if (hrefObj != null) CurrentArray.getDataCube().setHref(hrefObj); // determine the size of the dataFormat (s) in our dataCube if (CurrentArray.hasFieldAxis()) { // if there is a field axis, then its set to the number of fields FieldAxis fieldAxis = CurrentArray.getFieldAxis(); MaxDataFormatIndex = (fieldAxis.getLength()-1); } else { // its homogeneous MaxDataFormatIndex = 0; } // reset to start of which dataformat type we currently are reading CurrentDataFormatIndex = 0; // reset to start of which IOCmd we currently are reading CurrentIOCmdIndex = 0; // reset the list of dataformats we are reading DataFormatList = CurrentArray.getDataFormatList(); NrofDataFormats = DataFormatList.length; IntRadix = new int [NrofDataFormats]; // CALCULATE CURRENTREADBYTES // set up some other global information bout the dataformats // that will help speed reading CurrentReadBytes = 0; for (int i=0; i < NrofDataFormats; i++) { CurrentReadBytes += DataFormatList[i].numOfBytes(); if (DataFormatList[i] instanceof IntegerDataFormat) { String type = ((IntegerDataFormat) DataFormatList[i]).getType(); if (type.equals(Constants.INTEGER_TYPE_DECIMAL)) IntRadix[i] = 10; else if (type.equals(Constants.INTEGER_TYPE_HEX)) IntRadix[i] = 16; else if (type.equals(Constants.INTEGER_TYPE_OCTAL)) IntRadix[i] = 8; else IntRadix[i] = 10; // default } else if (DataFormatList[i] instanceof BinaryIntegerDataFormat) { IntRadix[i] = 10; } } // DONT FORGET TO ADD IN THE SKIPCHAR bytes XMLDataIOStyle readObj = CurrentArray.getXMLDataIOStyle(); if (readObj instanceof FormattedXMLDataIOStyle) { Iterator citer = ((FormattedXMLDataIOStyle) readObj).getFormatCommands().iterator(); while (citer.hasNext()) { FormattedIOCmd currentIOCmd = (FormattedIOCmd) citer.next(); if (currentIOCmd instanceof SkipCharFormattedIOCmd) { Integer bytes_to_skip = ((SkipCharFormattedIOCmd) currentIOCmd).getCount(); CurrentReadBytes += bytes_to_skip.intValue(); } } } else if (readObj instanceof DelimitedXMLDataIOStyle || readObj instanceof TaggedXMLDataIOStyle ) { throw new SAXException("Cant parse delimited or tagged data from external file (yet)."); } if (CurrentReadBytes > MAXINPUTREADSIZE) { Log.errorln("This XDF file has single record that is too big (greater than "+MAXINPUTREADSIZE+" bytes in a record) to parse by this code"); System.exit(-1); } // now determine properread size CurrentInputReadSize = BASEINPUTREADSIZE * CurrentReadBytes; // make sure its not TOO big while (CurrentInputReadSize > MAXINPUTREADSIZE) { CurrentInputReadSize -= CurrentReadBytes; } } XMLDataIOStyle readObj = CurrentArray.getXMLDataIOStyle();// FastestAxis = (AxisInterface) CurrentArray.getAxes().get(0);// LastFastAxisCoordinate = 0; LastFieldAxisCoordinate = 0; if ( readObj instanceof TaggedXMLDataIOStyle) { TaggedLocatorObj = CurrentArray.createLocator(); } else { // A safety. We clear datablock when this is the first datanode we // have entered DATABLOCK is used in cases where we read in untagged data if (DataNodeLevel == 0) DATABLOCK = new StringBuffer (); } // tack in href data Entity href = CurrentArray.getDataCube().getHref(); if (href != null) // The first method is the 'old' way. // If you uncomment it be sure to uncomment line that looks like: // if (CurrentArray.getDataCube().getHref() != null) return; // in the end dataElementHandler // DATABLOCK.append(getHrefData(href, CurrentArray.getDataCube().getCompression())); loadHrefDataIntoCurrentArray(href, CurrentArray.getDataCube().getCompression()); // entered a datanode, raise the count // this (partially helps) declare we are now reading data, DataNodeLevel++; return readObj; }
public Object action (SaxDocumentHandler handler, Attributes attrs) throws SAXException { // we only need to do these things for the first time we enter // a data node if (DataNodeLevel == 0) { // A little 'pre-handling' as href is a specialattribute // that will hold an (Href) object rather than string value Entity hrefObj = null; String hrefValue = getAttributesValueByName(attrs,"href"); if (hrefValue != null ) { // now we look up the href from the entity list gathered by // the parser and transfer relevant info to our Href object hrefObj = new Entity(); Hashtable hrefInfo = (Hashtable) UnParsedEntity.get(hrefValue);/*Log.errorln("Href Entity has following keys:");java.util.Set keys = hrefInfo.keySet();Iterator iter = keys.iterator();while (iter.hasNext()) { Log.errorln(" Key:"+iter.next().toString());}*/ if (UnParsedEntity.containsKey(hrefValue)) { hrefObj.setName((String) hrefInfo.get("name"));/* if (hrefInfo.containsKey("base")) hrefObj.setBase((String) hrefInfo.get("base"));*/ if (hrefInfo.containsKey("systemId")) hrefObj.setSystemId((String) hrefInfo.get("systemId")); if (hrefInfo.containsKey("publicId")) hrefObj.setPublicId((String) hrefInfo.get("publicId")); if (hrefInfo.containsKey("ndata")) hrefObj.setNdata((String) hrefInfo.get("ndata")); } else { // bizarre. It usually means that the unparsed entity handler // isnt working like it should Log.error("Error: UnParsedEntity list lacks entry for :"+hrefValue); Log.errorln(" ignoring request to read data."); } } // update the array dataCube with passed attributes CurrentArray.getDataCube().setAttributes(attrs); // Clean up. We override the string value of Href and set it as // the Href object , if we created it (yeh, sloppy). if (hrefObj != null) CurrentArray.getDataCube().setHref(hrefObj); // determine the size of the dataFormat (s) in our dataCube if (CurrentArray.hasFieldAxis()) { // if there is a field axis, then its set to the number of fields FieldAxis fieldAxis = CurrentArray.getFieldAxis(); MaxDataFormatIndex = (fieldAxis.getLength()-1); } else { // its homogeneous MaxDataFormatIndex = 0; } // reset to start of which dataformat type we currently are reading CurrentDataFormatIndex = 0; // reset to start of which IOCmd we currently are reading CurrentIOCmdIndex = 0; // reset the list of dataformats we are reading DataFormatList = CurrentArray.getDataFormatList(); NrofDataFormats = DataFormatList.length; IntRadix = new int [NrofDataFormats]; // CALCULATE CURRENTREADBYTES // set up some other global information bout the dataformats // that will help speed reading CurrentReadBytes = 0; for (int i=0; i < NrofDataFormats; i++) { CurrentReadBytes += DataFormatList[i].numOfBytes(); if (DataFormatList[i] instanceof IntegerDataFormat) { String type = ((IntegerDataFormat) DataFormatList[i]).getType(); if (type.equals(Constants.INTEGER_TYPE_DECIMAL)) IntRadix[i] = 10; else if (type.equals(Constants.INTEGER_TYPE_HEX)) IntRadix[i] = 16; else if (type.equals(Constants.INTEGER_TYPE_OCTAL)) IntRadix[i] = 8; else IntRadix[i] = 10; // default } else if (DataFormatList[i] instanceof BinaryIntegerDataFormat) { IntRadix[i] = 10; } } // DONT FORGET TO ADD IN THE SKIPCHAR bytes XMLDataIOStyle readObj = CurrentArray.getXMLDataIOStyle(); if (readObj instanceof FormattedXMLDataIOStyle) { Iterator citer = ((FormattedXMLDataIOStyle) readObj).getFormatCommands().iterator(); while (citer.hasNext()) { FormattedIOCmd currentIOCmd = (FormattedIOCmd) citer.next(); if (currentIOCmd instanceof SkipCharFormattedIOCmd) { Integer bytes_to_skip = ((SkipCharFormattedIOCmd) currentIOCmd).getCount(); CurrentReadBytes += bytes_to_skip.intValue(); } } } else if (readObj instanceof DelimitedXMLDataIOStyle || readObj instanceof TaggedXMLDataIOStyle ) { throw new SAXException("Cant parse delimited or tagged data from external file (yet)."); } if (CurrentReadBytes > MAXINPUTREADSIZE) { Log.errorln("This XDF file has single record that is too big (greater than "+MAXINPUTREADSIZE+" bytes in a record) to parse by this code"); System.exit(-1); } // now determine properread size CurrentInputReadSize = BASEINPUTREADSIZE * CurrentReadBytes; // make sure its not TOO big while (CurrentInputReadSize > MAXINPUTREADSIZE) { CurrentInputReadSize -= CurrentReadBytes; } } XMLDataIOStyle readObj = CurrentArray.getXMLDataIOStyle();// FastestAxis = (AxisInterface) CurrentArray.getAxes().get(0);// LastFastAxisCoordinate = 0; LastFieldAxisCoordinate = 0; if ( readObj instanceof TaggedXMLDataIOStyle) { TaggedLocatorObj = CurrentArray.createLocator(); } else { // A safety. We clear datablock when this is the first datanode we // have entered DATABLOCK is used in cases where we read in untagged data if (DataNodeLevel == 0) DATABLOCK = new StringBuffer (); } // tack in href data Entity href = CurrentArray.getDataCube().getHref(); if (href != null) // The first method is the 'old' way. // If you uncomment it be sure to uncomment line that looks like: // if (CurrentArray.getDataCube().getHref() != null) return; // in the end dataElementHandler // DATABLOCK.append(getHrefData(href, CurrentArray.getDataCube().getCompression())); loadHrefDataIntoCurrentArray(href, CurrentArray.getDataCube().getCompression()); // entered a datanode, raise the count // this (partially helps) declare we are now reading data, DataNodeLevel++; return readObj; }
5,315
public Array appendArrayToArray ( Array arrayToAppendTo, Array arrayToAdd ) { if (arrayToAppendTo != null) { List origAxisList = arrayToAppendTo.getAxes(); List addAxisList = arrayToAdd.getAxes(); Hashtable correspondingAddAxis = new Hashtable(); Hashtable correspondingOrigAxis = new Hashtable(); // 1. determine the proper alignment of the axes between both arrays // Then cross-reference each in lookup Hashtables. Iterator iter = origAxisList.iterator(); while (iter.hasNext()) { AxisInterface origAxis = (AxisInterface) iter.next(); String align = origAxis.getAlign(); // search the list of the other array for a matching axis boolean gotAMatch = false; Iterator iter2 = addAxisList.iterator(); while (iter2.hasNext()) { AxisInterface addAxis = (AxisInterface) iter2.next(); String thisAlign = addAxis.getAlign(); if(thisAlign != null) { if(thisAlign.equals(align)) { correspondingAddAxis.put(origAxis.getAxisId(), addAxis); correspondingOrigAxis.put(addAxis.getAxisId(), origAxis); gotAMatch = true; break; } } else { Log.errorln("Cant align axes, axis missing defined align attribute. Aborting."); return arrayToAppendTo; } } // no match?? then alignments are mis-specified. if (!gotAMatch) { Log.errorln("Cant align axes, axis has align attribute that is mis-specified. Aborting."); return arrayToAppendTo; } } // 2. "Append" axis values to original axis. Because // there are 2 different ways to add in data we either // have a pre-existing axis value, in which case we dont // need to expand the existing axis, or there is no pre-existing // value so we tack it in. We need to figure out here if an // axis value already exists, and if it doesnt then we add it in. // Iterator iter3 = origAxisList.iterator(); while (iter3.hasNext()) { AxisInterface origAxis = (AxisInterface) iter3.next(); AxisInterface addAxis = (AxisInterface) correspondingAddAxis.get(origAxis.getAxisId()); if (addAxis instanceof Axis && origAxis instanceof Axis) { List valuesToAdd = ((Axis) addAxis).getAxisValues(); Iterator iter4 = valuesToAdd.iterator(); while (iter4.hasNext()) { Value value = (Value) iter4.next(); if (((Axis) origAxis).getIndexFromAxisValue(value) == -1) { ((Axis) origAxis).addAxisValue(value); } } } else if (addAxis instanceof FieldAxis && origAxis instanceof FieldAxis) { // both are fieldAxis Log.errorln("Dont know how to merge field Axis data. Aborting."); System.exit(-1); } else { // mixed class Axes?? (e.g. a fieldAxis id matches Axis id??!? Error!!) Log.errorln("Dont know how to merge data. Aborting."); System.exit(-1); } } // 3. Append data from one array to the other appropriately Locator origLocator = arrayToAppendTo.createLocator(); Locator addLocator = arrayToAdd.createLocator(); while (addLocator.hasNext()) { try { // retrieve the data Object data = arrayToAdd.getData(addLocator); // set up the origLocator List locatorAxisList = addLocator.getIterationOrder(); Iterator iter5 = locatorAxisList.iterator(); while (iter5.hasNext()) { Axis addAxis = (Axis) iter5.next(); Value thisAxisValue = addLocator.getAxisValue(addAxis); Axis thisAxis = (Axis) correspondingOrigAxis.get(addAxis.getAxisId()); try { origLocator.setAxisIndexByAxisValue(thisAxis, thisAxisValue); Log.debug(origLocator.getAxisIndex(thisAxis)+","); } catch (AxisLocationOutOfBoundsException e) { Log.errorln("Weird axis out of bounds error for append array."); } } // add in the data as appropriate. Log.debugln(") => ["+data.toString()+"]"); try { if (data instanceof Double) arrayToAppendTo.setData(origLocator, (Double) data); else if (data instanceof Integer) arrayToAppendTo.setData(origLocator, (Integer) data); else if (data instanceof String ) arrayToAppendTo.setData(origLocator, (String) data); else Log.errorln("Cant understand class of data !(Double|Integer|String). Ignoring append."); } catch (SetDataException e) { Log.errorln(e.getMessage()+". Ignoring append"); } } catch (NoDataException e) { // do nothing for NoDataValues?? Log.errorln(e.getMessage()); } addLocator.next(); // go to next location } } else Log.errorln("Cannot append to null array. Ignoring request."); return arrayToAppendTo; }
public Array appendArrayToArray ( Array arrayToAppendTo, Array arrayToAdd ) { if (arrayToAppendTo != null) { List origAxisList = arrayToAppendTo.getAxes(); List addAxisList = arrayToAdd.getAxes(); Hashtable correspondingAddAxis = new Hashtable(); Hashtable correspondingOrigAxis = new Hashtable(); // 1. determine the proper alignment of the axes between both arrays // Then cross-reference each in lookup Hashtables. Iterator iter = origAxisList.iterator(); while (iter.hasNext()) { AxisInterface origAxis = (AxisInterface) iter.next(); String align = origAxis.getAlign(); // search the list of the other array for a matching axis boolean gotAMatch = false; Iterator iter2 = addAxisList.iterator(); while (iter2.hasNext()) { AxisInterface addAxis = (AxisInterface) iter2.next(); String thisAlign = addAxis.getAlign(); if(thisAlign != null) { if(thisAlign.equals(align)) { correspondingAddAxis.put(origAxis.getAxisId(), addAxis); correspondingOrigAxis.put(addAxis.getAxisId(), origAxis); gotAMatch = true; break; } } else { Log.errorln("Cant align axes, axis missing defined align attribute. Aborting."); return arrayToAppendTo; } } // no match?? then alignments are mis-specified. if (!gotAMatch) { Log.errorln("Cant align axes, axis has align attribute that is mis-specified. Aborting."); return arrayToAppendTo; } } // 2. "Append" axis values to original axis. Because // there are 2 different ways to add in data we either // have a pre-existing axis value, in which case we dont // need to expand the existing axis, or there is no pre-existing // value so we tack it in. We need to figure out here if an // axis value already exists, and if it doesnt then we add it in. // Iterator iter3 = origAxisList.iterator(); while (iter3.hasNext()) { AxisInterface origAxis = (AxisInterface) iter3.next(); AxisInterface addAxis = (AxisInterface) correspondingAddAxis.get(origAxis.getAxisId()); if (addAxis instanceof Axis && origAxis instanceof Axis) { List valuesToAdd = ((Axis) addAxis).getAxisValues(); Iterator iter4 = valuesToAdd.iterator(); while (iter4.hasNext()) { Value value = (Value) iter4.next(); if (((Axis) origAxis).getIndexFromAxisValue(value) == -1) { ((Axis) origAxis).addAxisValue(value); } } } else if (addAxis instanceof FieldAxis && origAxis instanceof FieldAxis) { // both are fieldAxis Log.errorln("Dont know how to merge field Axis data. Aborting."); System.exit(-1); } else { // mixed class Axes?? (e.g. a fieldAxis id matches Axis id??!? Error!!) Log.errorln("Dont know how to merge data. Aborting."); System.exit(-1); } } // 3. Append data from one array to the other appropriately Locator origLocator = arrayToAppendTo.createLocator(); Locator addLocator = arrayToAdd.createLocator(); while (addLocator.hasNext()) { try { // retrieve the data Object data = arrayToAdd.getData(addLocator); // set up the origLocator List locatorAxisList = addLocator.getIterationOrder(); Iterator iter5 = locatorAxisList.iterator(); while (iter5.hasNext()) { Axis addAxis = (Axis) iter5.next(); Value thisAxisValue = addLocator.getAxisValue(addAxis); Axis thisAxis = (Axis) correspondingOrigAxis.get(addAxis.getAxisId()); try { origLocator.setAxisIndexByAxisValue(thisAxis, thisAxisValue); Log.debug(origLocator.getAxisIndex(thisAxis)+","); } catch (AxisLocationOutOfBoundsException e) { Log.errorln("Weird axis out of bounds error for append array."); } } // add in the data as appropriate. Log.debugln(") => ["+data.toString()+"]"); try { if (data instanceof Double) arrayToAppendTo.setData(origLocator, (Double) data); else if (data instanceof Integer) arrayToAppendTo.setData(origLocator, (Integer) data); else if (data instanceof String ) arrayToAppendTo.setData(origLocator, (String) data); else Log.errorln("Dont understand this class of data !(Double|Integer|String). Ignoring append."); } catch (SetDataException e) { Log.errorln(e.getMessage()+". Ignoring append"); } } catch (NoDataException e) { // do nothing for NoDataValues?? Log.errorln(e.getMessage()); } addLocator.next(); // go to next location } } else Log.errorln("Cannot append to null array. Ignoring request."); return arrayToAppendTo; }
5,316
protected void fireActionPerformed() { ActionEvent event = new ActionEvent(this, 0, getText()); ActionListener[] listeners = getActionListeners(); for (int index = 0; index < listeners.length; ++index) listeners[index].actionPerformed(event); }
protected void fireActionPerformed() { ActionEvent event = new ActionEvent(this, 0, actionCommand == null ? getText() : actionCommand); ActionListener[] listeners = getActionListeners(); for (int index = 0; index < listeners.length; ++index) listeners[index].actionPerformed(event); }
5,317
public static void main(String[] args) throws NoSuchAliasException, NameNotFoundException { ParsedArguments cmdLine = HELP_INFO.parse(args); final Shell shell = ShellUtils.getShellManager().getCurrentShell(); final AliasManager aliasMgr = shell.getAliasManager(); if (cmdLine.size() == 0) { for (Iterator i = aliasMgr.aliasIterator(); i.hasNext();) { final String alias = (String) i.next(); System.out.println(alias + ":\t" + aliasMgr.getAliasClassName(alias)); } } else if (PARAM_REMOVE.isSet(cmdLine)) { // remove an alias aliasMgr.remove(ARG_ALIAS.getValue(cmdLine)); } else { // add an alias aliasMgr.add(ARG_ALIAS.getValue(cmdLine), ARG_CLASS.getValue(cmdLine)); } }
public static void main(String[] args) throws NoSuchAliasException, NameNotFoundException, SyntaxErrorException { ParsedArguments cmdLine = HELP_INFO.parse(args); final Shell shell = ShellUtils.getShellManager().getCurrentShell(); final AliasManager aliasMgr = shell.getAliasManager(); if (cmdLine.size() == 0) { for (Iterator i = aliasMgr.aliasIterator(); i.hasNext();) { final String alias = (String) i.next(); System.out.println(alias + ":\t" + aliasMgr.getAliasClassName(alias)); } } else if (PARAM_REMOVE.isSet(cmdLine)) { // remove an alias aliasMgr.remove(ARG_ALIAS.getValue(cmdLine)); } else { // add an alias aliasMgr.add(ARG_ALIAS.getValue(cmdLine), ARG_CLASS.getValue(cmdLine)); } }
5,319
private DeviceToDriverMapper newMapperInstance(Class cls, ConfigurationElement element) throws InstantiationException, IllegalAccessException { try { final Constructor c = cls.getConstructor(new Class[] { ConfigurationElement.class }); try { return (DeviceToDriverMapper)c.newInstance(new Object[] { element }); } catch (InvocationTargetException ex1) { throw new InstantiationException(ex1.getTargetException()); } } catch (NoSuchMethodException ex) { return (DeviceToDriverMapper) cls.newInstance(); } }
private DeviceToDriverMapper newMapperInstance(Class cls, ConfigurationElement element) throws InstantiationException, IllegalAccessException { try { final Constructor c = cls.getConstructor(new Class[] { ConfigurationElement.class }); try { return (DeviceToDriverMapper)c.newInstance(new Object[] { element }); } catch (InvocationTargetException ex1) { final InstantiationException ie = new InstantiationException(); ie.initCause(ex1.getTargetException()); throw ie; } } catch (NoSuchMethodException ex) { return (DeviceToDriverMapper) cls.newInstance(); } }
5,320
public float getPreferredSpan(int axis) { if (view != null) return view.getPreferredSpan(axis); return Integer.MAX_VALUE; }
public float getPreferredSpan(int axis) { float span = 10; if (view != null) return view.getPreferredSpan(axis); return Integer.MAX_VALUE; }
5,322
public float getPreferredSpan(int axis) { if (view != null) return view.getPreferredSpan(axis); return Integer.MAX_VALUE; }
public float getPreferredSpan(int axis) { if (view != null) return view.getPreferredSpan(axis); return Integer.MAX_VALUE; }
5,323
public void paint(Graphics g, Shape s) { if (view != null) { Rectangle b = s.getBounds(); view.setSize(b.width, b.height); view.paint(g, s); } }
public void paint(Graphics g, Shape s) { if (view != null) { Rectangle b = s.getBounds(); view.setSize(b.width, b.height); view.paint(g, s); } }
5,325
public void setSize(float w, float h) { if (view != null) view.setSize(w, h); }
public synchronized void setSize(float w, float h) { if (view != null) view.setSize(w, h); }
5,327
public Dimension getMaximumSize(JComponent c) { // Sun's implementation returns Integer.MAX_VALUE here, so do we. return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE); }
public Dimension getMaximumSize(JComponent c) { // Sun's implementation returns Integer.MAX_VALUE here, so do we. Dimension d = new Dimension(); Insets i = c.getInsets(); Document doc = textComponent.getDocument(); if (doc instanceof AbstractDocument) ((AbstractDocument) doc).readLock(); try { d.width = (int) Math.min((long) rootView.getMaximumSpan(View.X_AXIS) + i.left + i.right, Integer.MAX_VALUE); d.height = (int) Math.min((long) rootView.getMaximumSpan(View.Y_AXIS) + i.top + i.bottom, Integer.MAX_VALUE); } finally { if (doc instanceof AbstractDocument) ((AbstractDocument) doc).readUnlock(); } return d; }
5,329
public Dimension getMinimumSize(JComponent c) { Insets i = c.getInsets(); return new Dimension(i.left + i.right, i.top + i.bottom); }
public Dimension getMinimumSize(JComponent c) { Insets i = c.getInsets(); d.width += i.left + i.right; d.height += i.top + i.bottom; return d; }
5,330
public int getNextVisualPositionFrom(JTextComponent t, int pos, Position.Bias b, int direction, Position.Bias[] biasRet) throws BadLocationException { // A comment in the spec of NavigationFilter.getNextVisualPositionFrom() // suggests that this method should be implemented by forwarding the call // the root view. return rootView.getNextVisualPositionFrom(pos, b, getVisibleEditorRect(), direction, biasRet); }
public int getNextVisualPositionFrom(JTextComponent t, int pos, Position.Bias b, int direction, Position.Bias[] biasRet) throws BadLocationException { // A comment in the spec of NavigationFilter.getNextVisualPositionFrom() // suggests that this method should be implemented by forwarding the call // the root view. return rootView.getNextVisualPositionFrom(pos, b, getVisibleEditorRect(), direction, biasRet); }
5,331
public Dimension getPreferredSize(JComponent c) { Dimension d = c.getSize(); Insets i = c.getInsets(); if (d.width > (i.left + i.right) && d.height > (i.top + i.bottom)) { rootView.setSize(d.width - i.left - i.right, d.height - i.top - i.bottom); } float w = rootView.getPreferredSpan(View.X_AXIS); float h = rootView.getPreferredSpan(View.Y_AXIS); Dimension size = new Dimension((int) w + i.left + i.right, (int) h + i.top + i.bottom); return size; }
public Dimension getPreferredSize(JComponent c) { Dimension d = c.getSize(); Insets i = c.getInsets(); if (d.width > (i.left + i.right) && d.height > (i.top + i.bottom)) { rootView.setSize(d.width - i.left - i.right, d.height - i.top - i.bottom); } float w = rootView.getPreferredSpan(View.X_AXIS); float h = rootView.getPreferredSpan(View.Y_AXIS); Dimension size = new Dimension((int) w + i.left + i.right, (int) h + i.top + i.bottom); return size; }
5,333
protected Rectangle getVisibleEditorRect() { int width = textComponent.getWidth(); int height = textComponent.getHeight(); // Return null if the component has no valid size. if (width <= 0 || height <= 0) return null; Insets insets = textComponent.getInsets(); return new Rectangle(insets.left, insets.top, width - insets.left - insets.right, height - insets.top - insets.bottom); }
protected Rectangle getVisibleEditorRect() { int width = textComponent.getWidth(); int height = textComponent.getHeight(); // Return null if the component has no valid size. if (width <= 0 || height <= 0) return null; Insets insets = textComponent.getInsets(cachedInsets); return new Rectangle(insets.left, insets.top, width - insets.left - insets.right, height - insets.top - insets.bottom); }
5,334
protected void installDefaults() { String prefix = getPropertyPrefix(); // Install the standard properties. LookAndFeel.installColorsAndFont(textComponent, prefix + ".background", prefix + ".foreground", prefix + ".font"); LookAndFeel.installBorder(textComponent, prefix + ".border"); textComponent.setMargin(UIManager.getInsets(prefix + ".margin")); // Some additional text component only properties. Color color = textComponent.getCaretColor(); if (color == null || color instanceof UIResource) { color = UIManager.getColor(prefix + ".caretForeground"); textComponent.setCaretColor(color); } // Fetch the colors for enabled/disabled text components. color = textComponent.getDisabledTextColor(); if (color == null || color instanceof UIResource) { color = UIManager.getColor(prefix + ".inactiveBackground"); textComponent.setDisabledTextColor(color); } color = textComponent.getSelectedTextColor(); if (color == null || color instanceof UIResource) { color = UIManager.getColor(prefix + ".selectionForeground"); textComponent.setSelectedTextColor(color); } color = textComponent.getSelectionColor(); if (color == null || color instanceof UIResource) { color = UIManager.getColor(prefix + ".selectionBackground"); textComponent.setSelectionColor(color); } Insets margin = textComponent.getMargin(); if (margin == null || margin instanceof UIResource) { margin = UIManager.getInsets(prefix + ".margin"); textComponent.setMargin(margin); } Caret caret = textComponent.getCaret(); if (caret == null || caret instanceof UIResource) { caret = createCaret(); textComponent.setCaret(caret); caret.setBlinkRate(UIManager.getInt(prefix + ".caretBlinkRate")); } Highlighter highlighter = textComponent.getHighlighter(); if (highlighter == null || highlighter instanceof UIResource) textComponent.setHighlighter(createHighlighter()); }
protected void installDefaults() { String prefix = getPropertyPrefix(); // Install the standard properties. LookAndFeel.installColorsAndFont(textComponent, prefix + ".background", prefix + ".foreground", prefix + ".font"); LookAndFeel.installBorder(textComponent, prefix + ".border"); // Some additional text component only properties. Color color = textComponent.getCaretColor(); if (color == null || color instanceof UIResource) { color = UIManager.getColor(prefix + ".caretForeground"); textComponent.setCaretColor(color); } // Fetch the colors for enabled/disabled text components. color = textComponent.getDisabledTextColor(); if (color == null || color instanceof UIResource) { color = UIManager.getColor(prefix + ".inactiveBackground"); textComponent.setDisabledTextColor(color); } color = textComponent.getSelectedTextColor(); if (color == null || color instanceof UIResource) { color = UIManager.getColor(prefix + ".selectionForeground"); textComponent.setSelectedTextColor(color); } color = textComponent.getSelectionColor(); if (color == null || color instanceof UIResource) { color = UIManager.getColor(prefix + ".selectionBackground"); textComponent.setSelectionColor(color); } Insets margin = textComponent.getMargin(); if (margin == null || margin instanceof UIResource) { margin = UIManager.getInsets(prefix + ".margin"); textComponent.setMargin(margin); } Caret caret = textComponent.getCaret(); if (caret == null || caret instanceof UIResource) { caret = createCaret(); textComponent.setCaret(caret); caret.setBlinkRate(UIManager.getInt(prefix + ".caretBlinkRate")); } Highlighter highlighter = textComponent.getHighlighter(); if (highlighter == null || highlighter instanceof UIResource) textComponent.setHighlighter(createHighlighter()); }
5,335
protected void installDefaults() { String prefix = getPropertyPrefix(); // Install the standard properties. LookAndFeel.installColorsAndFont(textComponent, prefix + ".background", prefix + ".foreground", prefix + ".font"); LookAndFeel.installBorder(textComponent, prefix + ".border"); textComponent.setMargin(UIManager.getInsets(prefix + ".margin")); // Some additional text component only properties. Color color = textComponent.getCaretColor(); if (color == null || color instanceof UIResource) { color = UIManager.getColor(prefix + ".caretForeground"); textComponent.setCaretColor(color); } // Fetch the colors for enabled/disabled text components. color = textComponent.getDisabledTextColor(); if (color == null || color instanceof UIResource) { color = UIManager.getColor(prefix + ".inactiveBackground"); textComponent.setDisabledTextColor(color); } color = textComponent.getSelectedTextColor(); if (color == null || color instanceof UIResource) { color = UIManager.getColor(prefix + ".selectionForeground"); textComponent.setSelectedTextColor(color); } color = textComponent.getSelectionColor(); if (color == null || color instanceof UIResource) { color = UIManager.getColor(prefix + ".selectionBackground"); textComponent.setSelectionColor(color); } Insets margin = textComponent.getMargin(); if (margin == null || margin instanceof UIResource) { margin = UIManager.getInsets(prefix + ".margin"); textComponent.setMargin(margin); } Caret caret = textComponent.getCaret(); if (caret == null || caret instanceof UIResource) { caret = createCaret(); textComponent.setCaret(caret); caret.setBlinkRate(UIManager.getInt(prefix + ".caretBlinkRate")); } Highlighter highlighter = textComponent.getHighlighter(); if (highlighter == null || highlighter instanceof UIResource) textComponent.setHighlighter(createHighlighter()); }
protected void installDefaults() { String prefix = getPropertyPrefix(); // Install the standard properties. LookAndFeel.installColorsAndFont(textComponent, prefix + ".background", prefix + ".foreground", prefix + ".font"); LookAndFeel.installBorder(textComponent, prefix + ".border"); textComponent.setMargin(UIManager.getInsets(prefix + ".margin")); // Some additional text component only properties. Color color = textComponent.getCaretColor(); if (color == null || color instanceof UIResource) { color = UIManager.getColor(prefix + ".caretForeground"); textComponent.setCaretColor(color); } // Fetch the colors for enabled/disabled text components. color = textComponent.getDisabledTextColor(); if (color == null || color instanceof UIResource) { color = UIManager.getColor(prefix + ".inactiveForeground"); textComponent.setDisabledTextColor(color); } color = textComponent.getSelectedTextColor(); if (color == null || color instanceof UIResource) { color = UIManager.getColor(prefix + ".selectionForeground"); textComponent.setSelectedTextColor(color); } color = textComponent.getSelectionColor(); if (color == null || color instanceof UIResource) { color = UIManager.getColor(prefix + ".selectionBackground"); textComponent.setSelectionColor(color); } Insets margin = textComponent.getMargin(); if (margin == null || margin instanceof UIResource) { margin = UIManager.getInsets(prefix + ".margin"); textComponent.setMargin(margin); } Caret caret = textComponent.getCaret(); if (caret == null || caret instanceof UIResource) { caret = createCaret(); textComponent.setCaret(caret); caret.setBlinkRate(UIManager.getInt(prefix + ".caretBlinkRate")); } Highlighter highlighter = textComponent.getHighlighter(); if (highlighter == null || highlighter instanceof UIResource) textComponent.setHighlighter(createHighlighter()); }
5,336
protected void installDefaults() { String prefix = getPropertyPrefix(); // Install the standard properties. LookAndFeel.installColorsAndFont(textComponent, prefix + ".background", prefix + ".foreground", prefix + ".font"); LookAndFeel.installBorder(textComponent, prefix + ".border"); textComponent.setMargin(UIManager.getInsets(prefix + ".margin")); // Some additional text component only properties. Color color = textComponent.getCaretColor(); if (color == null || color instanceof UIResource) { color = UIManager.getColor(prefix + ".caretForeground"); textComponent.setCaretColor(color); } // Fetch the colors for enabled/disabled text components. color = textComponent.getDisabledTextColor(); if (color == null || color instanceof UIResource) { color = UIManager.getColor(prefix + ".inactiveBackground"); textComponent.setDisabledTextColor(color); } color = textComponent.getSelectedTextColor(); if (color == null || color instanceof UIResource) { color = UIManager.getColor(prefix + ".selectionForeground"); textComponent.setSelectedTextColor(color); } color = textComponent.getSelectionColor(); if (color == null || color instanceof UIResource) { color = UIManager.getColor(prefix + ".selectionBackground"); textComponent.setSelectionColor(color); } Insets margin = textComponent.getMargin(); if (margin == null || margin instanceof UIResource) { margin = UIManager.getInsets(prefix + ".margin"); textComponent.setMargin(margin); } Caret caret = textComponent.getCaret(); if (caret == null || caret instanceof UIResource) { caret = createCaret(); textComponent.setCaret(caret); caret.setBlinkRate(UIManager.getInt(prefix + ".caretBlinkRate")); } Highlighter highlighter = textComponent.getHighlighter(); if (highlighter == null || highlighter instanceof UIResource) textComponent.setHighlighter(createHighlighter()); }
protected void installDefaults() { String prefix = getPropertyPrefix(); // Install the standard properties. LookAndFeel.installColorsAndFont(textComponent, prefix + ".background", prefix + ".foreground", prefix + ".font"); LookAndFeel.installBorder(textComponent, prefix + ".border"); textComponent.setMargin(UIManager.getInsets(prefix + ".margin")); // Some additional text component only properties. Color color = textComponent.getCaretColor(); if (color == null || color instanceof UIResource) { color = UIManager.getColor(prefix + ".caretForeground"); textComponent.setCaretColor(color); } // Fetch the colors for enabled/disabled text components. color = textComponent.getDisabledTextColor(); if (color == null || color instanceof UIResource) { color = UIManager.getColor(prefix + ".inactiveBackground"); textComponent.setDisabledTextColor(color); } color = textComponent.getSelectedTextColor(); if (color == null || color instanceof UIResource) { color = UIManager.getColor(prefix + ".selectionForeground"); textComponent.setSelectedTextColor(color); } color = textComponent.getSelectionColor(); if (color == null || color instanceof UIResource) { color = UIManager.getColor(prefix + ".selectionBackground"); textComponent.setSelectionColor(color); } Insets margin = textComponent.getMargin(); if (margin == null || margin instanceof UIResource) { margin = UIManager.getInsets(prefix + ".margin"); textComponent.setMargin(margin); } Caret caret = textComponent.getCaret(); if (caret == null || caret instanceof UIResource) { caret = createCaret(); textComponent.setCaret(caret); caret.setBlinkRate(UIManager.getInt(prefix + ".caretBlinkRate")); } Highlighter highlighter = textComponent.getHighlighter(); if (highlighter == null || highlighter instanceof UIResource) textComponent.setHighlighter(createHighlighter()); }
5,337
protected void installListeners() { textComponent.addFocusListener(focuslistener); }
protected void installListeners() { if (SystemProperties.getProperty("gnu.swing.text.no-xlike-clipboard") == null) { if (focusListener == null) focusListener = new FocusHandler(); textComponent.addFocusListener(focusListener); } }
5,338
public void installUI(final JComponent c) { textComponent = (JTextComponent) c; installDefaults(); textComponent.addPropertyChangeListener(updateHandler); Document doc = textComponent.getDocument(); if (doc == null) { doc = getEditorKit(textComponent).createDefaultDocument(); textComponent.setDocument(doc); } else { doc.addDocumentListener(documentHandler); modelChanged(); } installListeners(); installKeyboardActions(); }
public void installUI(final JComponent c) { textComponent = (JTextComponent) c; installDefaults(); installFixedDefaults(); if (handler == null) handler = new Handler(); textComponent.addPropertyChangeListener(handler); Document doc = textComponent.getDocument(); if (doc == null) { doc = getEditorKit(textComponent).createDefaultDocument(); textComponent.setDocument(doc); } else { doc.addDocumentListener(documentHandler); modelChanged(); } installListeners(); installKeyboardActions(); }
5,339
public void installUI(final JComponent c) { textComponent = (JTextComponent) c; installDefaults(); textComponent.addPropertyChangeListener(updateHandler); Document doc = textComponent.getDocument(); if (doc == null) { doc = getEditorKit(textComponent).createDefaultDocument(); textComponent.setDocument(doc); } else { doc.addDocumentListener(documentHandler); modelChanged(); } installListeners(); installKeyboardActions(); }
public void installUI(final JComponent c) { textComponent = (JTextComponent) c; installDefaults(); textComponent.addPropertyChangeListener(updateHandler); Document doc = textComponent.getDocument(); if (doc == null) { doc = getEditorKit(textComponent).createDefaultDocument(); textComponent.setDocument(doc); } else { doc.addDocumentListener(handler); modelChanged(); } installListeners(); installKeyboardActions(); }
5,340
protected void uninstallListeners() { textComponent.removeFocusListener(focuslistener); textComponent.getDocument().removeDocumentListener(documentHandler); }
protected void uninstallListeners() { textComponent.removeFocusListener(focuslistener); textComponent.getDocument().removeDocumentListener(documentHandler); }
5,342
public void uninstallUI(final JComponent component) { super.uninstallUI(component); rootView.setView(null); uninstallDefaults(); uninstallListeners(); uninstallKeyboardActions(); textComponent = null; }
public void uninstallUI(final JComponent component) { textComponent.removePropertyChangeListener(handler); textComponent.getDocument().removeDocumentListener(handler); rootView.setView(null); uninstallDefaults(); uninstallListeners(); uninstallKeyboardActions(); textComponent = null; }
5,343
public void toXMLOutputStream (OutputStream outputstream, String indent) throws java.io.IOException { if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, indent); // indent node if desired // no need to have repeatable set to 'yes' would just waste space even if we used this functionality. writeOut(outputstream, "<valueList delimiter=\""+valueListDelimiter+"\" repeatable=\"no\""); if (valueListNoData != null) writeOut(outputstream, " noDataValue=\""+valueListNoData+"\""); if (valueListInfinite != null) writeOut(outputstream, " infiniteValue=\""+valueListInfinite+"\""); if (valueListInfiniteNegative != null) writeOut(outputstream, " infiniteNegaiveValue=\""+valueListInfiniteNegative+"\""); if (valueListNotANumber != null) writeOut(outputstream, " notANumberValue=\""+valueListNotANumber+"\""); if (valueListUnderflow != null) writeOut(outputstream, " underflowValue=\""+valueListUnderflow+"\""); if (valueListOverflow != null) writeOut(outputstream, " overflowValue=\""+valueListOverflow+"\""); writeOut(outputstream, ">"); Iterator iter = values.iterator(); while (iter.hasNext()) { Value thisValue = (Value) iter.next(); String specialValue = thisValue.getSpecial(); if(specialValue != null) { if(specialValue.equals(Constants.VALUE_SPECIAL_INFINITE)) { writeOut(outputstream, valueListInfinite); } else if(specialValue.equals(Constants.VALUE_SPECIAL_INFINITE_NEGATIVE)) { writeOut(outputstream, valueListInfiniteNegative); } else if(specialValue.equals(Constants.VALUE_SPECIAL_NODATA)) { writeOut(outputstream, valueListNoData); } else if(specialValue.equals(Constants.VALUE_SPECIAL_NOTANUMBER)) { writeOut(outputstream, valueListNotANumber); } else if(specialValue.equals(Constants.VALUE_SPECIAL_UNDERFLOW)) { writeOut(outputstream, valueListUnderflow); } else if(specialValue.equals(Constants.VALUE_SPECIAL_OVERFLOW)) { writeOut(outputstream, valueListOverflow); } else { Log.errorln("Error: valueList doesnt have "+specialValue+" defined but value does. Ignoring value."); } } else { writeOut(outputstream, thisValue.getValue()); } if (iter.hasNext()) writeOut(outputstream, valueListDelimiter); } writeOut(outputstream, "</valueList>"); if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, Constants.NEW_LINE); }
public void toXMLOutputStream (OutputStream outputstream, String indent) throws java.io.IOException { if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, indent); // indent node if desired // no need to have repeatable set to 'yes' would just waste space even if we used this functionality. writeOut(outputstream, "<valueList delimiter=\""+valueListDelimiter+"\" repeatable=\"no\""); if (valueListNoData != null) writeOut(outputstream, " noDataValue=\""+valueListNoData+"\""); if (valueListInfinite != null) writeOut(outputstream, " infiniteValue=\""+valueListInfinite+"\""); if (valueListInfiniteNegative != null) writeOut(outputstream, " infiniteNegaiveValue=\""+valueListInfiniteNegative+"\""); if (valueListNotANumber != null) writeOut(outputstream, " notANumberValue=\""+valueListNotANumber+"\""); if (valueListUnderflow != null) writeOut(outputstream, " underflowValue=\""+valueListUnderflow+"\""); if (valueListOverflow != null) writeOut(outputstream, " overflowValue=\""+valueListOverflow+"\""); writeOut(outputstream, ">"); Iterator iter = values.iterator(); while (iter.hasNext()) { Value thisValue = (Value) iter.next(); String specialValue = thisValue.getSpecial(); if(specialValue != null) { if(specialValue.equals(Constants.VALUE_SPECIAL_INFINITE)) { doValuePrint (outputstream, specialValue, valueListInfinite); } else if(specialValue.equals(Constants.VALUE_SPECIAL_INFINITE_NEGATIVE)) { writeOut(outputstream, valueListInfiniteNegative); } else if(specialValue.equals(Constants.VALUE_SPECIAL_NODATA)) { writeOut(outputstream, valueListNoData); } else if(specialValue.equals(Constants.VALUE_SPECIAL_NOTANUMBER)) { writeOut(outputstream, valueListNotANumber); } else if(specialValue.equals(Constants.VALUE_SPECIAL_UNDERFLOW)) { writeOut(outputstream, valueListUnderflow); } else if(specialValue.equals(Constants.VALUE_SPECIAL_OVERFLOW)) { writeOut(outputstream, valueListOverflow); } else { Log.errorln("Error: valueList doesnt have "+specialValue+" defined but value does. Ignoring value."); } } else { writeOut(outputstream, thisValue.getValue()); } if (iter.hasNext()) writeOut(outputstream, valueListDelimiter); } writeOut(outputstream, "</valueList>"); if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, Constants.NEW_LINE); }
5,345
public void toXMLOutputStream (OutputStream outputstream, String indent) throws java.io.IOException { if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, indent); // indent node if desired // no need to have repeatable set to 'yes' would just waste space even if we used this functionality. writeOut(outputstream, "<valueList delimiter=\""+valueListDelimiter+"\" repeatable=\"no\""); if (valueListNoData != null) writeOut(outputstream, " noDataValue=\""+valueListNoData+"\""); if (valueListInfinite != null) writeOut(outputstream, " infiniteValue=\""+valueListInfinite+"\""); if (valueListInfiniteNegative != null) writeOut(outputstream, " infiniteNegaiveValue=\""+valueListInfiniteNegative+"\""); if (valueListNotANumber != null) writeOut(outputstream, " notANumberValue=\""+valueListNotANumber+"\""); if (valueListUnderflow != null) writeOut(outputstream, " underflowValue=\""+valueListUnderflow+"\""); if (valueListOverflow != null) writeOut(outputstream, " overflowValue=\""+valueListOverflow+"\""); writeOut(outputstream, ">"); Iterator iter = values.iterator(); while (iter.hasNext()) { Value thisValue = (Value) iter.next(); String specialValue = thisValue.getSpecial(); if(specialValue != null) { if(specialValue.equals(Constants.VALUE_SPECIAL_INFINITE)) { writeOut(outputstream, valueListInfinite); } else if(specialValue.equals(Constants.VALUE_SPECIAL_INFINITE_NEGATIVE)) { writeOut(outputstream, valueListInfiniteNegative); } else if(specialValue.equals(Constants.VALUE_SPECIAL_NODATA)) { writeOut(outputstream, valueListNoData); } else if(specialValue.equals(Constants.VALUE_SPECIAL_NOTANUMBER)) { writeOut(outputstream, valueListNotANumber); } else if(specialValue.equals(Constants.VALUE_SPECIAL_UNDERFLOW)) { writeOut(outputstream, valueListUnderflow); } else if(specialValue.equals(Constants.VALUE_SPECIAL_OVERFLOW)) { writeOut(outputstream, valueListOverflow); } else { Log.errorln("Error: valueList doesnt have "+specialValue+" defined but value does. Ignoring value."); } } else { writeOut(outputstream, thisValue.getValue()); } if (iter.hasNext()) writeOut(outputstream, valueListDelimiter); } writeOut(outputstream, "</valueList>"); if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, Constants.NEW_LINE); }
public void toXMLOutputStream (OutputStream outputstream, String indent) throws java.io.IOException { if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, indent); // indent node if desired // no need to have repeatable set to 'yes' would just waste space even if we used this functionality. writeOut(outputstream, "<valueList delimiter=\""+valueListDelimiter+"\" repeatable=\"no\""); if (valueListNoData != null) writeOut(outputstream, " noDataValue=\""+valueListNoData+"\""); if (valueListInfinite != null) writeOut(outputstream, " infiniteValue=\""+valueListInfinite+"\""); if (valueListInfiniteNegative != null) writeOut(outputstream, " infiniteNegaiveValue=\""+valueListInfiniteNegative+"\""); if (valueListNotANumber != null) writeOut(outputstream, " notANumberValue=\""+valueListNotANumber+"\""); if (valueListUnderflow != null) writeOut(outputstream, " underflowValue=\""+valueListUnderflow+"\""); if (valueListOverflow != null) writeOut(outputstream, " overflowValue=\""+valueListOverflow+"\""); writeOut(outputstream, ">"); Iterator iter = values.iterator(); while (iter.hasNext()) { Value thisValue = (Value) iter.next(); String specialValue = thisValue.getSpecial(); if(specialValue != null) { if(specialValue.equals(Constants.VALUE_SPECIAL_INFINITE)) { writeOut(outputstream, valueListInfinite); } else if(specialValue.equals(Constants.VALUE_SPECIAL_INFINITE_NEGATIVE)) { doValuePrint (outputstream, specialValue, valueListInfiniteNegative); } else if(specialValue.equals(Constants.VALUE_SPECIAL_NODATA)) { writeOut(outputstream, valueListNoData); } else if(specialValue.equals(Constants.VALUE_SPECIAL_NOTANUMBER)) { writeOut(outputstream, valueListNotANumber); } else if(specialValue.equals(Constants.VALUE_SPECIAL_UNDERFLOW)) { writeOut(outputstream, valueListUnderflow); } else if(specialValue.equals(Constants.VALUE_SPECIAL_OVERFLOW)) { writeOut(outputstream, valueListOverflow); } else { Log.errorln("Error: valueList doesnt have "+specialValue+" defined but value does. Ignoring value."); } } else { writeOut(outputstream, thisValue.getValue()); } if (iter.hasNext()) writeOut(outputstream, valueListDelimiter); } writeOut(outputstream, "</valueList>"); if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, Constants.NEW_LINE); }
5,346
public void toXMLOutputStream (OutputStream outputstream, String indent) throws java.io.IOException { if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, indent); // indent node if desired // no need to have repeatable set to 'yes' would just waste space even if we used this functionality. writeOut(outputstream, "<valueList delimiter=\""+valueListDelimiter+"\" repeatable=\"no\""); if (valueListNoData != null) writeOut(outputstream, " noDataValue=\""+valueListNoData+"\""); if (valueListInfinite != null) writeOut(outputstream, " infiniteValue=\""+valueListInfinite+"\""); if (valueListInfiniteNegative != null) writeOut(outputstream, " infiniteNegaiveValue=\""+valueListInfiniteNegative+"\""); if (valueListNotANumber != null) writeOut(outputstream, " notANumberValue=\""+valueListNotANumber+"\""); if (valueListUnderflow != null) writeOut(outputstream, " underflowValue=\""+valueListUnderflow+"\""); if (valueListOverflow != null) writeOut(outputstream, " overflowValue=\""+valueListOverflow+"\""); writeOut(outputstream, ">"); Iterator iter = values.iterator(); while (iter.hasNext()) { Value thisValue = (Value) iter.next(); String specialValue = thisValue.getSpecial(); if(specialValue != null) { if(specialValue.equals(Constants.VALUE_SPECIAL_INFINITE)) { writeOut(outputstream, valueListInfinite); } else if(specialValue.equals(Constants.VALUE_SPECIAL_INFINITE_NEGATIVE)) { writeOut(outputstream, valueListInfiniteNegative); } else if(specialValue.equals(Constants.VALUE_SPECIAL_NODATA)) { writeOut(outputstream, valueListNoData); } else if(specialValue.equals(Constants.VALUE_SPECIAL_NOTANUMBER)) { writeOut(outputstream, valueListNotANumber); } else if(specialValue.equals(Constants.VALUE_SPECIAL_UNDERFLOW)) { writeOut(outputstream, valueListUnderflow); } else if(specialValue.equals(Constants.VALUE_SPECIAL_OVERFLOW)) { writeOut(outputstream, valueListOverflow); } else { Log.errorln("Error: valueList doesnt have "+specialValue+" defined but value does. Ignoring value."); } } else { writeOut(outputstream, thisValue.getValue()); } if (iter.hasNext()) writeOut(outputstream, valueListDelimiter); } writeOut(outputstream, "</valueList>"); if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, Constants.NEW_LINE); }
public void toXMLOutputStream (OutputStream outputstream, String indent) throws java.io.IOException { if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, indent); // indent node if desired // no need to have repeatable set to 'yes' would just waste space even if we used this functionality. writeOut(outputstream, "<valueList delimiter=\""+valueListDelimiter+"\" repeatable=\"no\""); if (valueListNoData != null) writeOut(outputstream, " noDataValue=\""+valueListNoData+"\""); if (valueListInfinite != null) writeOut(outputstream, " infiniteValue=\""+valueListInfinite+"\""); if (valueListInfiniteNegative != null) writeOut(outputstream, " infiniteNegaiveValue=\""+valueListInfiniteNegative+"\""); if (valueListNotANumber != null) writeOut(outputstream, " notANumberValue=\""+valueListNotANumber+"\""); if (valueListUnderflow != null) writeOut(outputstream, " underflowValue=\""+valueListUnderflow+"\""); if (valueListOverflow != null) writeOut(outputstream, " overflowValue=\""+valueListOverflow+"\""); writeOut(outputstream, ">"); Iterator iter = values.iterator(); while (iter.hasNext()) { Value thisValue = (Value) iter.next(); String specialValue = thisValue.getSpecial(); if(specialValue != null) { if(specialValue.equals(Constants.VALUE_SPECIAL_INFINITE)) { writeOut(outputstream, valueListInfinite); } else if(specialValue.equals(Constants.VALUE_SPECIAL_INFINITE_NEGATIVE)) { writeOut(outputstream, valueListInfiniteNegative); } else if(specialValue.equals(Constants.VALUE_SPECIAL_NODATA)) { doValuePrint (outputstream, specialValue, valueListNoData); } else if(specialValue.equals(Constants.VALUE_SPECIAL_NOTANUMBER)) { writeOut(outputstream, valueListNotANumber); } else if(specialValue.equals(Constants.VALUE_SPECIAL_UNDERFLOW)) { writeOut(outputstream, valueListUnderflow); } else if(specialValue.equals(Constants.VALUE_SPECIAL_OVERFLOW)) { writeOut(outputstream, valueListOverflow); } else { Log.errorln("Error: valueList doesnt have "+specialValue+" defined but value does. Ignoring value."); } } else { writeOut(outputstream, thisValue.getValue()); } if (iter.hasNext()) writeOut(outputstream, valueListDelimiter); } writeOut(outputstream, "</valueList>"); if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, Constants.NEW_LINE); }
5,347
public void toXMLOutputStream (OutputStream outputstream, String indent) throws java.io.IOException { if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, indent); // indent node if desired // no need to have repeatable set to 'yes' would just waste space even if we used this functionality. writeOut(outputstream, "<valueList delimiter=\""+valueListDelimiter+"\" repeatable=\"no\""); if (valueListNoData != null) writeOut(outputstream, " noDataValue=\""+valueListNoData+"\""); if (valueListInfinite != null) writeOut(outputstream, " infiniteValue=\""+valueListInfinite+"\""); if (valueListInfiniteNegative != null) writeOut(outputstream, " infiniteNegaiveValue=\""+valueListInfiniteNegative+"\""); if (valueListNotANumber != null) writeOut(outputstream, " notANumberValue=\""+valueListNotANumber+"\""); if (valueListUnderflow != null) writeOut(outputstream, " underflowValue=\""+valueListUnderflow+"\""); if (valueListOverflow != null) writeOut(outputstream, " overflowValue=\""+valueListOverflow+"\""); writeOut(outputstream, ">"); Iterator iter = values.iterator(); while (iter.hasNext()) { Value thisValue = (Value) iter.next(); String specialValue = thisValue.getSpecial(); if(specialValue != null) { if(specialValue.equals(Constants.VALUE_SPECIAL_INFINITE)) { writeOut(outputstream, valueListInfinite); } else if(specialValue.equals(Constants.VALUE_SPECIAL_INFINITE_NEGATIVE)) { writeOut(outputstream, valueListInfiniteNegative); } else if(specialValue.equals(Constants.VALUE_SPECIAL_NODATA)) { writeOut(outputstream, valueListNoData); } else if(specialValue.equals(Constants.VALUE_SPECIAL_NOTANUMBER)) { writeOut(outputstream, valueListNotANumber); } else if(specialValue.equals(Constants.VALUE_SPECIAL_UNDERFLOW)) { writeOut(outputstream, valueListUnderflow); } else if(specialValue.equals(Constants.VALUE_SPECIAL_OVERFLOW)) { writeOut(outputstream, valueListOverflow); } else { Log.errorln("Error: valueList doesnt have "+specialValue+" defined but value does. Ignoring value."); } } else { writeOut(outputstream, thisValue.getValue()); } if (iter.hasNext()) writeOut(outputstream, valueListDelimiter); } writeOut(outputstream, "</valueList>"); if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, Constants.NEW_LINE); }
public void toXMLOutputStream (OutputStream outputstream, String indent) throws java.io.IOException { if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, indent); // indent node if desired // no need to have repeatable set to 'yes' would just waste space even if we used this functionality. writeOut(outputstream, "<valueList delimiter=\""+valueListDelimiter+"\" repeatable=\"no\""); if (valueListNoData != null) writeOut(outputstream, " noDataValue=\""+valueListNoData+"\""); if (valueListInfinite != null) writeOut(outputstream, " infiniteValue=\""+valueListInfinite+"\""); if (valueListInfiniteNegative != null) writeOut(outputstream, " infiniteNegaiveValue=\""+valueListInfiniteNegative+"\""); if (valueListNotANumber != null) writeOut(outputstream, " notANumberValue=\""+valueListNotANumber+"\""); if (valueListUnderflow != null) writeOut(outputstream, " underflowValue=\""+valueListUnderflow+"\""); if (valueListOverflow != null) writeOut(outputstream, " overflowValue=\""+valueListOverflow+"\""); writeOut(outputstream, ">"); Iterator iter = values.iterator(); while (iter.hasNext()) { Value thisValue = (Value) iter.next(); String specialValue = thisValue.getSpecial(); if(specialValue != null) { if(specialValue.equals(Constants.VALUE_SPECIAL_INFINITE)) { writeOut(outputstream, valueListInfinite); } else if(specialValue.equals(Constants.VALUE_SPECIAL_INFINITE_NEGATIVE)) { writeOut(outputstream, valueListInfiniteNegative); } else if(specialValue.equals(Constants.VALUE_SPECIAL_NODATA)) { writeOut(outputstream, valueListNoData); } else if(specialValue.equals(Constants.VALUE_SPECIAL_NOTANUMBER)) { doValuePrint (outputstream, specialValue, valueListNotANumber); } else if(specialValue.equals(Constants.VALUE_SPECIAL_UNDERFLOW)) { writeOut(outputstream, valueListUnderflow); } else if(specialValue.equals(Constants.VALUE_SPECIAL_OVERFLOW)) { writeOut(outputstream, valueListOverflow); } else { Log.errorln("Error: valueList doesnt have "+specialValue+" defined but value does. Ignoring value."); } } else { writeOut(outputstream, thisValue.getValue()); } if (iter.hasNext()) writeOut(outputstream, valueListDelimiter); } writeOut(outputstream, "</valueList>"); if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, Constants.NEW_LINE); }
5,348
public void toXMLOutputStream (OutputStream outputstream, String indent) throws java.io.IOException { if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, indent); // indent node if desired // no need to have repeatable set to 'yes' would just waste space even if we used this functionality. writeOut(outputstream, "<valueList delimiter=\""+valueListDelimiter+"\" repeatable=\"no\""); if (valueListNoData != null) writeOut(outputstream, " noDataValue=\""+valueListNoData+"\""); if (valueListInfinite != null) writeOut(outputstream, " infiniteValue=\""+valueListInfinite+"\""); if (valueListInfiniteNegative != null) writeOut(outputstream, " infiniteNegaiveValue=\""+valueListInfiniteNegative+"\""); if (valueListNotANumber != null) writeOut(outputstream, " notANumberValue=\""+valueListNotANumber+"\""); if (valueListUnderflow != null) writeOut(outputstream, " underflowValue=\""+valueListUnderflow+"\""); if (valueListOverflow != null) writeOut(outputstream, " overflowValue=\""+valueListOverflow+"\""); writeOut(outputstream, ">"); Iterator iter = values.iterator(); while (iter.hasNext()) { Value thisValue = (Value) iter.next(); String specialValue = thisValue.getSpecial(); if(specialValue != null) { if(specialValue.equals(Constants.VALUE_SPECIAL_INFINITE)) { writeOut(outputstream, valueListInfinite); } else if(specialValue.equals(Constants.VALUE_SPECIAL_INFINITE_NEGATIVE)) { writeOut(outputstream, valueListInfiniteNegative); } else if(specialValue.equals(Constants.VALUE_SPECIAL_NODATA)) { writeOut(outputstream, valueListNoData); } else if(specialValue.equals(Constants.VALUE_SPECIAL_NOTANUMBER)) { writeOut(outputstream, valueListNotANumber); } else if(specialValue.equals(Constants.VALUE_SPECIAL_UNDERFLOW)) { writeOut(outputstream, valueListUnderflow); } else if(specialValue.equals(Constants.VALUE_SPECIAL_OVERFLOW)) { writeOut(outputstream, valueListOverflow); } else { Log.errorln("Error: valueList doesnt have "+specialValue+" defined but value does. Ignoring value."); } } else { writeOut(outputstream, thisValue.getValue()); } if (iter.hasNext()) writeOut(outputstream, valueListDelimiter); } writeOut(outputstream, "</valueList>"); if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, Constants.NEW_LINE); }
public void toXMLOutputStream (OutputStream outputstream, String indent) throws java.io.IOException { if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, indent); // indent node if desired // no need to have repeatable set to 'yes' would just waste space even if we used this functionality. writeOut(outputstream, "<valueList delimiter=\""+valueListDelimiter+"\" repeatable=\"no\""); if (valueListNoData != null) writeOut(outputstream, " noDataValue=\""+valueListNoData+"\""); if (valueListInfinite != null) writeOut(outputstream, " infiniteValue=\""+valueListInfinite+"\""); if (valueListInfiniteNegative != null) writeOut(outputstream, " infiniteNegaiveValue=\""+valueListInfiniteNegative+"\""); if (valueListNotANumber != null) writeOut(outputstream, " notANumberValue=\""+valueListNotANumber+"\""); if (valueListUnderflow != null) writeOut(outputstream, " underflowValue=\""+valueListUnderflow+"\""); if (valueListOverflow != null) writeOut(outputstream, " overflowValue=\""+valueListOverflow+"\""); writeOut(outputstream, ">"); Iterator iter = values.iterator(); while (iter.hasNext()) { Value thisValue = (Value) iter.next(); String specialValue = thisValue.getSpecial(); if(specialValue != null) { if(specialValue.equals(Constants.VALUE_SPECIAL_INFINITE)) { writeOut(outputstream, valueListInfinite); } else if(specialValue.equals(Constants.VALUE_SPECIAL_INFINITE_NEGATIVE)) { writeOut(outputstream, valueListInfiniteNegative); } else if(specialValue.equals(Constants.VALUE_SPECIAL_NODATA)) { writeOut(outputstream, valueListNoData); } else if(specialValue.equals(Constants.VALUE_SPECIAL_NOTANUMBER)) { writeOut(outputstream, valueListNotANumber); } else if(specialValue.equals(Constants.VALUE_SPECIAL_UNDERFLOW)) { doValuePrint (outputstream, specialValue, valueListUnderflow); } else if(specialValue.equals(Constants.VALUE_SPECIAL_OVERFLOW)) { writeOut(outputstream, valueListOverflow); } else { Log.errorln("Error: valueList doesnt have "+specialValue+" defined but value does. Ignoring value."); } } else { writeOut(outputstream, thisValue.getValue()); } if (iter.hasNext()) writeOut(outputstream, valueListDelimiter); } writeOut(outputstream, "</valueList>"); if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, Constants.NEW_LINE); }
5,349
public void toXMLOutputStream (OutputStream outputstream, String indent) throws java.io.IOException { if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, indent); // indent node if desired // no need to have repeatable set to 'yes' would just waste space even if we used this functionality. writeOut(outputstream, "<valueList delimiter=\""+valueListDelimiter+"\" repeatable=\"no\""); if (valueListNoData != null) writeOut(outputstream, " noDataValue=\""+valueListNoData+"\""); if (valueListInfinite != null) writeOut(outputstream, " infiniteValue=\""+valueListInfinite+"\""); if (valueListInfiniteNegative != null) writeOut(outputstream, " infiniteNegaiveValue=\""+valueListInfiniteNegative+"\""); if (valueListNotANumber != null) writeOut(outputstream, " notANumberValue=\""+valueListNotANumber+"\""); if (valueListUnderflow != null) writeOut(outputstream, " underflowValue=\""+valueListUnderflow+"\""); if (valueListOverflow != null) writeOut(outputstream, " overflowValue=\""+valueListOverflow+"\""); writeOut(outputstream, ">"); Iterator iter = values.iterator(); while (iter.hasNext()) { Value thisValue = (Value) iter.next(); String specialValue = thisValue.getSpecial(); if(specialValue != null) { if(specialValue.equals(Constants.VALUE_SPECIAL_INFINITE)) { writeOut(outputstream, valueListInfinite); } else if(specialValue.equals(Constants.VALUE_SPECIAL_INFINITE_NEGATIVE)) { writeOut(outputstream, valueListInfiniteNegative); } else if(specialValue.equals(Constants.VALUE_SPECIAL_NODATA)) { writeOut(outputstream, valueListNoData); } else if(specialValue.equals(Constants.VALUE_SPECIAL_NOTANUMBER)) { writeOut(outputstream, valueListNotANumber); } else if(specialValue.equals(Constants.VALUE_SPECIAL_UNDERFLOW)) { writeOut(outputstream, valueListUnderflow); } else if(specialValue.equals(Constants.VALUE_SPECIAL_OVERFLOW)) { writeOut(outputstream, valueListOverflow); } else { Log.errorln("Error: valueList doesnt have "+specialValue+" defined but value does. Ignoring value."); } } else { writeOut(outputstream, thisValue.getValue()); } if (iter.hasNext()) writeOut(outputstream, valueListDelimiter); } writeOut(outputstream, "</valueList>"); if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, Constants.NEW_LINE); }
public void toXMLOutputStream (OutputStream outputstream, String indent) throws java.io.IOException { if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, indent); // indent node if desired // no need to have repeatable set to 'yes' would just waste space even if we used this functionality. writeOut(outputstream, "<valueList delimiter=\""+valueListDelimiter+"\" repeatable=\"no\""); if (valueListNoData != null) writeOut(outputstream, " noDataValue=\""+valueListNoData+"\""); if (valueListInfinite != null) writeOut(outputstream, " infiniteValue=\""+valueListInfinite+"\""); if (valueListInfiniteNegative != null) writeOut(outputstream, " infiniteNegaiveValue=\""+valueListInfiniteNegative+"\""); if (valueListNotANumber != null) writeOut(outputstream, " notANumberValue=\""+valueListNotANumber+"\""); if (valueListUnderflow != null) writeOut(outputstream, " underflowValue=\""+valueListUnderflow+"\""); if (valueListOverflow != null) writeOut(outputstream, " overflowValue=\""+valueListOverflow+"\""); writeOut(outputstream, ">"); Iterator iter = values.iterator(); while (iter.hasNext()) { Value thisValue = (Value) iter.next(); String specialValue = thisValue.getSpecial(); if(specialValue != null) { if(specialValue.equals(Constants.VALUE_SPECIAL_INFINITE)) { writeOut(outputstream, valueListInfinite); } else if(specialValue.equals(Constants.VALUE_SPECIAL_INFINITE_NEGATIVE)) { writeOut(outputstream, valueListInfiniteNegative); } else if(specialValue.equals(Constants.VALUE_SPECIAL_NODATA)) { writeOut(outputstream, valueListNoData); } else if(specialValue.equals(Constants.VALUE_SPECIAL_NOTANUMBER)) { writeOut(outputstream, valueListNotANumber); } else if(specialValue.equals(Constants.VALUE_SPECIAL_UNDERFLOW)) { writeOut(outputstream, valueListUnderflow); } else if(specialValue.equals(Constants.VALUE_SPECIAL_OVERFLOW)) { writeOut(outputstream, valueListOverflow); } else { Log.errorln("Error: valueList doesnt have "+specialValue+" defined but value does. Ignoring value."); } } else { writeOut(outputstream, thisValue.getValue()); } if (iter.hasNext()) writeOut(outputstream, valueListDelimiter); } writeOut(outputstream, "</valueList>"); if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, Constants.NEW_LINE); }
5,350
public boolean match(Certificate certificate) { if (!(certificate instanceof X509Certificate)) return false; X509Certificate cert = (X509Certificate) certificate; if (this.cert != null) { try { byte[] e1 = this.cert.getEncoded(); byte[] e2 = cert.getEncoded(); if (!Arrays.equals(e1, e2)) return false; } catch (CertificateEncodingException cee) { return false; } } if (serialNo != null) { if (!serialNo.equals(cert.getSerialNumber())) return false; } if (certValid != null) { try { cert.checkValidity(certValid); } catch (CertificateException ce) { return false; } } if (issuer != null) { if (!issuer.equals(cert.getIssuerX500Principal())) return false; } if (subject != null) { if (!subject.equals(cert.getSubjectX500Principal())) return false; } if (sigId != null) { if (!sigId.equals(cert.getSigAlgOID())) return false; } if (subjectKeyId != null) { byte[] b = cert.getExtensionValue(SUBJECT_KEY_ID); if (!Arrays.equals(b, subjectKeyId)) return false; } if (authKeyId != null) { byte[] b = cert.getExtensionValue(AUTH_KEY_ID); if (!Arrays.equals(b, authKeyId)) return false; } if (keyUsage != null) { boolean[] b = cert.getKeyUsage(); if (!Arrays.equals(b, keyUsage)) return false; } if (basicConstraints >= 0) { if (cert.getBasicConstraints() != basicConstraints) return false; } if (keyPurposeSet != null) { List kp = null; try { kp = cert.getExtendedKeyUsage(); } catch (CertificateParsingException cpe) { return false; } if (kp == null) return false; for (Iterator it = keyPurposeSet.iterator(); it.hasNext(); ) { if (!kp.contains(it.next())) return false; } } if (altNames != null) { Collection an = null; try { an = cert.getSubjectAlternativeNames(); } catch (CertificateParsingException cpe) { return false; } if (an == null) return false; int match = 0; for (Iterator it = altNames.iterator(); it.hasNext(); ) { List l = (List) it.next(); Integer id = (Integer) l.get(0); String s = null; byte[] b = null; if (l.get(1) instanceof String) s = (String) l.get(1); else if (l.get(1) instanceof byte[]) b = (byte[]) l.get(1); else return false; for (Iterator it2 = an.iterator(); it2.hasNext(); ) { Object o = it2.next(); if (!(o instanceof List)) continue; List l2 = (List) o; if (l2.size() != 2) continue; if (!id.equals(l2.get(0))) continue; if (s != null && (l2.get(1) instanceof String) && s.equals(l2.get(1))) match++; else if (b != null && (l2.get(1) instanceof byte[]) && Arrays.equals(b, (byte[]) l2.get(1))) match++; } if (match == 0 || (matchAllNames && match != altNames.size())) return false; } } if (nameConstraints != null) { byte[] nc = cert.getExtensionValue(NAME_CONSTRAINTS_ID); if (!Arrays.equals(nameConstraints, nc)) return false; } // FIXME check policies. // FIXME check path-to-names. return true; }
public boolean match(Certificate certificate) { if (!(certificate instanceof X509Certificate)) return false; X509Certificate cert = (X509Certificate) certificate; if (this.cert != null) { try { byte[] e1 = this.cert.getEncoded(); byte[] e2 = cert.getEncoded(); if (!Arrays.equals(e1, e2)) return false; } catch (CertificateEncodingException cee) { return false; } } if (serialNo != null) { if (!serialNo.equals(cert.getSerialNumber())) return false; } if (certValid != null) { try { cert.checkValidity(certValid); } catch (CertificateException ce) { return false; } } if (issuer != null) { if (!issuer.equals(cert.getIssuerX500Principal())) return false; } if (subject != null) { if (!subject.equals(cert.getSubjectX500Principal())) return false; } if (sigId != null) { if (!sigId.toString().equals(cert.getSigAlgOID())) return false; } if (subjectKeyId != null) { byte[] b = cert.getExtensionValue(SUBJECT_KEY_ID); if (!Arrays.equals(b, subjectKeyId)) return false; } if (authKeyId != null) { byte[] b = cert.getExtensionValue(AUTH_KEY_ID); if (!Arrays.equals(b, authKeyId)) return false; } if (keyUsage != null) { boolean[] b = cert.getKeyUsage(); if (!Arrays.equals(b, keyUsage)) return false; } if (basicConstraints >= 0) { if (cert.getBasicConstraints() != basicConstraints) return false; } if (keyPurposeSet != null) { List kp = null; try { kp = cert.getExtendedKeyUsage(); } catch (CertificateParsingException cpe) { return false; } if (kp == null) return false; for (Iterator it = keyPurposeSet.iterator(); it.hasNext(); ) { if (!kp.contains(it.next())) return false; } } if (altNames != null) { Collection an = null; try { an = cert.getSubjectAlternativeNames(); } catch (CertificateParsingException cpe) { return false; } if (an == null) return false; int match = 0; for (Iterator it = altNames.iterator(); it.hasNext(); ) { List l = (List) it.next(); Integer id = (Integer) l.get(0); String s = null; byte[] b = null; if (l.get(1) instanceof String) s = (String) l.get(1); else if (l.get(1) instanceof byte[]) b = (byte[]) l.get(1); else return false; for (Iterator it2 = an.iterator(); it2.hasNext(); ) { Object o = it2.next(); if (!(o instanceof List)) continue; List l2 = (List) o; if (l2.size() != 2) continue; if (!id.equals(l2.get(0))) continue; if (s != null && (l2.get(1) instanceof String) && s.equals(l2.get(1))) match++; else if (b != null && (l2.get(1) instanceof byte[]) && Arrays.equals(b, (byte[]) l2.get(1))) match++; } if (match == 0 || (matchAllNames && match != altNames.size())) return false; } } if (nameConstraints != null) { byte[] nc = cert.getExtensionValue(NAME_CONSTRAINTS_ID); if (!Arrays.equals(nameConstraints, nc)) return false; } // FIXME check policies. // FIXME check path-to-names. return true; }
5,351
protected PropertyChangeListener createActionPropertyChangeListener(Action a) { return new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { Action act = (Action) (e.getSource()); if (e.getPropertyName().equals(AbstractAction.ENABLED_PROPERTY)) setEnabled(act.isEnabled()); else if (e.getPropertyName().equals(Action.NAME)) setText((String)(act.getValue(Action.NAME))); else if (e.getPropertyName().equals(Action.SMALL_ICON)) setIcon((Icon)(act.getValue(Action.SMALL_ICON))); else if (e.getPropertyName().equals(Action.SHORT_DESCRIPTION)) setToolTipText((String)(act.getValue(Action.SHORT_DESCRIPTION))); else if (e.getPropertyName().equals(Action.MNEMONIC_KEY)) if (act.getValue(Action.MNEMONIC_KEY) != null) setMnemonic(((Integer)(act.getValue(Action.MNEMONIC_KEY))).intValue()); else if (e.getPropertyName().equals(Action.ACTION_COMMAND_KEY)) setActionCommand((String)(act.getValue(Action.ACTION_COMMAND_KEY))); } }; }
protected PropertyChangeListener createActionPropertyChangeListener(Action a) { return new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { Action act = (Action) (e.getSource()); if (e.getPropertyName().equals("enabled")) setEnabled(act.isEnabled()); else if (e.getPropertyName().equals(Action.NAME)) setText((String)(act.getValue(Action.NAME))); else if (e.getPropertyName().equals(Action.SMALL_ICON)) setIcon((Icon)(act.getValue(Action.SMALL_ICON))); else if (e.getPropertyName().equals(Action.SHORT_DESCRIPTION)) setToolTipText((String)(act.getValue(Action.SHORT_DESCRIPTION))); else if (e.getPropertyName().equals(Action.MNEMONIC_KEY)) if (act.getValue(Action.MNEMONIC_KEY) != null) setMnemonic(((Integer)(act.getValue(Action.MNEMONIC_KEY))).intValue()); else if (e.getPropertyName().equals(Action.ACTION_COMMAND_KEY)) setActionCommand((String)(act.getValue(Action.ACTION_COMMAND_KEY))); } }; }
5,352
public void propertyChange(PropertyChangeEvent e) { Action act = (Action) (e.getSource()); if (e.getPropertyName().equals(AbstractAction.ENABLED_PROPERTY)) setEnabled(act.isEnabled()); else if (e.getPropertyName().equals(Action.NAME)) setText((String)(act.getValue(Action.NAME))); else if (e.getPropertyName().equals(Action.SMALL_ICON)) setIcon((Icon)(act.getValue(Action.SMALL_ICON))); else if (e.getPropertyName().equals(Action.SHORT_DESCRIPTION)) setToolTipText((String)(act.getValue(Action.SHORT_DESCRIPTION))); else if (e.getPropertyName().equals(Action.MNEMONIC_KEY)) if (act.getValue(Action.MNEMONIC_KEY) != null) setMnemonic(((Integer)(act.getValue(Action.MNEMONIC_KEY))).intValue()); else if (e.getPropertyName().equals(Action.ACTION_COMMAND_KEY)) setActionCommand((String)(act.getValue(Action.ACTION_COMMAND_KEY))); }
public void propertyChange(PropertyChangeEvent e) { Action act = (Action) (e.getSource()); if (e.getPropertyName().equals("enabled")) setEnabled(act.isEnabled()); else if (e.getPropertyName().equals(Action.NAME)) setText((String)(act.getValue(Action.NAME))); else if (e.getPropertyName().equals(Action.SMALL_ICON)) setIcon((Icon)(act.getValue(Action.SMALL_ICON))); else if (e.getPropertyName().equals(Action.SHORT_DESCRIPTION)) setToolTipText((String)(act.getValue(Action.SHORT_DESCRIPTION))); else if (e.getPropertyName().equals(Action.MNEMONIC_KEY)) if (act.getValue(Action.MNEMONIC_KEY) != null) setMnemonic(((Integer)(act.getValue(Action.MNEMONIC_KEY))).intValue()); else if (e.getPropertyName().equals(Action.ACTION_COMMAND_KEY)) setActionCommand((String)(act.getValue(Action.ACTION_COMMAND_KEY))); }
5,353
public void fireActionPerformed(ActionEvent e) { e.setSource(this); ActionListener[] listeners = getActionListeners(); for (int i = 0; i < listeners.length; i++) listeners[i].actionPerformed(e); }
protected void fireActionPerformed(ActionEvent e) { e.setSource(this); ActionListener[] listeners = getActionListeners(); for (int i = 0; i < listeners.length; i++) listeners[i].actionPerformed(e); }
5,354
public void fireItemStateChanged(ItemEvent e) { e.setSource(this); ItemListener[] listeners = getItemListeners(); for (int i = 0; i < listeners.length; i++) listeners[i].itemStateChanged(e); }
protected void fireItemStateChanged(ItemEvent e) { e.setSource(this); ItemListener[] listeners = getItemListeners(); for (int i = 0; i < listeners.length; i++) listeners[i].itemStateChanged(e); }
5,355
public void fireStateChanged() { ChangeListener[] listeners = getChangeListeners(); for (int i = 0; i < listeners.length; i++) listeners[i].stateChanged(changeEvent); }
protected void fireStateChanged() { ChangeListener[] listeners = getChangeListeners(); for (int i = 0; i < listeners.length; i++) listeners[i].stateChanged(changeEvent); }
5,356
protected String paramString() { return "AbstractButton"; }
protected String paramString() { StringBuffer sb = new StringBuffer(); sb.append(super.paramString()); sb.append(",defaultIcon="); if (getIcon() != null) sb.append(getIcon()); sb.append(",disabledIcon="); if (getDisabledIcon() != null) sb.append(getDisabledIcon()); sb.append(",disabledSelectedIcon="); if (getDisabledSelectedIcon() != null) sb.append(getDisabledSelectedIcon()); sb.append(",margin="); if (getMargin() != null) sb.append(getMargin()); sb.append(",paintBorder=").append(isBorderPainted()); sb.append(",paintFocus=").append(isFocusPainted()); sb.append(",pressedIcon="); if (getPressedIcon() != null) sb.append(getPressedIcon()); sb.append(",rolloverEnabled=").append(isRolloverEnabled()); sb.append(",rolloverIcon="); if (getRolloverIcon() != null) sb.append(getRolloverIcon()); sb.append(",rolloverSelected="); if (getRolloverSelectedIcon() != null) sb.append(getRolloverSelectedIcon()); sb.append(",selectedIcon="); if (getSelectedIcon() != null) sb.append(getSelectedIcon()); sb.append(",text="); if (getText() != null) sb.append(getText()); return sb.toString(); }
5,357
public void paint(GlyphView view, Graphics g, Shape a, int p0, int p1) { Color oldColor = g.getColor(); int height = (int) getHeight(view); Segment txt = view.getText(p0, p1); Rectangle bounds = a.getBounds(); TabExpander tabEx = null; View parent = view.getParent(); if (parent instanceof TabExpander) tabEx = (TabExpander) parent; int width = Utilities.getTabbedTextWidth(txt, g.getFontMetrics(), bounds.x, tabEx, txt.offset); // Fill the background of the text run. Color background = view.getBackground(); if (background != null) { g.setColor(background); g.fillRect(bounds.x, bounds.y, width, height); } // Draw the actual text. g.setColor(view.getForeground()); g.setFont(view.getFont()); int ascent = g.getFontMetrics().getAscent(); if (view.isSuperscript()) // TODO: Adjust font for superscripting. Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent - height / 2, g, tabEx, txt.offset); else if (view.isSubscript()) // TODO: Adjust font for subscripting. Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent + height / 2, g, tabEx, txt.offset); else Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent, g, tabEx, txt.offset); if (view.isStikeThrough()) { int strikeHeight = (int) (getAscent(view) / 2); g.drawLine(bounds.x, bounds.y + strikeHeight, bounds.height + width, bounds.y + strikeHeight); } if (view.isUnderline()) { int lineHeight = (int) getAscent(view); g.drawLine(bounds.x, bounds.y + lineHeight, bounds.height + width, bounds.y + lineHeight); } g.setColor(oldColor); }
public void paint(GlyphView view, Graphics g, Shape a, int p0, int p1) { Color oldColor = g.getColor(); int height = (int) getHeight(view); Segment txt = view.getText(p0, p1); Rectangle bounds = a.getBounds(); TabExpander tabEx = null; View parent = view.getParent(); if (parent instanceof TabExpander) tabEx = (TabExpander) parent; int width = Utilities.getTabbedTextWidth(txt, g.getFontMetrics(), bounds.x, tabEx, txt.offset); // Fill the background of the text run. Color background = view.getBackground(); if (background != null) { g.setColor(background); g.fillRect(bounds.x, bounds.y, width, height); } // Draw the actual text. g.setColor(view.getForeground()); g.setFont(view.getFont()); int ascent = g.getFontMetrics().getAscent(); if (view.isSuperscript()) // TODO: Adjust font for superscripting. Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent - height / 2, g, tabEx, txt.offset); else if (view.isSubscript()) // TODO: Adjust font for subscripting. Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent + height / 2, g, tabEx, txt.offset); else Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent, g, tabEx, txt.offset); if (view.isStrikeThrough()) { int strikeHeight = (int) (getAscent(view) / 2); g.drawLine(bounds.x, bounds.y + strikeHeight, bounds.height + width, bounds.y + strikeHeight); } if (view.isUnderline()) { int lineHeight = (int) getAscent(view); g.drawLine(bounds.x, bounds.y + lineHeight, bounds.height + width, bounds.y + lineHeight); } g.setColor(oldColor); }
5,359
public View breakView(int axis, int p0, float pos, float len) { if (axis == Y_AXIS) return this; checkPainter(); GlyphPainter painter = getGlyphPainter(); int breakLocation = painter.getBoundedPosition(this, p0, pos, len); // Try to find a suitable line break. BreakIterator lineBreaker = BreakIterator.getLineInstance(); Segment txt = new Segment(); try { getDocument().getText(getStartOffset(), getEndOffset(), txt); } catch (BadLocationException ex) { AssertionError err = new AssertionError("BadLocationException must not " + "be thrown here."); err.initCause(ex); throw err; } lineBreaker.setText(txt); int goodBreakLocation = lineBreaker.previous(); if (goodBreakLocation != BreakIterator.DONE) breakLocation = goodBreakLocation; View brokenView = createFragment(p0, breakLocation); return brokenView; }
public View breakView(int axis, int p0, float pos, float len) { if (axis == Y_AXIS) return this; checkPainter(); GlyphPainter painter = getGlyphPainter(); // Try to find a suitable line break. BreakIterator lineBreaker = BreakIterator.getLineInstance(); Segment txt = new Segment(); try { getDocument().getText(getStartOffset(), getEndOffset(), txt); } catch (BadLocationException ex) { AssertionError err = new AssertionError("BadLocationException must not " + "be thrown here."); err.initCause(ex); throw err; } lineBreaker.setText(txt); int goodBreakLocation = lineBreaker.previous(); if (goodBreakLocation != BreakIterator.DONE) breakLocation = goodBreakLocation; View brokenView = createFragment(p0, breakLocation); return brokenView; }
5,360
public View breakView(int axis, int p0, float pos, float len) { if (axis == Y_AXIS) return this; checkPainter(); GlyphPainter painter = getGlyphPainter(); int breakLocation = painter.getBoundedPosition(this, p0, pos, len); // Try to find a suitable line break. BreakIterator lineBreaker = BreakIterator.getLineInstance(); Segment txt = new Segment(); try { getDocument().getText(getStartOffset(), getEndOffset(), txt); } catch (BadLocationException ex) { AssertionError err = new AssertionError("BadLocationException must not " + "be thrown here."); err.initCause(ex); throw err; } lineBreaker.setText(txt); int goodBreakLocation = lineBreaker.previous(); if (goodBreakLocation != BreakIterator.DONE) breakLocation = goodBreakLocation; View brokenView = createFragment(p0, breakLocation); return brokenView; }
public View breakView(int axis, int p0, float pos, float len) { if (axis == Y_AXIS) return this; checkPainter(); GlyphPainter painter = getGlyphPainter(); int breakLocation = painter.getBoundedPosition(this, p0, pos, len); // Try to find a suitable line break. BreakIterator lineBreaker = BreakIterator.getLineInstance(); Segment txt = new Segment(); try { int start = getStartOffset(); int length = getEndOffset() - start; getDocument().getText(start, length, txt); } catch (BadLocationException ex) { AssertionError err = new AssertionError("BadLocationException must not " + "be thrown here."); err.initCause(ex); throw err; } lineBreaker.setText(txt); int goodBreakLocation = lineBreaker.previous(); if (goodBreakLocation != BreakIterator.DONE) breakLocation = goodBreakLocation; View brokenView = createFragment(p0, breakLocation); return brokenView; }
5,361
public View breakView(int axis, int p0, float pos, float len) { if (axis == Y_AXIS) return this; checkPainter(); GlyphPainter painter = getGlyphPainter(); int breakLocation = painter.getBoundedPosition(this, p0, pos, len); // Try to find a suitable line break. BreakIterator lineBreaker = BreakIterator.getLineInstance(); Segment txt = new Segment(); try { getDocument().getText(getStartOffset(), getEndOffset(), txt); } catch (BadLocationException ex) { AssertionError err = new AssertionError("BadLocationException must not " + "be thrown here."); err.initCause(ex); throw err; } lineBreaker.setText(txt); int goodBreakLocation = lineBreaker.previous(); if (goodBreakLocation != BreakIterator.DONE) breakLocation = goodBreakLocation; View brokenView = createFragment(p0, breakLocation); return brokenView; }
public View breakView(int axis, int p0, float pos, float len) { if (axis == Y_AXIS) return this; checkPainter(); GlyphPainter painter = getGlyphPainter(); int breakLocation = painter.getBoundedPosition(this, p0, pos, len); // Try to find a suitable line break. BreakIterator lineBreaker = BreakIterator.getLineInstance(); Segment txt = new Segment(); try { getDocument().getText(getStartOffset(), getEndOffset(), txt); } catch (BadLocationException ex) { AssertionError err = new AssertionError("BadLocationException must not " + "be thrown here."); err.initCause(ex); throw err; } lineBreaker.setText(txt); int goodBreakLocation = lineBreaker.previous(); if (goodBreakLocation != BreakIterator.DONE) breakLocation = goodBreakLocation; View brokenView = createFragment(p0, breakLocation); return brokenView; }
5,362
public void changedUpdate(DocumentEvent e, Shape a, ViewFactory vf) { getParent().preferenceChanged(this, true, true); }
public void changedUpdate(DocumentEvent e, Shape a, ViewFactory vf) { preferenceChanged(this, true, true); }
5,363
public void paint(Graphics g, Shape a) { Element el = getElement(); checkPainter(); getGlyphPainter().paint(this, g, a, el.getStartOffset(), el.getEndOffset()); }
public void paint(Graphics g, Shape a) { Element el = getElement(); checkPainter(); getGlyphPainter().paint(this, g, a, el.getStartOffset(), el.getEndOffset()); }
5,364
public void removeUpdate(DocumentEvent e, Shape a, ViewFactory vf) { getParent().preferenceChanged(this, true, false); }
public void removeUpdate(DocumentEvent e, Shape a, ViewFactory vf) { preferenceChanged(this, true, false); }
5,365
public void setDividerLocation(double proportionalLocation) { if (proportionalLocation > 1 || proportionalLocation < 0) throw new IllegalArgumentException ("proportion has to be between 0 and 1."); int max = (orientation == HORIZONTAL_SPLIT) ? getWidth() : getHeight(); setDividerLocation((int) (proportionalLocation * max)); }
public void setDividerLocation(double proportionalLocation) { if (proportionalLocation > 1 || proportionalLocation < 0) throw new IllegalArgumentException ("proportion has to be between 0 and 1."); int max = ((orientation == HORIZONTAL_SPLIT) ? getWidth() : getHeight()) - getDividerSize(); setDividerLocation((int) (proportionalLocation * max)); }
5,366
public MetalComboBoxEditor() { super(); editor = new JTextField(); editor.setBorder(new MetalComboBoxEditorBorder()); }
public MetalComboBoxEditor() { super(); editor.setBorder(new MetalComboBoxEditorBorder()); }
5,367
public void executeScript(Session session, String script) throws InterpreterDriver.InterpreterException { try { session.setMacroRunning(true); _interpreter.set("session",session); _interpreter.exec(script); session.setMacroRunning(false); } catch (PyException ex) { throw new InterpreterDriver.InterpreterException(ex); } }
public void executeScript(Session session, String script) throws InterpreterDriver.InterpreterException { try { session.setMacroRunning(true); _interpreter.set("_session",session); _interpreter.exec(script); session.setMacroRunning(false); } catch (PyException ex) { throw new InterpreterDriver.InterpreterException(ex); } }
5,368