bugged
stringlengths
6
599k
fixed
stringlengths
10
599k
__index_level_0__
int64
0
1.13M
private void buildMethodHash(Class cls, boolean build) { Method[] meths = cls.getMethods(); for (int i = 0; i < meths.length; i++) { /* Don't need to include any java.xxx related stuff */ if (meths[i].getDeclaringClass().getName().startsWith("java.")) { continue; } long hash = RMIHashes.getMethodHash(meths[i]); if(build) methods.put(new Long (hash), meths[i]); else methods.remove(new Long (hash));//System.out.println("meth = " + meths[i] + ", hash = " + hash); }}
private void buildMethodHash(Class cls, boolean build) { Method[] meths = cls.getMethods(); for (int i = 0; i < meths.length; i++) { /* Don't need to include any java.xxx related stuff */ if (meths[i].getDeclaringClass().getName().startsWith("java.")) { continue; long hash = RMIHashes.getMethodHash(meths[i]); if(build) methods.put(new Long (hash), meths[i]); else methods.remove(new Long (hash));//System.out.println("meth = " + meths[i] + ", hash = " + hash);
7,898
public RemoteStub exportObject(Remote obj) throws RemoteException { if (myself == null) { myself = obj; // Save it to server manager, to let client calls in the same VM to issue // local call manager.serverobj = obj; // Find and install the stub Class cls = obj.getClass(); Class expCls; try { // where ist the _Stub? (check superclasses also) expCls = findStubSkelClass(cls); } catch (Exception ex) { throw new RemoteException("can not find stubs for class: " + cls, ex); } stub = (RemoteStub)getHelperClass(expCls, "_Stub"); if (stub == null) { throw new RemoteException("failed to export: " + cls); } // Find and install the skeleton (if there is one) skel = (Skeleton)getHelperClass(expCls, "_Skel"); // Build hash of methods which may be called. buildMethodHash(obj.getClass(), true); // Export it. UnicastServer.exportObject(this); } return (stub);}
public RemoteStub exportObject(Remote obj) throws RemoteException { if (myself == null) { myself = obj; // Save it to server manager, to let client calls in the same VM to issue // local call manager.serverobj = obj; // Find and install the stub Class cls = obj.getClass(); Class expCls; try { // where ist the _Stub? (check superclasses also) expCls = findStubSkelClass(cls); } catch (Exception ex) { throw new RemoteException("can not find stubs for class: " + cls, ex); } stub = (RemoteStub)getHelperClass(expCls, "_Stub"); if (stub == null) { throw new RemoteException("failed to export: " + cls); } // Find and install the skeleton (if there is one) skel = (Skeleton)getHelperClass(expCls, "_Skel"); // Build hash of methods which may be called. buildMethodHash(obj.getClass(), true); // Export it. UnicastServer.exportObject(this); } return (stub);}
7,899
public RemoteStub exportObject(Remote obj) throws RemoteException { if (myself == null) { myself = obj; // Save it to server manager, to let client calls in the same VM to issue // local call manager.serverobj = obj; // Find and install the stub Class cls = obj.getClass(); Class expCls; try { // where ist the _Stub? (check superclasses also) expCls = findStubSkelClass(cls); } catch (Exception ex) { throw new RemoteException("can not find stubs for class: " + cls, ex); } stub = (RemoteStub)getHelperClass(expCls, "_Stub"); if (stub == null) { throw new RemoteException("failed to export: " + cls); } // Find and install the skeleton (if there is one) skel = (Skeleton)getHelperClass(expCls, "_Skel"); // Build hash of methods which may be called. buildMethodHash(obj.getClass(), true); // Export it. UnicastServer.exportObject(this); } return (stub);}
public RemoteStub exportObject(Remote obj) throws RemoteException { if (myself == null) { myself = obj; // Save it to server manager, to let client calls in the same VM to issue // local call manager.serverobj = obj; // Find and install the stub Class cls = obj.getClass(); Class expCls; try { // where ist the _Stub? (check superclasses also) expCls = findStubSkelClass(cls); } catch (Exception ex) { throw new RemoteException("can not find stubs for class: " + cls, ex); } stub = (RemoteStub)getHelperClass(expCls, "_Stub"); if (stub == null) { throw new RemoteException("failed to export: " + cls); } // Find and install the skeleton (if there is one) skel = (Skeleton)getHelperClass(expCls, "_Skel"); // Build hash of methods which may be called. buildMethodHash(obj.getClass(), true); // Export it. UnicastServer.exportObject(this); } return (stub);}
7,900
public RemoteStub exportObject(Remote obj) throws RemoteException { if (myself == null) { myself = obj; // Save it to server manager, to let client calls in the same VM to issue // local call manager.serverobj = obj; // Find and install the stub Class cls = obj.getClass(); Class expCls; try { // where ist the _Stub? (check superclasses also) expCls = findStubSkelClass(cls); } catch (Exception ex) { throw new RemoteException("can not find stubs for class: " + cls, ex); } stub = (RemoteStub)getHelperClass(expCls, "_Stub"); if (stub == null) { throw new RemoteException("failed to export: " + cls); } // Find and install the skeleton (if there is one) skel = (Skeleton)getHelperClass(expCls, "_Skel"); // Build hash of methods which may be called. buildMethodHash(obj.getClass(), true); // Export it. UnicastServer.exportObject(this); } return (stub);}
public RemoteStub exportObject(Remote obj) throws RemoteException { if (myself == null) { myself = obj; // Save it to server manager, to let client calls in the same VM to issue // local call manager.serverobj = obj; // Find and install the stub Class cls = obj.getClass(); Class expCls; try { // where ist the _Stub? (check superclasses also) expCls = findStubSkelClass(cls); } catch (Exception ex) { throw new RemoteException("can not find stubs for class: " + cls, ex); } stub = (RemoteStub)getHelperClass(expCls, "_Stub"); if (stub == null) { throw new RemoteException("failed to export: " + cls); } // Find and install the skeleton (if there is one) skel = (Skeleton)getHelperClass(expCls, "_Skel"); // Build hash of methods which may be called. buildMethodHash(obj.getClass(), true); // Export it. UnicastServer.exportObject(this); } return (stub);}
7,901
public RemoteStub exportObject(Remote obj) throws RemoteException { if (myself == null) { myself = obj; // Save it to server manager, to let client calls in the same VM to issue // local call manager.serverobj = obj; // Find and install the stub Class cls = obj.getClass(); Class expCls; try { // where ist the _Stub? (check superclasses also) expCls = findStubSkelClass(cls); } catch (Exception ex) { throw new RemoteException("can not find stubs for class: " + cls, ex); } stub = (RemoteStub)getHelperClass(expCls, "_Stub"); if (stub == null) { throw new RemoteException("failed to export: " + cls); } // Find and install the skeleton (if there is one) skel = (Skeleton)getHelperClass(expCls, "_Skel"); // Build hash of methods which may be called. buildMethodHash(obj.getClass(), true); // Export it. UnicastServer.exportObject(this); } return (stub);}
public RemoteStub exportObject(Remote obj) throws RemoteException { if (myself == null) { myself = obj; // Save it to server manager, to let client calls in the same VM to issue // local call manager.serverobj = obj; // Find and install the stub Class cls = obj.getClass(); Class expCls; try { // where ist the _Stub? (check superclasses also) expCls = findStubSkelClass(cls); } catch (Exception ex) { throw new RemoteException("can not find stubs for class: " + cls, ex); } stub = (RemoteStub)getHelperClass(expCls, "_Stub"); if (stub == null) { throw new RemoteException("failed to export: " + cls); } // Find and install the skeleton (if there is one) skel = (Skeleton)getHelperClass(expCls, "_Skel"); // Build hash of methods which may be called. buildMethodHash(obj.getClass(), true); // Export it. UnicastServer.exportObject(this); } return (stub);}
7,902
public RemoteStub exportObject(Remote obj) throws RemoteException { if (myself == null) { myself = obj; // Save it to server manager, to let client calls in the same VM to issue // local call manager.serverobj = obj; // Find and install the stub Class cls = obj.getClass(); Class expCls; try { // where ist the _Stub? (check superclasses also) expCls = findStubSkelClass(cls); } catch (Exception ex) { throw new RemoteException("can not find stubs for class: " + cls, ex); } stub = (RemoteStub)getHelperClass(expCls, "_Stub"); if (stub == null) { throw new RemoteException("failed to export: " + cls); } // Find and install the skeleton (if there is one) skel = (Skeleton)getHelperClass(expCls, "_Skel"); // Build hash of methods which may be called. buildMethodHash(obj.getClass(), true); // Export it. UnicastServer.exportObject(this); } return (stub);}
public RemoteStub exportObject(Remote obj) throws RemoteException { if (myself == null) { myself = obj; // Save it to server manager, to let client calls in the same VM to issue // local call manager.serverobj = obj; // Find and install the stub Class cls = obj.getClass(); Class expCls; try { // where ist the _Stub? (check superclasses also) expCls = findStubSkelClass(cls); } catch (Exception ex) { throw new RemoteException("can not find stubs for class: " + cls, ex); } stub = (RemoteStub)getHelperClass(expCls, "_Stub"); if (stub == null) { throw new RemoteException("failed to export: " + cls); } // Find and install the skeleton (if there is one) skel = (Skeleton)getHelperClass(expCls, "_Skel"); // Build hash of methods which may be called. buildMethodHash(obj.getClass(), true); // Export it. UnicastServer.exportObject(this); } return (stub);}
7,903
private Class findStubSkelClass(Class startCls) throws Exception { Class cls = startCls; while (true) { try { String stubClassname = cls.getName() + "_Stub"; ClassLoader cl = cls.getClassLoader(); Class scls = cl == null ? Class.forName(stubClassname) : cl.loadClass(stubClassname); return cls; // found it } catch (ClassNotFoundException e) { Class superCls = cls.getSuperclass(); if (superCls == null || superCls == java.rmi.server.UnicastRemoteObject.class) { throw new Exception("Neither " + startCls + " nor one of their superclasses (like" + cls + ")" + " has a _Stub"); } cls = superCls; } }}
private Class findStubSkelClass(Class startCls) { Class cls = startCls; while (true) { try { String stubClassname = cls.getName() + "_Stub"; ClassLoader cl = cls.getClassLoader(); Class scls = cl == null ? Class.forName(stubClassname) : cl.loadClass(stubClassname); return cls; // found it } catch (ClassNotFoundException e) { Class superCls = cls.getSuperclass(); if (superCls == null || superCls == java.rmi.server.UnicastRemoteObject.class) { throw new Exception("Neither " + startCls + " nor one of their superclasses (like" + cls + ")" + " has a _Stub"); } cls = superCls; } }}
7,904
private Class findStubSkelClass(Class startCls) throws Exception { Class cls = startCls; while (true) { try { String stubClassname = cls.getName() + "_Stub"; ClassLoader cl = cls.getClassLoader(); Class scls = cl == null ? Class.forName(stubClassname) : cl.loadClass(stubClassname); return cls; // found it } catch (ClassNotFoundException e) { Class superCls = cls.getSuperclass(); if (superCls == null || superCls == java.rmi.server.UnicastRemoteObject.class) { throw new Exception("Neither " + startCls + " nor one of their superclasses (like" + cls + ")" + " has a _Stub"); } cls = superCls; } }}
private Class findStubSkelClass(Class startCls) throws Exception { Class cls = startCls; while (true) { try { String stubClassname = cls.getName() + "_Stub"; ClassLoader cl = cls.getClassLoader(); Class scls = cl == null ? Class.forName(stubClassname) : cl.loadClass(stubClassname); return cls; // found it } catch (ClassNotFoundException e) { Class superCls = cls.getSuperclass(); if (superCls == null || superCls == java.rmi.server.UnicastRemoteObject.class) { throw new Exception("Neither " + startCls + " nor one of their superclasses (like" + cls + ")" + " has a _Stub"); } cls = superCls; } }}
7,905
public RemoteStub getStub(){ return stub;}
public Remote getStub() { return stub;}
7,906
public Object incomingMessageCall(UnicastConnection conn, int method, long hash) throws Exception {//System.out.println("method = " + method + ", hash = " + hash); // If method is -1 then this is JDK 1.2 RMI - so use the hash // to locate the method if (method == -1) { Method meth = (Method)methods.get(new Long (hash));//System.out.println("class = " + myself.getClass() + ", meth = " + meth); if (meth == null) { throw new NoSuchMethodException(); } ObjectInputStream in = conn.getObjectInputStream(); int nrargs = meth.getParameterTypes().length; Object[] args = new Object[nrargs]; for (int i = 0; i < nrargs; i++) { /** * For debugging purposes - we don't handle CodeBases * quite right so we don't always find the stubs. This * lets us know that. */ try { // need to handle primitive types args[i] = ((RMIObjectInputStream)in).readValue(meth.getParameterTypes()[i]); } catch (Exception t) { t.printStackTrace(); throw t; } } //We must reinterpret the exception thrown by meth.invoke() //return (meth.invoke(myself, args)); Object ret = null; try{ ret = meth.invoke(myself, args); }catch(InvocationTargetException e){ Throwable cause = e.getTargetException(); if (cause instanceof Exception) { throw (Exception)cause; } else if (cause instanceof Error) { throw (Error)cause; } else { throw new Error("The remote method threw a java.lang.Throwable that is neither java.lang.Exception nor java.lang.Error.", e); } } return ret; } // Otherwise this is JDK 1.1 style RMI - we find the skeleton // and invoke it using the method number. We wrap up our // connection system in a UnicastRemoteCall so it appears in a // way the Skeleton can handle. else { if (skel == null) { throw new NoSuchMethodException(); } UnicastRemoteCall call = new UnicastRemoteCall(conn); skel.dispatch(myself, call, method, hash); if (!call.isReturnValue()) return RMIVoidValue.INSTANCE; else return (call.returnValue()); }}
public Object incomingMessageCall(UnicastConnection conn, int method, long hash) throws Exception {//System.out.println("method = " + method + ", hash = " + hash); // If method is -1 then this is JDK 1.2 RMI - so use the hash // to locate the method if (method == -1) { Method meth = (Method)methods.get(new Long (hash));//System.out.println("class = " + myself.getClass() + ", meth = " + meth); if (meth == null) { throw new NoSuchMethodException(); } ObjectInputStream in = conn.getObjectInputStream(); int nrargs = meth.getParameterTypes().length; Object[] args = new Object[nrargs]; for (int i = 0; i < nrargs; i++) { /** * For debugging purposes - we don't handle CodeBases * quite right so we don't always find the stubs. This * lets us know that. */ try { // need to handle primitive types args[i] = ((RMIObjectInputStream)in).readValue(meth.getParameterTypes()[i]); } catch (Exception t) { t.printStackTrace(); throw t; } } //We must reinterpret the exception thrown by meth.invoke() //return (meth.invoke(myself, args)); Object ret = null; try{ ret = meth.invoke(myself, args); }catch(InvocationTargetException e){ Throwable cause = e.getTargetException(); if (cause instanceof Exception) { throw (Exception)cause; } else if (cause instanceof Error) { throw (Error)cause; } else { throw new Error("The remote method threw a java.lang.Throwable that is neither java.lang.Exception nor java.lang.Error.", e); } } return ret; } // Otherwise this is JDK 1.1 style RMI - we find the skeleton // and invoke it using the method number. We wrap up our // connection system in a UnicastRemoteCall so it appears in a // way the Skeleton can handle. else { if (skel == null) { throw new NoSuchMethodException(); } UnicastRemoteCall call = new UnicastRemoteCall(conn); skel.dispatch(myself, call, method, hash); if (!call.isReturnValue()) return RMIVoidValue.INSTANCE; else return (call.returnValue()); }}
7,907
public Object incomingMessageCall(UnicastConnection conn, int method, long hash) throws Exception {//System.out.println("method = " + method + ", hash = " + hash); // If method is -1 then this is JDK 1.2 RMI - so use the hash // to locate the method if (method == -1) { Method meth = (Method)methods.get(new Long (hash));//System.out.println("class = " + myself.getClass() + ", meth = " + meth); if (meth == null) { throw new NoSuchMethodException(); } ObjectInputStream in = conn.getObjectInputStream(); int nrargs = meth.getParameterTypes().length; Object[] args = new Object[nrargs]; for (int i = 0; i < nrargs; i++) { /** * For debugging purposes - we don't handle CodeBases * quite right so we don't always find the stubs. This * lets us know that. */ try { // need to handle primitive types args[i] = ((RMIObjectInputStream)in).readValue(meth.getParameterTypes()[i]); } catch (Exception t) { t.printStackTrace(); throw t; } } //We must reinterpret the exception thrown by meth.invoke() //return (meth.invoke(myself, args)); Object ret = null; try{ ret = meth.invoke(myself, args); }catch(InvocationTargetException e){ Throwable cause = e.getTargetException(); if (cause instanceof Exception) { throw (Exception)cause; } else if (cause instanceof Error) { throw (Error)cause; } else { throw new Error("The remote method threw a java.lang.Throwable that is neither java.lang.Exception nor java.lang.Error.", e); } } return ret; } // Otherwise this is JDK 1.1 style RMI - we find the skeleton // and invoke it using the method number. We wrap up our // connection system in a UnicastRemoteCall so it appears in a // way the Skeleton can handle. else { if (skel == null) { throw new NoSuchMethodException(); } UnicastRemoteCall call = new UnicastRemoteCall(conn); skel.dispatch(myself, call, method, hash); if (!call.isReturnValue()) return RMIVoidValue.INSTANCE; else return (call.returnValue()); }}
public Object incomingMessageCall(UnicastConnection conn, int method, long hash) throws Exception {//System.out.println("method = " + method + ", hash = " + hash); // If method is -1 then this is JDK 1.2 RMI - so use the hash // to locate the method if (method == -1) { Method meth = (Method)methods.get(new Long (hash));//System.out.println("class = " + myself.getClass() + ", meth = " + meth); if (meth == null) { throw new NoSuchMethodException(); } ObjectInputStream in = conn.getObjectInputStream(); int nrargs = meth.getParameterTypes().length; Object[] args = new Object[nrargs]; for (int i = 0; i < nrargs; i++) { /** * For debugging purposes - we don't handle CodeBases * quite right so we don't always find the stubs. This * lets us know that. */ try { // need to handle primitive types args[i] = ((RMIObjectInputStream)in).readValue(meth.getParameterTypes()[i]); } catch (Exception t) { t.printStackTrace(); throw t; } } //We must reinterpret the exception thrown by meth.invoke() //return (meth.invoke(myself, args)); Object ret = null; try{ ret = meth.invoke(myself, args); }catch(InvocationTargetException e){ Throwable cause = e.getTargetException(); if (cause instanceof Exception) { throw (Exception)cause; } else if (cause instanceof Error) { throw (Error)cause; } else { throw new Error("The remote method threw a java.lang.Throwable that is neither java.lang.Exception nor java.lang.Error.", e); } } return ret; } // Otherwise this is JDK 1.1 style RMI - we find the skeleton // and invoke it using the method number. We wrap up our // connection system in a UnicastRemoteCall so it appears in a // way the Skeleton can handle. else { if (skel == null) { throw new NoSuchMethodException(); } UnicastRemoteCall call = new UnicastRemoteCall(conn); skel.dispatch(myself, call, method, hash); if (!call.isReturnValue()) return RMIVoidValue.INSTANCE; else return (call.returnValue()); }}
7,908
private void jbInit() throws Exception { try { setIconImage(GUIGraphicsUtils.getApplicationIcon().getImage()); // set title setTitle(LangTool.getString("xtfr.wizardTitle")); // Load the JDBC driver. Driver driver2 = (Driver)Class.forName("com.ibm.as400.access.AS400JDBCDriver").newInstance(); DriverManager.registerDriver(driver2); // Get a connection to the database. Since we do not // provide a user id or password, a prompt will appear. connection = new SQLConnection("jdbc:as400://" + host, name, password); // Create an SQLQueryBuilderPane // object. Assume that "connection" // is an SQLConnection object that is // created and initialized elsewhere. queryBuilder = new SQLQueryBuilderPane(connection); queryBuilder.setTableSchemas(new String[] {"*USRLIBL"}); // Load the data needed for the query // builder. queryBuilder.load(); JButton done = new JButton(LangTool.getString("xtfr.tableDone")); done.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { fillQueryTextArea(); } }); JPanel panel = new JPanel(); panel.add(done); getContentPane().add(queryBuilder, BorderLayout.CENTER); getContentPane().add(panel, BorderLayout.SOUTH); Dimension max = new Dimension(OperatingSystem.getScreenBounds().width, OperatingSystem.getScreenBounds().height); pack(); if (getSize().width > max.width) setSize(max.width,getSize().height); if (getSize().height > max.height) setSize(getSize().width,max.height); //Center the window Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = getSize(); if (frameSize.height > screenSize.height) frameSize.height = screenSize.height; if (frameSize.width > screenSize.width) frameSize.width = screenSize.width; setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); setVisible(true); } catch (ClassNotFoundException cnfe) { JOptionPane.showMessageDialog(null,"Error loading AS400 JDBC Driver", "Error", JOptionPane.ERROR_MESSAGE); } }
private void jbInit() throws Exception { try { setIconImage(GUIGraphicsUtils.getApplicationIcon().getImage()); // set title setTitle(LangTool.getString("xtfr.wizardTitle")); // Load the JDBC driver. Driver driver2 = (Driver)Class.forName("com.ibm.as400.access.AS400JDBCDriver").newInstance(); DriverManager.registerDriver(driver2); // Get a connection to the database. Since we do not // provide a user id or password, a prompt will appear. connection = new SQLConnection("jdbc:as400://" + host, name, password); // Create an SQLQueryBuilderPane // object. Assume that "connection" // is an SQLConnection object that is // created and initialized elsewhere. queryBuilder = new SQLQueryBuilderPane(connection); queryBuilder.setTableSchemas(new String[] {"*USRLIBL"}); // Load the data needed for the query // builder. queryBuilder.load(); JButton done = new JButton(LangTool.getString("xtfr.tableDone")); done.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { fillQueryTextArea(); } }); JPanel panel = new JPanel(); panel.add(done); getContentPane().add(queryBuilder, BorderLayout.CENTER); getContentPane().add(panel, BorderLayout.SOUTH); Dimension max = new Dimension(OperatingSystem.getScreenBounds().width, OperatingSystem.getScreenBounds().height); pack(); if (getSize().width > max.width) setSize(max.width,getSize().height); if (getSize().height > max.height) setSize(getSize().width,max.height); //Center the window Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = getSize(); if (frameSize.height > screenSize.height) frameSize.height = screenSize.height; if (frameSize.width > screenSize.width) frameSize.width = screenSize.width; setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 3); setVisible(true); } catch (ClassNotFoundException cnfe) { JOptionPane.showMessageDialog(null,"Error loading AS400 JDBC Driver", "Error", JOptionPane.ERROR_MESSAGE); } }
7,909
public boolean equals (Object obj) { if (! (obj instanceof CollationKey)) return false; CollationKey ck = (CollationKey) obj; if (ck.collator != collator) return false; if (!ck.getSourceString ().equals (getSourceString ())) return false; if (!ck.toByteArray ().equals (toByteArray ())) return false; return true; }
public boolean equals (Object obj) { if (! (obj instanceof CollationKey)) return false; CollationKey ck = (CollationKey) obj; if (ck.collator != collator) return false; if (!ck.getSourceString ().equals (getSourceString ())) return false; if (! Arrays.equals (ck.toByteArray (), toByteArray ())) return false; return true; }
7,910
public List getIOAxesOrder() { synchronized (axesIOList) { return axesIOList; } }
public List getIOAxesOrder() { if (axesIOList == null) return parentArray.getAxes(); else return axesIOList; } }
7,911
public List getIOAxesOrder() { synchronized (axesIOList) { return axesIOList; } }
public List getIOAxesOrder() { synchronized (axesIOList) { return axesIOList;
7,912
private void privateSetIOAxesOrder (List axisOrderList) { synchronized (axesIOList) { axesIOList = Collections.synchronizedList(new ArrayList()); for (int i = 0, size = axesIOList.size(); i < size; i++) { axesIOList.add(axisOrderList.get(i)); } } }
private void privateSetIOAxesOrder (List axisOrderList) { synchronized (axesIOList) { axesIOList = Collections.synchronizedList(new ArrayList()); for (int i = 0, size = axisOrderList.size(); i < size; i++) { axesIOList.add(axisOrderList.get(i)); } } }
7,913
public Locator(Array array) { Log.debug("in Locator(Array)"); parentArray = array; List axisList = parentArray.getAxisList(); /**now, since we KNOW _parentArray is defined * (has to be instanciated via Array ONLY) * we can proceed to initialize the axis, index positions * to the origin (ie index 0 for each axis). * We choose the parent Array axisList ordering for our * default location ordering. */ locations = new Hashtable(axisList.size()); int stop = axisList.size(); for (int i = 0; i < stop; i++) { Object axisObj = axisList.get(i); axisOrderList.add(axisObj); locations.put(axisObj, new Integer(0)); } }
public Locator(Array array) { parentArray = array; List axisList = parentArray.getAxisList(); /**now, since we KNOW _parentArray is defined * (has to be instanciated via Array ONLY) * we can proceed to initialize the axis, index positions * to the origin (ie index 0 for each axis). * We choose the parent Array axisList ordering for our * default location ordering. */ locations = new Hashtable(axisList.size()); int stop = axisList.size(); for (int i = 0; i < stop; i++) { Object axisObj = axisList.get(i); axisOrderList.add(axisObj); locations.put(axisObj, new Integer(0)); } }
7,914
public AccessibleContext getAccessibleContext() { return null; }
public AccessibleContext getAccessibleContext() { if (accessibleContext == null) accessibleContext = new AccessibleJWindow(); return accessibleContext; }
7,915
public PrinterThread (char[] sc, Font font, int cols, int rows, Color colorBg, boolean toDefaultPrinter, Session ses) { setPriority(1); session = ses; session.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); config = ses.getConfiguration(); screen = new char[sc.length]; System.arraycopy(sc, 0, screen, 0, sc.length); toDefault = toDefaultPrinter; int len = sc.length; // we need to fix this to use the access methods to planes// for (int x = 0; x < len; x++) {// screen[x] = new ScreenChar(sc[x].s);// screen[x].setCharAndAttr(sc[x].getChar(),sc[x].getCharAttr(),sc[x].isAttributePlace());// } numCols = cols; numRows = rows; this.colorBg = colorBg; this.font = font; }
public PrinterThread (Screen5250 scr, Font font, int cols, int rows, Color colorBg, boolean toDefaultPrinter, Session ses) { setPriority(1); session = ses; session.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); config = ses.getConfiguration(); screen = new char[sc.length]; System.arraycopy(sc, 0, screen, 0, sc.length); toDefault = toDefaultPrinter; int len = sc.length; // we need to fix this to use the access methods to planes// for (int x = 0; x < len; x++) {// screen[x] = new ScreenChar(sc[x].s);// screen[x].setCharAndAttr(sc[x].getChar(),sc[x].getCharAttr(),sc[x].isAttributePlace());// } numCols = cols; numRows = rows; this.colorBg = colorBg; this.font = font; }
7,916
public PrinterThread (char[] sc, Font font, int cols, int rows, Color colorBg, boolean toDefaultPrinter, Session ses) { setPriority(1); session = ses; session.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); config = ses.getConfiguration(); screen = new char[sc.length]; System.arraycopy(sc, 0, screen, 0, sc.length); toDefault = toDefaultPrinter; int len = sc.length; // we need to fix this to use the access methods to planes// for (int x = 0; x < len; x++) {// screen[x] = new ScreenChar(sc[x].s);// screen[x].setCharAndAttr(sc[x].getChar(),sc[x].getCharAttr(),sc[x].isAttributePlace());// } numCols = cols; numRows = rows; this.colorBg = colorBg; this.font = font; }
public PrinterThread (char[] sc, Font font, int cols, int rows, Color colorBg, boolean toDefaultPrinter, Session ses) { setPriority(1); session = ses; session.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); config = ses.getConfiguration(); screen = new char[sc.length]; System.arraycopy(sc, 0, screen, 0, sc.length); toDefault = toDefaultPrinter; int len = sc.length; // we need to fix this to use the access methods to planes// for (int x = 0; x < len; x++) {// screen[x] = new ScreenChar(sc[x].s);// screen[x].setCharAndAttr(sc[x].getChar(),sc[x].getCharAttr(),sc[x].isAttributePlace());// } numCols = cols; numRows = rows; this.colorBg = colorBg; this.font = font; }
7,917
public PrinterThread (char[] sc, Font font, int cols, int rows, Color colorBg, boolean toDefaultPrinter, Session ses) { setPriority(1); session = ses; session.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); config = ses.getConfiguration(); screen = new char[sc.length]; System.arraycopy(sc, 0, screen, 0, sc.length); toDefault = toDefaultPrinter; int len = sc.length; // we need to fix this to use the access methods to planes// for (int x = 0; x < len; x++) {// screen[x] = new ScreenChar(sc[x].s);// screen[x].setCharAndAttr(sc[x].getChar(),sc[x].getCharAttr(),sc[x].isAttributePlace());// } numCols = cols; numRows = rows; this.colorBg = colorBg; this.font = font; }
public PrinterThread (char[] sc, Font font, int cols, int rows, Color colorBg, boolean toDefaultPrinter, Session ses) { setPriority(1); session = ses; session.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); config = ses.getConfiguration(); screen = new char[sc.length]; System.arraycopy(sc, 0, screen, 0, sc.length); toDefault = toDefaultPrinter; // we need to fix this to use the access methods to planes// for (int x = 0; x < len; x++) {// screen[x] = new ScreenChar(sc[x].s);// screen[x].setCharAndAttr(sc[x].getChar(),sc[x].getCharAttr(),sc[x].isAttributePlace());// } numCols = cols; numRows = rows; this.colorBg = colorBg; this.font = font; }
7,918
public int print (Graphics g, PageFormat pageFormat, int page) { Graphics2D g2; //--- Validate the page number, we only print the first page if (page == 0) { //--- Create a graphic2D object and set the default parameters g2 = (Graphics2D) g; g2.setColor (Color.black); //--- Translate the origin to be (0,0) g2.translate (pageFormat.getImageableX (), pageFormat.getImageableY ()); int w = (int)pageFormat.getImageableWidth() / numCols; // proposed width int h = (int)pageFormat.getImageableHeight() / numRows; // proposed height Font k = font; LineMetrics l; FontRenderContext f = null; float j = 1; for (; j < 50; j++) { // derive the font and obtain the relevent information to compute // the width and height k = font.deriveFont(j); f = new FontRenderContext(k.getTransform(),true,true); l = k.getLineMetrics("Wy",f); if ( (w < (int)k.getStringBounds("W",f).getWidth()) || h < (int)(k.getStringBounds("y",f).getHeight() + l.getDescent() + l.getLeading()) ) break; } // since we were looking for an overrun of the width or height we need // to adjust the font one down to get the last one that fit. k = font.deriveFont(--j); f = new FontRenderContext(k.getTransform(),true,true); l = k.getLineMetrics("Wy",f); // set the font of the print job g2.setFont(k); // get the width and height of the character bounds int w1 = (int)k.getStringBounds("W",f).getWidth(); int h1 = (int)(k.getStringBounds("y",f).getHeight() + l.getDescent() + l.getLeading()); int x; int y; // loop through all the screen characters and print them out. for (int m = 0;m < numRows; m++) for (int i = 0; i < numCols; i++) { x = w1 * i; y = h1 * (m + 1); // only draw printable characters (in this case >= ' ')// if (screen[getPos(m,i)].getChar() >= ' ' && !screen[getPos(m,i)].nonDisplay) { // TODO: Fix me for detecting non display if (screen[getPos(m,i)] >= ' ') { // && !screen[getPos(m,i)].nonDisplay) {// g2.drawChars(screen[getPos(m,i)], 0, 1,x , (int)(y + h1 - (l.getDescent() + l.getLeading())-2)); g2.drawChars(screen, getPos(m,i), 1,x , (int)(y + h1 - (l.getDescent() + l.getLeading())-2)); } // TODO: Fix me for detecting non display // if it is underlined then underline the character// if (screen[getPos(m,i)].underLine && !screen[getPos(m,i)].attributePlace)// g.drawLine(x, (int)(y + (h1 - l.getLeading()-3)), (int)(x + w1), (int)(y + (h1 - l.getLeading())-3)); } return (PAGE_EXISTS); } else return (NO_SUCH_PAGE); }
public int print (Graphics g, PageFormat pageFormat, int page) { Graphics2D g2; //--- Validate the page number, we only print the first page if (page == 0) { //--- Create a graphic2D object and set the default parameters g2 = (Graphics2D) g; g2.setColor (Color.black); //--- Translate the origin to be (0,0) g2.translate (pageFormat.getImageableX (), pageFormat.getImageableY ()); int w = (int)pageFormat.getImageableWidth() / numCols; // proposed width int h = (int)pageFormat.getImageableHeight() / numRows; // proposed height Font k = font; LineMetrics l; FontRenderContext f = null; float j = 1; for (; j < 50; j++) { // derive the font and obtain the relevent information to compute // the width and height k = font.deriveFont(j); f = new FontRenderContext(k.getTransform(),true,true); l = k.getLineMetrics("Wy",f); if ( (w < (int)k.getStringBounds("W",f).getWidth()) || h < (int)(k.getStringBounds("y",f).getHeight() + l.getDescent() + l.getLeading()) ) break; } // since we were looking for an overrun of the width or height we need // to adjust the font one down to get the last one that fit. k = font.deriveFont(--j); f = new FontRenderContext(k.getTransform(),true,true); l = k.getLineMetrics("Wy",f); // set the font of the print job g2.setFont(k); // get the width and height of the character bounds int w1 = (int)k.getStringBounds("W",f).getWidth(); int h1 = (int)(k.getStringBounds("y",f).getHeight() + l.getDescent() + l.getLeading()); int x; int y; // loop through all the screen characters and print them out. for (int m = 0;m < numRows; m++) for (int i = 0; i < numCols; i++) { x = w1 * i; y = h1 * (m + 1); // only draw printable characters (in this case >= ' ')// if (screen[getPos(m,i)].getChar() >= ' ' && !screen[getPos(m,i)].nonDisplay) { // TODO: Fix me for detecting non display if (screen[getPos(m,i)] >= ' ' && ((screen[getPos(m,i)] & EXTENDED_5250_NON_DSP) == 0)) { // && !screen[getPos(m,i)].nonDisplay) {// g2.drawChars(screen[getPos(m,i)], 0, 1,x , (int)(y + h1 - (l.getDescent() + l.getLeading())-2)); g2.drawChars(screen, getPos(m,i), 1,x , (int)(y + h1 - (l.getDescent() + l.getLeading())-2)); } // TODO: Fix me for detecting non display // if it is underlined then underline the character// if (screen[getPos(m,i)].underLine && !screen[getPos(m,i)].attributePlace)// g.drawLine(x, (int)(y + (h1 - l.getLeading()-3)), (int)(x + w1), (int)(y + (h1 - l.getLeading())-3)); } return (PAGE_EXISTS); } else return (NO_SUCH_PAGE); }
7,919
protected PluginDescriptorModel readDescriptor(File descriptor) { final PluginDescriptorModel descr; try { final XMLElement root = new XMLElement(new Hashtable(), true, false); try { final FileReader r = new FileReader(descriptor); try { root.parseFromReader(r); } finally { r.close(); } } catch (IOException ex) { throw new BuildException("Building " + descriptor + " failed", ex); } catch (XMLParseException ex) { throw new BuildException("Building " + descriptor + " failed", ex); } descr = new PluginDescriptorModel(root); } catch (PluginException ex) { ex.printStackTrace(); throw new BuildException("Building " + descriptor + " failed", ex); } return descr; }
protected PluginDescriptorModel readDescriptor(File descriptor) { final PluginDescriptorModel descr; try { final XMLElement root = new XMLElement(new Hashtable(), true, false); try { final FileReader r = new FileReader(descriptor); try { root.parseFromReader(r); } finally { r.close(); } } catch (IOException ex) { throw new BuildException("Building " + descriptor + " failed", ex); } catch (XMLParseException ex) { throw new BuildException("Building " + descriptor + " failed", ex); } if (root.getName().equals("plugin")) { descr = new PluginDescriptorModel(root); } else if (root.getName().equals("fragment")) { descr = new FragmentDescriptorModel(root); } else { throw new BuildException("Unknown root tag " + root.getName()); } } catch (PluginException ex) { ex.printStackTrace(); throw new BuildException("Building " + descriptor + " failed", ex); } return descr; }
7,923
private void parseIncoming() { boolean controlChars = false; byte control0; byte control1; boolean done = false; boolean error = false; try { while (bk.hasNext() && !done) { byte b = bk.getNextByte(); switch (b) { case 0: case 1: break; case CMD_SAVE_SCREEN: // 0x02 2 Save Screen case 3: // 0x03 3 Save Partial Screen saveScreen(); break; case ESC: // ESCAPE break; case 7: // audible bell Toolkit.getDefaultToolkit().beep(); bk.getNextByte(); bk.getNextByte(); break; case CMD_WRITE_TO_DISPLAY: // 0x11 17 write to display error = writeToDisplay(true); break; case CMD_RESTORE_SCREEN: // 0x12 18 Restore Screen case 13: // 0x13 19 Restore Partial Screen restoreScreen(); break; case CMD_CLEAR_UNIT_ALTERNATE: // 0x20 32 clear unit alternate int param = bk.getNextByte(); if (param != 0) {// System.out.println(" clear unit alternate error " + Integer.toHexString(param)); sendNegResponse(NR_REQUEST_ERROR,03,01,05, " clear unit alternate not supported"); done = true; } else { if (screen52.getRows() != 27) screen52.setRowsCols(27,132); screen52.clearAll(); } break; case CMD_WRITE_ERROR_CODE: // 0x21 33 Write Error Code writeErrorCode(); error = writeToDisplay(false); break; case CMD_WRITE_ERROR_CODE_TO_WINDOW: // 0x22 34 // Write Error Code to window writeErrorCodeToWindow(); error = writeToDisplay(false); break; case CMD_READ_SCREEN_IMMEDIATE: // 0x62 98 case CMD_READ_SCREEN_TO_PRINT: // 0x66 102 read screen to print readScreen(); break; case CMD_CLEAR_UNIT: // 64 0x40 clear unit if (screen52.getRows() != 24) screen52.setRowsCols(24,80); screen52.clearAll(); break; case CMD_CLEAR_FORMAT_TABLE: // 80 0x50 Clear format table screen52.clearTable(); break; case CMD_READ_INPUT_FIELDS: //0x42 66 read input fields case CMD_READ_MDT_FIELDS: // 0x52 82 read MDT Fields bk.getNextByte(); bk.getNextByte(); readType = b; screen52.goHome();// screen52.setCursorOn(); waitingForInput = true; screen52.setKeyboardLocked(false); break; case CMD_READ_MDT_IMMEDIATE_ALT: // 0x53 83 readType = b;// screen52.goHome();// waitingForInput = true;// screen52.setKeyboardLocked(false); readImmediate(readType); break; case CMD_WRITE_STRUCTURED_FIELD: // 243 0xF3 -13 Write structured field writeStructuredField(); break; default: done = true; sendNegResponse(NR_REQUEST_ERROR,03,01,01,"parseIncoming"); break; } if (error) done = true; } } catch (Exception exc) {System.out.println("incoming " + exc.getMessage());}; }
private void parseIncoming() { boolean controlChars = false; byte control0; byte control1; boolean done = false; boolean error = false; try { while (bk.hasNext() && !done) { byte b = bk.getNextByte(); switch (b) { case 0: case 1: break; case CMD_SAVE_SCREEN: // 0x02 2 Save Screen case 3: // 0x03 3 Save Partial Screen saveScreen(); break; case ESC: // ESCAPE break; case 7: // audible bell Toolkit.getDefaultToolkit().beep(); bk.getNextByte(); bk.getNextByte(); break; case CMD_WRITE_TO_DISPLAY: // 0x11 17 write to display error = writeToDisplay(true); break; case CMD_RESTORE_SCREEN: // 0x12 18 Restore Screen case 13: // 0x13 19 Restore Partial Screen restoreScreen(); break; case CMD_CLEAR_UNIT_ALTERNATE: // 0x20 32 clear unit alternate int param = bk.getNextByte(); if (param != 0) {// System.out.println(" clear unit alternate error " + Integer.toHexString(param)); sendNegResponse(NR_REQUEST_ERROR,03,01,05, " clear unit alternate not supported"); done = true; } else { if (screen52.getRows() != 27) screen52.setRowsCols(27,132); screen52.clearAll(); } break; case CMD_WRITE_ERROR_CODE: // 0x21 33 Write Error Code writeErrorCode(); error = writeToDisplay(false); break; case CMD_WRITE_ERROR_CODE_TO_WINDOW: // 0x22 34 // Write Error Code to window writeErrorCodeToWindow(); error = writeToDisplay(false); break; case CMD_READ_SCREEN_IMMEDIATE: // 0x62 98 case CMD_READ_SCREEN_TO_PRINT: // 0x66 102 read screen to print readScreen(); break; case CMD_CLEAR_UNIT: // 64 0x40 clear unit if (screen52.getRows() != 24) screen52.setRowsCols(24,80); screen52.clearAll(); break; case CMD_CLEAR_FORMAT_TABLE: // 80 0x50 Clear format table screen52.clearTable(); break; case CMD_READ_INPUT_FIELDS: //0x42 66 read input fields case CMD_READ_MDT_FIELDS: // 0x52 82 read MDT Fields bk.getNextByte(); bk.getNextByte(); readType = b; screen52.goHome();// screen52.setCursorOn(); waitingForInput = true; pendingUnlock = true; break; case CMD_READ_MDT_IMMEDIATE_ALT: // 0x53 83 readType = b;// screen52.goHome();// waitingForInput = true;// pendingUnlock = true; readImmediate(readType); break; case CMD_WRITE_STRUCTURED_FIELD: // 243 0xF3 -13 Write structured field writeStructuredField(); break; default: done = true; sendNegResponse(NR_REQUEST_ERROR,03,01,01,"parseIncoming"); break; } if (error) done = true; } } catch (Exception exc) {System.out.println("incoming " + exc.getMessage());}; }
7,925
public void run () { while (keepTrucking) { try { bk = (Stream5250)dsq.get(); } catch (InterruptedException ie) { System.out.println(" vt thread interrupted and stopping "); keepTrucking = false; continue; } // lets play nicely with the others on the playground// me.yield(); pthread.yield(); invited = false; screen52.setCursorOff();// System.out.println("operation code: " + bk.getOpCode()); if (bk == null) continue; switch (bk.getOpCode()) { case 00:// System.out.println("No operation"); break; case 1:// System.out.println("Invite Operation"); parseIncoming(); screen52.setKeyboardLocked(false); cursorOn = true; setInvited(); break; case 2:// System.out.println("Output Only"); parseIncoming();// System.out.println(screen52.dirty); screen52.updateDirty(); // invited = true; break; case 3:// System.out.println("Put/Get Operation"); parseIncoming();// inviteIt =true; setInvited(); break; case 4:// System.out.println("Save Screen Operation"); parseIncoming(); break; case 5:// System.out.println("Restore Screen Operation"); parseIncoming(); break; case 6:// System.out.println("Read Immediate"); sendAidKey(0); break; case 7:// System.out.println("Reserved"); break; case 8:// System.out.println("Read Screen Operation"); try { readScreen(); } catch (IOException ex) { } break; case 9:// System.out.println("Reserved"); break; case 10:// System.out.println("Cancel Invite Operation"); cancelInvite(); break; case 11:// System.out.println("Turn on message light"); screen52.setMessageLightOn(); screen52.setCursorOn(); break; case 12:// System.out.println("Turn off Message light"); screen52.setMessageLightOff(); screen52.setCursorOn(); break; default: break; } if (screen52.isUsingGuiInterface()) screen52.drawFields();// if (screen52.screen[0][1].getChar() == '#' &&// screen52.screen[0][2].getChar() == '!')// execCmd();// else { if (screen52.isHotSpots()) { screen52.checkHotSpots(); } try { screen52.updateDirty(); } catch (Exception exd ) { System.out.println(" tnvt.run: " + exd.getMessage()); } if (cursorOn && !screen52.isKeyboardLocked()) { screen52.setCursorOn(); cursorOn = false; } // lets play nicely with the others on the playground// me.yield(); pthread.yield(); } }
public void run () { while (keepTrucking) { try { bk = (Stream5250)dsq.get(); } catch (InterruptedException ie) { System.out.println(" vt thread interrupted and stopping "); keepTrucking = false; continue; } // lets play nicely with the others on the playground// me.yield(); pthread.yield(); invited = false; screen52.setCursorOff();// System.out.println("operation code: " + bk.getOpCode()); if (bk == null) continue; switch (bk.getOpCode()) { case 00:// System.out.println("No operation"); break; case 1:// System.out.println("Invite Operation"); parseIncoming(); pendingUnlock = true; cursorOn = true; setInvited(); break; case 2:// System.out.println("Output Only"); parseIncoming();// System.out.println(screen52.dirty); screen52.updateDirty(); // invited = true; break; case 3:// System.out.println("Put/Get Operation"); parseIncoming();// inviteIt =true; setInvited(); break; case 4:// System.out.println("Save Screen Operation"); parseIncoming(); break; case 5:// System.out.println("Restore Screen Operation"); parseIncoming(); break; case 6:// System.out.println("Read Immediate"); sendAidKey(0); break; case 7:// System.out.println("Reserved"); break; case 8:// System.out.println("Read Screen Operation"); try { readScreen(); } catch (IOException ex) { } break; case 9:// System.out.println("Reserved"); break; case 10:// System.out.println("Cancel Invite Operation"); cancelInvite(); break; case 11:// System.out.println("Turn on message light"); screen52.setMessageLightOn(); screen52.setCursorOn(); break; case 12:// System.out.println("Turn off Message light"); screen52.setMessageLightOff(); screen52.setCursorOn(); break; default: break; } if (screen52.isUsingGuiInterface()) screen52.drawFields();// if (screen52.screen[0][1].getChar() == '#' &&// screen52.screen[0][2].getChar() == '!')// execCmd();// else { if (screen52.isHotSpots()) { screen52.checkHotSpots(); } try { screen52.updateDirty(); } catch (Exception exd ) { System.out.println(" tnvt.run: " + exd.getMessage()); } if (cursorOn && !screen52.isKeyboardLocked()) { screen52.setCursorOn(); cursorOn = false; } // lets play nicely with the others on the playground// me.yield(); pthread.yield(); } }
7,928
protected TextRenderer createTextRenderer(RenderCache renderCache, Font font) { final String renderer = (String)AccessController.doPrivileged(new GetPropertyAction("jnode.font.renderer", "simple")); TextRenderer r; if (false || renderer.equals("new")) { r = new TTFTextRenderer(renderCache, getFontMetrics(font), getFontData(font)); } else { r = new TTFSimpleTextRenderer(getFontData(font), font.getSize()); } log.debug("created TextRenderer for TTF"); return r; }
protected TextRenderer createTextRenderer(RenderCache renderCache, Font font) { TextRenderer r; if (false || renderer.equals("new")) { r = new TTFTextRenderer(renderCache, getFontMetrics(font), getFontData(font)); } else { r = new TTFSimpleTextRenderer(getFontData(font), font.getSize()); } log.debug("created TextRenderer for TTF"); return r; }
7,932
protected TextRenderer createTextRenderer(RenderCache renderCache, Font font) { final String renderer = (String)AccessController.doPrivileged(new GetPropertyAction("jnode.font.renderer", "simple")); TextRenderer r; if (false || renderer.equals("new")) { r = new TTFTextRenderer(renderCache, getFontMetrics(font), getFontData(font)); } else { r = new TTFSimpleTextRenderer(getFontData(font), font.getSize()); } log.debug("created TextRenderer for TTF"); return r; }
protected TextRenderer createTextRenderer(RenderCache renderCache, Font font) { final String renderer = (String)AccessController.doPrivileged(new GetPropertyAction("jnode.font.renderer", "simple")); TextRenderer r; r = new TTFTextRenderer(renderCache, getFontMetrics(font), getFontData(font)); } else { r = new TTFSimpleTextRenderer(getFontData(font), font.getSize()); } log.debug("created TextRenderer for TTF"); return r; }
7,933
protected TextRenderer createTextRenderer(RenderCache renderCache, Font font) { final String renderer = (String)AccessController.doPrivileged(new GetPropertyAction("jnode.font.renderer", "simple")); TextRenderer r; if (false || renderer.equals("new")) { r = new TTFTextRenderer(renderCache, getFontMetrics(font), getFontData(font)); } else { r = new TTFSimpleTextRenderer(getFontData(font), font.getSize()); } log.debug("created TextRenderer for TTF"); return r; }
protected TextRenderer createTextRenderer(RenderCache renderCache, Font font) { final String renderer = (String)AccessController.doPrivileged(new GetPropertyAction("jnode.font.renderer", "simple")); TextRenderer r; if (false || renderer.equals("new")) { r = new TTFTextRenderer(renderCache, getFontMetrics(font), getFontData(font)); } else { r = new TTFSimpleTextRenderer(getFontData(font), font.getSize()); } log.debug("created TextRenderer for TTF"); return r; }
7,934
public GapContent() { this(10); }
public GapContent() { this(DEFAULT_BUFSIZE); }
7,935
public void getChars(int where, int len, Segment txt) throws BadLocationException { txt.array = new char[len]; System.arraycopy(buf.toString().toCharArray(), where, txt.array, 0, len); txt.count = len; txt.offset = 0; }
public void getChars(int where, int len, Segment txt) throws BadLocationException { int length = length(); if (where >= length) throw new BadLocationException("the where argument cannot be greater" + " than the content length", where); if ((where + len) > length) throw new BadLocationException("len plus where cannot be greater" + " than the content length", len + where); System.arraycopy(buf.toString().toCharArray(), where, txt.array, 0, len); txt.count = len; txt.offset = 0; }
7,936
public void getChars(int where, int len, Segment txt) throws BadLocationException { txt.array = new char[len]; System.arraycopy(buf.toString().toCharArray(), where, txt.array, 0, len); txt.count = len; txt.offset = 0; }
public void getChars(int where, int len, Segment txt) throws BadLocationException { txt.array = new char[len]; System.arraycopy(buf.toString().toCharArray(), where, txt.array, 0, len); txt.count = len; txt.offset = 0; }
7,937
public void getChars(int where, int len, Segment txt) throws BadLocationException { txt.array = new char[len]; System.arraycopy(buf.toString().toCharArray(), where, txt.array, 0, len); txt.count = len; txt.offset = 0; }
public void getChars(int where, int len, Segment txt) throws BadLocationException { txt.array = new char[len]; System.arraycopy(buf.toString().toCharArray(), where, txt.array, 0, len); txt.count = len; txt.offset = 0; txt.count = len; } else { txt.array = buffer; if (where < gapStart) txt.offset = where; else txt.offset = where + (gapEnd - gapStart); txt.count = len; } }
7,938
public String getString(int where, int len) throws BadLocationException { return buf.substring(where, where+len); }
public String getString(int where, int len) throws BadLocationException { Segment seg = new Segment(); getChars(where, len, seg); return new String(seg.array, seg.offset, seg.count); }
7,939
public UndoableEdit insertString(int where, String str) throws BadLocationException { buf.insert(where, str); return null; }
public UndoableEdit insertString(int where, String str) throws BadLocationException { int length = length(); int strLen = str.length(); if (where >= length) throw new BadLocationException("the where argument cannot be greater" + " than the content length", where); if ((gapEnd - gapStart) < strLen) shiftEnd(strLen + DEFAULT_BUFSIZE); if (where != gapStart) shiftGap(where); System.arraycopy(str.toCharArray(), 0, buffer, gapStart, strLen); gapStart += strLen; return null; }
7,940
public int length() { return buf.length(); }
public int length() { return buffer.length - (gapEnd - gapStart); }
7,941
public UndoableEdit remove(int where, int nitems) throws BadLocationException { buf.delete(where, where + nitems); return null; }
public UndoableEdit remove(int where, int nitems) throws BadLocationException { int length = length(); if (where >= length) throw new BadLocationException("the where argument cannot be greater" + " than the content length", where); if ((where + nitems) > length) throw new BadLocationException("where + nitems cannot be greater" + " than the content length", where + nitems); if (where != gapStart) shiftGap(where); gapEnd += nitems; return null; }
7,942
public void keyPressed(KeyEvent e) { TreePath start = BasicTreeUI.this.tree.getLeadSelectionPath(); TreeNode last = null; if (start != null) last = (TreeNode) start.getLastPathComponent(); if (last != null) { // DOWN, KP_DOWN if (e.getKeyCode() == KeyEvent.VK_DOWN || e.getKeyCode() == KeyEvent.VK_KP_DOWN) { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) { TreePath newPath = new TreePath(getPathToRoot(next, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, newPath); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!next.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // UP, KP_UP else if (e.getKeyCode() == KeyEvent.VK_UP || e.getKeyCode() == KeyEvent.VK_KP_UP) { TreeNode prev = (TreeNode) BasicTreeUI.this. getPreviousVisibleNode(last); if (prev != null) { TreePath newPath = new TreePath(getPathToRoot(prev, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(prev, 0))); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!prev.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // LEFT, KP_LEFT else if (e.getKeyCode() == KeyEvent.VK_LEFT || e.getKeyCode() == KeyEvent.VK_KP_LEFT) { TreePath path = new TreePath(getPathToRoot(last, 0)); TreeNode p = last.getParent(); if (!last.isLeaf() && BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else if (p != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(p, 0))); } // RIGHT, KP_RIGHT else if (e.getKeyCode() == KeyEvent.VK_RIGHT || e.getKeyCode() == KeyEvent.VK_KP_RIGHT) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf() && BasicTreeUI.this.tree.isCollapsed(path)) { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } else { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(next, 0))); } } // Enter else if (e.getKeyCode() == KeyEvent.VK_ENTER) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf()) { if (BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } } } } }
public void keyPressed(KeyEvent e) { TreePath start = BasicTreeUI.this.tree.getLeadSelectionPath(); Object last = null; if (start != null) last = (TreeNode) start.getLastPathComponent(); if (last != null) { // DOWN, KP_DOWN if (e.getKeyCode() == KeyEvent.VK_DOWN || e.getKeyCode() == KeyEvent.VK_KP_DOWN) { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) { TreePath newPath = new TreePath(getPathToRoot(next, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, newPath); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!next.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // UP, KP_UP else if (e.getKeyCode() == KeyEvent.VK_UP || e.getKeyCode() == KeyEvent.VK_KP_UP) { TreeNode prev = (TreeNode) BasicTreeUI.this. getPreviousVisibleNode(last); if (prev != null) { TreePath newPath = new TreePath(getPathToRoot(prev, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(prev, 0))); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!prev.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // LEFT, KP_LEFT else if (e.getKeyCode() == KeyEvent.VK_LEFT || e.getKeyCode() == KeyEvent.VK_KP_LEFT) { TreePath path = new TreePath(getPathToRoot(last, 0)); TreeNode p = last.getParent(); if (!last.isLeaf() && BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else if (p != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(p, 0))); } // RIGHT, KP_RIGHT else if (e.getKeyCode() == KeyEvent.VK_RIGHT || e.getKeyCode() == KeyEvent.VK_KP_RIGHT) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf() && BasicTreeUI.this.tree.isCollapsed(path)) { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } else { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(next, 0))); } } // Enter else if (e.getKeyCode() == KeyEvent.VK_ENTER) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf()) { if (BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } } } } }
7,944
public void keyPressed(KeyEvent e) { TreePath start = BasicTreeUI.this.tree.getLeadSelectionPath(); TreeNode last = null; if (start != null) last = (TreeNode) start.getLastPathComponent(); if (last != null) { // DOWN, KP_DOWN if (e.getKeyCode() == KeyEvent.VK_DOWN || e.getKeyCode() == KeyEvent.VK_KP_DOWN) { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) { TreePath newPath = new TreePath(getPathToRoot(next, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, newPath); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!next.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // UP, KP_UP else if (e.getKeyCode() == KeyEvent.VK_UP || e.getKeyCode() == KeyEvent.VK_KP_UP) { TreeNode prev = (TreeNode) BasicTreeUI.this. getPreviousVisibleNode(last); if (prev != null) { TreePath newPath = new TreePath(getPathToRoot(prev, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(prev, 0))); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!prev.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // LEFT, KP_LEFT else if (e.getKeyCode() == KeyEvent.VK_LEFT || e.getKeyCode() == KeyEvent.VK_KP_LEFT) { TreePath path = new TreePath(getPathToRoot(last, 0)); TreeNode p = last.getParent(); if (!last.isLeaf() && BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else if (p != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(p, 0))); } // RIGHT, KP_RIGHT else if (e.getKeyCode() == KeyEvent.VK_RIGHT || e.getKeyCode() == KeyEvent.VK_KP_RIGHT) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf() && BasicTreeUI.this.tree.isCollapsed(path)) { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } else { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(next, 0))); } } // Enter else if (e.getKeyCode() == KeyEvent.VK_ENTER) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf()) { if (BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } } } } }
public void keyPressed(KeyEvent e) { TreePath start = BasicTreeUI.this.tree.getLeadSelectionPath(); TreeNode last = null; if (start != null) last = start.getLastPathComponent(); if (last != null) { // DOWN, KP_DOWN if (e.getKeyCode() == KeyEvent.VK_DOWN || e.getKeyCode() == KeyEvent.VK_KP_DOWN) { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) { TreePath newPath = new TreePath(getPathToRoot(next, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, newPath); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!next.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // UP, KP_UP else if (e.getKeyCode() == KeyEvent.VK_UP || e.getKeyCode() == KeyEvent.VK_KP_UP) { TreeNode prev = (TreeNode) BasicTreeUI.this. getPreviousVisibleNode(last); if (prev != null) { TreePath newPath = new TreePath(getPathToRoot(prev, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(prev, 0))); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!prev.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // LEFT, KP_LEFT else if (e.getKeyCode() == KeyEvent.VK_LEFT || e.getKeyCode() == KeyEvent.VK_KP_LEFT) { TreePath path = new TreePath(getPathToRoot(last, 0)); TreeNode p = last.getParent(); if (!last.isLeaf() && BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else if (p != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(p, 0))); } // RIGHT, KP_RIGHT else if (e.getKeyCode() == KeyEvent.VK_RIGHT || e.getKeyCode() == KeyEvent.VK_KP_RIGHT) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf() && BasicTreeUI.this.tree.isCollapsed(path)) { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } else { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(next, 0))); } } // Enter else if (e.getKeyCode() == KeyEvent.VK_ENTER) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf()) { if (BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } } } } }
7,945
public void keyPressed(KeyEvent e) { TreePath start = BasicTreeUI.this.tree.getLeadSelectionPath(); TreeNode last = null; if (start != null) last = (TreeNode) start.getLastPathComponent(); if (last != null) { // DOWN, KP_DOWN if (e.getKeyCode() == KeyEvent.VK_DOWN || e.getKeyCode() == KeyEvent.VK_KP_DOWN) { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) { TreePath newPath = new TreePath(getPathToRoot(next, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, newPath); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!next.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // UP, KP_UP else if (e.getKeyCode() == KeyEvent.VK_UP || e.getKeyCode() == KeyEvent.VK_KP_UP) { TreeNode prev = (TreeNode) BasicTreeUI.this. getPreviousVisibleNode(last); if (prev != null) { TreePath newPath = new TreePath(getPathToRoot(prev, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(prev, 0))); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!prev.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // LEFT, KP_LEFT else if (e.getKeyCode() == KeyEvent.VK_LEFT || e.getKeyCode() == KeyEvent.VK_KP_LEFT) { TreePath path = new TreePath(getPathToRoot(last, 0)); TreeNode p = last.getParent(); if (!last.isLeaf() && BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else if (p != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(p, 0))); } // RIGHT, KP_RIGHT else if (e.getKeyCode() == KeyEvent.VK_RIGHT || e.getKeyCode() == KeyEvent.VK_KP_RIGHT) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf() && BasicTreeUI.this.tree.isCollapsed(path)) { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } else { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(next, 0))); } } // Enter else if (e.getKeyCode() == KeyEvent.VK_ENTER) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf()) { if (BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } } } } }
public void keyPressed(KeyEvent e) { TreePath start = BasicTreeUI.this.tree.getLeadSelectionPath(); TreeNode last = null; if (start != null) last = (TreeNode) start.getLastPathComponent(); if (last != null) { // DOWN, KP_DOWN if (e.getKeyCode() == KeyEvent.VK_DOWN || e.getKeyCode() == KeyEvent.VK_KP_DOWN) { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) { TreePath newPath = new TreePath(getPathToRoot(next, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, newPath); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!next.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // UP, KP_UP else if (e.getKeyCode() == KeyEvent.VK_UP || e.getKeyCode() == KeyEvent.VK_KP_UP) { TreeNode prev = (TreeNode) BasicTreeUI.this. getPreviousVisibleNode(last); if (prev != null) { TreePath newPath = new TreePath(getPathToRoot(prev, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(prev, 0))); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!prev.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // LEFT, KP_LEFT else if (e.getKeyCode() == KeyEvent.VK_LEFT || e.getKeyCode() == KeyEvent.VK_KP_LEFT) { TreePath path = new TreePath(getPathToRoot(last, 0)); TreeNode p = last.getParent(); if (!last.isLeaf() && BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else if (p != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(p, 0))); } // RIGHT, KP_RIGHT else if (e.getKeyCode() == KeyEvent.VK_RIGHT || e.getKeyCode() == KeyEvent.VK_KP_RIGHT) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf() && BasicTreeUI.this.tree.isCollapsed(path)) { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } else { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(next, 0))); } } // Enter else if (e.getKeyCode() == KeyEvent.VK_ENTER) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf()) { if (BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } } } } }
7,946
public void keyPressed(KeyEvent e) { TreePath start = BasicTreeUI.this.tree.getLeadSelectionPath(); TreeNode last = null; if (start != null) last = (TreeNode) start.getLastPathComponent(); if (last != null) { // DOWN, KP_DOWN if (e.getKeyCode() == KeyEvent.VK_DOWN || e.getKeyCode() == KeyEvent.VK_KP_DOWN) { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) { TreePath newPath = new TreePath(getPathToRoot(next, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, newPath); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!next.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // UP, KP_UP else if (e.getKeyCode() == KeyEvent.VK_UP || e.getKeyCode() == KeyEvent.VK_KP_UP) { TreeNode prev = (TreeNode) BasicTreeUI.this. getPreviousVisibleNode(last); if (prev != null) { TreePath newPath = new TreePath(getPathToRoot(prev, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(prev, 0))); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!prev.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // LEFT, KP_LEFT else if (e.getKeyCode() == KeyEvent.VK_LEFT || e.getKeyCode() == KeyEvent.VK_KP_LEFT) { TreePath path = new TreePath(getPathToRoot(last, 0)); TreeNode p = last.getParent(); if (!last.isLeaf() && BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else if (p != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(p, 0))); } // RIGHT, KP_RIGHT else if (e.getKeyCode() == KeyEvent.VK_RIGHT || e.getKeyCode() == KeyEvent.VK_KP_RIGHT) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf() && BasicTreeUI.this.tree.isCollapsed(path)) { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } else { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(next, 0))); } } // Enter else if (e.getKeyCode() == KeyEvent.VK_ENTER) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf()) { if (BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } } } } }
public void keyPressed(KeyEvent e) { TreePath start = BasicTreeUI.this.tree.getLeadSelectionPath(); TreeNode last = null; if (start != null) last = (TreeNode) start.getLastPathComponent(); if (last != null) { // DOWN, KP_DOWN if (e.getKeyCode() == KeyEvent.VK_DOWN || e.getKeyCode() == KeyEvent.VK_KP_DOWN) { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) { TreePath newPath = new TreePath(getPathToRoot(next, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, newPath); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!mod.isLeaf(next) && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // UP, KP_UP else if (e.getKeyCode() == KeyEvent.VK_UP || e.getKeyCode() == KeyEvent.VK_KP_UP) { TreeNode prev = (TreeNode) BasicTreeUI.this. getPreviousVisibleNode(last); if (prev != null) { TreePath newPath = new TreePath(getPathToRoot(prev, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(prev, 0))); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!prev.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // LEFT, KP_LEFT else if (e.getKeyCode() == KeyEvent.VK_LEFT || e.getKeyCode() == KeyEvent.VK_KP_LEFT) { TreePath path = new TreePath(getPathToRoot(last, 0)); TreeNode p = last.getParent(); if (!last.isLeaf() && BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else if (p != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(p, 0))); } // RIGHT, KP_RIGHT else if (e.getKeyCode() == KeyEvent.VK_RIGHT || e.getKeyCode() == KeyEvent.VK_KP_RIGHT) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf() && BasicTreeUI.this.tree.isCollapsed(path)) { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } else { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(next, 0))); } } // Enter else if (e.getKeyCode() == KeyEvent.VK_ENTER) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf()) { if (BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } } } } }
7,947
public void keyPressed(KeyEvent e) { TreePath start = BasicTreeUI.this.tree.getLeadSelectionPath(); TreeNode last = null; if (start != null) last = (TreeNode) start.getLastPathComponent(); if (last != null) { // DOWN, KP_DOWN if (e.getKeyCode() == KeyEvent.VK_DOWN || e.getKeyCode() == KeyEvent.VK_KP_DOWN) { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) { TreePath newPath = new TreePath(getPathToRoot(next, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, newPath); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!next.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // UP, KP_UP else if (e.getKeyCode() == KeyEvent.VK_UP || e.getKeyCode() == KeyEvent.VK_KP_UP) { TreeNode prev = (TreeNode) BasicTreeUI.this. getPreviousVisibleNode(last); if (prev != null) { TreePath newPath = new TreePath(getPathToRoot(prev, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(prev, 0))); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!prev.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // LEFT, KP_LEFT else if (e.getKeyCode() == KeyEvent.VK_LEFT || e.getKeyCode() == KeyEvent.VK_KP_LEFT) { TreePath path = new TreePath(getPathToRoot(last, 0)); TreeNode p = last.getParent(); if (!last.isLeaf() && BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else if (p != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(p, 0))); } // RIGHT, KP_RIGHT else if (e.getKeyCode() == KeyEvent.VK_RIGHT || e.getKeyCode() == KeyEvent.VK_KP_RIGHT) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf() && BasicTreeUI.this.tree.isCollapsed(path)) { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } else { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(next, 0))); } } // Enter else if (e.getKeyCode() == KeyEvent.VK_ENTER) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf()) { if (BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } } } } }
public void keyPressed(KeyEvent e) { TreePath start = BasicTreeUI.this.tree.getLeadSelectionPath(); TreeNode last = null; if (start != null) last = (TreeNode) start.getLastPathComponent(); if (last != null) { // DOWN, KP_DOWN if (e.getKeyCode() == KeyEvent.VK_DOWN || e.getKeyCode() == KeyEvent.VK_KP_DOWN) { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) { TreePath newPath = new TreePath(getPathToRoot(next, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, newPath); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!next.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // UP, KP_UP else if (e.getKeyCode() == KeyEvent.VK_UP || e.getKeyCode() == KeyEvent.VK_KP_UP) { TreeNode prev = (TreeNode) BasicTreeUI.this. getPreviousVisibleNode(last); if (prev != null) { TreePath newPath = new TreePath(getPathToRoot(prev, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(prev, 0))); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!prev.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // LEFT, KP_LEFT else if (e.getKeyCode() == KeyEvent.VK_LEFT || e.getKeyCode() == KeyEvent.VK_KP_LEFT) { TreePath path = new TreePath(getPathToRoot(last, 0)); TreeNode p = last.getParent(); if (!last.isLeaf() && BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else if (p != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(p, 0))); } // RIGHT, KP_RIGHT else if (e.getKeyCode() == KeyEvent.VK_RIGHT || e.getKeyCode() == KeyEvent.VK_KP_RIGHT) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf() && BasicTreeUI.this.tree.isCollapsed(path)) { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } else { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(next, 0))); } } // Enter else if (e.getKeyCode() == KeyEvent.VK_ENTER) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf()) { if (BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } } } } }
7,948
public void keyPressed(KeyEvent e) { TreePath start = BasicTreeUI.this.tree.getLeadSelectionPath(); TreeNode last = null; if (start != null) last = (TreeNode) start.getLastPathComponent(); if (last != null) { // DOWN, KP_DOWN if (e.getKeyCode() == KeyEvent.VK_DOWN || e.getKeyCode() == KeyEvent.VK_KP_DOWN) { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) { TreePath newPath = new TreePath(getPathToRoot(next, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, newPath); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!next.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // UP, KP_UP else if (e.getKeyCode() == KeyEvent.VK_UP || e.getKeyCode() == KeyEvent.VK_KP_UP) { TreeNode prev = (TreeNode) BasicTreeUI.this. getPreviousVisibleNode(last); if (prev != null) { TreePath newPath = new TreePath(getPathToRoot(prev, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(prev, 0))); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!prev.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // LEFT, KP_LEFT else if (e.getKeyCode() == KeyEvent.VK_LEFT || e.getKeyCode() == KeyEvent.VK_KP_LEFT) { TreePath path = new TreePath(getPathToRoot(last, 0)); TreeNode p = last.getParent(); if (!last.isLeaf() && BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else if (p != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(p, 0))); } // RIGHT, KP_RIGHT else if (e.getKeyCode() == KeyEvent.VK_RIGHT || e.getKeyCode() == KeyEvent.VK_KP_RIGHT) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf() && BasicTreeUI.this.tree.isCollapsed(path)) { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } else { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(next, 0))); } } // Enter else if (e.getKeyCode() == KeyEvent.VK_ENTER) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf()) { if (BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } } } } }
public void keyPressed(KeyEvent e) { TreePath start = BasicTreeUI.this.tree.getLeadSelectionPath(); TreeNode last = null; if (start != null) last = (TreeNode) start.getLastPathComponent(); if (last != null) { // DOWN, KP_DOWN if (e.getKeyCode() == KeyEvent.VK_DOWN || e.getKeyCode() == KeyEvent.VK_KP_DOWN) { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) { TreePath newPath = new TreePath(getPathToRoot(next, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, newPath); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!next.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // UP, KP_UP else if (e.getKeyCode() == KeyEvent.VK_UP || e.getKeyCode() == KeyEvent.VK_KP_UP) { TreeNode prev = (TreeNode) BasicTreeUI.this. getPreviousVisibleNode(last); if (prev != null) { TreePath newPath = new TreePath(getPathToRoot(prev, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(prev, 0))); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!mod.isLeaf(prev) && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // LEFT, KP_LEFT else if (e.getKeyCode() == KeyEvent.VK_LEFT || e.getKeyCode() == KeyEvent.VK_KP_LEFT) { TreePath path = new TreePath(getPathToRoot(last, 0)); TreeNode p = last.getParent(); if (!last.isLeaf() && BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else if (p != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(p, 0))); } // RIGHT, KP_RIGHT else if (e.getKeyCode() == KeyEvent.VK_RIGHT || e.getKeyCode() == KeyEvent.VK_KP_RIGHT) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf() && BasicTreeUI.this.tree.isCollapsed(path)) { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } else { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(next, 0))); } } // Enter else if (e.getKeyCode() == KeyEvent.VK_ENTER) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf()) { if (BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } } } } }
7,949
public void keyPressed(KeyEvent e) { TreePath start = BasicTreeUI.this.tree.getLeadSelectionPath(); TreeNode last = null; if (start != null) last = (TreeNode) start.getLastPathComponent(); if (last != null) { // DOWN, KP_DOWN if (e.getKeyCode() == KeyEvent.VK_DOWN || e.getKeyCode() == KeyEvent.VK_KP_DOWN) { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) { TreePath newPath = new TreePath(getPathToRoot(next, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, newPath); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!next.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // UP, KP_UP else if (e.getKeyCode() == KeyEvent.VK_UP || e.getKeyCode() == KeyEvent.VK_KP_UP) { TreeNode prev = (TreeNode) BasicTreeUI.this. getPreviousVisibleNode(last); if (prev != null) { TreePath newPath = new TreePath(getPathToRoot(prev, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(prev, 0))); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!prev.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // LEFT, KP_LEFT else if (e.getKeyCode() == KeyEvent.VK_LEFT || e.getKeyCode() == KeyEvent.VK_KP_LEFT) { TreePath path = new TreePath(getPathToRoot(last, 0)); TreeNode p = last.getParent(); if (!last.isLeaf() && BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else if (p != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(p, 0))); } // RIGHT, KP_RIGHT else if (e.getKeyCode() == KeyEvent.VK_RIGHT || e.getKeyCode() == KeyEvent.VK_KP_RIGHT) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf() && BasicTreeUI.this.tree.isCollapsed(path)) { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } else { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(next, 0))); } } // Enter else if (e.getKeyCode() == KeyEvent.VK_ENTER) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf()) { if (BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } } } } }
public void keyPressed(KeyEvent e) { TreePath start = BasicTreeUI.this.tree.getLeadSelectionPath(); TreeNode last = null; if (start != null) last = (TreeNode) start.getLastPathComponent(); if (last != null) { // DOWN, KP_DOWN if (e.getKeyCode() == KeyEvent.VK_DOWN || e.getKeyCode() == KeyEvent.VK_KP_DOWN) { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) { TreePath newPath = new TreePath(getPathToRoot(next, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, newPath); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!next.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // UP, KP_UP else if (e.getKeyCode() == KeyEvent.VK_UP || e.getKeyCode() == KeyEvent.VK_KP_UP) { TreeNode prev = (TreeNode) BasicTreeUI.this. getPreviousVisibleNode(last); if (prev != null) { TreePath newPath = new TreePath(getPathToRoot(prev, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(prev, 0))); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!prev.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // LEFT, KP_LEFT else if (e.getKeyCode() == KeyEvent.VK_LEFT || e.getKeyCode() == KeyEvent.VK_KP_LEFT) { TreePath path = new TreePath(getPathToRoot(last, 0)); Object p = getParent(mod.getRoot(), last); if (!last.isLeaf() && BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else if (p != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(p, 0))); } // RIGHT, KP_RIGHT else if (e.getKeyCode() == KeyEvent.VK_RIGHT || e.getKeyCode() == KeyEvent.VK_KP_RIGHT) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf() && BasicTreeUI.this.tree.isCollapsed(path)) { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } else { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(next, 0))); } } // Enter else if (e.getKeyCode() == KeyEvent.VK_ENTER) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf()) { if (BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } } } } }
7,950
public void keyPressed(KeyEvent e) { TreePath start = BasicTreeUI.this.tree.getLeadSelectionPath(); TreeNode last = null; if (start != null) last = (TreeNode) start.getLastPathComponent(); if (last != null) { // DOWN, KP_DOWN if (e.getKeyCode() == KeyEvent.VK_DOWN || e.getKeyCode() == KeyEvent.VK_KP_DOWN) { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) { TreePath newPath = new TreePath(getPathToRoot(next, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, newPath); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!next.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // UP, KP_UP else if (e.getKeyCode() == KeyEvent.VK_UP || e.getKeyCode() == KeyEvent.VK_KP_UP) { TreeNode prev = (TreeNode) BasicTreeUI.this. getPreviousVisibleNode(last); if (prev != null) { TreePath newPath = new TreePath(getPathToRoot(prev, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(prev, 0))); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!prev.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // LEFT, KP_LEFT else if (e.getKeyCode() == KeyEvent.VK_LEFT || e.getKeyCode() == KeyEvent.VK_KP_LEFT) { TreePath path = new TreePath(getPathToRoot(last, 0)); TreeNode p = last.getParent(); if (!last.isLeaf() && BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else if (p != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(p, 0))); } // RIGHT, KP_RIGHT else if (e.getKeyCode() == KeyEvent.VK_RIGHT || e.getKeyCode() == KeyEvent.VK_KP_RIGHT) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf() && BasicTreeUI.this.tree.isCollapsed(path)) { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } else { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(next, 0))); } } // Enter else if (e.getKeyCode() == KeyEvent.VK_ENTER) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf()) { if (BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } } } } }
public void keyPressed(KeyEvent e) { TreePath start = BasicTreeUI.this.tree.getLeadSelectionPath(); TreeNode last = null; if (start != null) last = (TreeNode) start.getLastPathComponent(); if (last != null) { // DOWN, KP_DOWN if (e.getKeyCode() == KeyEvent.VK_DOWN || e.getKeyCode() == KeyEvent.VK_KP_DOWN) { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) { TreePath newPath = new TreePath(getPathToRoot(next, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, newPath); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!next.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // UP, KP_UP else if (e.getKeyCode() == KeyEvent.VK_UP || e.getKeyCode() == KeyEvent.VK_KP_UP) { TreeNode prev = (TreeNode) BasicTreeUI.this. getPreviousVisibleNode(last); if (prev != null) { TreePath newPath = new TreePath(getPathToRoot(prev, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(prev, 0))); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!prev.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // LEFT, KP_LEFT else if (e.getKeyCode() == KeyEvent.VK_LEFT || e.getKeyCode() == KeyEvent.VK_KP_LEFT) { TreePath path = new TreePath(getPathToRoot(last, 0)); TreeNode p = last.getParent(); if (!mod.isLeaf(last) && BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else if (p != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(p, 0))); } // RIGHT, KP_RIGHT else if (e.getKeyCode() == KeyEvent.VK_RIGHT || e.getKeyCode() == KeyEvent.VK_KP_RIGHT) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf() && BasicTreeUI.this.tree.isCollapsed(path)) { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } else { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(next, 0))); } } // Enter else if (e.getKeyCode() == KeyEvent.VK_ENTER) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf()) { if (BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } } } } }
7,951
public void keyPressed(KeyEvent e) { TreePath start = BasicTreeUI.this.tree.getLeadSelectionPath(); TreeNode last = null; if (start != null) last = (TreeNode) start.getLastPathComponent(); if (last != null) { // DOWN, KP_DOWN if (e.getKeyCode() == KeyEvent.VK_DOWN || e.getKeyCode() == KeyEvent.VK_KP_DOWN) { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) { TreePath newPath = new TreePath(getPathToRoot(next, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, newPath); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!next.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // UP, KP_UP else if (e.getKeyCode() == KeyEvent.VK_UP || e.getKeyCode() == KeyEvent.VK_KP_UP) { TreeNode prev = (TreeNode) BasicTreeUI.this. getPreviousVisibleNode(last); if (prev != null) { TreePath newPath = new TreePath(getPathToRoot(prev, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(prev, 0))); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!prev.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // LEFT, KP_LEFT else if (e.getKeyCode() == KeyEvent.VK_LEFT || e.getKeyCode() == KeyEvent.VK_KP_LEFT) { TreePath path = new TreePath(getPathToRoot(last, 0)); TreeNode p = last.getParent(); if (!last.isLeaf() && BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else if (p != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(p, 0))); } // RIGHT, KP_RIGHT else if (e.getKeyCode() == KeyEvent.VK_RIGHT || e.getKeyCode() == KeyEvent.VK_KP_RIGHT) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf() && BasicTreeUI.this.tree.isCollapsed(path)) { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } else { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(next, 0))); } } // Enter else if (e.getKeyCode() == KeyEvent.VK_ENTER) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf()) { if (BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } } } } }
public void keyPressed(KeyEvent e) { TreePath start = BasicTreeUI.this.tree.getLeadSelectionPath(); TreeNode last = null; if (start != null) last = (TreeNode) start.getLastPathComponent(); if (last != null) { // DOWN, KP_DOWN if (e.getKeyCode() == KeyEvent.VK_DOWN || e.getKeyCode() == KeyEvent.VK_KP_DOWN) { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) { TreePath newPath = new TreePath(getPathToRoot(next, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, newPath); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!next.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // UP, KP_UP else if (e.getKeyCode() == KeyEvent.VK_UP || e.getKeyCode() == KeyEvent.VK_KP_UP) { TreeNode prev = (TreeNode) BasicTreeUI.this. getPreviousVisibleNode(last); if (prev != null) { TreePath newPath = new TreePath(getPathToRoot(prev, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(prev, 0))); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!prev.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // LEFT, KP_LEFT else if (e.getKeyCode() == KeyEvent.VK_LEFT || e.getKeyCode() == KeyEvent.VK_KP_LEFT) { TreePath path = new TreePath(getPathToRoot(last, 0)); TreeNode p = last.getParent(); if (!last.isLeaf() && BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else if (p != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(p, 0))); } // RIGHT, KP_RIGHT else if (e.getKeyCode() == KeyEvent.VK_RIGHT || e.getKeyCode() == KeyEvent.VK_KP_RIGHT) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!mod.isLeaf(last) && BasicTreeUI.this.tree.isCollapsed(path)) { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } else { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(next, 0))); } } // Enter else if (e.getKeyCode() == KeyEvent.VK_ENTER) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf()) { if (BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } } } } }
7,952
public void keyPressed(KeyEvent e) { TreePath start = BasicTreeUI.this.tree.getLeadSelectionPath(); TreeNode last = null; if (start != null) last = (TreeNode) start.getLastPathComponent(); if (last != null) { // DOWN, KP_DOWN if (e.getKeyCode() == KeyEvent.VK_DOWN || e.getKeyCode() == KeyEvent.VK_KP_DOWN) { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) { TreePath newPath = new TreePath(getPathToRoot(next, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, newPath); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!next.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // UP, KP_UP else if (e.getKeyCode() == KeyEvent.VK_UP || e.getKeyCode() == KeyEvent.VK_KP_UP) { TreeNode prev = (TreeNode) BasicTreeUI.this. getPreviousVisibleNode(last); if (prev != null) { TreePath newPath = new TreePath(getPathToRoot(prev, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(prev, 0))); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!prev.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // LEFT, KP_LEFT else if (e.getKeyCode() == KeyEvent.VK_LEFT || e.getKeyCode() == KeyEvent.VK_KP_LEFT) { TreePath path = new TreePath(getPathToRoot(last, 0)); TreeNode p = last.getParent(); if (!last.isLeaf() && BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else if (p != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(p, 0))); } // RIGHT, KP_RIGHT else if (e.getKeyCode() == KeyEvent.VK_RIGHT || e.getKeyCode() == KeyEvent.VK_KP_RIGHT) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf() && BasicTreeUI.this.tree.isCollapsed(path)) { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } else { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(next, 0))); } } // Enter else if (e.getKeyCode() == KeyEvent.VK_ENTER) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf()) { if (BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } } } } }
public void keyPressed(KeyEvent e) { TreePath start = BasicTreeUI.this.tree.getLeadSelectionPath(); TreeNode last = null; if (start != null) last = (TreeNode) start.getLastPathComponent(); if (last != null) { // DOWN, KP_DOWN if (e.getKeyCode() == KeyEvent.VK_DOWN || e.getKeyCode() == KeyEvent.VK_KP_DOWN) { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) { TreePath newPath = new TreePath(getPathToRoot(next, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, newPath); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!next.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // UP, KP_UP else if (e.getKeyCode() == KeyEvent.VK_UP || e.getKeyCode() == KeyEvent.VK_KP_UP) { TreeNode prev = (TreeNode) BasicTreeUI.this. getPreviousVisibleNode(last); if (prev != null) { TreePath newPath = new TreePath(getPathToRoot(prev, 0)); BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(prev, 0))); if (e.isControlDown()) tree.setLeadSelectionPath(newPath); else if (!prev.isLeaf() && e.isShiftDown()) { BasicTreeUI.this.tree.expandPath(newPath); BasicTreeUI.this.tree.fireTreeExpanded(newPath); } } } // LEFT, KP_LEFT else if (e.getKeyCode() == KeyEvent.VK_LEFT || e.getKeyCode() == KeyEvent.VK_KP_LEFT) { TreePath path = new TreePath(getPathToRoot(last, 0)); TreeNode p = last.getParent(); if (!last.isLeaf() && BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else if (p != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(p, 0))); } // RIGHT, KP_RIGHT else if (e.getKeyCode() == KeyEvent.VK_RIGHT || e.getKeyCode() == KeyEvent.VK_KP_RIGHT) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!last.isLeaf() && BasicTreeUI.this.tree.isCollapsed(path)) { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } else { TreeNode next = (TreeNode) BasicTreeUI.this. getNextVisibleNode(last); if (next != null) BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, new TreePath(getPathToRoot(next, 0))); } } // Enter else if (e.getKeyCode() == KeyEvent.VK_ENTER) { TreePath path = new TreePath(getPathToRoot(last, 0)); if (!mod.isLeaf(last)) { if (BasicTreeUI.this.tree.isExpanded(path)) { BasicTreeUI.this.tree.collapsePath(path); BasicTreeUI.this.tree.fireTreeCollapsed(path); } else { BasicTreeUI.this.tree.expandPath(path); BasicTreeUI.this.tree.fireTreeExpanded(path); } } } } }
7,953
Point getCellLocation(int x, int y, JTree tree, TreeModel mod, Object node, Object startNode) { int rowHeight = getRowHeight(); if (startNode == null || startNode.equals(node)) { if (!tree.isRootVisible() && tree.isExpanded(new TreePath(mod.getRoot()))) return new Point(x + ((getLevel((TreeNode) node)) * rightChildIndent), y); return new Point(x + ((getLevel((TreeNode) node) + 1) * rightChildIndent), y); } if (!mod.isLeaf(startNode) && tree.isExpanded(new TreePath(getPathToRoot(((TreeNode) startNode), 0)))) { Object child = mod.getChild(startNode, 0); if (child != null) return getCellLocation(x, y + rowHeight, tree, mod, node, child); } return getCellLocation(x, y + rowHeight, tree, mod, node, getNextVisibleNode((TreeNode) startNode)); }
Point getCellLocation(int x, int y, JTree tree, TreeModel mod, Object node, Object startNode) { int rowHeight = getRowHeight(); if (startNode == null || startNode.equals(node)) { if (!tree.isRootVisible() && tree.isExpanded(new TreePath(mod.getRoot()))) return new Point(x + ((getLevel((TreeNode) node)) * rightChildIndent), y); return new Point(x + ((getLevel((TreeNode) node) + 1) * rightChildIndent), y); } if (!mod.isLeaf(startNode) && tree.isExpanded(new TreePath(getPathToRoot(((TreeNode) startNode), 0)))) { Object child = mod.getChild(startNode, 0); if (child != null) return getCellLocation(x, y + rowHeight, tree, mod, node, child); } return getCellLocation(x, y + rowHeight, tree, mod, node, getNextVisibleNode((TreeNode) startNode)); }
7,956
Point getCellLocation(int x, int y, JTree tree, TreeModel mod, Object node, Object startNode) { int rowHeight = getRowHeight(); if (startNode == null || startNode.equals(node)) { if (!tree.isRootVisible() && tree.isExpanded(new TreePath(mod.getRoot()))) return new Point(x + ((getLevel((TreeNode) node)) * rightChildIndent), y); return new Point(x + ((getLevel((TreeNode) node) + 1) * rightChildIndent), y); } if (!mod.isLeaf(startNode) && tree.isExpanded(new TreePath(getPathToRoot(((TreeNode) startNode), 0)))) { Object child = mod.getChild(startNode, 0); if (child != null) return getCellLocation(x, y + rowHeight, tree, mod, node, child); } return getCellLocation(x, y + rowHeight, tree, mod, node, getNextVisibleNode((TreeNode) startNode)); }
Point getCellLocation(int x, int y, JTree tree, TreeModel mod, Object node, Object startNode) { int rowHeight = getRowHeight(); if (startNode == null || startNode.equals(node)) { if (!tree.isRootVisible() && tree.isExpanded(new TreePath(mod.getRoot()))) return new Point(x + ((getLevel((TreeNode) node)) * rightChildIndent), y); return new Point(x + ((getLevel((TreeNode) node) + 1) * rightChildIndent), y); } if (!mod.isLeaf(startNode) && tree.isExpanded(new TreePath(getPathToRoot(((TreeNode) startNode), 0)))) { Object child = mod.getChild(startNode, 0); if (child != null) return getCellLocation(x, y + rowHeight, tree, mod, node, child); } return getCellLocation(x, y + rowHeight, tree, mod, node, getNextVisibleNode((TreeNode) startNode)); }
7,957
Point getCellLocation(int x, int y, JTree tree, TreeModel mod, Object node, Object startNode) { int rowHeight = getRowHeight(); if (startNode == null || startNode.equals(node)) { if (!tree.isRootVisible() && tree.isExpanded(new TreePath(mod.getRoot()))) return new Point(x + ((getLevel((TreeNode) node)) * rightChildIndent), y); return new Point(x + ((getLevel((TreeNode) node) + 1) * rightChildIndent), y); } if (!mod.isLeaf(startNode) && tree.isExpanded(new TreePath(getPathToRoot(((TreeNode) startNode), 0)))) { Object child = mod.getChild(startNode, 0); if (child != null) return getCellLocation(x, y + rowHeight, tree, mod, node, child); } return getCellLocation(x, y + rowHeight, tree, mod, node, getNextVisibleNode((TreeNode) startNode)); }
Point getCellLocation(int x, int y, JTree tree, TreeModel mod, Object node, Object startNode) { int rowHeight = getRowHeight(); if (startNode == null || startNode.equals(node)) { if (!tree.isRootVisible() && tree.isExpanded(new TreePath(mod.getRoot()))) return new Point(x + ((getLevel((TreeNode) node)) * rightChildIndent), y); return new Point(x + ((getLevel((TreeNode) node) + 1) * rightChildIndent), y); } if (!mod.isLeaf(startNode) && tree.isExpanded(new TreePath(getPathToRoot(((TreeNode) startNode), 0)))) { Object child = mod.getChild(startNode, 0); if (child != null) return getCellLocation(x, y + rowHeight, tree, mod, node, child); } return getCellLocation(x, y + rowHeight, tree, mod, node, getNextVisibleNode((TreeNode) startNode)); }
7,958
Point getCellLocation(int x, int y, JTree tree, TreeModel mod, Object node, Object startNode) { int rowHeight = getRowHeight(); if (startNode == null || startNode.equals(node)) { if (!tree.isRootVisible() && tree.isExpanded(new TreePath(mod.getRoot()))) return new Point(x + ((getLevel((TreeNode) node)) * rightChildIndent), y); return new Point(x + ((getLevel((TreeNode) node) + 1) * rightChildIndent), y); } if (!mod.isLeaf(startNode) && tree.isExpanded(new TreePath(getPathToRoot(((TreeNode) startNode), 0)))) { Object child = mod.getChild(startNode, 0); if (child != null) return getCellLocation(x, y + rowHeight, tree, mod, node, child); } return getCellLocation(x, y + rowHeight, tree, mod, node, getNextVisibleNode((TreeNode) startNode)); }
Point getCellLocation(int x, int y, JTree tree, TreeModel mod, Object node, Object startNode) { int rowHeight = getRowHeight(); if (startNode == null || startNode.equals(node)) { if (!tree.isRootVisible() && tree.isExpanded(new TreePath(mod.getRoot()))) return new Point(x + ((getLevel((TreeNode) node)) * rightChildIndent), y); return new Point(x + ((getLevel((TreeNode) node) + 1) * rightChildIndent), y); } if (!mod.isLeaf(startNode) && tree.isExpanded(new TreePath(getPathToRoot(((TreeNode) startNode), 0)))) { Object child = mod.getChild(startNode, 0); if (child != null) return getCellLocation(x, y + rowHeight, tree, mod, node, child); } return getCellLocation(x, y + rowHeight, tree, mod, node, getNextVisibleNode(startNode)); }
7,959
public int getLevel(TreeNode node) { int count = -1; TreeNode current = node; do { current = current.getParent(); count++; } while (current != null); return count; }
int getLevel(Object node) { int count = -1; TreeNode current = node; do { current = current.getParent(); count++; } while (current != null); return count; }
7,960
public int getLevel(TreeNode node) { int count = -1; TreeNode current = node; do { current = current.getParent(); count++; } while (current != null); return count; }
public int getLevel(TreeNode node) { int count = -1; Object current = node; do { current = current.getParent(); count++; } while (current != null); return count; }
7,961
public int getLevel(TreeNode node) { int count = -1; TreeNode current = node; do { current = current.getParent(); count++; } while (current != null); return count; }
public int getLevel(TreeNode node) { int count = -1; TreeNode current = node; do { current = getParent(tree.getModel().getRoot(), current); count++; } while (current != null); return count; }
7,962
TreeNode getNextNode(TreeNode curr) { if (curr.getChildCount() != 0) return curr.getChildAt(0); TreeNode node = curr; TreeNode sibling; do { sibling = getNextSibling(node); node = node.getParent(); } while (sibling == null && node != null); return sibling; }
Object getNextNode(Object curr) { if (curr.getChildCount() != 0) return curr.getChildAt(0); TreeNode node = curr; TreeNode sibling; do { sibling = getNextSibling(node); node = node.getParent(); } while (sibling == null && node != null); return sibling; }
7,963
TreeNode getNextNode(TreeNode curr) { if (curr.getChildCount() != 0) return curr.getChildAt(0); TreeNode node = curr; TreeNode sibling; do { sibling = getNextSibling(node); node = node.getParent(); } while (sibling == null && node != null); return sibling; }
TreeNode getNextNode(TreeNode curr) { if (curr.getChildCount() != 0) return curr.getChildAt(0); TreeNode node = curr; TreeNode sibling; do { sibling = getNextSibling(node); node = node.getParent(); } while (sibling == null && node != null); return sibling; }
7,964
TreeNode getNextNode(TreeNode curr) { if (curr.getChildCount() != 0) return curr.getChildAt(0); TreeNode node = curr; TreeNode sibling; do { sibling = getNextSibling(node); node = node.getParent(); } while (sibling == null && node != null); return sibling; }
TreeNode getNextNode(TreeNode curr) { if (curr.getChildCount() != 0) return curr.getChildAt(0); TreeNode node = curr; TreeNode sibling; do { sibling = getNextSibling(node); node = node.getParent(); } while (sibling == null && node != null); return sibling; }
7,965
TreeNode getNextNode(TreeNode curr) { if (curr.getChildCount() != 0) return curr.getChildAt(0); TreeNode node = curr; TreeNode sibling; do { sibling = getNextSibling(node); node = node.getParent(); } while (sibling == null && node != null); return sibling; }
TreeNode getNextNode(TreeNode curr) { if (curr.getChildCount() != 0) return curr.getChildAt(0); TreeNode node = curr; TreeNode sibling; do { sibling = getNextSibling(node); node = getParent(mod.getRoot(), node); } while (sibling == null && node != null); return sibling; }
7,966
TreeNode getNextSibling(TreeNode node) { TreeNode parent = node.getParent(); if (parent == null) return null; int index = parent.getIndex(node) + 1; if (index == parent.getChildCount()) return null; return parent.getChildAt(index); }
Object getNextSibling(Object node) { TreeNode parent = node.getParent(); if (parent == null) return null; int index = parent.getIndex(node) + 1; if (index == parent.getChildCount()) return null; return parent.getChildAt(index); }
7,967
TreeNode getNextSibling(TreeNode node) { TreeNode parent = node.getParent(); if (parent == null) return null; int index = parent.getIndex(node) + 1; if (index == parent.getChildCount()) return null; return parent.getChildAt(index); }
TreeNode getNextSibling(TreeNode node) { TreeModel mod = tree.getModel(); Object parent = getParent(mod.getRoot(), node); if (parent == null) return null; int index = parent.getIndex(node) + 1; if (index == parent.getChildCount()) return null; return parent.getChildAt(index); }
7,968
TreeNode getNextSibling(TreeNode node) { TreeNode parent = node.getParent(); if (parent == null) return null; int index = parent.getIndex(node) + 1; if (index == parent.getChildCount()) return null; return parent.getChildAt(index); }
TreeNode getNextSibling(TreeNode node) { TreeNode parent = node.getParent(); if (parent == null) return null; int index = mod.getIndexOfChild(parent, node) + 1; if (index == parent.getChildCount()) return null; return parent.getChildAt(index); }
7,969
TreeNode getNextSibling(TreeNode node) { TreeNode parent = node.getParent(); if (parent == null) return null; int index = parent.getIndex(node) + 1; if (index == parent.getChildCount()) return null; return parent.getChildAt(index); }
TreeNode getNextSibling(TreeNode node) { TreeNode parent = node.getParent(); if (parent == null) return null; int index = parent.getIndex(node) + 1; if (index == 0 || index >= mod.getChildCount(parent)) return null; return parent.getChildAt(index); }
7,970
TreeNode getNextSibling(TreeNode node) { TreeNode parent = node.getParent(); if (parent == null) return null; int index = parent.getIndex(node) + 1; if (index == parent.getChildCount()) return null; return parent.getChildAt(index); }
TreeNode getNextSibling(TreeNode node) { TreeNode parent = node.getParent(); if (parent == null) return null; int index = parent.getIndex(node) + 1; if (index == parent.getChildCount()) return null; return mod.getChild(parent, index); }
7,971
TreeNode getNextVisibleNode(TreeNode node) { TreeNode next = null; TreePath current = null; if (node != null) next = getNextNode(node); if (next != null) { current = new TreePath(getPathToRoot(next, 0)); if (tree.isVisible(current)) return next; while (next != null && !tree.isVisible(current)) { next = getNextNode(next); if (next != null) current = new TreePath(getPathToRoot(next, 0)); } } return next; }
Object getNextVisibleNode(Object node) { TreeNode next = null; TreePath current = null; if (node != null) next = getNextNode(node); if (next != null) { current = new TreePath(getPathToRoot(next, 0)); if (tree.isVisible(current)) return next; while (next != null && !tree.isVisible(current)) { next = getNextNode(next); if (next != null) current = new TreePath(getPathToRoot(next, 0)); } } return next; }
7,972
TreeNode getNextVisibleNode(TreeNode node) { TreeNode next = null; TreePath current = null; if (node != null) next = getNextNode(node); if (next != null) { current = new TreePath(getPathToRoot(next, 0)); if (tree.isVisible(current)) return next; while (next != null && !tree.isVisible(current)) { next = getNextNode(next); if (next != null) current = new TreePath(getPathToRoot(next, 0)); } } return next; }
TreeNode getNextVisibleNode(TreeNode node) { Object next = null; TreePath current = null; if (node != null) next = getNextNode(node); if (next != null) { current = new TreePath(getPathToRoot(next, 0)); if (tree.isVisible(current)) return next; while (next != null && !tree.isVisible(current)) { next = getNextNode(next); if (next != null) current = new TreePath(getPathToRoot(next, 0)); } } return next; }
7,973
public Rectangle getPathBounds(JTree tree, TreePath path) { if (path != null) { Object cell = path.getLastPathComponent(); TreeModel mod = tree.getModel(); TreeNode root = (TreeNode) mod.getRoot(); if (!tree.isRootVisible() && tree.isExpanded(new TreePath(root))) root = getNextNode(root); Point loc = getCellLocation(0, 0, tree, mod, cell, root); return getCellBounds(loc.x, loc.y, cell); } return null; }
public Rectangle getPathBounds(JTree tree, TreePath path) { if (path != null) { Object cell = path.getLastPathComponent(); TreeModel mod = tree.getModel(); TreeNode root = (TreeNode) mod.getRoot(); if (!tree.isRootVisible() && tree.isExpanded(new TreePath(root))) root = getNextNode(root); Point loc = getCellLocation(0, 0, tree, mod, cell, root); return getCellBounds(loc.x, loc.y, cell); } return null; }
7,974
public TreePath getPathForRow(JTree tree, int row) { TreeNode node = ((TreeNode) (tree.getModel()).getRoot()); if (!tree.isRootVisible() && tree.isExpanded(new TreePath(getPathToRoot(node, 0)))) node = getNextNode(node); for (int i = 0; i < row; i++) node = getNextVisibleNode(node); // in case nothing was found if (node == null) return null; // something was found return new TreePath(getPathToRoot(node, 0)); }
public TreePath getPathForRow(JTree tree, int row) { TreeModel mod = tree.getModel(); if (mod != null) { Object node = mod.getRoot(); if (!tree.isRootVisible() && tree.isExpanded(new TreePath(getPathToRoot(node, 0)))) node = getNextNode(node); for (int i = 0; i < row; i++) node = getNextVisibleNode(node); // in case nothing was found if (node == null) return null; // something was found return new TreePath(getPathToRoot(node, 0)); }
7,976
TreeNode[] getPathToRoot(TreeNode node, int depth) { if (node == null) { if (depth == 0) return null; return new TreeNode[depth]; } TreeNode[] path = getPathToRoot(node.getParent(), depth + 1); path[path.length - depth - 1] = node; return path; }
Object[] getPathToRoot(Object node, int depth) { if (node == null) { if (depth == 0) return null; return new TreeNode[depth]; } TreeNode[] path = getPathToRoot(node.getParent(), depth + 1); path[path.length - depth - 1] = node; return path; }
7,978
TreeNode[] getPathToRoot(TreeNode node, int depth) { if (node == null) { if (depth == 0) return null; return new TreeNode[depth]; } TreeNode[] path = getPathToRoot(node.getParent(), depth + 1); path[path.length - depth - 1] = node; return path; }
TreeNode[] getPathToRoot(TreeNode node, int depth) { if (node == null) { if (depth == 0) return null; return new Object[depth]; } TreeNode[] path = getPathToRoot(node.getParent(), depth + 1); path[path.length - depth - 1] = node; return path; }
7,979
TreeNode[] getPathToRoot(TreeNode node, int depth) { if (node == null) { if (depth == 0) return null; return new TreeNode[depth]; } TreeNode[] path = getPathToRoot(node.getParent(), depth + 1); path[path.length - depth - 1] = node; return path; }
TreeNode[] getPathToRoot(TreeNode node, int depth) { if (node == null) { if (depth == 0) return null; return new TreeNode[depth]; } Object[] path = getPathToRoot(getParent(mod.getRoot(), node), depth + 1); path[path.length - depth - 1] = node; return path; }
7,980
TreeNode getPreviousNode(TreeNode node) { TreeNode parent = node.getParent(); if (parent == null) return null; TreeNode sibling = getPreviousSibling(node); if (sibling == null) return parent; int size = sibling.getChildCount(); while (size > 0) { sibling = sibling.getChildAt(size - 1); size = sibling.getChildCount(); } return sibling; }
Object getPreviousNode(Object node) { TreeNode parent = node.getParent(); if (parent == null) return null; TreeNode sibling = getPreviousSibling(node); if (sibling == null) return parent; int size = sibling.getChildCount(); while (size > 0) { sibling = sibling.getChildAt(size - 1); size = sibling.getChildCount(); } return sibling; }
7,981
TreeNode getPreviousNode(TreeNode node) { TreeNode parent = node.getParent(); if (parent == null) return null; TreeNode sibling = getPreviousSibling(node); if (sibling == null) return parent; int size = sibling.getChildCount(); while (size > 0) { sibling = sibling.getChildAt(size - 1); size = sibling.getChildCount(); } return sibling; }
TreeNode getPreviousNode(TreeNode node) { TreeModel mod = tree.getModel(); Object parent = getParent(mod.getRoot(), node); if (parent == null) return null; TreeNode sibling = getPreviousSibling(node); if (sibling == null) return parent; int size = sibling.getChildCount(); while (size > 0) { sibling = sibling.getChildAt(size - 1); size = sibling.getChildCount(); } return sibling; }
7,982
TreeNode getPreviousNode(TreeNode node) { TreeNode parent = node.getParent(); if (parent == null) return null; TreeNode sibling = getPreviousSibling(node); if (sibling == null) return parent; int size = sibling.getChildCount(); while (size > 0) { sibling = sibling.getChildAt(size - 1); size = sibling.getChildCount(); } return sibling; }
TreeNode getPreviousNode(TreeNode node) { TreeNode parent = node.getParent(); if (parent == null) return null; Object sibling = getPreviousSibling(node); if (sibling == null) return parent; int size = sibling.getChildCount(); while (size > 0) { sibling = sibling.getChildAt(size - 1); size = sibling.getChildCount(); } return sibling; }
7,983
TreeNode getPreviousNode(TreeNode node) { TreeNode parent = node.getParent(); if (parent == null) return null; TreeNode sibling = getPreviousSibling(node); if (sibling == null) return parent; int size = sibling.getChildCount(); while (size > 0) { sibling = sibling.getChildAt(size - 1); size = sibling.getChildCount(); } return sibling; }
TreeNode getPreviousNode(TreeNode node) { TreeNode parent = node.getParent(); if (parent == null) return null; TreeNode sibling = getPreviousSibling(node); if (sibling == null) return parent; int size = mod.getChildCount(sibling); while (size > 0) { sibling = sibling.getChildAt(size - 1); size = sibling.getChildCount(); } return sibling; }
7,984
TreeNode getPreviousNode(TreeNode node) { TreeNode parent = node.getParent(); if (parent == null) return null; TreeNode sibling = getPreviousSibling(node); if (sibling == null) return parent; int size = sibling.getChildCount(); while (size > 0) { sibling = sibling.getChildAt(size - 1); size = sibling.getChildCount(); } return sibling; }
TreeNode getPreviousNode(TreeNode node) { TreeNode parent = node.getParent(); if (parent == null) return null; TreeNode sibling = getPreviousSibling(node); if (sibling == null) return parent; int size = sibling.getChildCount(); while (size > 0) { sibling = sibling.getChildAt(size - 1); size = sibling.getChildCount(); } return sibling; }
7,985
TreeNode getPreviousSibling(TreeNode node) { TreeNode parent = node.getParent(); if (parent == null) return null; int index = parent.getIndex(node) - 1; if (index < 0) return null; return parent.getChildAt(index); }
Object getPreviousSibling(Object node) { TreeNode parent = node.getParent(); if (parent == null) return null; int index = parent.getIndex(node) - 1; if (index < 0) return null; return parent.getChildAt(index); }
7,986
TreeNode getPreviousSibling(TreeNode node) { TreeNode parent = node.getParent(); if (parent == null) return null; int index = parent.getIndex(node) - 1; if (index < 0) return null; return parent.getChildAt(index); }
TreeNode getPreviousSibling(TreeNode node) { TreeModel mod = tree.getModel(); Object parent = getParent(mod.getRoot(), node); if (parent == null) return null; int index = parent.getIndex(node) - 1; if (index < 0) return null; return parent.getChildAt(index); }
7,987
TreeNode getPreviousSibling(TreeNode node) { TreeNode parent = node.getParent(); if (parent == null) return null; int index = parent.getIndex(node) - 1; if (index < 0) return null; return parent.getChildAt(index); }
TreeNode getPreviousSibling(TreeNode node) { TreeNode parent = node.getParent(); if (parent == null) return null; int index = mod.getIndexOfChild(parent, node) - 1; if (index < 0) return null; return parent.getChildAt(index); }
7,988
TreeNode getPreviousSibling(TreeNode node) { TreeNode parent = node.getParent(); if (parent == null) return null; int index = parent.getIndex(node) - 1; if (index < 0) return null; return parent.getChildAt(index); }
TreeNode getPreviousSibling(TreeNode node) { TreeNode parent = node.getParent(); if (parent == null) return null; int index = parent.getIndex(node) - 1; if (index < 0 || index >= mod.getChildCount(parent)) return null; return parent.getChildAt(index); }
7,989
TreeNode getPreviousSibling(TreeNode node) { TreeNode parent = node.getParent(); if (parent == null) return null; int index = parent.getIndex(node) - 1; if (index < 0) return null; return parent.getChildAt(index); }
TreeNode getPreviousSibling(TreeNode node) { TreeNode parent = node.getParent(); if (parent == null) return null; int index = parent.getIndex(node) - 1; if (index < 0) return null; return mod.getChild(parent, index); }
7,990
TreeNode getPreviousVisibleNode(TreeNode node) { TreeNode prev = null; TreePath current = null; if (node != null) prev = getPreviousNode(node); if (prev != null) { current = new TreePath(getPathToRoot(prev, 0)); if (tree.isVisible(current)) return prev; while (prev != null && !tree.isVisible(current)) { prev = getPreviousNode(prev); if (prev != null) current = new TreePath(getPathToRoot(prev, 0)); } } return prev; }
Object getPreviousVisibleNode(Object node) { TreeNode prev = null; TreePath current = null; if (node != null) prev = getPreviousNode(node); if (prev != null) { current = new TreePath(getPathToRoot(prev, 0)); if (tree.isVisible(current)) return prev; while (prev != null && !tree.isVisible(current)) { prev = getPreviousNode(prev); if (prev != null) current = new TreePath(getPathToRoot(prev, 0)); } } return prev; }
7,991
TreeNode getPreviousVisibleNode(TreeNode node) { TreeNode prev = null; TreePath current = null; if (node != null) prev = getPreviousNode(node); if (prev != null) { current = new TreePath(getPathToRoot(prev, 0)); if (tree.isVisible(current)) return prev; while (prev != null && !tree.isVisible(current)) { prev = getPreviousNode(prev); if (prev != null) current = new TreePath(getPathToRoot(prev, 0)); } } return prev; }
TreeNode getPreviousVisibleNode(TreeNode node) { Object prev = null; TreePath current = null; if (node != null) prev = getPreviousNode(node); if (prev != null) { current = new TreePath(getPathToRoot(prev, 0)); if (tree.isVisible(current)) return prev; while (prev != null && !tree.isVisible(current)) { prev = getPreviousNode(prev); if (prev != null) current = new TreePath(getPathToRoot(prev, 0)); } } return prev; }
7,992
public int getRowCount(JTree tree) { TreeNode node = ((TreeNode) (tree.getModel()) .getRoot()); if (!tree.isRootVisible() && tree.isExpanded(new TreePath((getPathToRoot(node, 0))))) node = getNextNode(node); int count = 0; while (node != null) { count++; node = getNextVisibleNode(node); } return count; }
public int getRowCount(JTree tree) { TreeNode node = ((TreeNode) (tree.getModel()) .getRoot()); if (!tree.isRootVisible() && tree.isExpanded(new TreePath((getPathToRoot(node, 0))))) node = getNextNode(node); int count = 0; while (node != null) { count++; node = getNextVisibleNode(node); } return count; }
7,993
public int getRowCount(JTree tree) { TreeNode node = ((TreeNode) (tree.getModel()) .getRoot()); if (!tree.isRootVisible() && tree.isExpanded(new TreePath((getPathToRoot(node, 0))))) node = getNextNode(node); int count = 0; while (node != null) { count++; node = getNextVisibleNode(node); } return count; }
public int getRowCount(JTree tree) { TreeNode node = ((TreeNode) (tree.getModel()) .getRoot()); if (!tree.isRootVisible() && tree.isExpanded(new TreePath((getPathToRoot(node, 0))))) node = getNextNode(node); while (node != null) { count++; node = getNextVisibleNode(node); } return count; }
7,994
public void installUI(JComponent c) { super.installUI(c); installDefaults((JTree) c); tree = (JTree) c; setModel(tree.getModel()); tree.setRootVisible(true); tree.expandPath(new TreePath(tree.getModel().getRoot())); treeSelectionModel = tree.getSelectionModel(); installListeners(); installKeyboardActions(); completeUIInstall(); }
public void installUI(JComponent c) { super.installUI(c); installDefaults((JTree) c); tree = (JTree) c; TreeModel mod = tree.getModel(); setModel(mod); tree.setRootVisible(true); tree.expandPath(new TreePath(tree.getModel().getRoot())); treeSelectionModel = tree.getSelectionModel(); installListeners(); installKeyboardActions(); completeUIInstall(); }
7,997
public void installUI(JComponent c) { super.installUI(c); installDefaults((JTree) c); tree = (JTree) c; setModel(tree.getModel()); tree.setRootVisible(true); tree.expandPath(new TreePath(tree.getModel().getRoot())); treeSelectionModel = tree.getSelectionModel(); installListeners(); installKeyboardActions(); completeUIInstall(); }
public void installUI(JComponent c) { super.installUI(c); installDefaults((JTree) c); tree = (JTree) c; setModel(tree.getModel()); tree.setRootVisible(true); if (mod != null) tree.expandPath(new TreePath(mod.getRoot())); treeSelectionModel = tree.getSelectionModel(); installListeners(); installKeyboardActions(); completeUIInstall(); }
7,998
protected boolean isLeaf(int row) { TreePath pathForRow = getPathForRow(tree, row); if (pathForRow == null) return true; Object node = pathForRow.getLastPathComponent(); if (node instanceof TreeNode) return ((TreeNode) node).isLeaf(); else return true; }
protected boolean isLeaf(int row) { TreePath pathForRow = getPathForRow(tree, row); if (pathForRow == null) return true; Object node = pathForRow.getLastPathComponent(); if (node instanceof TreeNode) return ((TreeNode) node).isLeaf(); else return true; }
7,999
int paintControlIcons(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object node) { int h = descent; int rowHeight = getRowHeight(); Icon ei = UIManager.getLookAndFeelDefaults() .getIcon("Tree.expandedIcon"); Icon ci = UIManager.getLookAndFeelDefaults() .getIcon("Tree.collapsedIcon"); Rectangle clip = g.getClipBounds(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; if (mod.isLeaf(node)) descent += rowHeight; else { if (depth > 0 || tree.isRootVisible()) descent += rowHeight; int max = mod.getChildCount(node); if (tree.isExpanded(new TreePath(getPathToRoot(((TreeNode) node), 0)))) { if (!node.equals(mod.getRoot())) drawCentered(tree, g, ei, indentation - rightChildIndent - 3, h); for (int i = 0; i < max; ++i) { int indent = indentation + rightChildIndent; if (depth == 0 && !tree.isRootVisible()) indent = -1; descent = paintControlIcons(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(node, i)); } } else if (!node.equals(mod.getRoot())) drawCentered(tree, g, ei, indentation - rightChildIndent - 3, descent - getRowHeight()); } return descent; }
int paintControlIcons(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object node) { int h = descent; int rowHeight = getRowHeight(); Icon ei = UIManager.getLookAndFeelDefaults() .getIcon("Tree.expandedIcon"); Icon ci = UIManager.getLookAndFeelDefaults() .getIcon("Tree.collapsedIcon"); Rectangle clip = g.getClipBounds(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; if (mod.isLeaf(node)) descent += rowHeight; else { if (depth > 0 || tree.isRootVisible()) descent += rowHeight; int max = mod.getChildCount(node); if (tree.isExpanded(new TreePath(getPathToRoot(node, 0)))) { if (!node.equals(mod.getRoot())) drawCentered(tree, g, ei, indentation - rightChildIndent - 3, h); for (int i = 0; i < max; ++i) { int indent = indentation + rightChildIndent; if (depth == 0 && !tree.isRootVisible()) indent = -1; descent = paintControlIcons(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(node, i)); } } else if (!node.equals(mod.getRoot())) drawCentered(tree, g, ei, indentation - rightChildIndent - 3, descent - getRowHeight()); } return descent; }
8,001
int paintControlIcons(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object node) { int h = descent; int rowHeight = getRowHeight(); Icon ei = UIManager.getLookAndFeelDefaults() .getIcon("Tree.expandedIcon"); Icon ci = UIManager.getLookAndFeelDefaults() .getIcon("Tree.collapsedIcon"); Rectangle clip = g.getClipBounds(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; if (mod.isLeaf(node)) descent += rowHeight; else { if (depth > 0 || tree.isRootVisible()) descent += rowHeight; int max = mod.getChildCount(node); if (tree.isExpanded(new TreePath(getPathToRoot(((TreeNode) node), 0)))) { if (!node.equals(mod.getRoot())) drawCentered(tree, g, ei, indentation - rightChildIndent - 3, h); for (int i = 0; i < max; ++i) { int indent = indentation + rightChildIndent; if (depth == 0 && !tree.isRootVisible()) indent = -1; descent = paintControlIcons(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(node, i)); } } else if (!node.equals(mod.getRoot())) drawCentered(tree, g, ei, indentation - rightChildIndent - 3, descent - getRowHeight()); } return descent; }
int paintControlIcons(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object node) { int h = descent; int rowHeight = getRowHeight(); Icon ei = UIManager.getLookAndFeelDefaults() .getIcon("Tree.expandedIcon"); Icon ci = UIManager.getLookAndFeelDefaults() .getIcon("Tree.collapsedIcon"); Rectangle clip = g.getClipBounds(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; if (mod.isLeaf(node)) descent += rowHeight; else { if (depth > 0 || tree.isRootVisible()) descent += rowHeight; int max = mod.getChildCount(node); if (tree.isExpanded(new TreePath(getPathToRoot(((TreeNode) node), 0)))) { if (!node.equals(mod.getRoot())) ei.paintIcon(tree, g, indentation - rightChildIndent - 3, h); for (int i = 0; i < max; ++i) { int indent = indentation + rightChildIndent; if (depth == 0 && !tree.isRootVisible()) indent = -1; descent = paintControlIcons(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(node, i)); } } else if (!node.equals(mod.getRoot())) drawCentered(tree, g, ei, indentation - rightChildIndent - 3, descent - getRowHeight()); } return descent; }
8,002
int paintControlIcons(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object node) { int h = descent; int rowHeight = getRowHeight(); Icon ei = UIManager.getLookAndFeelDefaults() .getIcon("Tree.expandedIcon"); Icon ci = UIManager.getLookAndFeelDefaults() .getIcon("Tree.collapsedIcon"); Rectangle clip = g.getClipBounds(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; if (mod.isLeaf(node)) descent += rowHeight; else { if (depth > 0 || tree.isRootVisible()) descent += rowHeight; int max = mod.getChildCount(node); if (tree.isExpanded(new TreePath(getPathToRoot(((TreeNode) node), 0)))) { if (!node.equals(mod.getRoot())) drawCentered(tree, g, ei, indentation - rightChildIndent - 3, h); for (int i = 0; i < max; ++i) { int indent = indentation + rightChildIndent; if (depth == 0 && !tree.isRootVisible()) indent = -1; descent = paintControlIcons(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(node, i)); } } else if (!node.equals(mod.getRoot())) drawCentered(tree, g, ei, indentation - rightChildIndent - 3, descent - getRowHeight()); } return descent; }
int paintControlIcons(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object node) { int h = descent; int rowHeight = getRowHeight(); Icon ei = UIManager.getLookAndFeelDefaults() .getIcon("Tree.expandedIcon"); Icon ci = UIManager.getLookAndFeelDefaults() .getIcon("Tree.collapsedIcon"); Rectangle clip = g.getClipBounds(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; if (mod.isLeaf(node)) descent += rowHeight; else { if (depth > 0 || tree.isRootVisible()) descent += rowHeight; int max = mod.getChildCount(node); if (tree.isExpanded(new TreePath(getPathToRoot(((TreeNode) node), 0)))) { if (!node.equals(mod.getRoot())) drawCentered(tree, g, ei, indentation - rightChildIndent - 3, h); for (int i = 0; i < max; i++) { int indent = indentation + rightChildIndent; if (depth == 0 && !tree.isRootVisible()) indent = -1; descent = paintControlIcons(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(node, i)); } } else if (!node.equals(mod.getRoot())) drawCentered(tree, g, ei, indentation - rightChildIndent - 3, descent - getRowHeight()); } return descent; }
8,003
int paintControlIcons(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object node) { int h = descent; int rowHeight = getRowHeight(); Icon ei = UIManager.getLookAndFeelDefaults() .getIcon("Tree.expandedIcon"); Icon ci = UIManager.getLookAndFeelDefaults() .getIcon("Tree.collapsedIcon"); Rectangle clip = g.getClipBounds(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; if (mod.isLeaf(node)) descent += rowHeight; else { if (depth > 0 || tree.isRootVisible()) descent += rowHeight; int max = mod.getChildCount(node); if (tree.isExpanded(new TreePath(getPathToRoot(((TreeNode) node), 0)))) { if (!node.equals(mod.getRoot())) drawCentered(tree, g, ei, indentation - rightChildIndent - 3, h); for (int i = 0; i < max; ++i) { int indent = indentation + rightChildIndent; if (depth == 0 && !tree.isRootVisible()) indent = -1; descent = paintControlIcons(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(node, i)); } } else if (!node.equals(mod.getRoot())) drawCentered(tree, g, ei, indentation - rightChildIndent - 3, descent - getRowHeight()); } return descent; }
int paintControlIcons(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object node) { int h = descent; int rowHeight = getRowHeight(); Icon ei = UIManager.getLookAndFeelDefaults() .getIcon("Tree.expandedIcon"); Icon ci = UIManager.getLookAndFeelDefaults() .getIcon("Tree.collapsedIcon"); Rectangle clip = g.getClipBounds(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; if (mod.isLeaf(node)) descent += rowHeight; else { if (depth > 0 || tree.isRootVisible()) descent += rowHeight; int max = mod.getChildCount(node); if (tree.isExpanded(new TreePath(getPathToRoot(((TreeNode) node), 0)))) { if (!node.equals(mod.getRoot())) ci.paintIcon(tree, g, indentation - rightChildIndent - 3, h); for (int i = 0; i < max; ++i) { int indent = indentation + rightChildIndent; if (depth == 0 && !tree.isRootVisible()) indent = -1; descent = paintControlIcons(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(node, i)); } } else if (!node.equals(mod.getRoot())) ci.paintIcon(tree, g, indentation - rightChildIndent - 3, descent - getRowHeight()); } return descent; }
8,004
void paintNode(Graphics g, int x, int y, JTree tree, Object node, boolean isLeaf) { TreePath curr = new TreePath(getPathToRoot(((TreeNode) node), 0)); boolean selected = tree.isPathSelected(curr); boolean expanded = false; boolean hasIcons = false; if (tree.isVisible(curr)) { DefaultTreeCellRenderer dtcr = (DefaultTreeCellRenderer) createDefaultCellRenderer(); if (!isLeaf) expanded = tree.isExpanded(curr); Icon icon = null; if (!isLeaf && expanded) icon = dtcr.getOpenIcon(); else if (!isLeaf && !expanded) icon = dtcr.getClosedIcon(); else icon = dtcr.getLeafIcon(); if (icon.getIconHeight() > -1 && icon.getIconWidth() > -1) hasIcons = true; Component c = dtcr.getTreeCellRendererComponent(tree, node, selected, expanded, isLeaf, 0, false); if (hasIcons) { if (selected) { Rectangle cell = getPathBounds(tree, curr); g.setColor(dtcr.getBackgroundSelectionColor()); g.fillRect(cell.x + icon.getIconWidth()/2, cell.y, cell.width, cell.height); if (curr.equals(tree.getLeadSelectionPath())) { g.setColor(UIManager.getLookAndFeelDefaults().getColor( "Tree.selectionBorderColor")); g.drawRect(cell.x + icon.getIconWidth()/2, cell.y, cell.width, cell.height); } } g.translate(x, y); c.paint(g); g.translate(-x, -y); } else rendererPane.paintComponent(g, c, c.getParent(), getCellBounds(x, y, node)); } }
void paintNode(Graphics g, int x, int y, JTree tree, Object node, boolean isLeaf) { TreePath curr = new TreePath(getPathToRoot(node, 0)); boolean selected = tree.isPathSelected(curr); boolean expanded = false; boolean hasIcons = false; if (tree.isVisible(curr)) { DefaultTreeCellRenderer dtcr = (DefaultTreeCellRenderer) createDefaultCellRenderer(); if (!isLeaf) expanded = tree.isExpanded(curr); Icon icon = null; if (!isLeaf && expanded) icon = dtcr.getOpenIcon(); else if (!isLeaf && !expanded) icon = dtcr.getClosedIcon(); else icon = dtcr.getLeafIcon(); if (icon.getIconHeight() > -1 && icon.getIconWidth() > -1) hasIcons = true; Component c = dtcr.getTreeCellRendererComponent(tree, node, selected, expanded, isLeaf, 0, false); if (hasIcons) { if (selected) { Rectangle cell = getPathBounds(tree, curr); g.setColor(dtcr.getBackgroundSelectionColor()); g.fillRect(cell.x + icon.getIconWidth()/2, cell.y, cell.width, cell.height); if (curr.equals(tree.getLeadSelectionPath())) { g.setColor(UIManager.getLookAndFeelDefaults().getColor( "Tree.selectionBorderColor")); g.drawRect(cell.x + icon.getIconWidth()/2, cell.y, cell.width, cell.height); } } g.translate(x, y); c.paint(g); g.translate(-x, -y); } else rendererPane.paintComponent(g, c, c.getParent(), getCellBounds(x, y, node)); } }
8,005
void paintNode(Graphics g, int x, int y, JTree tree, Object node, boolean isLeaf) { TreePath curr = new TreePath(getPathToRoot(((TreeNode) node), 0)); boolean selected = tree.isPathSelected(curr); boolean expanded = false; boolean hasIcons = false; if (tree.isVisible(curr)) { DefaultTreeCellRenderer dtcr = (DefaultTreeCellRenderer) createDefaultCellRenderer(); if (!isLeaf) expanded = tree.isExpanded(curr); Icon icon = null; if (!isLeaf && expanded) icon = dtcr.getOpenIcon(); else if (!isLeaf && !expanded) icon = dtcr.getClosedIcon(); else icon = dtcr.getLeafIcon(); if (icon.getIconHeight() > -1 && icon.getIconWidth() > -1) hasIcons = true; Component c = dtcr.getTreeCellRendererComponent(tree, node, selected, expanded, isLeaf, 0, false); if (hasIcons) { if (selected) { Rectangle cell = getPathBounds(tree, curr); g.setColor(dtcr.getBackgroundSelectionColor()); g.fillRect(cell.x + icon.getIconWidth()/2, cell.y, cell.width, cell.height); if (curr.equals(tree.getLeadSelectionPath())) { g.setColor(UIManager.getLookAndFeelDefaults().getColor( "Tree.selectionBorderColor")); g.drawRect(cell.x + icon.getIconWidth()/2, cell.y, cell.width, cell.height); } } g.translate(x, y); c.paint(g); g.translate(-x, -y); } else rendererPane.paintComponent(g, c, c.getParent(), getCellBounds(x, y, node)); } }
void paintNode(Graphics g, int x, int y, JTree tree, Object node, boolean isLeaf) { TreePath curr = new TreePath(getPathToRoot(((TreeNode) node), 0)); boolean selected = tree.isPathSelected(curr); boolean expanded = false; boolean hasIcons = false; if (tree.isVisible(curr)) { DefaultTreeCellRenderer dtcr = (DefaultTreeCellRenderer) createDefaultCellRenderer(); if (!isLeaf) expanded = tree.isExpanded(curr); Icon icon = null; if (!isLeaf && expanded) icon = dtcr.getOpenIcon(); else if (!isLeaf && !expanded) icon = dtcr.getClosedIcon(); else icon = dtcr.getLeafIcon(); if (icon.getIconHeight() > -1 && icon.getIconWidth() > -1) hasIcons = true; Component c = dtcr.getTreeCellRendererComponent(tree, node, selected, expanded, isLeaf, 0, false); if (hasIcons) { if (selected) { Rectangle cell = getPathBounds(tree, curr); g.setColor(dtcr.getBackgroundSelectionColor()); g.fillRect(cell.x + icon.getIconWidth()/2, cell.y, cell.width, cell.height); if (curr.equals(tree.getLeadSelectionPath())) { g.setColor(UIManager.getLookAndFeelDefaults().getColor( "Tree.selectionBorderColor")); g.drawRect(cell.x + icon.getIconWidth()/2, cell.y, cell.width, cell.height); } } g.translate(x, y); c.paint(g); g.translate(-x, -y); } else rendererPane.paintComponent(g, c, c.getParent(), getCellBounds(x, y, node)); } }
8,006
void paintNode(Graphics g, int x, int y, JTree tree, Object node, boolean isLeaf) { TreePath curr = new TreePath(getPathToRoot(((TreeNode) node), 0)); boolean selected = tree.isPathSelected(curr); boolean expanded = false; boolean hasIcons = false; if (tree.isVisible(curr)) { DefaultTreeCellRenderer dtcr = (DefaultTreeCellRenderer) createDefaultCellRenderer(); if (!isLeaf) expanded = tree.isExpanded(curr); Icon icon = null; if (!isLeaf && expanded) icon = dtcr.getOpenIcon(); else if (!isLeaf && !expanded) icon = dtcr.getClosedIcon(); else icon = dtcr.getLeafIcon(); if (icon.getIconHeight() > -1 && icon.getIconWidth() > -1) hasIcons = true; Component c = dtcr.getTreeCellRendererComponent(tree, node, selected, expanded, isLeaf, 0, false); if (hasIcons) { if (selected) { Rectangle cell = getPathBounds(tree, curr); g.setColor(dtcr.getBackgroundSelectionColor()); g.fillRect(cell.x + icon.getIconWidth()/2, cell.y, cell.width, cell.height); if (curr.equals(tree.getLeadSelectionPath())) { g.setColor(UIManager.getLookAndFeelDefaults().getColor( "Tree.selectionBorderColor")); g.drawRect(cell.x + icon.getIconWidth()/2, cell.y, cell.width, cell.height); } } g.translate(x, y); c.paint(g); g.translate(-x, -y); } else rendererPane.paintComponent(g, c, c.getParent(), getCellBounds(x, y, node)); } }
void paintNode(Graphics g, int x, int y, JTree tree, Object node, boolean isLeaf) { TreePath curr = new TreePath(getPathToRoot(((TreeNode) node), 0)); boolean selected = tree.isPathSelected(curr); boolean expanded = false; boolean hasIcons = false; if (tree.isVisible(curr)) { DefaultTreeCellRenderer dtcr = (DefaultTreeCellRenderer) createDefaultCellRenderer(); if (!isLeaf) expanded = tree.isExpanded(curr); Icon icon = null; if (!isLeaf && expanded) icon = dtcr.getOpenIcon(); else if (!isLeaf && !expanded) icon = dtcr.getClosedIcon(); else icon = dtcr.getLeafIcon(); if (icon.getIconHeight() > -1 && icon.getIconWidth() > -1) hasIcons = true; Component c = dtcr.getTreeCellRendererComponent(tree, node, selected, expanded, isLeaf, 0, false); if (hasIcons) { if (selected) { Rectangle cell = getPathBounds(tree, curr); g.setColor(dtcr.getBackgroundSelectionColor()); g.fillRect(cell.x + icon.getIconWidth()/2, cell.y, cell.width, cell.height); if (curr.equals(tree.getLeadSelectionPath())) { g.setColor(UIManager.getLookAndFeelDefaults().getColor( "Tree.selectionBorderColor")); g.drawRect(cell.x + icon.getIconWidth()/2, cell.y, cell.width, cell.height); } } g.translate(x, y); c.paint(g); g.translate(-x, -y); } else rendererPane.paintComponent(g, c, c.getParent(), getCellBounds(x, y, node)); } }
8,007
void paintNode(Graphics g, int x, int y, JTree tree, Object node, boolean isLeaf) { TreePath curr = new TreePath(getPathToRoot(((TreeNode) node), 0)); boolean selected = tree.isPathSelected(curr); boolean expanded = false; boolean hasIcons = false; if (tree.isVisible(curr)) { DefaultTreeCellRenderer dtcr = (DefaultTreeCellRenderer) createDefaultCellRenderer(); if (!isLeaf) expanded = tree.isExpanded(curr); Icon icon = null; if (!isLeaf && expanded) icon = dtcr.getOpenIcon(); else if (!isLeaf && !expanded) icon = dtcr.getClosedIcon(); else icon = dtcr.getLeafIcon(); if (icon.getIconHeight() > -1 && icon.getIconWidth() > -1) hasIcons = true; Component c = dtcr.getTreeCellRendererComponent(tree, node, selected, expanded, isLeaf, 0, false); if (hasIcons) { if (selected) { Rectangle cell = getPathBounds(tree, curr); g.setColor(dtcr.getBackgroundSelectionColor()); g.fillRect(cell.x + icon.getIconWidth()/2, cell.y, cell.width, cell.height); if (curr.equals(tree.getLeadSelectionPath())) { g.setColor(UIManager.getLookAndFeelDefaults().getColor( "Tree.selectionBorderColor")); g.drawRect(cell.x + icon.getIconWidth()/2, cell.y, cell.width, cell.height); } } g.translate(x, y); c.paint(g); g.translate(-x, -y); } else rendererPane.paintComponent(g, c, c.getParent(), getCellBounds(x, y, node)); } }
void paintNode(Graphics g, int x, int y, JTree tree, Object node, boolean isLeaf) { TreePath curr = new TreePath(getPathToRoot(((TreeNode) node), 0)); boolean selected = tree.isPathSelected(curr); boolean expanded = false; boolean hasIcons = false; if (tree.isVisible(curr)) { DefaultTreeCellRenderer dtcr = (DefaultTreeCellRenderer) createDefaultCellRenderer(); if (!isLeaf) expanded = tree.isExpanded(curr); Icon icon = null; if (!isLeaf && expanded) icon = dtcr.getOpenIcon(); else if (!isLeaf && !expanded) icon = dtcr.getClosedIcon(); else icon = dtcr.getLeafIcon(); if (icon.getIconHeight() > -1 && icon.getIconWidth() > -1) hasIcons = true; Component c = dtcr.getTreeCellRendererComponent(tree, node, selected, expanded, isLeaf, 0, false); if (hasIcons) { if (selected) { Rectangle cell = getPathBounds(tree, curr); g.setColor(dtcr.getBackgroundSelectionColor()); g.fillRect(cell.x + icon.getIconWidth()/2, cell.y, cell.width, cell.height); if (curr.equals(tree.getLeadSelectionPath())) { g.setColor(UIManager.getLookAndFeelDefaults().getColor( "Tree.selectionBorderColor")); g.drawRect(cell.x + icon.getIconWidth()/2, cell.y, cell.width, cell.height); } } g.translate(x, y); c.paint(g); g.translate(-x, -y); } else rendererPane.paintComponent(g, c, c.getParent(), getCellBounds(x, y, node)); } }
8,008
int paintRecursive(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object curr) { Rectangle clip = g.getClipBounds(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; int halfHeight = getRowHeight() / 2; int halfWidth = rightChildIndent / 2; int y0 = descent + halfHeight; int heightOfLine = descent + halfHeight; boolean isRootVisible = tree.isRootVisible(); if (mod.isLeaf(curr)) { paintNode(g, indentation + 4, descent, tree, curr, true); descent += getRowHeight(); } else { if (depth > 0 || isRootVisible) { paintNode(g, indentation + 4, descent, tree, curr, false); descent += getRowHeight(); y0 += halfHeight; } int max = mod.getChildCount(curr); if (tree.isExpanded(new TreePath(getPathToRoot(((TreeNode) curr), 0)))) { for (int i = 0; i < max; ++i) { int indent = indentation + rightChildIndent; if (!isRootVisible && depth == 0) indent = 0; else if ((!isRootVisible && !curr.equals(mod.getRoot())) || isRootVisible) { g.setColor(getHashColor()); heightOfLine = descent + halfHeight; g.drawLine(indentation + halfWidth, heightOfLine, indentation + rightChildIndent, heightOfLine); } descent = paintRecursive(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(curr, i)); } } } if (tree.isExpanded(new TreePath(getPathToRoot(((TreeNode) curr), 0)))) if (y0 != heightOfLine) { g.setColor(getHashColor()); g.drawLine(indentation + halfWidth, y0, indentation + halfWidth, heightOfLine); } return descent; }
int paintRecursive(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object curr) { Rectangle clip = g.getClipBounds(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; int halfHeight = getRowHeight() / 2; int halfWidth = rightChildIndent / 2; int y0 = descent + halfHeight; int heightOfLine = descent + halfHeight; boolean isRootVisible = tree.isRootVisible(); if (mod.isLeaf(curr)) { paintNode(g, indentation + 4, descent, tree, curr, true); descent += getRowHeight(); } else { if (depth > 0 || isRootVisible) { paintNode(g, indentation + 4, descent, tree, curr, false); descent += getRowHeight(); y0 += halfHeight; } int max = mod.getChildCount(curr); if (tree.isExpanded(new TreePath(getPathToRoot(curr, 0)))) { for (int i = 0; i < max; ++i) { int indent = indentation + rightChildIndent; if (!isRootVisible && depth == 0) indent = 0; else if ((!isRootVisible && !curr.equals(mod.getRoot())) || isRootVisible) { g.setColor(getHashColor()); heightOfLine = descent + halfHeight; g.drawLine(indentation + halfWidth, heightOfLine, indentation + rightChildIndent, heightOfLine); } descent = paintRecursive(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(curr, i)); } } } if (tree.isExpanded(new TreePath(getPathToRoot(curr, 0)))) if (y0 != heightOfLine) { g.setColor(getHashColor()); g.drawLine(indentation + halfWidth, y0, indentation + halfWidth, heightOfLine); } return descent; }
8,009
int paintRecursive(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object curr) { Rectangle clip = g.getClipBounds(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; int halfHeight = getRowHeight() / 2; int halfWidth = rightChildIndent / 2; int y0 = descent + halfHeight; int heightOfLine = descent + halfHeight; boolean isRootVisible = tree.isRootVisible(); if (mod.isLeaf(curr)) { paintNode(g, indentation + 4, descent, tree, curr, true); descent += getRowHeight(); } else { if (depth > 0 || isRootVisible) { paintNode(g, indentation + 4, descent, tree, curr, false); descent += getRowHeight(); y0 += halfHeight; } int max = mod.getChildCount(curr); if (tree.isExpanded(new TreePath(getPathToRoot(((TreeNode) curr), 0)))) { for (int i = 0; i < max; ++i) { int indent = indentation + rightChildIndent; if (!isRootVisible && depth == 0) indent = 0; else if ((!isRootVisible && !curr.equals(mod.getRoot())) || isRootVisible) { g.setColor(getHashColor()); heightOfLine = descent + halfHeight; g.drawLine(indentation + halfWidth, heightOfLine, indentation + rightChildIndent, heightOfLine); } descent = paintRecursive(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(curr, i)); } } } if (tree.isExpanded(new TreePath(getPathToRoot(((TreeNode) curr), 0)))) if (y0 != heightOfLine) { g.setColor(getHashColor()); g.drawLine(indentation + halfWidth, y0, indentation + halfWidth, heightOfLine); } return descent; }
int paintRecursive(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object curr) { Rectangle clip = g.getClipBounds(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; int halfHeight = getRowHeight() / 2; int halfWidth = rightChildIndent / 2; int y0 = descent + halfHeight; int heightOfLine = descent + halfHeight; boolean isRootVisible = tree.isRootVisible(); if (mod.isLeaf(curr)) { paintNode(g, indentation + 4, descent, tree, curr, true); descent += getRowHeight(); } else { if (depth > 0 || isRootVisible) { paintNode(g, indentation + 4, descent, tree, curr, false); descent += getRowHeight(); y0 += halfHeight; } int max = mod.getChildCount(curr); if (tree.isExpanded(new TreePath(getPathToRoot(((TreeNode) curr), 0)))) { for (int i = 0; i < max; i++) { int indent = indentation + rightChildIndent; if (!isRootVisible && depth == 0) indent = 0; else if ((!isRootVisible && !curr.equals(mod.getRoot())) || isRootVisible) { g.setColor(getHashColor()); heightOfLine = descent + halfHeight; g.drawLine(indentation + halfWidth, heightOfLine, indentation + rightChildIndent, heightOfLine); } descent = paintRecursive(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(curr, i)); } } } if (tree.isExpanded(new TreePath(getPathToRoot(((TreeNode) curr), 0)))) if (y0 != heightOfLine) { g.setColor(getHashColor()); g.drawLine(indentation + halfWidth, y0, indentation + halfWidth, heightOfLine); } return descent; }
8,010
int paintRecursive(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object curr) { Rectangle clip = g.getClipBounds(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; int halfHeight = getRowHeight() / 2; int halfWidth = rightChildIndent / 2; int y0 = descent + halfHeight; int heightOfLine = descent + halfHeight; boolean isRootVisible = tree.isRootVisible(); if (mod.isLeaf(curr)) { paintNode(g, indentation + 4, descent, tree, curr, true); descent += getRowHeight(); } else { if (depth > 0 || isRootVisible) { paintNode(g, indentation + 4, descent, tree, curr, false); descent += getRowHeight(); y0 += halfHeight; } int max = mod.getChildCount(curr); if (tree.isExpanded(new TreePath(getPathToRoot(((TreeNode) curr), 0)))) { for (int i = 0; i < max; ++i) { int indent = indentation + rightChildIndent; if (!isRootVisible && depth == 0) indent = 0; else if ((!isRootVisible && !curr.equals(mod.getRoot())) || isRootVisible) { g.setColor(getHashColor()); heightOfLine = descent + halfHeight; g.drawLine(indentation + halfWidth, heightOfLine, indentation + rightChildIndent, heightOfLine); } descent = paintRecursive(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(curr, i)); } } } if (tree.isExpanded(new TreePath(getPathToRoot(((TreeNode) curr), 0)))) if (y0 != heightOfLine) { g.setColor(getHashColor()); g.drawLine(indentation + halfWidth, y0, indentation + halfWidth, heightOfLine); } return descent; }
int paintRecursive(Graphics g, int indentation, int descent, int childNumber, int depth, JTree tree, TreeModel mod, Object curr) { Rectangle clip = g.getClipBounds(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; int halfHeight = getRowHeight() / 2; int halfWidth = rightChildIndent / 2; int y0 = descent + halfHeight; int heightOfLine = descent + halfHeight; boolean isRootVisible = tree.isRootVisible(); if (mod.isLeaf(curr)) { paintNode(g, indentation + 4, descent, tree, curr, true); descent += getRowHeight(); } else { if (depth > 0 || isRootVisible) { paintNode(g, indentation + 4, descent, tree, curr, false); descent += getRowHeight(); y0 += halfHeight; } int max = mod.getChildCount(curr); if (tree.isExpanded(new TreePath(getPathToRoot(((TreeNode) curr), 0)))) { for (int i = 0; i < max; ++i) { int indent = indentation + rightChildIndent; if (!isRootVisible && depth == 0) indent = 0; else if ((!isRootVisible && !curr.equals(mod.getRoot())) || isRootVisible) { g.setColor(getHashColor()); heightOfLine = descent + halfHeight; g.drawLine(indentation + halfWidth, heightOfLine, indentation + rightChildIndent, heightOfLine); } descent = paintRecursive(g, indent, descent, i, depth + 1, tree, mod, mod.getChild(curr, i)); } } } if (tree.isExpanded(new TreePath(getPathToRoot(((TreeNode) curr), 0)))) if (y0 != heightOfLine) { g.setColor(getHashColor()); g.drawLine(indentation + halfWidth, y0, indentation + halfWidth, heightOfLine); } return descent; }
8,011
protected void setModel(TreeModel model) { tree.setModel(model); treeModel = model; }
protected void setModel(TreeModel model) { tree.setModel(model); treeModel = tree.getModel(); }
8,013
protected void uninstallDefaults(JTree tree) { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); tree.setFont(null); tree.setForeground(null); tree.setBackground(null); tree.setCellRenderer(null); }
protected void uninstallDefaults(JTree tree) { tree.setFont(null); tree.setForeground(null); tree.setBackground(null); tree.setCellRenderer(null); }
8,014
protected void uninstallDefaults(JTree tree) { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); tree.setFont(null); tree.setForeground(null); tree.setBackground(null); tree.setCellRenderer(null); }
protected void uninstallDefaults(JTree tree) { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); tree.setFont(null); tree.setForeground(null); tree.setBackground(null); }
8,015