rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
if (clickCount == 2)
if (clickCount == 2 || cntlClick == true)
public void mouseClicked(MouseEvent e) { Point click = e.getPoint(); int row = ((int) click.getY() / getRowHeight()) - 1; TreePath path = BasicTreeUI.this.tree.getPathForRow(row); if (path == null) { // nothing should be selected if user clicks outside of tree BasicTreeUI.this.tree.getSelectionModel().clearSelection(); BasicTreeUI.this.tree.repaint(); } else if (BasicTreeUI.this.tree.isVisible(path)) { if (!BasicTreeUI.this.isLeaf(row)) clickCount++; if (clickCount == 2) { BasicTreeUI.this.tree.getSelectionModel().clearSelection(); clickCount = 0; 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); } } BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, path); } }
BasicTreeUI.this.tree.getSelectionModel().clearSelection();
public void mouseClicked(MouseEvent e) { Point click = e.getPoint(); int row = ((int) click.getY() / getRowHeight()) - 1; TreePath path = BasicTreeUI.this.tree.getPathForRow(row); if (path == null) { // nothing should be selected if user clicks outside of tree BasicTreeUI.this.tree.getSelectionModel().clearSelection(); BasicTreeUI.this.tree.repaint(); } else if (BasicTreeUI.this.tree.isVisible(path)) { if (!BasicTreeUI.this.isLeaf(row)) clickCount++; if (clickCount == 2) { BasicTreeUI.this.tree.getSelectionModel().clearSelection(); clickCount = 0; 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); } } BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, path); } }
}
public void mouseClicked(MouseEvent e) { Point click = e.getPoint(); int row = ((int) click.getY() / getRowHeight()) - 1; TreePath path = BasicTreeUI.this.tree.getPathForRow(row); if (path == null) { // nothing should be selected if user clicks outside of tree BasicTreeUI.this.tree.getSelectionModel().clearSelection(); BasicTreeUI.this.tree.repaint(); } else if (BasicTreeUI.this.tree.isVisible(path)) { if (!BasicTreeUI.this.isLeaf(row)) clickCount++; if (clickCount == 2) { BasicTreeUI.this.tree.getSelectionModel().clearSelection(); clickCount = 0; 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); } } BasicTreeUI.this.selectPath(BasicTreeUI.this.tree, path); } }
private Rectangle getCellBounds(int x, int y, Object cell)
Rectangle getCellBounds(int x, int y, Object cell)
private Rectangle getCellBounds(int x, int y, Object cell) { if (cell != null) { String s = cell.toString(); Font f = tree.getFont(); FontMetrics fm = tree.getToolkit().getFontMetrics(tree.getFont()); // add 22 to width for icon, FIXME later return new Rectangle(x, y, SwingUtilities.computeStringWidth(fm, s) + 22, fm.getHeight()); } return null; }
return new Rectangle(x, y, SwingUtilities.computeStringWidth(fm, s) + 22, fm.getHeight());
return new Rectangle(x, y, SwingUtilities.computeStringWidth(fm, s), fm.getHeight());
private Rectangle getCellBounds(int x, int y, Object cell) { if (cell != null) { String s = cell.toString(); Font f = tree.getFont(); FontMetrics fm = tree.getToolkit().getFontMetrics(tree.getFont()); // add 22 to width for icon, FIXME later return new Rectangle(x, y, SwingUtilities.computeStringWidth(fm, s) + 22, fm.getHeight()); } return null; }
return treeState.getPathClosestTo(x, y);
int row = Math.round(y / getRowHeight()); TreePath path = getPathForRow(tree, row); while (row > 0 && path == null) { --row; path = getPathForRow(tree, row); } return path;
public TreePath getClosestPathForLocation(JTree tree, int x, int y) { return treeState.getPathClosestTo(x, y); }
private DefaultMutableTreeNode getNextVisibleNode(DefaultMutableTreeNode node)
DefaultMutableTreeNode getNextVisibleNode(DefaultMutableTreeNode node)
private DefaultMutableTreeNode getNextVisibleNode(DefaultMutableTreeNode node) { DefaultMutableTreeNode next = null; TreePath current = null; if (node != null) next = node.getNextNode(); if (next != null) { current = new TreePath(next.getPath()); if (tree.isVisible(current)) return next; while (next != null && !tree.isVisible(current)) { next = next.getNextNode(); if (next != null) current = new TreePath(next.getPath()); } } return next; }
if (path != null) { Object cell = path.getLastPathComponent(); TreeModel mod = tree.getModel(); DefaultMutableTreeNode root = (DefaultMutableTreeNode) mod.getRoot(); if (!tree.isRootVisible() && tree.isExpanded(new TreePath(((DefaultMutableTreeNode) root) .getPath()))) root = root.getNextNode(); Point loc = getCellLocation(0, 0, tree, mod, cell, root); return getCellBounds(loc.x, loc.y, cell); }
public Rectangle getPathBounds(JTree tree, TreePath path) { // FIXME: not implemented return null; }
if (!tree.isRootVisible() && tree.isExpanded(new TreePath(((DefaultMutableTreeNode) node) .getPath()))) node = node.getNextNode();
public TreePath getPathForRow(JTree tree, int row) { DefaultMutableTreeNode node = ((DefaultMutableTreeNode) (tree.getModel()) .getRoot()); 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(node.getPath()); }
private DefaultMutableTreeNode getPreviousVisibleNode
DefaultMutableTreeNode getPreviousVisibleNode
private DefaultMutableTreeNode getPreviousVisibleNode (DefaultMutableTreeNode node) { DefaultMutableTreeNode prev = null; TreePath current = null; if (node != null) prev = node.getPreviousNode(); if (prev != null) { current = new TreePath(prev.getPath()); if (tree.isVisible(current)) return prev; while (prev != null && !tree.isVisible(current)) { prev = prev.getPreviousNode(); if (prev != null) current = new TreePath(prev.getPath()); } } return prev; }
if (!tree.isRootVisible() && tree.isExpanded(new TreePath(((DefaultMutableTreeNode) node) .getPath()))) node = node.getNextNode();
public int getRowCount(JTree tree) { DefaultMutableTreeNode node = ((DefaultMutableTreeNode) (tree.getModel()) .getRoot()); int count = 0; while (node != null) { count++; node = getNextVisibleNode(node); } return count; }
tree.setRootVisible(true); tree.expandPath(new TreePath(((DefaultMutableTreeNode) (tree.getModel()).getRoot()).getPath()));
public void installUI(JComponent c) { super.installUI(c); installDefaults((JTree) c); tree = (JTree) c; setModel(tree.getModel()); treeSelectionModel = tree.getSelectionModel(); installListeners(); installKeyboardActions(); completeUIInstall(); }
return treeState.isRootVisible();
return tree.isRootVisible();
protected boolean isRootVisible() { return treeState.isRootVisible(); }
g.translate(10, 10); paintRecursive(g, 0, 0, 0, 0, tree, mod, mod.getRoot()); g.translate(-10, -10);
Object root = mod.getRoot(); if (!tree.isRootVisible()) tree.expandPath(new TreePath(((DefaultMutableTreeNode) root) .getPath())); paintRecursive(g, 0, 0, 0, 0, tree, mod, root); if (hasControlIcons()) paintControlIcons(g, 0, 0, 0, 0, tree, mod, root); TreePath lead = tree.getLeadSelectionPath(); if (lead != null && tree.isPathSelected(lead)) { Rectangle cell = getPathBounds(tree, lead); g.setColor(UIManager.getLookAndFeelDefaults().getColor( "Tree.selectionBorderColor")); g.drawRect(cell.x + rightChildIndent - 4, cell.y, cell.width + 4, cell.height); }
public void paint(Graphics g, JComponent c) { JTree tree = (JTree) c; TreeModel mod = tree.getModel(); g.translate(10, 10); paintRecursive(g, 0, 0, 0, 0, tree, mod, mod.getRoot()); g.translate(-10, -10); }
private int paintRecursive(Graphics g, int indentation, int descent,
int paintRecursive(Graphics g, int indentation, int descent,
private 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; if (mod.isLeaf(curr)) { paintLeaf(g, indentation, descent, tree, curr); descent += getRowHeight(); } else { if (depth > 0 || tree.isRootVisible()) { paintNonLeaf(g, indentation, descent, tree, curr); descent += getRowHeight(); y0 += halfHeight; } int max = mod.getChildCount(curr); if (tree.isExpanded(new TreePath(((DefaultMutableTreeNode) curr) .getPath()))) for (int i = 0; i < max; ++i) { g.setColor(getHashColor()); heightOfLine = descent + halfHeight; g.drawLine(indentation + halfWidth, heightOfLine, indentation + rightChildIndent, heightOfLine); descent = paintRecursive(g, indentation + rightChildIndent, descent, i, depth + 1, tree, mod, mod.getChild(curr, i)); } } if (tree.isExpanded(new TreePath(((DefaultMutableTreeNode) curr) .getPath()))) if (y0 != heightOfLine) { g.setColor(getHashColor()); g.drawLine(indentation + halfWidth, y0, indentation + halfWidth, heightOfLine); } return descent; }
paintLeaf(g, indentation, descent, tree, curr);
paintNode(g, indentation + 4, descent, tree, curr, true);
private 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; if (mod.isLeaf(curr)) { paintLeaf(g, indentation, descent, tree, curr); descent += getRowHeight(); } else { if (depth > 0 || tree.isRootVisible()) { paintNonLeaf(g, indentation, descent, tree, curr); descent += getRowHeight(); y0 += halfHeight; } int max = mod.getChildCount(curr); if (tree.isExpanded(new TreePath(((DefaultMutableTreeNode) curr) .getPath()))) for (int i = 0; i < max; ++i) { g.setColor(getHashColor()); heightOfLine = descent + halfHeight; g.drawLine(indentation + halfWidth, heightOfLine, indentation + rightChildIndent, heightOfLine); descent = paintRecursive(g, indentation + rightChildIndent, descent, i, depth + 1, tree, mod, mod.getChild(curr, i)); } } if (tree.isExpanded(new TreePath(((DefaultMutableTreeNode) curr) .getPath()))) if (y0 != heightOfLine) { g.setColor(getHashColor()); g.drawLine(indentation + halfWidth, y0, indentation + halfWidth, heightOfLine); } return descent; }
if (depth > 0 || tree.isRootVisible())
if (depth > 0 || isRootVisible)
private 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; if (mod.isLeaf(curr)) { paintLeaf(g, indentation, descent, tree, curr); descent += getRowHeight(); } else { if (depth > 0 || tree.isRootVisible()) { paintNonLeaf(g, indentation, descent, tree, curr); descent += getRowHeight(); y0 += halfHeight; } int max = mod.getChildCount(curr); if (tree.isExpanded(new TreePath(((DefaultMutableTreeNode) curr) .getPath()))) for (int i = 0; i < max; ++i) { g.setColor(getHashColor()); heightOfLine = descent + halfHeight; g.drawLine(indentation + halfWidth, heightOfLine, indentation + rightChildIndent, heightOfLine); descent = paintRecursive(g, indentation + rightChildIndent, descent, i, depth + 1, tree, mod, mod.getChild(curr, i)); } } if (tree.isExpanded(new TreePath(((DefaultMutableTreeNode) curr) .getPath()))) if (y0 != heightOfLine) { g.setColor(getHashColor()); g.drawLine(indentation + halfWidth, y0, indentation + halfWidth, heightOfLine); } return descent; }
paintNonLeaf(g, indentation, descent, tree, curr);
paintNode(g, indentation + 4, descent, tree, curr, false);
private 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; if (mod.isLeaf(curr)) { paintLeaf(g, indentation, descent, tree, curr); descent += getRowHeight(); } else { if (depth > 0 || tree.isRootVisible()) { paintNonLeaf(g, indentation, descent, tree, curr); descent += getRowHeight(); y0 += halfHeight; } int max = mod.getChildCount(curr); if (tree.isExpanded(new TreePath(((DefaultMutableTreeNode) curr) .getPath()))) for (int i = 0; i < max; ++i) { g.setColor(getHashColor()); heightOfLine = descent + halfHeight; g.drawLine(indentation + halfWidth, heightOfLine, indentation + rightChildIndent, heightOfLine); descent = paintRecursive(g, indentation + rightChildIndent, descent, i, depth + 1, tree, mod, mod.getChild(curr, i)); } } if (tree.isExpanded(new TreePath(((DefaultMutableTreeNode) curr) .getPath()))) if (y0 != heightOfLine) { g.setColor(getHashColor()); g.drawLine(indentation + halfWidth, y0, indentation + halfWidth, heightOfLine); } return descent; }
g.drawLine(indentation + halfWidth, heightOfLine, indentation + rightChildIndent, heightOfLine); descent = paintRecursive(g, indentation + rightChildIndent,
g.drawLine(indentation + halfWidth, heightOfLine, indentation + rightChildIndent, heightOfLine); } descent = paintRecursive(g, indent,
private 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; if (mod.isLeaf(curr)) { paintLeaf(g, indentation, descent, tree, curr); descent += getRowHeight(); } else { if (depth > 0 || tree.isRootVisible()) { paintNonLeaf(g, indentation, descent, tree, curr); descent += getRowHeight(); y0 += halfHeight; } int max = mod.getChildCount(curr); if (tree.isExpanded(new TreePath(((DefaultMutableTreeNode) curr) .getPath()))) for (int i = 0; i < max; ++i) { g.setColor(getHashColor()); heightOfLine = descent + halfHeight; g.drawLine(indentation + halfWidth, heightOfLine, indentation + rightChildIndent, heightOfLine); descent = paintRecursive(g, indentation + rightChildIndent, descent, i, depth + 1, tree, mod, mod.getChild(curr, i)); } } if (tree.isExpanded(new TreePath(((DefaultMutableTreeNode) curr) .getPath()))) if (y0 != heightOfLine) { g.setColor(getHashColor()); g.drawLine(indentation + halfWidth, y0, indentation + halfWidth, heightOfLine); } return descent; }
private void selectPath(JTree tree, TreePath path)
void selectPath(JTree tree, TreePath path)
private void selectPath(JTree tree, TreePath path) { if (path != null) { if (tree.isPathSelected(path)) tree.removeSelectionPath(path); else if (tree.getSelectionModel().getSelectionMode() == TreeSelectionModel.SINGLE_TREE_SELECTION) { tree.getSelectionModel().clearSelection(); tree.addSelectionPath(path); tree.setLeadSelectionPath(path); } else if (tree.getSelectionModel().getSelectionMode() == TreeSelectionModel.CONTIGUOUS_TREE_SELECTION) { // TODO } else { tree.getSelectionModel().setSelectionMode( TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); tree.addSelectionPath(path); tree.setLeadSelectionPath(path); } } }
treeState.setModel(model);
tree.setModel(model);
protected void setModel(TreeModel model) { treeState.setModel(model); treeModel = model; }
treeState.setRootVisible(newValue);
tree.setRootVisible(newValue);
protected void setRootVisible(boolean newValue) { treeState.setRootVisible(newValue); }
public void firePropertyChange(String propertyName, Object oldValue,
protected void firePropertyChange(String propertyName, Object oldValue,
public void firePropertyChange(String propertyName, Object oldValue, Object newValue) { // Does nothing. }
if (name.startsWith("org.mmtk.")) {
if (name.startsWith("org.mmtk.") || type.isEnum()) {
protected void copyStaticFields(VmSystemClassLoader cl, VmSharedStatics sharedStatics, VmIsolatedStatics isolatedStatics, NativeStream os, ObjectEmitter emitter) throws ClassNotFoundException { for (VmType< ? > type : cl.getLoadedClasses()) { final String name = type.getName(); final int cnt = type.getNoDeclaredFields(); if ((cnt > 0) && !name.startsWith("java.")) { final Class javaType = Class.forName(type.getName()); try { final FieldInfo fieldInfo = emitter.getFieldInfo(javaType); final Field[] jdkFields = fieldInfo.getJdkStaticFields(); final int max = jdkFields.length; for (int k = 0; k < max; k++) { final Field jdkField = jdkFields[k]; if (jdkField != null) { final VmField f = fieldInfo.getJNodeStaticField(k); if (!f.isTransient()) { try { copyStaticField(type, f, jdkField, sharedStatics, isolatedStatics, os, emitter); } catch (IllegalAccessException ex) { throw new BuildException(ex); } } } } if (name.startsWith("org.mmtk.")) { type.setInitialized(); } } catch (JNodeClassNotFoundException ex) { log("JNode class not found" + ex.getMessage()); } } } }
loadClass(VmArchitecture.Space.class).link();
loadClass(VirtualMemoryRegion.class).link();
private final void doExecute() throws BuildException { debug = (getProject().getProperty("jnode.debug") != null); final long lmKernel = kernelFile.lastModified(); final long lmDest = destFile.lastModified(); final long lmPIL = getPluginListFile().lastModified(); if (version == null) { throw new BuildException("Version property must be set"); } if (memMgrPluginId == null) { throw new BuildException("Memory manager plugin Id must be set"); } final PluginList piList; final long lmPI; final URL memMgrPluginURL; try { log("plugin-list: " + getPluginListFile(), Project.MSG_DEBUG); piList = getPluginList(); memMgrPluginURL = piList.createPluginURL(memMgrPluginId); lmPI = Math.max(piList.lastModified(), memMgrPluginURL.openConnection().getLastModified()); } catch (PluginException ex) { throw new BuildException(ex); } catch (IOException ex) { throw new BuildException(ex); } if ((lmKernel < lmDest) && (lmPIL < lmDest) && (lmPI < lmDest)) { // No need to do anything, skip return; } if (debugFile != null) { debugFile.delete(); } try { System.getProperties().setProperty(BUILDTIME_PROPERTY, "1"); // Load the plugin descriptors final PluginRegistryModel piRegistry; piRegistry = Factory.createRegistry(piList.getPluginList()); // Load the memory management plugin piRegistry.loadPlugin(memMgrPluginURL, true); // Test the set of system plugins testPluginPrerequisites(piRegistry); // Load all resources final Map<String, byte[]> resources = loadSystemResource(piRegistry); /* Now create the processor */ final VmArchitecture arch = getArchitecture(); final NativeStream os = createNativeStream(); clsMgr = new VmSystemClassLoader(null/*classesURL*/, arch, new BuildObjectResolver(os, this)); blockedObjects.add(clsMgr); blockedObjects.add(clsMgr.getSharedStatics()); blockedObjects.add(clsMgr.getSharedStatics().getTable()); blockedObjects.add(clsMgr.getIsolatedStatics()); blockedObjects.add(clsMgr.getIsolatedStatics().getTable()); blockedObjects.add(resources); clsMgr.setSystemRtJar(resources); // Initialize the statics table. initializeStatics(clsMgr.getSharedStatics()); if (debug) { log("Building in DEBUG mode", Project.MSG_WARN); } // Create the VM final Vm vm = new Vm(version, arch, clsMgr.getSharedStatics(), debug, clsMgr, piRegistry); blockedObjects.add(vm); blockedObjects.add(Vm.getCompiledMethods()); final VmProcessor proc = createProcessor(clsMgr.getSharedStatics(), clsMgr.getIsolatedStatics()); log("Building for " + proc.getCPUID()); final Label clInitCaller = new Label("$$clInitCaller"); VmType< ? > systemClasses[] = VmType.initializeForBootImage(clsMgr); for (int i = 0; i < systemClasses.length; i++) { clsMgr.addLoadedClass(systemClasses[i].getName(), systemClasses[i]); } // First copy the native kernel file if (enableJNasm) { compileKernel(os, asmSourceInfo); } else { copyKernel(os); } os.setObjectRef(bootHeapStart); // Setup a call to our first java method initImageHeader(os, clInitCaller, vm, piRegistry); // Create the initial stack createInitialStack(os, initialStack, initialStackPtr); /* Now load the classes */ loadClass(VmMethodCode.class); loadClass(Unsafe.class); loadClass(VmSystemClassLoader.class); loadClass(VmType[].class); loadClass(Vm.class); loadClass(VmArchitecture.Space.class).link(); Vm.getHeapManager().loadClasses(clsMgr); loadClass(VmHeapManager.class); loadClass(VmSharedStatics.class); loadClass(VmIsolatedStatics.class); loadClass(Vm.getHeapManager().getClass()); loadClass(HeapHelper.class); loadClass("org.jnode.vm.HeapHelperImpl"); loadClass(Vm.getCompiledMethods().getClass()); loadClass(VmCompiledCode[].class); loadSystemClasses(resources.keySet()); /* Now emit the processor */ os.getObjectRef(proc); /* Let the compilers load its native symbol offsets */ final NativeCodeCompiler[] cmps = arch.getCompilers(); for (int i = 0; i < cmps.length; i++) { final NativeCodeCompiler cmp = cmps[i]; cmp.initialize(clsMgr); os.getObjectRef(cmp); } /* Let the test compilers load its native symbol offsets */ final NativeCodeCompiler[] testCmps = arch.getTestCompilers(); if (testCmps != null) { for (int i = 0; i < testCmps.length; i++) { final NativeCodeCompiler cmp = testCmps[i]; cmp.initialize(clsMgr); os.getObjectRef(cmp); } } log("Compiling using " + cmps[0].getName() + " and " + cmps[cmps.length - 1].getName() + " compilers"); // Initialize the IMT compiler. arch.getIMTCompiler().initialize(clsMgr); // Load the jarfile as byte-array// copyJarFile(blockedObjects, piRegistry); // Now emit all object images to the actual image emitObjects(os, arch, blockedObjects, false); // Disallow the loading of new classes clsMgr.setFailOnNewLoad(true); emitObjects(os, arch, blockedObjects, false); // Emit the vm log("Emit vm", Project.MSG_VERBOSE); blockedObjects.remove(vm); emitObjects(os, arch, blockedObjects, false); // Twice, this is intended! emitObjects(os, arch, blockedObjects, false); // Emit the compiled method list log("Emit compiled methods", Project.MSG_VERBOSE); blockedObjects.remove(Vm.getCompiledMethods()); final int compiledMethods = Vm.getCompiledMethods().size(); emitObjects(os, arch, blockedObjects, false); // Twice, this is intended! emitObjects(os, arch, blockedObjects, false); /* Set the bootclasses */ log("prepare bootClassArray", Project.MSG_VERBOSE); final VmType bootClasses[] = clsMgr.prepareAfterBootstrap(); os.getObjectRef(bootClasses); emitObjects(os, arch, blockedObjects, false); // Twice, this is intended! emitObjects(os, arch, blockedObjects, false); // Emit the classmanager log("Emit clsMgr", Project.MSG_VERBOSE); // Turn auto-compilation on clsMgr.setCompileRequired(); blockedObjects.remove(clsMgr); emitObjects(os, arch, blockedObjects, false); // Twice, this is intended! emitObjects(os, arch, blockedObjects, false); // Emit the statics table log("Emit statics", Project.MSG_VERBOSE); blockedObjects.remove(clsMgr.getSharedStatics()); blockedObjects.remove(clsMgr.getIsolatedStatics()); emitObjects(os, arch, blockedObjects, true); // Twice, this is intended! emitObjects(os, arch, blockedObjects, true); // Emit the remaining objects log("Emit rest; blocked=" + blockedObjects, Project.MSG_VERBOSE); emitObjects(os, arch, null, true); // Verify no methods have been compiled after we wrote the // CompiledCodeList. if (Vm.getCompiledMethods().size() != compiledMethods) { throw new BuildException( "Method have been compiled after CompiledCodeList was written."); } /* Write static initializer code */ emitStaticInitializerCalls(os, bootClasses, clInitCaller); // This is the end of the image X86BinaryAssembler.ObjectInfo dummyObjectAtEnd = os .startObject(loadClass(VmMethodCode.class)); pageAlign(os); dummyObjectAtEnd.markEnd(); os.setObjectRef(imageEnd); os.setObjectRef(bootHeapEnd); /* Link all native symbols */ linkNativeSymbols(os); // Patch multiboot header patchHeader(os); // Store the image storeImage(os); // Generate the listfile printLabels(os, bootClasses, clsMgr.getSharedStatics()); logLargeClasses(bootClasses); // Generate debug info for (int i = 0; i < cmps.length; i++) { cmps[i].dumpStatistics(); } final int bootHeapSize = os.getObjectRef(bootHeapEnd).getOffset() - os.getObjectRef(bootHeapStart).getOffset(); final int bootHeapBitmapSize = (bootHeapSize / ObjectLayout.OBJECT_ALIGN) >> 3; log("Boot heap size " + (bootHeapSize >>> 10) + "K bitmap size " + (bootHeapBitmapSize >>> 10) + "K"); log("Shared statics"); clsMgr.getSharedStatics().dumpStatistics(System.out); log("Isolated statics"); clsMgr.getIsolatedStatics().dumpStatistics(System.out); vm.dumpStatistics(System.out); logStatistics(os); BytecodeParser.dumpStatistics(); log("Optimized methods : " + totalHighMethods + ", avg size " + (totalHighMethodSize / totalHighMethods) + ", tot size " + totalHighMethodSize); log("Ondemand comp. methods: " + totalLowMethods + ", avg size " + (totalLowMethodSize / totalLowMethods) + ", tot size " + totalLowMethodSize); log("Done."); os.clear(); } catch (Throwable ex) { ex.printStackTrace(); throw new BuildException(ex); } }
if(annotation == null) clss[0] = RMIClassLoader.loadClass(intfs[0]);
for (int i = 0; i < intfs.length; i++) { if (annotation == null) clss[i] = RMIClassLoader.loadClass(intfs[i]); else clss[i] = RMIClassLoader.loadClass(annotation, intfs[i]); } ClassLoader loader; if (clss.length > 0) { ArrayList loaders = new ArrayList(intfs.length); ClassLoader cx; for (int i = 0; i < clss.length; i++) { cx = clss[i].getClassLoader(); if (!loaders.contains(cx)) { loaders.add(0, cx); } } loader = new CombinedClassLoader(loaders); }
protected Class resolveProxyClass(String intfs[]) throws IOException, ClassNotFoundException{ String annotation = (String)getAnnotation(); Class clss[] = new Class[intfs.length]; if(annotation == null) clss[0] = RMIClassLoader.loadClass(intfs[0]); else clss[0] = RMIClassLoader.loadClass(annotation, intfs[0]); //assume all interfaces can be loaded by the same classloader ClassLoader loader = clss[0].getClassLoader(); for (int i = 0; i < intfs.length; i++) clss[i] = Class.forName(intfs[i], false, loader); try { return Proxy.getProxyClass(loader, clss); } catch (IllegalArgumentException e) { throw new ClassNotFoundException(null, e); } }
clss[0] = RMIClassLoader.loadClass(annotation, intfs[0]); ClassLoader loader = clss[0].getClassLoader(); for (int i = 0; i < intfs.length; i++) clss[i] = Class.forName(intfs[i], false, loader); try {
loader = ClassLoader.getSystemClassLoader(); try {
protected Class resolveProxyClass(String intfs[]) throws IOException, ClassNotFoundException{ String annotation = (String)getAnnotation(); Class clss[] = new Class[intfs.length]; if(annotation == null) clss[0] = RMIClassLoader.loadClass(intfs[0]); else clss[0] = RMIClassLoader.loadClass(annotation, intfs[0]); //assume all interfaces can be loaded by the same classloader ClassLoader loader = clss[0].getClassLoader(); for (int i = 0; i < intfs.length; i++) clss[i] = Class.forName(intfs[i], false, loader); try { return Proxy.getProxyClass(loader, clss); } catch (IllegalArgumentException e) { throw new ClassNotFoundException(null, e); } }
if ( (attrib=getCount()) !=null) writeOut( outputstream, " count=\"" + attrib + "\"");
if ( (attrib=getCount()) !=null) { writeOut( outputstream, " count=\""); writeOutAttribute(outputstream, ((Integer) attrib).toString()); writeOut(outputstream, "\""); }
protected void specificIOStyleToXDF( OutputStream outputstream, String indent) { synchronized (attribHash) { //open the node writeOut(outputstream, "<" + classXDFNodeName); //writeOutAttributes Object attrib=null; if ( (attrib=getCount()) !=null) writeOut( outputstream, " count=\"" + attrib + "\""); if ((attrib=getOutput()) !=null) writeOut(outputstream, " output=\"" + attrib + "\""); //close the node writeOut(outputstream, "/>"); } }
writeOut(outputstream, " output=\"" + attrib + "\"");
{ writeOut(outputstream, " output=\""); writeOutAttribute(outputstream, (String) attrib); writeOut(outputstream, "\""); }
protected void specificIOStyleToXDF( OutputStream outputstream, String indent) { synchronized (attribHash) { //open the node writeOut(outputstream, "<" + classXDFNodeName); //writeOutAttributes Object attrib=null; if ( (attrib=getCount()) !=null) writeOut( outputstream, " count=\"" + attrib + "\""); if ((attrib=getOutput()) !=null) writeOut(outputstream, " output=\"" + attrib + "\""); //close the node writeOut(outputstream, "/>"); } }
public abstract PageFormat pageDialog(PageFormat page_format);
public abstract PageFormat pageDialog(PageFormat page_format) throws HeadlessException;
public abstract PageFormat pageDialog(PageFormat page_format);
public abstract boolean printDialog();
public abstract boolean printDialog() throws HeadlessException;
public abstract boolean printDialog();
bad.minor = Minor.Any;
public static FormatMismatch extract(Any any) { try { EmptyExceptionHolder h = (EmptyExceptionHolder) any.extract_Streamable(); return (FormatMismatch) h.value; } catch (ClassCastException cex) { BAD_OPERATION bad = new BAD_OPERATION("FormatMismatch expected"); bad.initCause(cex); throw bad; } }
public RequestSenseData requestSense() throws SCSIException,
public SenseData requestSense() throws SCSIException,
public RequestSenseData requestSense() throws SCSIException, TimeoutException, InterruptedException { final byte[] data = new byte[ 256]; final CDB cdb = new CDBRequestSense(data.length); api.executeCommand(cdb, data, 0, 5000); return new RequestSenseData(data); }
return new RequestSenseData(data);
return new SenseData(data);
public RequestSenseData requestSense() throws SCSIException, TimeoutException, InterruptedException { final byte[] data = new byte[ 256]; final CDB cdb = new CDBRequestSense(data.length); api.executeCommand(cdb, data, 0, 5000); return new RequestSenseData(data); }
System.out.println("getKeyStrokeText " + lastKeyMnemonic);
public final static String getKeyStrokeText(KeyEvent ke) { if (!workStroke.equals(ke)) { workStroke.setAttributes(ke); lastKeyMnemonic = (String)mappedKeys.get(workStroke); } System.out.println("getKeyStrokeText " + lastKeyMnemonic); return lastKeyMnemonic; }
if (locked) { throw new RuntimeException("Locked"); }
private final synchronized int alloc(byte type, int length) { final int idx = next; types[idx] = type; next += length; return idx; }
if (locked) { throw new RuntimeException("Locked"); }
final void setInt(int idx, int value) { if (types[idx] != TYPE_INT) { throw new IllegalArgumentException("Type error " + types[idx]); } statics[idx] = value; }
if (locked) { throw new RuntimeException("Locked"); }
final void setLong(int idx, long value) { if (types[idx] != TYPE_LONG) { throw new IllegalArgumentException("Type error " + types[idx]); } if (lsbFirst) { statics[idx + 0] = (int) (value & 0xFFFFFFFFL); statics[idx + 1] = (int) ((value >>> 32) & 0xFFFFFFFFL); } else { statics[idx + 1] = (int) (value & 0xFFFFFFFFL); statics[idx + 0] = (int) ((value >>> 32) & 0xFFFFFFFFL); } }
if (locked) { throw new RuntimeException("Locked"); }
final void setMethod(int idx, VmMethod value) { if (types[idx] != TYPE_METHOD) { throw new IllegalArgumentException("Type error " + types[idx]); } setRawObject(idx, value); }
if (locked) { throw new RuntimeException("Locked"); }
final void setObject(int idx, Object value) { if (types[idx] != TYPE_OBJECT) { throw new IllegalArgumentException("Type error " + types[idx]); } setRawObject(idx, value); }
System.out.println("VmStatics#verifyBeforeEmit");
System.out.println("VmStatics#verifyBeforeEmit " + slotLength + ", " + resolver);
public void verifyBeforeEmit() { System.out.println("VmStatics#verifyBeforeEmit"); final int max = statics.length; for (int i = 0; i < max; i++) { final Object value = objects[i]; if (value != null) { if (slotLength == 1) { statics[i] = resolver.addressOf32(value); } else { final long lvalue = resolver.addressOf64(value); if (lsbFirst) { statics[i + 0] = (int) (lvalue & 0xFFFFFFFFL); statics[i + 1] = (int) ((lvalue >>> 32) & 0xFFFFFFFFL); } else { statics[i + 1] = (int) (lvalue & 0xFFFFFFFFL); statics[i + 0] = (int) ((lvalue >>> 32) & 0xFFFFFFFFL); } } } else if (types[i] == TYPE_METHOD) { throw new RuntimeException("Method is null"); } } }
objects = null; locked = true; System.out.println("VmStatics#verifyBeforeEmit count=" + count);
public void verifyBeforeEmit() { System.out.println("VmStatics#verifyBeforeEmit"); final int max = statics.length; for (int i = 0; i < max; i++) { final Object value = objects[i]; if (value != null) { if (slotLength == 1) { statics[i] = resolver.addressOf32(value); } else { final long lvalue = resolver.addressOf64(value); if (lsbFirst) { statics[i + 0] = (int) (lvalue & 0xFFFFFFFFL); statics[i + 1] = (int) ((lvalue >>> 32) & 0xFFFFFFFFL); } else { statics[i + 1] = (int) (lvalue & 0xFFFFFFFFL); statics[i + 0] = (int) ((lvalue >>> 32) & 0xFFFFFFFFL); } } } else if (types[i] == TYPE_METHOD) { throw new RuntimeException("Method is null"); } } }
bad.minor = Minor.Any;
public static NameValuePair extract(Any any) { try { return ((NameValuePairHolder) any.extract_Streamable()).value; } catch (ClassCastException cex) { BAD_OPERATION bad = new BAD_OPERATION("NameValuePair expected"); bad.initCause(cex); throw bad; } }
bad.minor = Minor.Any;
public static NameComponent[] extract(Any a) { try { return ((NameHolder) a.extract_Streamable()).value; } catch (ClassCastException ex) { BAD_OPERATION bad = new BAD_OPERATION("Name expected"); bad.initCause(ex); throw bad; } }
if (! allowsChildren) throw new IllegalStateException();
if (isNodeAncestor(child)) throw new IllegalArgumentException("Cannot add ancestor node.");
public void add(MutableTreeNode child) { if (child == null) throw new IllegalArgumentException(); if (! allowsChildren) throw new IllegalStateException(); children.add(child); child.setParent(this); }
try { return super.clone(); } catch (CloneNotSupportedException e) { return null; }
return new DefaultMutableTreeNode(this.userObject, this.allowsChildren);
public Object clone() { try { return super.clone(); // TODO: Do we need to do more here ? } catch (CloneNotSupportedException e) { // This never happens. return null; } }
if (node == null) throw new IllegalArgumentException("Null 'node' argument.");
public int getIndex(TreeNode node) { return children.indexOf(node); }
if (parent == null)
DefaultMutableTreeNode sibling = getNextSibling(); if (sibling != null) return sibling.getFirstLeaf(); if (parent != null) return ((DefaultMutableTreeNode) parent).getNextLeaf();
public DefaultMutableTreeNode getNextLeaf() { if (parent == null) return null; // TODO: Fix implementation. return null; //return parent.getChildAfter(this); }
return null;
public DefaultMutableTreeNode getNextLeaf() { if (parent == null) return null; // TODO: Fix implementation. return null; //return parent.getChildAfter(this); }
if (parent == null) return null;
DefaultMutableTreeNode sibling = getPreviousSibling(); if (sibling != null) return sibling.getLastLeaf(); if (parent != null) return ((DefaultMutableTreeNode) parent).getPreviousLeaf();
public DefaultMutableTreeNode getPreviousLeaf() { if (parent == null) return null; // TODO: Fix implementation. return null; //return parent.getChildBefore(this); }
if (! allowsChildren) throw new IllegalStateException(); if (node == null) throw new IllegalArgumentException("Null 'node' argument."); if (isNodeAncestor(node)) throw new IllegalArgumentException("Cannot insert ancestor node.");
public void insert(MutableTreeNode node, int index) { children.insertElementAt(node, index); }
if (node == this) return true;
public boolean isNodeSibling(TreeNode node) { if (node == null) return false; return (node.getParent() == getParent() && getParent() != null); }
children.remove(index);
MutableTreeNode child = (MutableTreeNode) children.remove(index); child.setParent(null);
public void remove(int index) { children.remove(index); }
children.removeAllElements();
for (int i = getChildCount() - 1; i >= 0; i--) remove(i);
public void removeAllChildren() { children.removeAllElements(); }
if (!allowsChildren) removeAllChildren();
public void setAllowsChildren(boolean allowsChildren) { this.allowsChildren = allowsChildren; }
Point p = awtFrame.getLocationOnScreen(); Insets ins = swingPeer.getInsets(); awtFrame.reshape(p.x + x, p.y + y, width + ins.left + ins.right, height + ins.top + ins.bottom);
if (awtFrame.isVisible()) { Point p = awtFrame.getLocationOnScreen(); Insets ins = swingPeer.getInsets(); awtFrame.reshape(p.x + x, p.y + y, width + ins.left + ins.right, height + ins.top + ins.bottom); }
public void reshape(int x, int y, int width, int height) { super.reshape(x, y, width, height); //TODO fix it Point p = awtFrame.getLocationOnScreen(); Insets ins = swingPeer.getInsets(); awtFrame.reshape(p.x + x, p.y + y, width + ins.left + ins.right, height + ins.top + ins.bottom); }
return new Rectangle(x, y, SwingUtilities.computeStringWidth(fm, s),
if (s != null) return new Rectangle(x, y, SwingUtilities.computeStringWidth(fm, s) + 4,
Rectangle getCellBounds(int x, int y, Object cell) { if (cell != null) { String s = cell.toString(); Font f = tree.getFont(); FontMetrics fm = tree.getToolkit().getFontMetrics(tree.getFont()); return new Rectangle(x, y, SwingUtilities.computeStringWidth(fm, s), fm.getHeight()); } return null; }
return null;
return new Rectangle(x, y, 0, 0);
Rectangle getCellBounds(int x, int y, Object cell) { if (cell != null) { String s = cell.toString(); Font f = tree.getFont(); FontMetrics fm = tree.getToolkit().getFontMetrics(tree.getFont()); return new Rectangle(x, y, SwingUtilities.computeStringWidth(fm, s), fm.getHeight()); } return null; }
if (!tree.isRootVisible() && tree.isExpanded(new TreePath(( (DefaultMutableTreeNode) mod.getRoot()).getPath())))
if (!tree.isRootVisible() && tree.isExpanded(new TreePath(mod.getRoot())))
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(( (DefaultMutableTreeNode) mod.getRoot()).getPath()))) return new Point(x + ((((DefaultMutableTreeNode) node).getLevel()) * rightChildIndent), y); return new Point(x + ((((DefaultMutableTreeNode) node).getLevel() + 1) * rightChildIndent), y); } if (!mod.isLeaf(startNode) && tree.isExpanded(new TreePath( ((DefaultMutableTreeNode) startNode).getPath()))) { 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((DefaultMutableTreeNode) startNode)); }
&& tree.isExpanded(new TreePath(((DefaultMutableTreeNode) root) .getPath())))
&& tree.isExpanded(new TreePath(root)))
public Rectangle getPathBounds(JTree tree, TreePath path) { if (path != null) { Object cell = path.getLastPathComponent(); TreeModel mod = tree.getModel(); DefaultMutableTreeNode root = (DefaultMutableTreeNode) mod.getRoot(); if (!tree.isRootVisible() && tree.isExpanded(new TreePath(((DefaultMutableTreeNode) root) .getPath()))) root = root.getNextNode(); Point loc = getCellLocation(0, 0, tree, mod, cell, root); return getCellBounds(loc.x, loc.y, cell); } return null; }
public int getRightChildIndent(int newAmount)
public int getRightChildIndent()
public int getRightChildIndent(int newAmount) { return rightChildIndent; }
tree.expandPath(new TreePath(((DefaultMutableTreeNode) (tree.getModel()).getRoot()).getPath()));
tree.expandPath(new TreePath(tree.getModel().getRoot()));
public void installUI(JComponent c) { super.installUI(c); installDefaults((JTree) c); tree = (JTree) c; setModel(tree.getModel()); tree.setRootVisible(true); tree.expandPath(new TreePath(((DefaultMutableTreeNode) (tree.getModel()).getRoot()).getPath())); treeSelectionModel = tree.getSelectionModel(); installListeners(); installKeyboardActions(); completeUIInstall(); }
tree.expandPath(new TreePath(((DefaultMutableTreeNode) root) .getPath()));
tree.expandPath(new TreePath(root));
public void paint(Graphics g, JComponent c) { JTree tree = (JTree) c; TreeModel mod = tree.getModel(); Object root = mod.getRoot(); if (!tree.isRootVisible()) tree.expandPath(new TreePath(((DefaultMutableTreeNode) root) .getPath())); paintRecursive(g, 0, 0, 0, 0, tree, mod, root); if (hasControlIcons()) paintControlIcons(g, 0, 0, 0, 0, tree, mod, root); TreePath lead = tree.getLeadSelectionPath(); if (lead != null && tree.isPathSelected(lead)) { Rectangle cell = getPathBounds(tree, lead); g.setColor(UIManager.getLookAndFeelDefaults().getColor( "Tree.selectionBorderColor")); g.drawRect(cell.x + rightChildIndent - 4, cell.y, cell.width + 4, cell.height); } }
TreePath lead = tree.getLeadSelectionPath(); if (lead != null && tree.isPathSelected(lead)) { Rectangle cell = getPathBounds(tree, lead); g.setColor(UIManager.getLookAndFeelDefaults().getColor( "Tree.selectionBorderColor")); g.drawRect(cell.x + rightChildIndent - 4, cell.y, cell.width + 4, cell.height); }
public void paint(Graphics g, JComponent c) { JTree tree = (JTree) c; TreeModel mod = tree.getModel(); Object root = mod.getRoot(); if (!tree.isRootVisible()) tree.expandPath(new TreePath(((DefaultMutableTreeNode) root) .getPath())); paintRecursive(g, 0, 0, 0, 0, tree, mod, root); if (hasControlIcons()) paintControlIcons(g, 0, 0, 0, 0, tree, mod, root); TreePath lead = tree.getLeadSelectionPath(); if (lead != null && tree.isPathSelected(lead)) { Rectangle cell = getPathBounds(tree, lead); g.setColor(UIManager.getLookAndFeelDefaults().getColor( "Tree.selectionBorderColor")); g.drawRect(cell.x + rightChildIndent - 4, cell.y, cell.width + 4, cell.height); } }
g.fillRect(cell.x + rightChildIndent - 4, cell.y, cell.width + 4,
g.fillRect(cell.x + icon.getIconWidth()/2, cell.y, cell.width,
void paintNode(Graphics g, int x, int y, JTree tree, Object node, boolean isLeaf) { TreePath curr = new TreePath(((DefaultMutableTreeNode) node).getPath()); boolean selected = tree.isPathSelected(curr); boolean expanded = false; if (tree.isVisible(curr)) { DefaultTreeCellRenderer dtcr = (DefaultTreeCellRenderer) tree .getCellRenderer(); if (!isLeaf) expanded = tree.isExpanded(curr); Component c = dtcr.getTreeCellRendererComponent(tree, node, selected, expanded, isLeaf, 0, false); if (selected) { Rectangle cell = getPathBounds(tree, curr); g.setColor(dtcr.getBackgroundSelectionColor()); g.fillRect(cell.x + rightChildIndent - 4, cell.y, cell.width + 4, 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(((DefaultMutableTreeNode) node).getPath()); boolean selected = tree.isPathSelected(curr); boolean expanded = false; if (tree.isVisible(curr)) { DefaultTreeCellRenderer dtcr = (DefaultTreeCellRenderer) tree .getCellRenderer(); if (!isLeaf) expanded = tree.isExpanded(curr); Component c = dtcr.getTreeCellRendererComponent(tree, node, selected, expanded, isLeaf, 0, false); if (selected) { Rectangle cell = getPathBounds(tree, curr); g.setColor(dtcr.getBackgroundSelectionColor()); g.fillRect(cell.x + rightChildIndent - 4, cell.y, cell.width + 4, cell.height); } g.translate(x, y); c.paint(g); g.translate(-x, -y); } }
tree.getCellEditor().removeCellEditorListener(cellEditorListener);
protected void uninstallListeners() { tree.removePropertyChangeListener(propertyChangeListener); tree.removeFocusListener(focusListener); tree.removeTreeSelectionListener(treeSelectionListener); tree.removeMouseListener(mouseInputListener); tree.removeKeyListener(keyListener); tree.removePropertyChangeListener(selectionModelPropertyChangeListener); tree.removeComponentListener(componentListener); tree.getCellEditor().removeCellEditorListener(cellEditorListener); tree.removeTreeExpansionListener(treeExpansionListener); tree.getModel().removeTreeModelListener(treeModelListener); }
tree.getModel().removeTreeModelListener(treeModelListener);
TreeCellEditor tce = tree.getCellEditor(); if (tce != null) tce.removeCellEditorListener(cellEditorListener); TreeModel tm = tree.getModel(); if (tm != null) tm.removeTreeModelListener(treeModelListener);
protected void uninstallListeners() { tree.removePropertyChangeListener(propertyChangeListener); tree.removeFocusListener(focusListener); tree.removeTreeSelectionListener(treeSelectionListener); tree.removeMouseListener(mouseInputListener); tree.removeKeyListener(keyListener); tree.removePropertyChangeListener(selectionModelPropertyChangeListener); tree.removeComponentListener(componentListener); tree.getCellEditor().removeCellEditorListener(cellEditorListener); tree.removeTreeExpansionListener(treeExpansionListener); tree.getModel().removeTreeModelListener(treeModelListener); }
throw new BAD_OPERATION();
BAD_OPERATION bad = new BAD_OPERATION(); bad.initCause(ex); bad.minor = Minor.Any; throw bad;
public static NotFound extract(Any a) { try { return ((NotFoundHolder) a.extract_Streamable()).value; } catch (ClassCastException ex) { throw new BAD_OPERATION(); } }
StringWriter sw = new StringWriter(); jnasmppInput(new PrintWriter(sw)); ReInit(new StringReader(sw.toString()));
public void print(Writer w){ try{ jnasmppInput(new PrintWriter(w)); } catch (Exception pe){ pe.printStackTrace(); System.exit(-1); } }
public void setValue(Object value)
public void setValue(Object aValue)
public void setValue(Object value) { // TODO: should be setting the value in the editorComp this.value = value; }
this.value = value;
value = aValue;
public void setValue(Object value) { // TODO: should be setting the value in the editorComp this.value = value; }
clickCountToStart = 3;
clickCountToStart = 2; delegate = new JTextFieldDelegate(); textfield.addActionListener(delegate);
public DefaultCellEditor(JTextField textfield) { editorComponent = textfield; clickCountToStart = 3; } // DefaultCellEditor()
if (editorComponent instanceof JTextField) { ((JTextField)editorComponent).setText(value.toString()); delegate = new EditorDelegate(); ((JTextField)editorComponent).addActionListener(delegate); } else { }
delegate.setValue(value);
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { // NOTE: as specified by Sun, we don't call new() everytime, we return // editorComponent on each call to getTableCellEditorComponent or // getTreeCellEditorComponent. However, currently JTextFields have a // problem with getting rid of old text, so without calling new() there // are some strange results. If you edit more than one cell in the table // text from previously edited cells may unexpectedly show up in the // cell you are currently editing. This will be fixed automatically // when JTextField is fixed. if (editorComponent instanceof JTextField) { ((JTextField)editorComponent).setText(value.toString()); delegate = new EditorDelegate(); ((JTextField)editorComponent).addActionListener(delegate); } else { // TODO } return editorComponent; } // getTableCellEditorComponent()
String getDTDType();
QName getDTDType();
String getDTDType();
v[i] = getModel().getElementAt(i);
v[i] = getModel().getElementAt(idx[i]);
public Object[] getSelectedValues() { int [] idx = getSelectedIndices(); Object [] v = new Object[idx.length]; for (int i = 0; i < idx.length; ++i) v[i] = getModel().getElementAt(i); return v; }
tree.revalidate();
public void editingCanceled(ChangeEvent e) { editingPath = null; editingRow = -1; stopEditingInCompleteEditing = false; if (editingComponent != null) tree.remove(editingComponent.getParent()); editingComponent = null; if (cellEditor != null) { if (cellEditor instanceof DefaultTreeCellEditor) tree.removeTreeSelectionListener((DefaultTreeCellEditor) cellEditor); cellEditor.removeCellEditorListener(cellEditorListener); setCellEditor(null); createdCellEditor = false; } tree.requestFocusInWindow(false); editorTimer.stop(); isEditing = false; validCachedPreferredSize = false; tree.revalidate(); tree.repaint(); }
tree.revalidate();
public void editingStopped(ChangeEvent e) { editingPath = null; editingRow = -1; stopEditingInCompleteEditing = false; if (editingComponent != null) { tree.remove(editingComponent.getParent()); editingComponent = null; } if (cellEditor != null) { newVal = ((JTextField) getCellEditor().getCellEditorValue()).getText(); completeEditing(false, false, true); if (cellEditor instanceof DefaultTreeCellEditor) tree.removeTreeSelectionListener((DefaultTreeCellEditor) cellEditor); cellEditor.removeCellEditorListener(cellEditorListener); setCellEditor(null); createdCellEditor = false; } isEditing = false; tree.requestFocusInWindow(false); editorTimer.stop(); validCachedPreferredSize = false; tree.revalidate(); tree.repaint(); }
updateCurrentVisiblePath(); tree.revalidate();
public void propertyChange(PropertyChangeEvent event) { if ((event.getPropertyName()).equals("rootVisible")) { validCachedPreferredSize = false; updateCurrentVisiblePath(); tree.revalidate(); tree.repaint(); } }
updateCurrentVisiblePath(); tree.revalidate();
public void treeCollapsed(TreeExpansionEvent event) { validCachedPreferredSize = false; updateCurrentVisiblePath(); tree.revalidate(); tree.repaint(); }
updateCurrentVisiblePath(); tree.revalidate();
public void treeExpanded(TreeExpansionEvent event) { validCachedPreferredSize = false; updateCurrentVisiblePath(); tree.revalidate(); tree.repaint(); }
updateCurrentVisiblePath(); tree.revalidate();
public void treeNodesChanged(TreeModelEvent e) { validCachedPreferredSize = false; updateCurrentVisiblePath(); tree.revalidate(); tree.repaint(); }
updateCurrentVisiblePath(); tree.revalidate();
public void treeNodesInserted(TreeModelEvent e) { validCachedPreferredSize = false; updateCurrentVisiblePath(); tree.revalidate(); tree.repaint(); }
updateCurrentVisiblePath(); tree.revalidate();
public void treeNodesRemoved(TreeModelEvent e) { validCachedPreferredSize = false; updateCurrentVisiblePath(); tree.revalidate(); tree.repaint(); }
updateCurrentVisiblePath();
public void treeStructureChanged(TreeModelEvent e) { if (e.getPath().length == 1 && !e.getPath()[0].equals(treeModel.getRoot())) tree.expandPath(new TreePath(treeModel.getRoot())); updateCurrentVisiblePath(); validCachedPreferredSize = false; tree.revalidate(); tree.repaint(); }
tree.revalidate();
public void treeStructureChanged(TreeModelEvent e) { if (e.getPath().length == 1 && !e.getPath()[0].equals(treeModel.getRoot())) tree.expandPath(new TreePath(treeModel.getRoot())); updateCurrentVisiblePath(); validCachedPreferredSize = false; tree.revalidate(); tree.repaint(); }
TreePath path = new TreePath(mod.getRoot());
Object root = mod.getRoot(); if (root != null) { TreePath path = new TreePath(root);
public void installUI(JComponent c) { tree = (JTree) c; prepareForUIInstall(); super.installUI(c); installDefaults(); installComponents(); installKeyboardActions(); installListeners(); setCellEditor(createDefaultCellEditor()); createdCellEditor = true; isEditing = false; TreeModel mod = tree.getModel(); setModel(mod); if (mod != null) { TreePath path = new TreePath(mod.getRoot()); if (!tree.isExpanded(path)) toggleExpandState(path); } treeSelectionModel = tree.getSelectionModel(); completeUIInstall(); }
}
public void installUI(JComponent c) { tree = (JTree) c; prepareForUIInstall(); super.installUI(c); installDefaults(); installComponents(); installKeyboardActions(); installListeners(); setCellEditor(createDefaultCellEditor()); createdCellEditor = true; isEditing = false; TreeModel mod = tree.getModel(); setModel(mod); if (mod != null) { TreePath path = new TreePath(mod.getRoot()); if (!tree.isExpanded(path)) toggleExpandState(path); } treeSelectionModel = tree.getSelectionModel(); completeUIInstall(); }
if (currentVisiblePath == null)
public void paint(Graphics g, JComponent c) { JTree tree = (JTree) c; if (currentVisiblePath == null) updateCurrentVisiblePath(); Rectangle clip = g.getClipBounds(); Insets insets = tree.getInsets(); if (clip != null && treeModel != null && currentVisiblePath != null) { int startIndex = tree.getClosestRowForLocation(clip.x, clip.y); int endIndex = tree.getClosestRowForLocation(clip.x + clip.width, clip.y + clip.height); paintVerticalPartOfLeg(g, clip, insets, currentVisiblePath); for (int i = startIndex; i <= endIndex; i++) { Object curr = currentVisiblePath.getPathComponent(i); boolean isLeaf = treeModel.isLeaf(curr); TreePath path = new TreePath(getPathToRoot(curr, 0)); boolean isExpanded = tree.isExpanded(path); Rectangle bounds = getPathBounds(tree, path); paintHorizontalPartOfLeg(g, clip, insets, bounds, path, i, isExpanded, false, isLeaf); paintRow(g, clip, insets, bounds, path, i, isExpanded, false, isLeaf); } } }
tree.revalidate();
protected void pathWasCollapsed(TreePath path) { validCachedPreferredSize = false; tree.revalidate(); tree.repaint(); }
tree.revalidate();
protected void pathWasExpanded(TreePath path) { validCachedPreferredSize = false; tree.revalidate(); tree.repaint(); }
tree.revalidate();
protected boolean startEditing(TreePath path, MouseEvent event) { int x; int y; if (event == null) { Rectangle bounds = getPathBounds(tree, path); x = bounds.x; y = bounds.y; } else { x = event.getX(); y = event.getY(); } updateCellEditor(); TreeCellEditor ed = getCellEditor(); if (ed != null && ed.shouldSelectCell(event) && ed.isCellEditable(event)) { editingPath = path; editingRow = tree.getRowForPath(editingPath); Object val = editingPath.getLastPathComponent(); cellEditor.addCellEditorListener(cellEditorListener); stopEditingInCompleteEditing = false; boolean expanded = tree.isExpanded(editingPath); isEditing = true; editingComponent = ed.getTreeCellEditorComponent(tree, val, true, expanded, isLeaf(editingRow), editingRow); editingComponent.getParent().setVisible(true); editingComponent.getParent().validate(); tree.add(editingComponent.getParent()); editingComponent.getParent().validate(); validCachedPreferredSize = false; tree.revalidate(); ((JTextField) editingComponent).requestFocusInWindow(false); editorTimer.start(); return true; } return false; }
updateCurrentVisiblePath();
protected void toggleExpandState(TreePath path) { if (tree.isExpanded(path)) tree.collapsePath(path); else tree.expandPath(path); updateCurrentVisiblePath(); }
if (next == null) return;
void updateCurrentVisiblePath() { if (treeModel == null) return; Object next = treeModel.getRoot(); TreePath rootPath = new TreePath(next); Rectangle bounds = getPathBounds(tree, rootPath); // If root is not a valid size to be visible, or is // not visible and the tree is expanded, then the next node acts // as the root if ((bounds.width == 0 && bounds.height == 0) || (!isRootVisible() && tree.isExpanded(new TreePath(next)))) { next = getNextNode(next); rootPath = new TreePath(next); } Object root = next; TreePath current = null; while (next != null) { if (current == null) current = rootPath; else current = current.pathByAddingChild(next); do { TreePath path = new TreePath(getPathToRoot(next, 0)); if ((tree.isVisible(path) && tree.isExpanded(path)) || treeModel.isLeaf(next)) next = getNextNode(next); else { Object pNext = next; next = getNextSibling(pNext); // if no next sibling, check parent's next sibling. if (next == null) { Object parent = getParent(root, pNext); while (next == null && parent != null) { next = getNextSibling(parent); if (next == null) parent = getParent(root, parent); } } } } while (next != null && !tree.isVisible(new TreePath(getPathToRoot(next, 0)))); } currentVisiblePath = current; tree.setVisibleRowCount(getRowCount(tree)); if (tree.getSelectionModel() != null && tree.getSelectionCount() == 0 && currentVisiblePath != null) selectPath(tree, new TreePath(getPathToRoot(currentVisiblePath. getPathComponent(0), 0))); }
toolBar.setBorder(new ToolBarBorder());
toolBar.setBorder(defaults.getBorder("ToolBar.border"));
protected void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); toolBar.setBorder(new ToolBarBorder()); toolBar.setBackground(defaults.getColor("ToolBar.background")); toolBar.setForeground(defaults.getColor("ToolBar.foreground")); toolBar.setFont(defaults.getFont("ToolBar.font")); dockingBorderColor = defaults.getColor("ToolBar.dockingForeground"); dockingColor = defaults.getColor("ToolBar.dockingBackground"); floatingBorderColor = defaults.getColor("ToolBar.floatingForeground"); floatingColor = defaults.getColor("ToolBar.floatingBackground"); }
if (tex instanceof SyntaxError) {
if (tex instanceof SyntaxErrorException) {
public void invoke(String cmdLineStr) { final CommandLine cmdLine = new CommandLine(cmdLineStr); if (!cmdLine.hasNext()) return; String cmdName = cmdLine.next(); commandShell.addCommandToHistory(cmdLineStr); // System.err.println("Got command: "+cmdLineStr+", name="+cmdName); try { Class cmdClass = commandShell.getCommandClass(cmdName); // System.err.println("CmdClass="+cmdClass); final Method main = cmdClass.getMethod("main", MAIN_ARG_TYPES); // System.err.println("main="+main); try { // System.err.println("Invoking..."); try { final Object[] args = new Object[] { cmdLine.getRemainder() .toStringArray()}; AccessController.doPrivileged(new InvokeAction(main, null, args)); } catch (PrivilegedActionException ex) { throw ex.getException(); } //main.invoke(null, ); // System.err.println("Finished invoke."); } catch (InvocationTargetException ex) { Throwable tex = ex.getTargetException(); if (tex instanceof SyntaxError) { Help.getInfo(cmdClass).usage(); err.println(tex.getMessage()); } else { err.println("Exception in command"); tex.printStackTrace(err); } } catch (Exception ex) { err.println("Exception in command"); ex.printStackTrace(err); } catch (Error ex) { err.println("Fatal error in command"); ex.printStackTrace(err); } } catch (NoSuchMethodException ex) { err.println("Alias class has no main method " + cmdName); } catch (ClassNotFoundException ex) { err.println("Unknown alias class " + ex.getMessage()); } catch (ClassCastException ex) { err.println("Invalid command " + cmdName); } catch (Exception ex) { err.println("I FOUND AN ERROR: " + ex); } }
if (from != null && from.length() > 0) msg.setFrom(new InternetAddress(from));
if (from == null) from = SMTPProperties.getProperty("mail.smtp.from"); if (from != null && from.length() > 0) { pers = SMTPProperties.getProperty("mail.smtp.realname"); if (pers != null) msg.setFrom(new InternetAddress(from, pers)); }
public boolean send() throws Exception { try { if(!loadConfig(configFile)) return false; Session session = Session.getDefaultInstance(SMTPProperties, null); session.setDebug(false); // create the Multipart and its parts to it Multipart mp = new MimeMultipart(); Message msg = new MimeMessage(session); InternetAddress[] toAddrs = null, ccAddrs = null; toAddrs = InternetAddress.parse(to, false); msg.setRecipients(Message.RecipientType.TO, toAddrs); if (cc != null) { ccAddrs = InternetAddress.parse(cc, false); msg.setRecipients(Message.RecipientType.CC, ccAddrs); } if (subject != null) msg.setSubject(subject.trim()); if (from != null && from.length() > 0) msg.setFrom(new InternetAddress(from)); if (message != null && message.length() > 0) { // create and fill the attachment message part MimeBodyPart mbp = new MimeBodyPart(); mbp.setText(message,"us-ascii"); mp.addBodyPart(mbp); } msg.setSentDate(new Date()); if (attachment != null && attachment.length() > 0) { // create and fill the attachment message part MimeBodyPart abp = new MimeBodyPart(); abp.setText(attachment,"us-ascii"); if (attachmentName == null || attachmentName.length() == 0) abp.setFileName("tn5250j.txt"); else abp.setFileName(attachmentName); mp.addBodyPart(abp); } if (fileName != null && fileName.length() > 0) { // create and fill the attachment message part MimeBodyPart fbp = new MimeBodyPart(); fbp.setText("File sent using tn5250j","us-ascii"); if (attachmentName == null || attachmentName.length() == 0) fbp.setFileName("tn5250j.txt"); else fbp.setFileName(attachmentName); // Get the attachment DataSource source = new FileDataSource(fileName); // Set the data handler to the attachment fbp.setDataHandler(new DataHandler(source)); mp.addBodyPart(fbp); } // add the Multipart to the message msg.setContent(mp); // send the message Transport.send(msg); return true; } catch (SendFailedException sfe) { showFailedException(sfe); }// catch (AddressException ae) {//// }// catch ( MessagingException me) {//// } return false; }
for (int x = 0; x < ia.length; x++) { error += "Invalid Address: " + ia[x].toString() + "\n";
if (ia != null) { for (int x = 0; x < ia.length; x++) { error += "Invalid Address: " + ia[x].toString() + "\n"; }
private void showFailedException(SendFailedException sfe) { String error = sfe.getMessage() + "\n"; Address[] ia = sfe.getInvalidAddresses(); for (int x = 0; x < ia.length; x++) { error += "Invalid Address: " + ia[x].toString() + "\n"; } JTextArea ea = new JTextArea(error,6,50); JScrollPane errorScrollPane = new JScrollPane(ea); errorScrollPane.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); errorScrollPane.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); JOptionPane.showMessageDialog(null, errorScrollPane, LangTool.getString("em.titleConfirmation"), JOptionPane.ERROR_MESSAGE); }
public HostNameArgument(String _name, String _description)
public HostNameArgument(String _name, String _description, boolean _multi)
public HostNameArgument(String _name, String _description) { super(_name, _description); }
super(_name, _description);
super(_name, _description, _multi);
public HostNameArgument(String _name, String _description) { super(_name, _description); }