rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
if (offset < 0 || offset > count) throw new StringIndexOutOfBoundsException(offset); ensureCapacity_unsynchronized(count + 1); VMSystem.arraycopy(value, offset, value, offset + 1, count - offset); value[offset] = ch; count++;
if (offset < 0 || offset > count || len < 0 || str_offset < 0 || str_offset > str.length - len) throw new StringIndexOutOfBoundsException(); ensureCapacity_unsynchronized(count + len); VMSystem.arraycopy(value, offset, value, offset + len, count - offset); VMSystem.arraycopy(str, str_offset, value, offset, len); count += len;
public synchronized StringBuffer insert(int offset, char ch) { if (offset < 0 || offset > count) throw new StringIndexOutOfBoundsException(offset); ensureCapacity_unsynchronized(count + 1); VMSystem.arraycopy(value, offset, value, offset + 1, count - offset); value[offset] = ch; count++; return this; }
public int getHeight(ImageObserver io) {
public int getHeight() {
public int getHeight(ImageObserver io) { synchronized (lock) { // tell waiting threads to wake up lock.notifyAll(); return bi.getHeight(io); } }
return bi.getHeight(io);
return bi.getHeight();
public int getHeight(ImageObserver io) { synchronized (lock) { // tell waiting threads to wake up lock.notifyAll(); return bi.getHeight(io); } }
public TTFFileInput(RandomAccessFile file) throws IOException { this(file, 0, file.length());
public TTFFileInput(RandomAccessFile file, long offset, long length) throws IOException { this.ttf = file; this.offset = offset; this.length = length;
public TTFFileInput(RandomAccessFile file) throws IOException { this(file, 0, file.length()); }
public GrubBootSector(byte[] src) { super(src);
public GrubBootSector(int size) { super(size);
public GrubBootSector(byte[] src) { super(src); }
if (insideTimer != null) insideTimer.start();
public void actionPerformed(ActionEvent event) { showTip(); if (insideTimer != null) insideTimer.start(); }
parent.invalidate(); parent.validate(); parent.repaint();
void hideTip() { if (currentTip == null || ! currentTip.isVisible() || ! enabled) return; currentTip.setVisible(false); if (containerPanel != null) { Container parent = containerPanel.getParent(); if (parent == null) return; parent.remove(containerPanel); parent.invalidate(); parent.validate(); parent.repaint(); parent = currentTip.getParent(); if (parent == null) return; parent.remove(currentTip); containerPanel = null; } if (tooltipWindow != null) { tooltipWindow.hide(); tooltipWindow.dispose(); tooltipWindow = null; } }
showTip();
public void mouseEntered(MouseEvent event) { if (currentComponent != null && getContentPaneDeepestComponent(event) == currentComponent) return; currentPoint = event.getPoint(); currentComponent = (Component) event.getSource(); if (exitTimer.isRunning()) { exitTimer.stop(); showTip(); insideTimer.start(); return; } // This should always be stopped unless we have just fake-exited. if (! enterTimer.isRunning()) enterTimer.start(); }
if (currentTip != null) { if (currentComponent == null) currentComponent = (Component) event.getSource(); String text = ((JComponent) currentComponent).getToolTipText(event); currentTip.setTipText(text); }
public void mouseMoved(MouseEvent event) { currentPoint = event.getPoint(); if (currentTip != null) { if (currentComponent == null) currentComponent = (Component) event.getSource(); String text = ((JComponent) currentComponent).getToolTipText(event); currentTip.setTipText(text); } if (enterTimer.isRunning()) enterTimer.restart(); }
if (currentComponent == null) currentComponent = (Component) event.getSource(); currentComponent.invalidate(); currentComponent.validate(); currentComponent.repaint();
public void mousePressed(MouseEvent event) { currentPoint = event.getPoint(); if (enterTimer.isRunning()) enterTimer.restart(); else if (insideTimer.isRunning()) { insideTimer.stop(); hideTip(); } if (currentComponent == null) currentComponent = (Component) event.getSource(); currentComponent.invalidate(); currentComponent.validate(); currentComponent.repaint(); }
if (! enabled || currentComponent == null)
if (!enabled || currentComponent == null || !currentComponent.isEnabled() || (currentTip != null && currentTip.isVisible()))
void showTip() { if (! enabled || currentComponent == null) return; if (currentTip == null || currentTip.getComponent() != currentComponent && currentComponent instanceof JComponent) currentTip = ((JComponent) currentComponent).createToolTip(); Point p = currentPoint; Dimension dims = currentTip.getPreferredSize(); if (canToolTipFit(currentTip)) { JLayeredPane pane = ((JRootPane) SwingUtilities.getAncestorOfClass(JRootPane.class, currentComponent)) .getLayeredPane(); // This should never happen, but just in case. if (pane == null) return; if (containerPanel != null) hideTip(); if (isLightWeightPopupEnabled()) { containerPanel = new Panel(); JRootPane root = new JRootPane(); root.getContentPane().add(currentTip); containerPanel.add(root); } else { containerPanel = new JPanel(); containerPanel.add(currentTip); } LayoutManager lm = containerPanel.getLayout(); if (lm instanceof FlowLayout) { FlowLayout fm = (FlowLayout) lm; fm.setVgap(0); fm.setHgap(0); } p = getGoodPoint(p, pane, currentTip, dims); pane.add(containerPanel); containerPanel.setBounds(p.x, p.y, dims.width, dims.height); currentTip.setBounds(0, 0, dims.width, dims.height); pane.revalidate(); pane.repaint(); } else { SwingUtilities.convertPointToScreen(p, currentComponent); tooltipWindow = new JWindow(); tooltipWindow.getContentPane().add(currentTip); tooltipWindow.setFocusable(false); tooltipWindow.pack(); tooltipWindow.setBounds(p.x, p.y, dims.width, dims.height); tooltipWindow.show(); } currentTip.setVisible(true); }
if (canToolTipFit(currentTip))
if (parent instanceof JPopupMenu) setLightWeightPopupEnabled(((JPopupMenu) parent).isLightWeightPopupEnabled()); else setLightWeightPopupEnabled(true); if (isLightWeightPopupEnabled())
void showTip() { if (! enabled || currentComponent == null) return; if (currentTip == null || currentTip.getComponent() != currentComponent && currentComponent instanceof JComponent) currentTip = ((JComponent) currentComponent).createToolTip(); Point p = currentPoint; Dimension dims = currentTip.getPreferredSize(); if (canToolTipFit(currentTip)) { JLayeredPane pane = ((JRootPane) SwingUtilities.getAncestorOfClass(JRootPane.class, currentComponent)) .getLayeredPane(); // This should never happen, but just in case. if (pane == null) return; if (containerPanel != null) hideTip(); if (isLightWeightPopupEnabled()) { containerPanel = new Panel(); JRootPane root = new JRootPane(); root.getContentPane().add(currentTip); containerPanel.add(root); } else { containerPanel = new JPanel(); containerPanel.add(currentTip); } LayoutManager lm = containerPanel.getLayout(); if (lm instanceof FlowLayout) { FlowLayout fm = (FlowLayout) lm; fm.setVgap(0); fm.setHgap(0); } p = getGoodPoint(p, pane, currentTip, dims); pane.add(containerPanel); containerPanel.setBounds(p.x, p.y, dims.width, dims.height); currentTip.setBounds(0, 0, dims.width, dims.height); pane.revalidate(); pane.repaint(); } else { SwingUtilities.convertPointToScreen(p, currentComponent); tooltipWindow = new JWindow(); tooltipWindow.getContentPane().add(currentTip); tooltipWindow.setFocusable(false); tooltipWindow.pack(); tooltipWindow.setBounds(p.x, p.y, dims.width, dims.height); tooltipWindow.show(); } currentTip.setVisible(true); }
if (pane == null) return;
if (pane == null) return; if (containerPanel != null) hideTip(); containerPanel = new Panel(); JRootPane root = new JRootPane(); root.getContentPane().add(currentTip); containerPanel.add(root);
void showTip() { if (! enabled || currentComponent == null) return; if (currentTip == null || currentTip.getComponent() != currentComponent && currentComponent instanceof JComponent) currentTip = ((JComponent) currentComponent).createToolTip(); Point p = currentPoint; Dimension dims = currentTip.getPreferredSize(); if (canToolTipFit(currentTip)) { JLayeredPane pane = ((JRootPane) SwingUtilities.getAncestorOfClass(JRootPane.class, currentComponent)) .getLayeredPane(); // This should never happen, but just in case. if (pane == null) return; if (containerPanel != null) hideTip(); if (isLightWeightPopupEnabled()) { containerPanel = new Panel(); JRootPane root = new JRootPane(); root.getContentPane().add(currentTip); containerPanel.add(root); } else { containerPanel = new JPanel(); containerPanel.add(currentTip); } LayoutManager lm = containerPanel.getLayout(); if (lm instanceof FlowLayout) { FlowLayout fm = (FlowLayout) lm; fm.setVgap(0); fm.setHgap(0); } p = getGoodPoint(p, pane, currentTip, dims); pane.add(containerPanel); containerPanel.setBounds(p.x, p.y, dims.width, dims.height); currentTip.setBounds(0, 0, dims.width, dims.height); pane.revalidate(); pane.repaint(); } else { SwingUtilities.convertPointToScreen(p, currentComponent); tooltipWindow = new JWindow(); tooltipWindow.getContentPane().add(currentTip); tooltipWindow.setFocusable(false); tooltipWindow.pack(); tooltipWindow.setBounds(p.x, p.y, dims.width, dims.height); tooltipWindow.show(); } currentTip.setVisible(true); }
if (containerPanel != null) hideTip(); if (isLightWeightPopupEnabled()) { containerPanel = new Panel(); JRootPane root = new JRootPane(); root.getContentPane().add(currentTip); containerPanel.add(root); } else { containerPanel = new JPanel(); containerPanel.add(currentTip); } LayoutManager lm = containerPanel.getLayout(); if (lm instanceof FlowLayout) { FlowLayout fm = (FlowLayout) lm; fm.setVgap(0); fm.setHgap(0); }
LayoutManager lm = containerPanel.getLayout(); if (lm instanceof FlowLayout) { FlowLayout fm = (FlowLayout) lm; fm.setVgap(0); fm.setHgap(0); }
void showTip() { if (! enabled || currentComponent == null) return; if (currentTip == null || currentTip.getComponent() != currentComponent && currentComponent instanceof JComponent) currentTip = ((JComponent) currentComponent).createToolTip(); Point p = currentPoint; Dimension dims = currentTip.getPreferredSize(); if (canToolTipFit(currentTip)) { JLayeredPane pane = ((JRootPane) SwingUtilities.getAncestorOfClass(JRootPane.class, currentComponent)) .getLayeredPane(); // This should never happen, but just in case. if (pane == null) return; if (containerPanel != null) hideTip(); if (isLightWeightPopupEnabled()) { containerPanel = new Panel(); JRootPane root = new JRootPane(); root.getContentPane().add(currentTip); containerPanel.add(root); } else { containerPanel = new JPanel(); containerPanel.add(currentTip); } LayoutManager lm = containerPanel.getLayout(); if (lm instanceof FlowLayout) { FlowLayout fm = (FlowLayout) lm; fm.setVgap(0); fm.setHgap(0); } p = getGoodPoint(p, pane, currentTip, dims); pane.add(containerPanel); containerPanel.setBounds(p.x, p.y, dims.width, dims.height); currentTip.setBounds(0, 0, dims.width, dims.height); pane.revalidate(); pane.repaint(); } else { SwingUtilities.convertPointToScreen(p, currentComponent); tooltipWindow = new JWindow(); tooltipWindow.getContentPane().add(currentTip); tooltipWindow.setFocusable(false); tooltipWindow.pack(); tooltipWindow.setBounds(p.x, p.y, dims.width, dims.height); tooltipWindow.show(); } currentTip.setVisible(true); }
p = getGoodPoint(p, pane, currentTip, dims); pane.add(containerPanel); containerPanel.setBounds(p.x, p.y, dims.width, dims.height); currentTip.setBounds(0, 0, dims.width, dims.height); pane.revalidate(); pane.repaint();
p = SwingUtilities.convertPoint(currentComponent, p, pane); p = adjustLocation(p, pane, dims); pane.add(containerPanel); containerPanel.setBounds(p.x, p.y, dims.width, dims.height); currentTip.setBounds(0, 0, dims.width, dims.height); containerPanel.validate(); containerPanel.repaint();
void showTip() { if (! enabled || currentComponent == null) return; if (currentTip == null || currentTip.getComponent() != currentComponent && currentComponent instanceof JComponent) currentTip = ((JComponent) currentComponent).createToolTip(); Point p = currentPoint; Dimension dims = currentTip.getPreferredSize(); if (canToolTipFit(currentTip)) { JLayeredPane pane = ((JRootPane) SwingUtilities.getAncestorOfClass(JRootPane.class, currentComponent)) .getLayeredPane(); // This should never happen, but just in case. if (pane == null) return; if (containerPanel != null) hideTip(); if (isLightWeightPopupEnabled()) { containerPanel = new Panel(); JRootPane root = new JRootPane(); root.getContentPane().add(currentTip); containerPanel.add(root); } else { containerPanel = new JPanel(); containerPanel.add(currentTip); } LayoutManager lm = containerPanel.getLayout(); if (lm instanceof FlowLayout) { FlowLayout fm = (FlowLayout) lm; fm.setVgap(0); fm.setHgap(0); } p = getGoodPoint(p, pane, currentTip, dims); pane.add(containerPanel); containerPanel.setBounds(p.x, p.y, dims.width, dims.height); currentTip.setBounds(0, 0, dims.width, dims.height); pane.revalidate(); pane.repaint(); } else { SwingUtilities.convertPointToScreen(p, currentComponent); tooltipWindow = new JWindow(); tooltipWindow.getContentPane().add(currentTip); tooltipWindow.setFocusable(false); tooltipWindow.pack(); tooltipWindow.setBounds(p.x, p.y, dims.width, dims.height); tooltipWindow.show(); } currentTip.setVisible(true); }
else { SwingUtilities.convertPointToScreen(p, currentComponent); tooltipWindow = new JWindow(); tooltipWindow.getContentPane().add(currentTip); tooltipWindow.setFocusable(false); tooltipWindow.pack(); tooltipWindow.setBounds(p.x, p.y, dims.width, dims.height); tooltipWindow.show();
else if (currentComponent.isShowing()) { SwingUtilities.convertPointToScreen(p, currentComponent); p = adjustLocation(p, SwingUtilities.getWindowAncestor(currentComponent), dims); tooltipWindow = new JDialog(); tooltipWindow.setContentPane(currentTip); tooltipWindow.setUndecorated(true); tooltipWindow.getRootPane(). setWindowDecorationStyle(JRootPane.PLAIN_DIALOG); tooltipWindow.pack(); tooltipWindow.setBounds(p.x, p.y, dims.width, dims.height); tooltipWindow.show(); tooltipWindow.repaint();
void showTip() { if (! enabled || currentComponent == null) return; if (currentTip == null || currentTip.getComponent() != currentComponent && currentComponent instanceof JComponent) currentTip = ((JComponent) currentComponent).createToolTip(); Point p = currentPoint; Dimension dims = currentTip.getPreferredSize(); if (canToolTipFit(currentTip)) { JLayeredPane pane = ((JRootPane) SwingUtilities.getAncestorOfClass(JRootPane.class, currentComponent)) .getLayeredPane(); // This should never happen, but just in case. if (pane == null) return; if (containerPanel != null) hideTip(); if (isLightWeightPopupEnabled()) { containerPanel = new Panel(); JRootPane root = new JRootPane(); root.getContentPane().add(currentTip); containerPanel.add(root); } else { containerPanel = new JPanel(); containerPanel.add(currentTip); } LayoutManager lm = containerPanel.getLayout(); if (lm instanceof FlowLayout) { FlowLayout fm = (FlowLayout) lm; fm.setVgap(0); fm.setHgap(0); } p = getGoodPoint(p, pane, currentTip, dims); pane.add(containerPanel); containerPanel.setBounds(p.x, p.y, dims.width, dims.height); currentTip.setBounds(0, 0, dims.width, dims.height); pane.revalidate(); pane.repaint(); } else { SwingUtilities.convertPointToScreen(p, currentComponent); tooltipWindow = new JWindow(); tooltipWindow.getContentPane().add(currentTip); tooltipWindow.setFocusable(false); tooltipWindow.pack(); tooltipWindow.setBounds(p.x, p.y, dims.width, dims.height); tooltipWindow.show(); } currentTip.setVisible(true); }
currentTip.repaint();
void showTip() { if (! enabled || currentComponent == null) return; if (currentTip == null || currentTip.getComponent() != currentComponent && currentComponent instanceof JComponent) currentTip = ((JComponent) currentComponent).createToolTip(); Point p = currentPoint; Dimension dims = currentTip.getPreferredSize(); if (canToolTipFit(currentTip)) { JLayeredPane pane = ((JRootPane) SwingUtilities.getAncestorOfClass(JRootPane.class, currentComponent)) .getLayeredPane(); // This should never happen, but just in case. if (pane == null) return; if (containerPanel != null) hideTip(); if (isLightWeightPopupEnabled()) { containerPanel = new Panel(); JRootPane root = new JRootPane(); root.getContentPane().add(currentTip); containerPanel.add(root); } else { containerPanel = new JPanel(); containerPanel.add(currentTip); } LayoutManager lm = containerPanel.getLayout(); if (lm instanceof FlowLayout) { FlowLayout fm = (FlowLayout) lm; fm.setVgap(0); fm.setHgap(0); } p = getGoodPoint(p, pane, currentTip, dims); pane.add(containerPanel); containerPanel.setBounds(p.x, p.y, dims.width, dims.height); currentTip.setBounds(0, 0, dims.width, dims.height); pane.revalidate(); pane.repaint(); } else { SwingUtilities.convertPointToScreen(p, currentComponent); tooltipWindow = new JWindow(); tooltipWindow.getContentPane().add(currentTip); tooltipWindow.setFocusable(false); tooltipWindow.pack(); tooltipWindow.setBounds(p.x, p.y, dims.width, dims.height); tooltipWindow.show(); } currentTip.setVisible(true); }
FileInputStream in = new FileInputStream(getConfigurationResource());
FileInputStream in = new FileInputStream(settingsDirectory() + getConfigurationResource());
private void loadConfigurationResource() { sesProps = new Properties(); try { FileInputStream in = new FileInputStream(getConfigurationResource()); sesProps.load(in); if (sesProps.size() == 0) loadDefaults(); } catch (IOException ioe) { System.out.println("Information Message: Properties file is being " + "created for first time use: File name " + getConfigurationResource()); loadDefaults(); } catch (SecurityException se) { System.out.println(se.getMessage()); } }
abstract public void saveSettings(String regKey, String fileName, String header);
abstract public void saveSettings();
abstract public void saveSettings(String regKey, String fileName, String header);
bad.minor = Minor.Any;
public static InvalidSlot extract(Any any) { try { EmptyExceptionHolder h = (EmptyExceptionHolder) any.extract_Streamable(); return (InvalidSlot) h.value; } catch (ClassCastException cex) { BAD_OPERATION bad = new BAD_OPERATION("InvalidSlot expected"); bad.initCause(cex); throw bad; } }
if(pcdata != null) writeOut(outputstream, pcdata);
if(pcdata != null) { writeOut(outputstream, pcdata); if (!dontCloseNode) if ( nodeNameString.equals(sXDFStructureNodeName) && !XMLDeclAttribs.isEmpty() ) { writeOut(outputstream, "</"+sXDFRootNodeName+">"); } else { writeOut(outputstream, "</"+nodeNameString+">"); } if (sPrettyXDFOutput) writeOut(outputstream, Constants.NEW_LINE); return ; };
public void toXDFOutputStream ( OutputStream outputstream, Hashtable XMLDeclAttribs, String indent, boolean dontCloseNode, String newNodeNameString, String noChildObjectNodeName ) { String nodeNameString = this.classXDFNodeName; // Setup. Sometimes the name of the node we are opening is different from // that specified in the classXDFNodeName (*sigh*) if (newNodeNameString != null) nodeNameString = newNodeNameString; // 0. To be valid XML, we always start an XML block with an // XML declaration (e.g. somehting like "<?xml standalone="no"?>"). // Here we deal with printing out XML Declaration && its attributes if (!XMLDeclAttribs.isEmpty()) { indent = ""; writeXMLDeclToOutputStream(outputstream, XMLDeclAttribs); } else { Log.warn("Warning: XMLDeclAttribs NOT currently supported."); } // 1. open this node, print its simple XML attributes if (nodeNameString != null) { if (sPrettyXDFOutput) writeOut(outputstream, indent); // indent node if desired // For printing the opening statement we need to invoke a little // Voodoo to keep the DTD happy: the first structure node is always // called by the root node name instead of the usual nodeNameString // We can tell this by checking if this object is derived from class // Structure and if XMLDeclAttrib defined/populated with information // NOTE: This isnt really the way to do this. We need to check if 'this' is // is or has as a superclass xdf.Structure instead of the 'string check' below. // check is class Strucuture & XMLDeclAttribs populated? if ( nodeNameString.equals(sXDFStructureNodeName) && !XMLDeclAttribs.isEmpty() ) { writeOut(outputstream,"<" + sXDFRootNodeName); // print opening root node statement } else { writeOut(outputstream,"<" + nodeNameString); // print opening statement } } // gather info about XMLAttributes in this object/node Hashtable xmlInfo = getXMLInfo(); // 2. Print out string object XML attributes EXCEPT for the one that // matches PCDATAAttribute. ArrayList attribs = (ArrayList) xmlInfo.get("attribList"); // is synchronized here correct? synchronized(attribs) { for (int i = 0; i < attribs.size(); i++) { Hashtable item = (Hashtable) attribs.get(i); writeOut(outputstream, " "+ item.get("name") + "=\"" + item.get("value") + "\""); } } // 3. Print out Node PCData or Child Nodes as specified by object ref // XML attributes. The way this stuff occurs will also affect how we // close the node. ArrayList childObjs = (ArrayList) xmlInfo.get("childObjList"); String pcdata = (String) xmlInfo.get("PCDATA"); if ( childObjs.size() > 0 || pcdata != null || noChildObjectNodeName != null) { // close the opening tag if (nodeNameString != null) { writeOut(outputstream, ">"); if (sPrettyXDFOutput && pcdata == null) writeOut(outputstream, Constants.NEW_LINE); } // deal with object/list XML attributes, if any in our list for (int i = 0; i < childObjs.size(); i++) { Hashtable item = (Hashtable) childObjs.get(i); if (item.get("type") == Constants.LIST_TYPE) { List objectList = (List) item.get("value"); // Im not sure this synchronized wrapper is needed, we are // only accessing stuff here.. Also, should synchronzied wrapper // occur back in the getXMLInfo method instead where the orig // access occured?!? synchronized(objectList) { Iterator iter = objectList.iterator(); // Must be in synchronized block while (iter.hasNext()) { BaseObject containedObj = (BaseObject) iter.next(); if (containedObj != null) { // can happen from pre-allocation of axis values, etc (?) String newindent = indent + sPrettyXDFOutputIndentation; dealWithOpeningGroupNodes(containedObj, outputstream, indent); dealWithClosingGroupNodes(containedObj, outputstream, indent); containedObj.toXDFOutputStream(outputstream, new Hashtable(), newindent); } } } } else if (item.get("type") == Constants.OBJECT_TYPE) { BaseObject containedObj = (BaseObject) item.get("value"); if (containedObj != null) { // can happen from pre-allocation of axis values, etc (?) // shouldnt this be synchronized too?? synchronized(containedObj) { String newindent = indent + sPrettyXDFOutputIndentation; dealWithOpeningGroupNodes(containedObj, outputstream, indent); dealWithClosingGroupNodes(containedObj, outputstream, indent); containedObj.toXDFOutputStream(outputstream, new Hashtable(), newindent); } } } else { // error: weird type, actually shouldnt occur. Is this needed?? Log.error("Weird error: unknown XML attribute type for item:"+item); } } // print out PCDATA, if any if(pcdata != null) writeOut(outputstream, pcdata); // if there are no PCDATA or child objects/nodes then // we print out noChildObjectNodeName if ( childObjs.size() == 0 && pcdata == null && noChildObjectNodeName != null) { if (sPrettyXDFOutput) writeOut(outputstream, indent); writeOut(outputstream, "<" + noChildObjectNodeName + "/>"); if (sPrettyXDFOutput) writeOut(outputstream, Constants.NEW_LINE); } // ok, now deal with closing the node if (nodeNameString != null) { // Needed?? //dealWithClosingGroupNodes(containedObj, outputstream, indent); //Brian: we have to fix this, no whitespace should be allowed between //PCDATA and closing node if (sPrettyXDFOutput) writeOut(outputstream, indent); if (!dontCloseNode) if ( nodeNameString.equals(sXDFStructureNodeName) && !XMLDeclAttribs.isEmpty() ) { writeOut(outputstream, "</"+sXDFRootNodeName+">"); } else { writeOut(outputstream, "</"+nodeNameString+">"); } } } else { if(dontCloseNode) { // it may not have sub-objects, but we dont want to close it // (happens for group objects) } else { // no sub-objects, just close this node writeOut(outputstream, "/>"); } } if (sPrettyXDFOutput) writeOut(outputstream, Constants.NEW_LINE); }
public void toXDFOutputStream (OutputStream outputstream, String indent)
public void toXDFOutputStream ( OutputStream outputstream, Hashtable XMLDeclAttribs, String indent, boolean dontCloseNode, String newNodeNameString, String noChildObjectNodeName )
public void toXDFOutputStream (OutputStream outputstream, String indent) { // prepare XMLDeclaration Hashtable XMLDeclAttribs = new Hashtable(); XMLDeclAttribs.put("standalone", new String("no")); XMLDeclAttribs.put("version", (String) sXMLSpecVersion); toXDFOutputStream(outputstream, XMLDeclAttribs, indent); }
Hashtable XMLDeclAttribs = new Hashtable(); XMLDeclAttribs.put("standalone", new String("no")); XMLDeclAttribs.put("version", (String) sXMLSpecVersion); toXDFOutputStream(outputstream, XMLDeclAttribs, indent);
String nodeNameString = this.classXDFNodeName; if (newNodeNameString != null) nodeNameString = newNodeNameString; if ((XMLDeclAttribs !=null) &&(!XMLDeclAttribs.isEmpty())) { indent = ""; writeXMLDeclToOutputStream(outputstream, XMLDeclAttribs); } if (nodeNameString != null) { if (sPrettyXDFOutput) writeOut(outputstream, indent); if ( nodeNameString.equals(sXDFStructureNodeName) && !XMLDeclAttribs.isEmpty() ) nodeNameString = sXDFRootNodeName; writeOut(outputstream,"<" + nodeNameString); } Hashtable xmlInfo = getXMLInfo(); ArrayList attribs = (ArrayList) xmlInfo.get("attribList"); synchronized(attribs) { for (int i = 0; i < attribs.size(); i++) { Hashtable item = (Hashtable) attribs.get(i); writeOut(outputstream, " "+ item.get("name") + "=\"" + item.get("value") + "\""); } } ArrayList childObjs = (ArrayList) xmlInfo.get("childObjList"); String pcdata = (String) xmlInfo.get("PCDATA"); if ( childObjs.size() > 0 || pcdata != null || noChildObjectNodeName != null) { if (nodeNameString != null) { writeOut(outputstream, ">"); if ((sPrettyXDFOutput) && (pcdata == null)) writeOut(outputstream, Constants.NEW_LINE); } for (int i = 0; i < childObjs.size(); i++) { Hashtable item = (Hashtable) childObjs.get(i); if (item.get("type") == Constants.LIST_TYPE) { List objectList = (List) item.get("value"); synchronized(objectList) { Iterator iter = objectList.iterator(); while (iter.hasNext()) { BaseObject containedObj = (BaseObject) iter.next(); if (containedObj != null) { indent = dealWithOpeningGroupNodes(containedObj, outputstream, indent); indent = dealWithClosingGroupNodes(containedObj, outputstream, indent); String newindent = indent + sPrettyXDFOutputIndentation; containedObj.toXDFOutputStream(outputstream, new Hashtable(), newindent); } } } } else if (item.get("type") == Constants.OBJECT_TYPE) { BaseObject containedObj = (BaseObject) item.get("value"); if (containedObj != null) { synchronized(containedObj) { indent = dealWithOpeningGroupNodes(containedObj, outputstream, indent); indent = dealWithClosingGroupNodes(containedObj, outputstream, indent); String newindent = indent + sPrettyXDFOutputIndentation; containedObj.toXDFOutputStream(outputstream, new Hashtable(), newindent); } } } else { Log.errorln("Weird error: unknown XML attribute type for item:"+item); } } if(pcdata != null) { writeOut(outputstream, pcdata); }; if ( childObjs.size() == 0 && pcdata == null && noChildObjectNodeName != null) { if (sPrettyXDFOutput) writeOut(outputstream, indent + sPrettyXDFOutputIndentation); writeOut(outputstream, "<" + noChildObjectNodeName + "/>"); if (sPrettyXDFOutput) writeOut(outputstream, Constants.NEW_LINE); } if (nodeNameString != null) { indent = dealWithClosingGroupNodes((BaseObject) this, outputstream, indent); if (sPrettyXDFOutput && pcdata == null) writeOut(outputstream, indent); if (!dontCloseNode) writeOut(outputstream, "</"+nodeNameString+">"); } } else { if (dontCloseNode) { writeOut(outputstream, ">"); } else { writeOut(outputstream, "/>"); } } if (sPrettyXDFOutput) writeOut(outputstream, Constants.NEW_LINE);
public void toXDFOutputStream (OutputStream outputstream, String indent) { // prepare XMLDeclaration Hashtable XMLDeclAttribs = new Hashtable(); XMLDeclAttribs.put("standalone", new String("no")); XMLDeclAttribs.put("version", (String) sXMLSpecVersion); toXDFOutputStream(outputstream, XMLDeclAttribs, indent); }
super(p, q, g); this.x = x;
this(Registry.RAW_ENCODING_ID, p, q, g, x);
public DSSPrivateKey(BigInteger p, BigInteger q, BigInteger g, BigInteger x) { super(p, q, g); this.x = x; }
throw new IllegalArgumentException("format");
throw new IllegalArgumentException("Unsupported encoding format: " + format);
public byte[] getEncoded(int format) { byte[] result; switch (format) { case IKeyPairCodec.RAW_FORMAT: result = new DSSKeyPairRawCodec().encodePrivateKey(this); break; default: throw new IllegalArgumentException("format"); } return result; }
IKeyPairCodec codec = new DSSKeyPairRawCodec(); return (DSSPrivateKey) codec.decodePrivateKey(k);
return (DSSPrivateKey) new DSSKeyPairRawCodec().decodePrivateKey(k);
public static DSSPrivateKey valueOf(byte[] k) { // check magic... // we should parse here enough bytes to know which codec to use, and // direct the byte array to the appropriate codec. since we only have one // codec, we could have immediately tried it; nevertheless since testing // one byte is cheaper than instatiating a codec that will fail we test // the first byte before we carry on. if (k[0] == Registry.MAGIC_RAW_DSS_PRIVATE_KEY[0]) { // it's likely to be in raw format. get a raw codec and hand it over IKeyPairCodec codec = new DSSKeyPairRawCodec(); return (DSSPrivateKey) codec.decodePrivateKey(k); } else { throw new IllegalArgumentException("magic"); } }
else
catch (IllegalArgumentException ignored)
public static DSSPrivateKey valueOf(byte[] k) { // check magic... // we should parse here enough bytes to know which codec to use, and // direct the byte array to the appropriate codec. since we only have one // codec, we could have immediately tried it; nevertheless since testing // one byte is cheaper than instatiating a codec that will fail we test // the first byte before we carry on. if (k[0] == Registry.MAGIC_RAW_DSS_PRIVATE_KEY[0]) { // it's likely to be in raw format. get a raw codec and hand it over IKeyPairCodec codec = new DSSKeyPairRawCodec(); return (DSSPrivateKey) codec.decodePrivateKey(k); } else { throw new IllegalArgumentException("magic"); } }
throw new IllegalArgumentException("magic");
public static DSSPrivateKey valueOf(byte[] k) { // check magic... // we should parse here enough bytes to know which codec to use, and // direct the byte array to the appropriate codec. since we only have one // codec, we could have immediately tried it; nevertheless since testing // one byte is cheaper than instatiating a codec that will fail we test // the first byte before we carry on. if (k[0] == Registry.MAGIC_RAW_DSS_PRIVATE_KEY[0]) { // it's likely to be in raw format. get a raw codec and hand it over IKeyPairCodec codec = new DSSKeyPairRawCodec(); return (DSSPrivateKey) codec.decodePrivateKey(k); } else { throw new IllegalArgumentException("magic"); } }
return (DSSPrivateKey) new DSSKeyPairPKCS8Codec().decodePrivateKey(k);
public static DSSPrivateKey valueOf(byte[] k) { // check magic... // we should parse here enough bytes to know which codec to use, and // direct the byte array to the appropriate codec. since we only have one // codec, we could have immediately tried it; nevertheless since testing // one byte is cheaper than instatiating a codec that will fail we test // the first byte before we carry on. if (k[0] == Registry.MAGIC_RAW_DSS_PRIVATE_KEY[0]) { // it's likely to be in raw format. get a raw codec and hand it over IKeyPairCodec codec = new DSSKeyPairRawCodec(); return (DSSPrivateKey) codec.decodePrivateKey(k); } else { throw new IllegalArgumentException("magic"); } }
public boolean equals(Object obj)
private static boolean equals(BigInteger x, BigInteger y)
public boolean equals(Object obj) { if (! (obj instanceof BigInteger)) return false; return equals(this, (BigInteger) obj); }
if (! (obj instanceof BigInteger))
if (x.words == null && y.words == null) return x.ival == y.ival; if (x.words == null || y.words == null || x.ival != y.ival)
public boolean equals(Object obj) { if (! (obj instanceof BigInteger)) return false; return equals(this, (BigInteger) obj); }
return equals(this, (BigInteger) obj);
for (int i = x.ival; --i >= 0; ) { if (x.words[i] != y.words[i]) return false; } return true;
public boolean equals(Object obj) { if (! (obj instanceof BigInteger)) return false; return equals(this, (BigInteger) obj); }
public static void error(String msg, Throwable ex) { log(ERROR, System.err, msg, ex);
public static void error(String msg) { log(ERROR, System.err, msg, null);
public static void error(String msg, Throwable ex) { log(ERROR, System.err, msg, ex); /*try { Thread.sleep(2500); } catch (InterruptedException ex2) { // Ignore }*/ }
double small = getFlatness() * (1E-10);
double small = getFlatness() * EPSILON;
private int getAxisIntersections(double x, double y, boolean useYaxis, double distance) { int nCrossings = 0; double a0; double a1; double a2; double b0; double b1; double b2; double[] r = new double[3]; int nRoots; a0 = a2 = 0.0; if (useYaxis) { a0 = getY1() - y; a1 = getCtrlY() - y; a2 = getY2() - y; b0 = getX1() - x; b1 = getCtrlX() - x; b2 = getX2() - x; } else { a0 = getX1() - x; a1 = getCtrlX() - x; a2 = getX2() - x; b0 = getY1() - y; b1 = getCtrlY() - y; b2 = getY2() - y; } /* If the axis intersects a start/endpoint, shift it up by some small amount to guarantee the line is 'inside' If this is not done,bad behaviour may result for points on that axis. */ if (a0 == 0.0 || a2 == 0.0) { double small = getFlatness() * (1E-10); if (a0 == 0.0) a0 += small; if (a2 == 0.0) a2 += small; } r[0] = a0; r[1] = 2 * (a1 - a0); r[2] = (a2 - 2 * a1 + a0); nRoots = solveQuadratic(r); for (int i = 0; i < nRoots; i++) { double t = r[i]; if (t >= 0.0 && t <= 1.0) { double crossing = t * t * (b2 - 2 * b1 + b0) + 2 * t * (b1 - b0) + b0; /* single root is always doubly degenerate in quads */ if (crossing > 0 && crossing < distance) nCrossings += (nRoots == 1) ? 2 : 1; } } if (useYaxis) { if (Line2D.linesIntersect(b0, a0, b2, a2, 0.0, 0.0, distance, 0.0)) nCrossings++; } else { if (Line2D.linesIntersect(a0, b0, a2, b2, 0.0, 0.0, 0.0, distance)) nCrossings++; } return (nCrossings); }
a0 += small;
a0 -= small;
private int getAxisIntersections(double x, double y, boolean useYaxis, double distance) { int nCrossings = 0; double a0; double a1; double a2; double b0; double b1; double b2; double[] r = new double[3]; int nRoots; a0 = a2 = 0.0; if (useYaxis) { a0 = getY1() - y; a1 = getCtrlY() - y; a2 = getY2() - y; b0 = getX1() - x; b1 = getCtrlX() - x; b2 = getX2() - x; } else { a0 = getX1() - x; a1 = getCtrlX() - x; a2 = getX2() - x; b0 = getY1() - y; b1 = getCtrlY() - y; b2 = getY2() - y; } /* If the axis intersects a start/endpoint, shift it up by some small amount to guarantee the line is 'inside' If this is not done,bad behaviour may result for points on that axis. */ if (a0 == 0.0 || a2 == 0.0) { double small = getFlatness() * (1E-10); if (a0 == 0.0) a0 += small; if (a2 == 0.0) a2 += small; } r[0] = a0; r[1] = 2 * (a1 - a0); r[2] = (a2 - 2 * a1 + a0); nRoots = solveQuadratic(r); for (int i = 0; i < nRoots; i++) { double t = r[i]; if (t >= 0.0 && t <= 1.0) { double crossing = t * t * (b2 - 2 * b1 + b0) + 2 * t * (b1 - b0) + b0; /* single root is always doubly degenerate in quads */ if (crossing > 0 && crossing < distance) nCrossings += (nRoots == 1) ? 2 : 1; } } if (useYaxis) { if (Line2D.linesIntersect(b0, a0, b2, a2, 0.0, 0.0, distance, 0.0)) nCrossings++; } else { if (Line2D.linesIntersect(a0, b0, a2, b2, 0.0, 0.0, 0.0, distance)) nCrossings++; } return (nCrossings); }
a2 += small;
a2 -= small;
private int getAxisIntersections(double x, double y, boolean useYaxis, double distance) { int nCrossings = 0; double a0; double a1; double a2; double b0; double b1; double b2; double[] r = new double[3]; int nRoots; a0 = a2 = 0.0; if (useYaxis) { a0 = getY1() - y; a1 = getCtrlY() - y; a2 = getY2() - y; b0 = getX1() - x; b1 = getCtrlX() - x; b2 = getX2() - x; } else { a0 = getX1() - x; a1 = getCtrlX() - x; a2 = getX2() - x; b0 = getY1() - y; b1 = getCtrlY() - y; b2 = getY2() - y; } /* If the axis intersects a start/endpoint, shift it up by some small amount to guarantee the line is 'inside' If this is not done,bad behaviour may result for points on that axis. */ if (a0 == 0.0 || a2 == 0.0) { double small = getFlatness() * (1E-10); if (a0 == 0.0) a0 += small; if (a2 == 0.0) a2 += small; } r[0] = a0; r[1] = 2 * (a1 - a0); r[2] = (a2 - 2 * a1 + a0); nRoots = solveQuadratic(r); for (int i = 0; i < nRoots; i++) { double t = r[i]; if (t >= 0.0 && t <= 1.0) { double crossing = t * t * (b2 - 2 * b1 + b0) + 2 * t * (b1 - b0) + b0; /* single root is always doubly degenerate in quads */ if (crossing > 0 && crossing < distance) nCrossings += (nRoots == 1) ? 2 : 1; } } if (useYaxis) { if (Line2D.linesIntersect(b0, a0, b2, a2, 0.0, 0.0, distance, 0.0)) nCrossings++; } else { if (Line2D.linesIntersect(a0, b0, a2, b2, 0.0, 0.0, 0.0, distance)) nCrossings++; } return (nCrossings); }
if (Line2D.linesIntersect(b0, a0, b2, a2, 0.0, 0.0, distance, 0.0))
if (Line2D.linesIntersect(b0, a0, b2, a2, EPSILON, 0.0, distance, 0.0))
private int getAxisIntersections(double x, double y, boolean useYaxis, double distance) { int nCrossings = 0; double a0; double a1; double a2; double b0; double b1; double b2; double[] r = new double[3]; int nRoots; a0 = a2 = 0.0; if (useYaxis) { a0 = getY1() - y; a1 = getCtrlY() - y; a2 = getY2() - y; b0 = getX1() - x; b1 = getCtrlX() - x; b2 = getX2() - x; } else { a0 = getX1() - x; a1 = getCtrlX() - x; a2 = getX2() - x; b0 = getY1() - y; b1 = getCtrlY() - y; b2 = getY2() - y; } /* If the axis intersects a start/endpoint, shift it up by some small amount to guarantee the line is 'inside' If this is not done,bad behaviour may result for points on that axis. */ if (a0 == 0.0 || a2 == 0.0) { double small = getFlatness() * (1E-10); if (a0 == 0.0) a0 += small; if (a2 == 0.0) a2 += small; } r[0] = a0; r[1] = 2 * (a1 - a0); r[2] = (a2 - 2 * a1 + a0); nRoots = solveQuadratic(r); for (int i = 0; i < nRoots; i++) { double t = r[i]; if (t >= 0.0 && t <= 1.0) { double crossing = t * t * (b2 - 2 * b1 + b0) + 2 * t * (b1 - b0) + b0; /* single root is always doubly degenerate in quads */ if (crossing > 0 && crossing < distance) nCrossings += (nRoots == 1) ? 2 : 1; } } if (useYaxis) { if (Line2D.linesIntersect(b0, a0, b2, a2, 0.0, 0.0, distance, 0.0)) nCrossings++; } else { if (Line2D.linesIntersect(a0, b0, a2, b2, 0.0, 0.0, 0.0, distance)) nCrossings++; } return (nCrossings); }
if (Line2D.linesIntersect(a0, b0, a2, b2, 0.0, 0.0, 0.0, distance))
if (Line2D.linesIntersect(a0, b0, a2, b2, 0.0, EPSILON, 0.0, distance))
private int getAxisIntersections(double x, double y, boolean useYaxis, double distance) { int nCrossings = 0; double a0; double a1; double a2; double b0; double b1; double b2; double[] r = new double[3]; int nRoots; a0 = a2 = 0.0; if (useYaxis) { a0 = getY1() - y; a1 = getCtrlY() - y; a2 = getY2() - y; b0 = getX1() - x; b1 = getCtrlX() - x; b2 = getX2() - x; } else { a0 = getX1() - x; a1 = getCtrlX() - x; a2 = getX2() - x; b0 = getY1() - y; b1 = getCtrlY() - y; b2 = getY2() - y; } /* If the axis intersects a start/endpoint, shift it up by some small amount to guarantee the line is 'inside' If this is not done,bad behaviour may result for points on that axis. */ if (a0 == 0.0 || a2 == 0.0) { double small = getFlatness() * (1E-10); if (a0 == 0.0) a0 += small; if (a2 == 0.0) a2 += small; } r[0] = a0; r[1] = 2 * (a1 - a0); r[2] = (a2 - 2 * a1 + a0); nRoots = solveQuadratic(r); for (int i = 0; i < nRoots; i++) { double t = r[i]; if (t >= 0.0 && t <= 1.0) { double crossing = t * t * (b2 - 2 * b1 + b0) + 2 * t * (b1 - b0) + b0; /* single root is always doubly degenerate in quads */ if (crossing > 0 && crossing < distance) nCrossings += (nRoots == 1) ? 2 : 1; } } if (useYaxis) { if (Line2D.linesIntersect(b0, a0, b2, a2, 0.0, 0.0, distance, 0.0)) nCrossings++; } else { if (Line2D.linesIntersect(a0, b0, a2, b2, 0.0, 0.0, 0.0, distance)) nCrossings++; } return (nCrossings); }
double beta = (((y1 - y3) * (x4 - x3) + (x1 - x3) * (y4 - y3)) / ((y2 - y1) * (x4 - x3) + (x2 - x1) * (y4 - y3))); if (beta < 0.0 || beta > 1.0)
double a1, a2, a3, a4; if ((a1 = area2(x1, y1, x2, y2, x3, y3)) == 0.0) { if (between(x1, y1, x2, y2, x3, y3)) { return true; } else { if (area2(x1, y1, x2, y2, x4, y4) == 0.0) { return between(x3, y3, x4, y4, x1, y1) || between (x3, y3, x4, y4, x2, y2); } else {
public static boolean linesIntersect(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) { double beta = (((y1 - y3) * (x4 - x3) + (x1 - x3) * (y4 - y3)) / ((y2 - y1) * (x4 - x3) + (x2 - x1) * (y4 - y3))); if (beta < 0.0 || beta > 1.0) return false; double alpha = (x1 + beta * (x2 - x1) - x3) / (x4 - x3); return alpha >= 0.0 && alpha <= 1.0; }
double alpha = (x1 + beta * (x2 - x1) - x3) / (x4 - x3); return alpha >= 0.0 && alpha <= 1.0;
} } } else if ((a2 = area2(x1, y1, x2, y2, x4, y4)) == 0.0) { return between(x1, y1, x2, y2, x4, y4); } if ((a3 = area2(x3, y3, x4, y4, x1, y1)) == 0.0) { if (between(x3, y3, x4, y4, x1, y1)) { return true; } else { if (area2(x3, y3, x4, y4, x2, y2) == 0.0) { return between(x1, y1, x2, y2, x3, y3) || between (x1, y1, x2, y2, x4, y4); } else { return false; } } } else if ((a4 = area2(x3, y3, x4, y4, x2, y2)) == 0.0) { return between(x3, y3, x4, y4, x2, y2); } else { return ((a1 > 0.0) ^ (a2 > 0.0)) && ((a3 > 0.0) ^ (a4 > 0.0)); }
public static boolean linesIntersect(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) { double beta = (((y1 - y3) * (x4 - x3) + (x1 - x3) * (y4 - y3)) / ((y2 - y1) * (x4 - x3) + (x2 - x1) * (y4 - y3))); if (beta < 0.0 || beta > 1.0) return false; double alpha = (x1 + beta * (x2 - x1) - x3) / (x4 - x3); return alpha >= 0.0 && alpha <= 1.0; }
public void transform(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int num)
public Point2D transform(Point2D src, Point2D dst)
public void transform(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int num) { if (srcPts == dstPts && dstOff > srcOff && num > 1 && srcOff + 2 * num > dstOff) { float[] f = new float[2 * num]; System.arraycopy(srcPts, srcOff, f, 0, 2 * num); srcPts = f; } while (--num >= 0) { float x = srcPts[srcOff++]; float y = srcPts[srcOff++]; dstPts[dstOff++] = (float) (m00 * x + m01 * y + m02); dstPts[dstOff++] = (float) (m10 * x + m11 * y + m12); } }
if (srcPts == dstPts && dstOff > srcOff && num > 1 && srcOff + 2 * num > dstOff) { float[] f = new float[2 * num]; System.arraycopy(srcPts, srcOff, f, 0, 2 * num); srcPts = f; } while (--num >= 0) { float x = srcPts[srcOff++]; float y = srcPts[srcOff++]; dstPts[dstOff++] = (float) (m00 * x + m01 * y + m02); dstPts[dstOff++] = (float) (m10 * x + m11 * y + m12); }
if (dst == null) dst = new Point2D.Double(); double x = src.getX(); double y = src.getY(); double nx = m00 * x + m01 * y + m02; double ny = m10 * x + m11 * y + m12; dst.setLocation(nx, ny); return dst;
public void transform(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int num) { if (srcPts == dstPts && dstOff > srcOff && num > 1 && srcOff + 2 * num > dstOff) { float[] f = new float[2 * num]; System.arraycopy(srcPts, srcOff, f, 0, 2 * num); srcPts = f; } while (--num >= 0) { float x = srcPts[srcOff++]; float y = srcPts[srcOff++]; dstPts[dstOff++] = (float) (m00 * x + m01 * y + m02); dstPts[dstOff++] = (float) (m10 * x + m11 * y + m12); } }
public static double abs(double d) { return (d <= 0) ? 0 - d : d;
public static int abs(int i) { return (i < 0) ? -i : i;
public static double abs(double d) { return (d <= 0) ? 0 - d : d; }
public ProtectionDomain(CodeSource codesource, PermissionCollection permissions, ClassLoader classloader, Principal[] principals)
public ProtectionDomain(CodeSource codesource, PermissionCollection permissions)
public ProtectionDomain(CodeSource codesource, PermissionCollection permissions, ClassLoader classloader, Principal[] principals) { this(codesource, permissions, classloader, principals, false); }
this(codesource, permissions, classloader, principals, false);
this(codesource, permissions, null, null, true);
public ProtectionDomain(CodeSource codesource, PermissionCollection permissions, ClassLoader classloader, Principal[] principals) { this(codesource, permissions, classloader, principals, false); }
String linesep = System.getProperty("line.separator");
String linesep = SystemProperties.getProperty("line.separator");
public String toString() { String linesep = System.getProperty("line.separator"); StringBuffer sb = new StringBuffer("ProtectionDomain (").append(linesep); if (code_source == null) sb.append("CodeSource:null"); else sb.append(code_source); sb.append(linesep); if (classloader == null) sb.append("ClassLoader:null"); else sb.append(classloader); sb.append(linesep); sb.append("Principals:"); if (principals != null && principals.length > 0) { sb.append("["); Principal pal; for (int i = 0; i < principals.length; i++) { pal = principals[i]; sb.append("'").append(pal.getName()) .append("' of type ").append(pal.getClass().getName()); if (i < principals.length-1) sb.append(", "); } sb.append("]"); } else sb.append("none"); sb.append(linesep); if (!staticBinding) // include all but dont force loading Policy.currentPolicy if (Policy.isLoaded()) sb.append(Policy.getCurrentPolicy().getPermissions(this)); else // fallback on this one's permissions sb.append(perms); else sb.append(perms); return sb.append(linesep).append(")").append(linesep).toString(); }
throw new BAD_OPERATION("Invalid enumeration code " + code);
BAD_OPERATION bad = new BAD_OPERATION("Invalid policy code " + code); bad.minor = Minor.PolicyType; throw bad;
public static IdAssignmentPolicyValue from_int(int code) { try { return enume [ code ]; } catch (ArrayIndexOutOfBoundsException ex) { throw new BAD_OPERATION("Invalid enumeration code " + code); } }
if (workingThread != null)
if (workingThread != null) {
public void canceled(WizardEvent e) {// System.out.println("It is canceled!"); if (workingThread != null) workingThread.interrupt(); this.hide(); this.dispose(); }
workingThread = null; }
public void canceled(WizardEvent e) {// System.out.println("It is canceled!"); if (workingThread != null) workingThread.interrupt(); this.hide(); this.dispose(); }
public JFileChooser(String currentDirectoryPath)
public JFileChooser()
public JFileChooser(String currentDirectoryPath) { setup(null); setCurrentDirectory(fsv.createFileObject(currentDirectoryPath)); }
setCurrentDirectory(fsv.createFileObject(currentDirectoryPath));
setCurrentDirectory(null);
public JFileChooser(String currentDirectoryPath) { setup(null); setCurrentDirectory(fsv.createFileObject(currentDirectoryPath)); }
public Process exec(String[] cmd) throws IOException
public Process exec(String cmdline) throws IOException
public Process exec(String[] cmd) throws IOException { return exec(cmd, null, null); }
return exec(cmd, null, null); }
return exec(cmdline, null, null); }
public Process exec(String[] cmd) throws IOException { return exec(cmd, null, null); }
setIconImage(Image icon) {
public synchronized void setIconImage(Image icon) {
setIconImage(Image icon){ this.icon = icon; if (peer != null) ((FramePeer) peer).setIconImage(icon);}
public WizardPage(int button_flags) { setLayout(new BoxLayout(this,BoxLayout.Y_AXIS)); Box pageBox = Box.createVerticalBox(); contentPane = new JPanel(); add(contentPane); add(Box.createGlue()); JSeparator js = new JSeparator(); js.setAlignmentY(Component.BOTTOM_ALIGNMENT); add(js); add(Box.createRigidArea(new Dimension(10,10))); buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel,BoxLayout.X_AXIS)); buttonPanel.setName("buttonPanel"); buttonPanel.add(Box.createHorizontalGlue()); add(buttonPanel); if (button_flags == 0) { return; } if ((button_flags & PREVIOUS) != 0) { previousAction = new AbstractAction(LangTool.getString("wiz.previous")) { public void actionPerformed(ActionEvent e) { } }; previousButton = new JButton(previousAction); buttonPanel.add(Box.createRigidArea(new Dimension(GROUP_SPACING,0))); buttonPanel.add(previousButton); } if ((button_flags & NEXT) != 0) { nextAction = new AbstractAction(LangTool.getString("wiz.next")) { public void actionPerformed(ActionEvent e) { } }; nextButton = new JButton(nextAction); buttonPanel.add(Box.createRigidArea(new Dimension(BUTTON_SPACING,0))); buttonPanel.add(nextButton); } if ((button_flags & FINISH) != 0) { finishAction = new AbstractAction(LangTool.getString("wiz.finish")) { public void actionPerformed(ActionEvent e) { } }; finishButton = new JButton(finishAction); buttonPanel.add(Box.createRigidArea(new Dimension(BUTTON_SPACING,0))); buttonPanel.add(finishButton); } if ((button_flags & CANCEL) != 0) { cancelAction = new AbstractAction(LangTool.getString("wiz.cancel")) { public void actionPerformed(ActionEvent e) { } }; cancelButton = new JButton(cancelAction); buttonPanel.add(Box.createRigidArea(new Dimension(GROUP_SPACING,0))); buttonPanel.add(cancelButton); buttonPanel.add(Box.createRigidArea(new Dimension(MARGIN,0))); } if ((button_flags & HELP) != 0) { helpAction = new AbstractAction(LangTool.getString("wiz.help")) { public void actionPerformed(ActionEvent e) { } }; helpButton = new JButton(helpAction); }
public WizardPage() { this(ALL);
public WizardPage(int button_flags) { // set layout as a vertical column setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));// setLayout(new BorderLayout()); Box pageBox = Box.createVerticalBox(); contentPane = new JPanel(); // add the pages contentpane to our wizard page add(contentPane); // lets add some glue here but it still does not stop the separator from // moving up and down. add(Box.createGlue()); // create the separator between the panels JSeparator js = new JSeparator(); js.setAlignmentY(Component.BOTTOM_ALIGNMENT); add(js); add(Box.createRigidArea(new Dimension(10,10))); // create the box for the buttons with an x-axis buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel,BoxLayout.X_AXIS)); buttonPanel.setName("buttonPanel"); buttonPanel.add(Box.createHorizontalGlue()); add(buttonPanel); if (button_flags == 0) { // no buttons to add :-( return; } if ((button_flags & PREVIOUS) != 0) { previousAction = new AbstractAction(LangTool.getString("wiz.previous")) { public void actionPerformed(ActionEvent e) { } }; previousButton = new JButton(previousAction); buttonPanel.add(Box.createRigidArea(new Dimension(GROUP_SPACING,0))); buttonPanel.add(previousButton); } if ((button_flags & NEXT) != 0) { nextAction = new AbstractAction(LangTool.getString("wiz.next")) { public void actionPerformed(ActionEvent e) { } }; nextButton = new JButton(nextAction); buttonPanel.add(Box.createRigidArea(new Dimension(BUTTON_SPACING,0))); buttonPanel.add(nextButton); } if ((button_flags & FINISH) != 0) { finishAction = new AbstractAction(LangTool.getString("wiz.finish")) { public void actionPerformed(ActionEvent e) { } }; finishButton = new JButton(finishAction); buttonPanel.add(Box.createRigidArea(new Dimension(BUTTON_SPACING,0))); buttonPanel.add(finishButton); } if ((button_flags & CANCEL) != 0) { cancelAction = new AbstractAction(LangTool.getString("wiz.cancel")) { public void actionPerformed(ActionEvent e) { } }; cancelButton = new JButton(cancelAction); buttonPanel.add(Box.createRigidArea(new Dimension(GROUP_SPACING,0))); buttonPanel.add(cancelButton); buttonPanel.add(Box.createRigidArea(new Dimension(MARGIN,0))); } if ((button_flags & HELP) != 0) { helpAction = new AbstractAction(LangTool.getString("wiz.help")) { public void actionPerformed(ActionEvent e) { } }; helpButton = new JButton(helpAction); } }
setTitle(String title) {
public synchronized void setTitle(String title) {
setTitle(String title){ this.title = title; if (peer != null) ((FramePeer) peer).setTitle(title);}
super();
super(kpgName);
protected KeyPairGeneratorAdapter(String kpgName) { super(); this.adaptee = KeyPairGeneratorFactory.getInstance(kpgName); }
super();
public UIResource() { }
if (parent instanceof JScrollPane) {
public void layoutContainer(Container parent) { if (parent instanceof JScrollPane) { JScrollPane sc = (JScrollPane) parent; JViewport viewport = sc.getViewport(); Dimension viewSize = viewport.getViewSize(); int x1 = 0, x2 = 0, x3 = 0, x4 = 0; int y1 = 0, y2 = 0, y3 = 0, y4 = 0; Rectangle scrollPaneBounds = SwingUtilities.calculateInnerArea(sc, null); x1 = scrollPaneBounds.x; y1 = scrollPaneBounds.y; x4 = scrollPaneBounds.x + scrollPaneBounds.width; y4 = scrollPaneBounds.y + scrollPaneBounds.height; if (colHead != null) y2 = y1 + colHead.getPreferredSize().height; else y2 = y1; if (rowHead != null) x2 = x1 + rowHead.getPreferredSize().width; else x2 = x1; int vsbPolicy = sc.getVerticalScrollBarPolicy(); int hsbPolicy = sc.getHorizontalScrollBarPolicy(); boolean showVsb = (vsb != null) && ((vsbPolicy == VERTICAL_SCROLLBAR_ALWAYS) || (vsbPolicy == VERTICAL_SCROLLBAR_AS_NEEDED && viewSize.height > (y4 - y2))); boolean showHsb = (hsb != null) && ((hsbPolicy == HORIZONTAL_SCROLLBAR_ALWAYS) || (hsbPolicy == HORIZONTAL_SCROLLBAR_AS_NEEDED && viewSize.width > (x4 - x2))); if (!showVsb) x3 = x4; else x3 = x4 - vsb.getPreferredSize().width; if (!showHsb) y3 = y4; else y3 = y4 - hsb.getPreferredSize().height; // now set the layout if (viewport != null) viewport.setBounds(new Rectangle(x2, y2, x3-x2, y3-y2)); if (colHead != null) colHead.setBounds(new Rectangle(x2, y1, x3-x2, y2-y1)); if (rowHead != null) rowHead.setBounds(new Rectangle(x1, y2, x2-x1, y3-y2)); if (showVsb) { vsb.setVisible(true); vsb.setBounds(new Rectangle(x3, y2, x4-x3, y3-y2)); } else if (vsb != null) vsb.setVisible(false); if (showHsb) { hsb.setVisible(true); hsb.setBounds(new Rectangle(x2, y3, x3-x2, y4-y3)); } else if (hsb != null) hsb.setVisible(false); if (upperLeft != null) upperLeft.setBounds(new Rectangle(x1, y1, x2-x1, y2-y1)); if (upperRight != null) upperRight.setBounds(new Rectangle(x3, y1, x4-x3, y2-y1)); if (lowerLeft != null) lowerLeft.setBounds(new Rectangle(x1, y3, x2-x1, y4-y3)); if (lowerRight != null) lowerRight.setBounds(new Rectangle(x3, y3, x4-x3, y4-y3)); } }
}
public void layoutContainer(Container parent) { if (parent instanceof JScrollPane) { JScrollPane sc = (JScrollPane) parent; JViewport viewport = sc.getViewport(); Dimension viewSize = viewport.getViewSize(); int x1 = 0, x2 = 0, x3 = 0, x4 = 0; int y1 = 0, y2 = 0, y3 = 0, y4 = 0; Rectangle scrollPaneBounds = SwingUtilities.calculateInnerArea(sc, null); x1 = scrollPaneBounds.x; y1 = scrollPaneBounds.y; x4 = scrollPaneBounds.x + scrollPaneBounds.width; y4 = scrollPaneBounds.y + scrollPaneBounds.height; if (colHead != null) y2 = y1 + colHead.getPreferredSize().height; else y2 = y1; if (rowHead != null) x2 = x1 + rowHead.getPreferredSize().width; else x2 = x1; int vsbPolicy = sc.getVerticalScrollBarPolicy(); int hsbPolicy = sc.getHorizontalScrollBarPolicy(); boolean showVsb = (vsb != null) && ((vsbPolicy == VERTICAL_SCROLLBAR_ALWAYS) || (vsbPolicy == VERTICAL_SCROLLBAR_AS_NEEDED && viewSize.height > (y4 - y2))); boolean showHsb = (hsb != null) && ((hsbPolicy == HORIZONTAL_SCROLLBAR_ALWAYS) || (hsbPolicy == HORIZONTAL_SCROLLBAR_AS_NEEDED && viewSize.width > (x4 - x2))); if (!showVsb) x3 = x4; else x3 = x4 - vsb.getPreferredSize().width; if (!showHsb) y3 = y4; else y3 = y4 - hsb.getPreferredSize().height; // now set the layout if (viewport != null) viewport.setBounds(new Rectangle(x2, y2, x3-x2, y3-y2)); if (colHead != null) colHead.setBounds(new Rectangle(x2, y1, x3-x2, y2-y1)); if (rowHead != null) rowHead.setBounds(new Rectangle(x1, y2, x2-x1, y3-y2)); if (showVsb) { vsb.setVisible(true); vsb.setBounds(new Rectangle(x3, y2, x4-x3, y3-y2)); } else if (vsb != null) vsb.setVisible(false); if (showHsb) { hsb.setVisible(true); hsb.setBounds(new Rectangle(x2, y3, x3-x2, y4-y3)); } else if (hsb != null) hsb.setVisible(false); if (upperLeft != null) upperLeft.setBounds(new Rectangle(x1, y1, x2-x1, y2-y1)); if (upperRight != null) upperRight.setBounds(new Rectangle(x3, y1, x4-x3, y2-y1)); if (lowerLeft != null) lowerLeft.setBounds(new Rectangle(x1, y3, x2-x1, y4-y3)); if (lowerRight != null) lowerRight.setBounds(new Rectangle(x3, y3, x4-x3, y4-y3)); } }
if (parent != null && parent instanceof JScrollPane) {
public Dimension minimumLayoutSize(Container parent) { if (parent != null && parent instanceof JScrollPane) { JScrollPane sc = (JScrollPane) parent; Dimension viewportSize = viewport.getMinimumSize(); int width = viewportSize.width; int height = viewportSize.height; if (hsb != null && hsb.isVisible()) height += hsb.getMinimumSize().height; if (vsb != null && vsb.isVisible()) width += vsb.getMinimumSize().width; if (rowHead != null && rowHead.isVisible()) width += rowHead.getMinimumSize().width; if (colHead != null && colHead.isVisible()) height += colHead.getMinimumSize().height; return new Dimension(width, height); } // TODO: Probably throw an exception here. Check this. return new Dimension(0,0); }
return new Dimension(width, height); } return new Dimension(0,0);
Insets i = sc.getInsets(); return new Dimension(width + i.left + i.right, height + i.top + i.bottom);
public Dimension minimumLayoutSize(Container parent) { if (parent != null && parent instanceof JScrollPane) { JScrollPane sc = (JScrollPane) parent; Dimension viewportSize = viewport.getMinimumSize(); int width = viewportSize.width; int height = viewportSize.height; if (hsb != null && hsb.isVisible()) height += hsb.getMinimumSize().height; if (vsb != null && vsb.isVisible()) width += vsb.getMinimumSize().width; if (rowHead != null && rowHead.isVisible()) width += rowHead.getMinimumSize().width; if (colHead != null && colHead.isVisible()) height += colHead.getMinimumSize().height; return new Dimension(width, height); } // TODO: Probably throw an exception here. Check this. return new Dimension(0,0); }
if (parent != null && parent instanceof JScrollPane) {
public Dimension preferredLayoutSize(Container parent) { if (parent != null && parent instanceof JScrollPane) { JScrollPane sc = (JScrollPane) parent; Dimension viewportSize = viewport.getPreferredSize(); int width = viewportSize.width; int height = viewportSize.height; if (hsb != null && hsb.isVisible()) height += hsb.getPreferredSize().height; if (vsb != null && vsb.isVisible()) width += vsb.getPreferredSize().width; if (rowHead != null && rowHead.isVisible()) width += rowHead.getPreferredSize().width; if (colHead != null && colHead.isVisible()) height += colHead.getPreferredSize().height; return new Dimension(width, height); } // TODO: Probably throw an exception here. Check this. return new Dimension(0,0); }
return new Dimension(width, height);
Insets i = sc.getInsets(); return new Dimension(width + i.left + i.right, height + i.left + i.right);
public Dimension preferredLayoutSize(Container parent) { if (parent != null && parent instanceof JScrollPane) { JScrollPane sc = (JScrollPane) parent; Dimension viewportSize = viewport.getPreferredSize(); int width = viewportSize.width; int height = viewportSize.height; if (hsb != null && hsb.isVisible()) height += hsb.getPreferredSize().height; if (vsb != null && vsb.isVisible()) width += vsb.getPreferredSize().width; if (rowHead != null && rowHead.isVisible()) width += rowHead.getPreferredSize().width; if (colHead != null && colHead.isVisible()) height += colHead.getPreferredSize().height; return new Dimension(width, height); } // TODO: Probably throw an exception here. Check this. return new Dimension(0,0); }
return new Dimension(0,0); }
public Dimension preferredLayoutSize(Container parent) { if (parent != null && parent instanceof JScrollPane) { JScrollPane sc = (JScrollPane) parent; Dimension viewportSize = viewport.getPreferredSize(); int width = viewportSize.width; int height = viewportSize.height; if (hsb != null && hsb.isVisible()) height += hsb.getPreferredSize().height; if (vsb != null && vsb.isVisible()) width += vsb.getPreferredSize().width; if (rowHead != null && rowHead.isVisible()) width += rowHead.getPreferredSize().width; if (colHead != null && colHead.isVisible()) height += colHead.getPreferredSize().height; return new Dimension(width, height); } // TODO: Probably throw an exception here. Check this. return new Dimension(0,0); }
public DataCube(Array parentArray) {
public DataCube(ArrayInterface parentArray) {
public DataCube(Array parentArray) { this.parentArray = parentArray; init(); }
public Array getParentArray() {
public ArrayInterface getParentArray() {
public Array getParentArray() { return parentArray; }
NoDataValues[0] = parentArray.getNoDataValue();
String value = (String) null; if (parentArray.getNoDataValue() != null) { value = parentArray.getNoDataValue().toString(); } NoDataValues[0] = value;
public void toXMLOutputStream ( OutputStream outputstream, Hashtable XMLDeclAttribs, String strIndent, boolean dontCloseNode, String newNodeNameString, String noChildObjectNodeName ) { boolean writeHrefAttribute = false; boolean niceOutput = Specification.getInstance().isPrettyXDFOutput(); String indent = ""; String nodeName = getClassXDFNodeName(); if (newNodeNameString != null) nodeName = newNodeNameString; // indent up one indent = indent + strIndent; //open node if (niceOutput) writeOut(outputstream, indent); writeOut(outputstream, "<" + nodeName ); Href hrefObj = getHref(); //write out just the data XMLDataIOStyle readObj = parentArray.getXMLDataIOStyle(); OutputStream dataOutputStream = outputstream; if (hrefObj !=null) { //write out to another file, String fileName = hrefObj.getSysId(); String hrefName = hrefObj.getName(); if(hrefName == null) { Log.errorln("Error: href object in dataCube lacks name. Data being written into metadata instead.\n"); } else if (fileName != null) { writeHrefAttribute = true; try { dataOutputStream = new FileOutputStream(hrefObj.getSysId()); } catch (IOException e) { //oops, something. is wrong, writ out to the passed in OutputStream Log.warnln("Error: cannot open file:"+fileName+" for writing. Data being written into metadata.\n"); writeHrefAttribute = false; } } else { Log.warnln("Error: href:"+hrefName+" lacks systemId, cannot write data to a separate file."); Log.warnln("Data are being written into metadata instead.\n"); writeHrefAttribute = false; } } else { // no *href* attribute specified, write out to the passed in OutputStream // dataOutputStream = outputstream; // not needed now } // write data node attributes if (writeHrefAttribute) { writeOut(outputstream, " "+HREF_XML_ATTRIBUTE_NAME+"=\""); writeOutAttribute(outputstream, hrefObj.getName()); writeOut(outputstream, "\""); } String checksum = getChecksum(); if (checksum != null) { writeOut(outputstream, " "+CHECKSUM_XML_ATTRIBUTE_NAME+"=\""); writeOutAttribute(outputstream, checksum.toString()); writeOut(outputstream, "\""); } String encoding = getEncoding(); if (encoding!= null) { writeOut(outputstream, " "+ENCODING_XML_ATTRIBUTE_NAME+"=\""); writeOutAttribute(outputstream, encoding.toString()); writeOut(outputstream, "\""); } String compress = getCompression(); if (compress != null) { writeOut(outputstream, " "+COMPRESSION_TYPE_XML_ATTRIBUTE_NAME+"=\""); writeOutAttribute(outputstream, compress.toString()); writeOut(outputstream, "\""); } if (writeHrefAttribute) writeOut(outputstream, "/>"); //we just close the data node now else writeOut(outputstream, ">"); //end of opening code Locator currentLocator = parentArray.createLocator(); AxisInterface fastestAxis = (AxisInterface) parentArray.getAxes().get(0); //stores the NoDataValues for the parentArray, //used in writing out when NoDataException is caught String[] NoDataValues; if (parentArray.hasFieldAxis()) { NoDataValues = new String[parentArray.getFieldAxis().getLength()]; List fields = parentArray.getFieldAxis().getFields(); Iterator iter = fields.iterator(); int i = 0; while (iter.hasNext()) { Field field = (Field) iter.next(); if (field != null && field.getNoDataValue() != null) NoDataValues[i]=field.getNoDataValue().toString(); i++; } /* DataFormat[] dataFormatList = parentArray.getDataFormatList(); for (int i = 0; i < NoDataValues.length; i++) { DataFormat d = dataFormatList[i]; if (d != null && d.getNoDataValue() != null) NoDataValues[i]=d.getNoDataValue().toString(); }*/ } else { NoDataValues = new String[1]; NoDataValues[0] = parentArray.getNoDataValue();/* // what tis this?? If there is no fieldAxis, then no fields, // and hence, only ONE noDataValue. DataFormat d = parentArray.getDataFormat(); for (int i = 0; i < NoDataValues.length; i++) { if (d!=null && d.getNoDataValue() != null) NoDataValues[i] = d.getNoDataValue().toString(); }*/ } if (readObj instanceof TaggedXMLDataIOStyle) { String[] tagOrder = ((TaggedXMLDataIOStyle)readObj).getAxisTags(); int stop = tagOrder.length; String[] tags = new String[stop]; for (int i = stop-1; i >= 0 ; i--) { tags[stop-i-1] = tagOrder[i]; } int[] axes = getMaxDataIndex(); stop =axes.length; int[] axisLength = new int[stop]; for (int i = 0; i < stop; i++) { axisLength[i] =axes[stop - 1 - i]; } writeTaggedData(dataOutputStream, currentLocator, indent, axisLength, tags, 0, fastestAxis, NoDataValues); } //done dealing with with TaggedXMLDataIOSytle else { if (readObj instanceof DelimitedXMLDataIOStyle) { writeDelimitedData( dataOutputStream, currentLocator, (DelimitedXMLDataIOStyle) readObj, fastestAxis, NoDataValues, writeHrefAttribute ? false : true ); } else { writeFormattedData( dataOutputStream, currentLocator, (FormattedXMLDataIOStyle) readObj, fastestAxis, NoDataValues, writeHrefAttribute ? false : true ); } } //close the data section appropriately if (!writeHrefAttribute && niceOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } // If we didnt write Href attribute, then means that data // were put into document. We need to close the open data // node appropriately. if (!writeHrefAttribute) writeOut(outputstream, "</" + nodeName + ">"); if (niceOutput) writeOut(outputstream, Constants.NEW_LINE); }
if (axisList.size() == 0){
if (axisList.size() == 0 || !this.hasFieldAxis() ){
public FieldAxis getFieldAxis() { List axisList = getAxes(); if (axisList.size() == 0){ //empty axisList return null; } Object axisObj = axisList.get(0); if (axisObj instanceof FieldAxis) return (FieldAxis) axisObj; else return null; }
if (endian == null) endian = DEFAULT_ENDIAN;
public String getEndian() { String endian = (String) ((Attribute) attribHash.get(ENDIAN_XML_ATTRIBUTE_NAME)).getAttribValue(); // a safety just in case someone asks a stupid question // if (endian == null) endian = DEFAULT_ENDIAN; return endian; }
int availSize = getAvailableSize(splitPane.getSize(), splitPane.getInsets()); int[] newSizes = new int[3]; double weight = splitPane.getResizeWeight(); int oldLen = sizes[0] + sizes[1]; availSize -= sizes[2] + oldLen; int rightAlloc = (int) (availSize * (1 - weight)); int leftAlloc = availSize - rightAlloc; sizes[0] += leftAlloc; sizes[1] += rightAlloc;
void distributeExtraSpace() { int availSize = getAvailableSize(splitPane.getSize(), splitPane.getInsets()); int[] newSizes = new int[3]; double weight = splitPane.getResizeWeight(); int oldLen = sizes[0] + sizes[1]; // dividers don't change size. availSize -= sizes[2] + oldLen; int rightAlloc = (int) (availSize * (1 - weight)); int leftAlloc = availSize - rightAlloc; sizes[0] += leftAlloc; sizes[1] += rightAlloc; }
int width = getInitialLocation(insets);
public void layoutContainer(Container container) { if (container instanceof JSplitPane) { JSplitPane split = (JSplitPane) container; distributeExtraSpace(); Insets insets = split.getInsets(); int width = getInitialLocation(insets); Dimension dims = split.getSize(); for (int i = 0; i < components.length; i += 2) { if (components[i] == null) continue; setComponentToSize(components[i], sizes[i], width, insets, dims); width += sizes[i]; } if (components[1] != null) { setComponentToSize(components[1], sizes[1], width, insets, dims); width += sizes[1]; } } }
for (int i = 0; i < components.length; i += 2) { if (components[i] == null) continue; setComponentToSize(components[i], sizes[i], width, insets, dims); width += sizes[i]; } if (components[1] != null) { setComponentToSize(components[1], sizes[1], width, insets, dims); width += sizes[1]; }
int loc = getInitialLocation(insets); int available = getAvailableSize(dims, insets); sizes[0] = getDividerLocation(split) - loc; sizes[1] = available - sizes[0] - sizes[1]; setComponentToSize(components[0], sizes[0], loc, insets, dims); loc += sizes[0]; setComponentToSize(components[2], sizes[2], loc, insets, dims); loc += sizes[2]; setComponentToSize(components[1], sizes[1], loc, insets, dims);
public void layoutContainer(Container container) { if (container instanceof JSplitPane) { JSplitPane split = (JSplitPane) container; distributeExtraSpace(); Insets insets = split.getInsets(); int width = getInitialLocation(insets); Dimension dims = split.getSize(); for (int i = 0; i < components.length; i += 2) { if (components[i] == null) continue; setComponentToSize(components[i], sizes[i], width, insets, dims); width += sizes[i]; } if (components[1] != null) { setComponentToSize(components[1], sizes[1], width, insets, dims); width += sizes[1]; } } }
return layoutManager.sizes[0] + layoutManager.getInitialLocation(splitPane.getInsets());
return dividerLocation;
public int getDividerLocation(JSplitPane jc) { return layoutManager.sizes[0] + layoutManager.getInitialLocation(splitPane.getInsets()); }
value -= layoutManager.minimumSizeOfComponent(0);
value += layoutManager.minimumSizeOfComponent(0);
public int getMinimumDividerLocation(JSplitPane jc) { int value = layoutManager.getInitialLocation(jc.getInsets()); if (layoutManager.components[0] != null) value -= layoutManager.minimumSizeOfComponent(0); return value; }
divider.setBorder(UIManager.getBorder("SplitPaneDivider.border"));
protected void installDefaults() { LookAndFeel.installColors(splitPane, "SplitPane.background", "SplitPane.foreground"); LookAndFeel.installBorder(splitPane, "SplitPane.border"); divider = createDefaultDivider(); resetLayoutManager(); nonContinuousLayoutDivider = createDefaultNonContinuousLayoutDivider(); splitPane.add(divider, JSplitPane.DIVIDER); // There is no need to add the nonContinuousLayoutDivider splitPane.setDividerSize(UIManager.getInt("SplitPane.dividerSize")); splitPane.setOpaque(true); }
location = validLocation(location); Container p = jc.getParent(); Component right = jc.getRightComponent(); Dimension rightPrefSize = right == null ? new Dimension(0, 0) : right.getPreferredSize(); Dimension size = jc.getSize(); if (size.width == 0 && size.height == 0) size = jc.getPreferredSize(); if (getOrientation() == 0 && location > size.height) { location = size.height; while (p != null) { p.setSize(p.getWidth(), p.getHeight() + rightPrefSize.height); p = p.getParent(); } } else if (location > size.width) { location = size.width; while (p != null) { p.setSize(p.getWidth() + rightPrefSize.width, p.getHeight()); p = p.getParent(); } } setLastDragLocation(getDividerLocation(splitPane)); splitPane.setLastDividerLocation(getDividerLocation(splitPane)); int[] tmpSizes = layoutManager.getSizes(); tmpSizes[0] = location - layoutManager.getInitialLocation(splitPane.getInsets()); tmpSizes[1] = layoutManager.getAvailableSize(splitPane.getSize(), splitPane.getInsets()) - tmpSizes[0]; layoutManager.setSizes(tmpSizes);
dividerLocation = validLocation(location);
public void setDividerLocation(JSplitPane jc, int location) { location = validLocation(location); Container p = jc.getParent(); Component right = jc.getRightComponent(); Dimension rightPrefSize = right == null ? new Dimension(0, 0) : right.getPreferredSize(); Dimension size = jc.getSize(); // check if the size has been set for the splitpane if (size.width == 0 && size.height == 0) size = jc.getPreferredSize(); if (getOrientation() == 0 && location > size.height) { location = size.height; while (p != null) { p.setSize(p.getWidth(), p.getHeight() + rightPrefSize.height); p = p.getParent(); } } else if (location > size.width) { location = size.width; while (p != null) { p.setSize(p.getWidth() + rightPrefSize.width, p.getHeight()); p = p.getParent(); } } setLastDragLocation(getDividerLocation(splitPane)); splitPane.setLastDividerLocation(getDividerLocation(splitPane)); int[] tmpSizes = layoutManager.getSizes(); tmpSizes[0] = location - layoutManager.getInitialLocation(splitPane.getInsets()); tmpSizes[1] = layoutManager.getAvailableSize(splitPane.getSize(), splitPane.getInsets()) - tmpSizes[0]; layoutManager.setSizes(tmpSizes); splitPane.revalidate(); splitPane.repaint(); }
if (splitPane.getBorder() instanceof UIResource)
protected void uninstallDefaults() { layoutManager = null; splitPane.remove(divider); divider = null; nonContinuousLayoutDivider = null; splitPane.setBackground(null); splitPane.setBorder(null); }
public static void paintComponent(Graphics g, Component c, Container p, Rectangle r) { paintComponent(g, c, p, r.x, r.y, r.width, r.height);
public static void paintComponent(Graphics g, Component c, Container p, int x, int y, int w, int h) { Container parent = c.getParent(); if (parent != null) parent.remove(c); if (p != null) p.add(c); Shape savedClip = g.getClip(); g.setClip(x, y, w, h); g.translate(x, y); c.paint(g); g.translate(-x, -y); g.setClip(savedClip);
public static void paintComponent(Graphics g, Component c, Container p, Rectangle r) { paintComponent(g, c, p, r.x, r.y, r.width, r.height); }
public void addSessionView(String tabText,Session session) {
public void addSessionView(String tabText,Session sessionView) { final Session session = sessionView;
public void addSessionView(String tabText,Session session) { if (hideTabBar && sessionPane.getTabCount() == 0 && !embedded) { this.getContentPane().add(session, BorderLayout.CENTER); session.grabFocus(); session.resizeMe(); repaint(); if (packFrame) pack(); else validate(); embedded = true; } else { if (hideTabBar && sessionPane.getTabCount() == 0 ) { Session ses = null; for (int x=0; x < this.getContentPane().getComponentCount(); x++) { if (this.getContentPane().getComponent(x) instanceof Session) { ses = (Session)(this.getContentPane().getComponent(x)); this.getContentPane().remove(x); break; } } //ses = (Session)(this.getContentPane().getComponent(0)); sessionPane.addTab(tabText,focused,ses); ses.grabFocus(); ses.resizeMe(); repaint(); if (ses.getAllocDeviceName() != null) sessionPane.setTitleAt(0,ses.getAllocDeviceName()); else sessionPane.setTitleAt(0,ses.getSessionName()); ses.addSessionListener(this); ses.addSessionJumpListener(this); this.getContentPane().add(sessionPane, BorderLayout.CENTER); } sessionPane.addTab(tabText,focused,session); sessionPane.setForegroundAt(sessionPane.getSelectedIndex(),Color.black); sessionPane.setIconAt(sessionPane.getSelectedIndex(),unfocused); sessionPane.setSelectedIndex(sessionPane.getTabCount()-1); sessionPane.setForegroundAt(sessionPane.getSelectedIndex(),Color.blue); sessionPane.setIconAt(sessionPane.getSelectedIndex(),focused); session.addSessionListener(this); session.addSessionJumpListener(this); session.grabFocus(); session.resizeMe(); session.repaint(); } }
session.grabFocus();
public void addSessionView(String tabText,Session session) { if (hideTabBar && sessionPane.getTabCount() == 0 && !embedded) { this.getContentPane().add(session, BorderLayout.CENTER); session.grabFocus(); session.resizeMe(); repaint(); if (packFrame) pack(); else validate(); embedded = true; } else { if (hideTabBar && sessionPane.getTabCount() == 0 ) { Session ses = null; for (int x=0; x < this.getContentPane().getComponentCount(); x++) { if (this.getContentPane().getComponent(x) instanceof Session) { ses = (Session)(this.getContentPane().getComponent(x)); this.getContentPane().remove(x); break; } } //ses = (Session)(this.getContentPane().getComponent(0)); sessionPane.addTab(tabText,focused,ses); ses.grabFocus(); ses.resizeMe(); repaint(); if (ses.getAllocDeviceName() != null) sessionPane.setTitleAt(0,ses.getAllocDeviceName()); else sessionPane.setTitleAt(0,ses.getSessionName()); ses.addSessionListener(this); ses.addSessionJumpListener(this); this.getContentPane().add(sessionPane, BorderLayout.CENTER); } sessionPane.addTab(tabText,focused,session); sessionPane.setForegroundAt(sessionPane.getSelectedIndex(),Color.black); sessionPane.setIconAt(sessionPane.getSelectedIndex(),unfocused); sessionPane.setSelectedIndex(sessionPane.getTabCount()-1); sessionPane.setForegroundAt(sessionPane.getSelectedIndex(),Color.blue); sessionPane.setIconAt(sessionPane.getSelectedIndex(),focused); session.addSessionListener(this); session.addSessionJumpListener(this); session.grabFocus(); session.resizeMe(); session.repaint(); } }
ses.grabFocus(); ses.resizeMe(); repaint();
final Session finalSession = ses; SwingUtilities.invokeLater(new Runnable() { public void run() { finalSession.resizeMe(); finalSession.repaint(); } });
public void addSessionView(String tabText,Session session) { if (hideTabBar && sessionPane.getTabCount() == 0 && !embedded) { this.getContentPane().add(session, BorderLayout.CENTER); session.grabFocus(); session.resizeMe(); repaint(); if (packFrame) pack(); else validate(); embedded = true; } else { if (hideTabBar && sessionPane.getTabCount() == 0 ) { Session ses = null; for (int x=0; x < this.getContentPane().getComponentCount(); x++) { if (this.getContentPane().getComponent(x) instanceof Session) { ses = (Session)(this.getContentPane().getComponent(x)); this.getContentPane().remove(x); break; } } //ses = (Session)(this.getContentPane().getComponent(0)); sessionPane.addTab(tabText,focused,ses); ses.grabFocus(); ses.resizeMe(); repaint(); if (ses.getAllocDeviceName() != null) sessionPane.setTitleAt(0,ses.getAllocDeviceName()); else sessionPane.setTitleAt(0,ses.getSessionName()); ses.addSessionListener(this); ses.addSessionJumpListener(this); this.getContentPane().add(sessionPane, BorderLayout.CENTER); } sessionPane.addTab(tabText,focused,session); sessionPane.setForegroundAt(sessionPane.getSelectedIndex(),Color.black); sessionPane.setIconAt(sessionPane.getSelectedIndex(),unfocused); sessionPane.setSelectedIndex(sessionPane.getTabCount()-1); sessionPane.setForegroundAt(sessionPane.getSelectedIndex(),Color.blue); sessionPane.setIconAt(sessionPane.getSelectedIndex(),focused); session.addSessionListener(this); session.addSessionJumpListener(this); session.grabFocus(); session.resizeMe(); session.repaint(); } }
session.grabFocus(); session.resizeMe(); session.repaint();
SwingUtilities.invokeLater(new Runnable() { public void run() { session.resizeMe(); session.repaint(); session.grabFocus(); } });
public void addSessionView(String tabText,Session session) { if (hideTabBar && sessionPane.getTabCount() == 0 && !embedded) { this.getContentPane().add(session, BorderLayout.CENTER); session.grabFocus(); session.resizeMe(); repaint(); if (packFrame) pack(); else validate(); embedded = true; } else { if (hideTabBar && sessionPane.getTabCount() == 0 ) { Session ses = null; for (int x=0; x < this.getContentPane().getComponentCount(); x++) { if (this.getContentPane().getComponent(x) instanceof Session) { ses = (Session)(this.getContentPane().getComponent(x)); this.getContentPane().remove(x); break; } } //ses = (Session)(this.getContentPane().getComponent(0)); sessionPane.addTab(tabText,focused,ses); ses.grabFocus(); ses.resizeMe(); repaint(); if (ses.getAllocDeviceName() != null) sessionPane.setTitleAt(0,ses.getAllocDeviceName()); else sessionPane.setTitleAt(0,ses.getSessionName()); ses.addSessionListener(this); ses.addSessionJumpListener(this); this.getContentPane().add(sessionPane, BorderLayout.CENTER); } sessionPane.addTab(tabText,focused,session); sessionPane.setForegroundAt(sessionPane.getSelectedIndex(),Color.black); sessionPane.setIconAt(sessionPane.getSelectedIndex(),unfocused); sessionPane.setSelectedIndex(sessionPane.getTabCount()-1); sessionPane.setForegroundAt(sessionPane.getSelectedIndex(),Color.blue); sessionPane.setIconAt(sessionPane.getSelectedIndex(),focused); session.addSessionListener(this); session.addSessionJumpListener(this); session.grabFocus(); session.resizeMe(); session.repaint(); } }
sessionPane.setTitleAt(index,d); }
finalSession.resizeMe(); finalSession.repaint(); }
public void run() { sessionPane.setTitleAt(index,d); }
public void addTab(String title, Icon icon, Component component)
public void addTab(String title, Icon icon, Component component, String tip)
public void addTab(String title, Icon icon, Component component) { insertTab(title, icon, component, null, tabs.size()); }
insertTab(title, icon, component, null, tabs.size());
insertTab(title, icon, component, tip, tabs.size());
public void addTab(String title, Icon icon, Component component) { insertTab(title, icon, component, null, tabs.size()); }
repaint();
public void remove (int index) { Component c = getComponent (index); int layer = getLayer (c); decrLayer (new Integer(layer)); componentToLayer.remove (c); super.remove (index); revalidate(); repaint(); }
this.inlineDepth--;
public void endInlinedMethod(VmMethod previousMethod) { if (log) { os.log("End of inlined method"); } // Do some housekeeping helper.setMethod(previousMethod); os.setObjectRef(inlinedMethodInfo.getEndOfInlineLabel()); this.currentMethod = previousMethod; // Push the types on the vstack inlinedMethodInfo.pushExitStack(ifac, vstack); // Push the return value inlinedMethodInfo.pushReturnValue(helper); // Cleanup helper.setLabelPrefix(inlinedMethodInfo.getPreviousLabelPrefix()); this.inlinedMethodInfo = inlinedMethodInfo.getPrevious(); if (debug) { BootLog.debug("endInlinedMethod"); } }
this.inlineDepth++;
public void startInlinedMethodCode(VmMethod inlinedMethod, int newMaxLocals) { if (log) { os.log("Start of inlined method code"); } if (debug) { BootLog.debug("startInlinedMethodCode(" + inlinedMethod + ")"); } // TODO: check whether this is really needed // For now yes, because a new basic block resets the registerpool // and that fails if not all registers are freed. vstack.push(eContext); this.inlinedMethodInfo.setOuterMethodStack(vstack.asTypeStack()); }
cm.add(currentMethod, address, offset);
cm.add(currentMethod, address, offset, inlineDepth);
public void startInstruction(int address) { if (debug) { BootLog.debug("#" + address + "\t" + vstack); } if (log) { if (debug) { os.log("#" + address + " VStack: " + vstack.toString()); } else { os.log("#" + address); } } this.curAddress = address; this._curInstrLabel = null; if (startOfBB || setCurInstrLabel) { os.setObjectRef(getCurInstrLabel()); startOfBB = false; setCurInstrLabel = false; } final int offset = os.getLength() - startOffset; cm.add(currentMethod, address, offset); }
os.writeLEA(SP, SP, 8);
os.writeLEA(SP, SP, -8);
final void push(EmitterContext ec) { final AbstractX86Stream os = ec.getStream(); final VirtualStack stack = ec.getVStack(); //os.log("LongItem.push "+Integer.toString(getKind())); switch (getKind()) { case Kind.REGISTER: os.writePUSH(msb); os.writePUSH(lsb); break; case Kind.LOCAL: os.writePUSH(FP, getMsbOffsetToFP()); os.writePUSH(FP, getLsbOffsetToFP()); break; case Kind.CONSTANT: pushConstant(ec, os); break; case Kind.FPUSTACK: // Make sure this item is on top of the FPU stack final FPUStack fpuStack = stack.fpuStack; if (!fpuStack.isTos(this)) { FPUHelper.fxch(os, fpuStack, fpuStack.getRegister(this)); } stack.fpuStack.pop(this); // Convert & move to new space on normal stack os.writeLEA(SP, SP, 8); popFromFPU(os, SP, 0); break; case Kind.STACK: //nothing to do if (VirtualStack.checkOperandStack) { // the item is not really pushed and popped // but this checks that it is really the top // element stack.operandStack.pop(this); } break; } release(ec); kind = Kind.STACK; if (VirtualStack.checkOperandStack) { stack.operandStack.push(this); } }
public final void invokeJavaMethod(VmMethod method) { if (false) { final int staticsIdx = (VmArray.DATA_OFFSET + method.getStaticsIndex()) << 2; os.writeMOV(INTSIZE, Register.EAX, STATICS, staticsIdx); } else { os.writeMOV_Const(Register.EAX, method); } invokeJavaMethod(method.getSignature());
public final void invokeJavaMethod(String signature) { final int offset = context.getVmMethodNativeCodeField().getOffset(); os.writeCALL(Register.EAX, offset); pushReturnValue(signature);
public final void invokeJavaMethod(VmMethod method) { if (false) { final int staticsIdx = (VmArray.DATA_OFFSET + method.getStaticsIndex()) << 2; os.writeMOV(INTSIZE, Register.EAX, STATICS, staticsIdx); } else { os.writeMOV_Const(Register.EAX, method); } invokeJavaMethod(method.getSignature()); }
os.writeLEA(SP, SP, 4);
os.writeLEA(SP, SP, -4);
final void loadTo(EmitterContext ec, Register reg) { assertCondition(reg != null, "Reg != null"); final AbstractX86Stream os = ec.getStream(); final X86RegisterPool pool = ec.getPool(); final VirtualStack stack = ec.getVStack(); assertCondition(!pool.isFree(reg), "reg not free"); switch (kind) { case Kind.REGISTER: if (this.reg != reg) { os.writeMOV(INTSIZE, reg, this.reg); release(ec); } break; case Kind.LOCAL: os.writeMOV(INTSIZE, reg, FP, getOffsetToFP()); break; case Kind.CONSTANT: loadToConstant(ec, os, reg); break; case Kind.FPUSTACK: // Make sure this item is on top of the FPU stack FPUHelper.fxch(os, stack.fpuStack, this); stack.fpuStack.pop(this); // Convert & move to new space on normal stack os.writeLEA(SP, SP, 4); popFromFPU(os, SP, 0); os.writePOP(reg); break; case Kind.STACK: //TODO: make sure this is on top os stack if (VirtualStack.checkOperandStack) { stack.operandStack.pop(this); } os.writePOP(reg); break; default: throw new IllegalArgumentException("Invalid item kind"); } kind = Kind.REGISTER; this.reg = reg; }
if (!resolved) { doResolve(clc); resolved = true; }
public void resolve(VmClassLoader clc) { if (!resolved) { doResolve(clc); resolved = true; } }
public static int SignatureToType(String signature) { return SignatureToType(signature.charAt(0));
public static int SignatureToType(char type) { int res; switch (type) { case 'Z': case 'B': case 'C': case 'S': case 'I': res = JvmType.INT; break; case 'F': res = JvmType.FLOAT; break; case 'L': case ';': case '[': res = JvmType.REFERENCE; break; case 'J': res = JvmType.LONG; break; case 'D': res = JvmType.DOUBLE; break; default: throw new IllegalArgumentException("Unknown type" + type); } return res;
public static int SignatureToType(String signature) { return SignatureToType(signature.charAt(0)); }
public DoubleWordItem createReg(int jvmType, Register lsb, Register msb) { final DoubleWordItem item = (DoubleWordItem) getOrCreate(jvmType); item.initialize(Item.Kind.REGISTER, 0, lsb, msb);
public WordItem createReg(int jvmType, Register reg) { final WordItem item = (WordItem) getOrCreate(jvmType); item.initialize(Item.Kind.REGISTER, reg, 0);
public DoubleWordItem createReg(int jvmType, Register lsb, Register msb) { final DoubleWordItem item = (DoubleWordItem) getOrCreate(jvmType); item.initialize(Item.Kind.REGISTER, 0, lsb, msb); return item; }
public CompileError(String s) { super(s);
public CompileError() { super();
public CompileError(String s) { super(s); }
public abstract void visit_ldc(VmConstClass value);
public abstract void visit_ldc(VmConstString value);
public abstract void visit_ldc(VmConstClass value);
os.writeLEA(SP, SP, 4);
os.writeLEA(SP, SP, -4);
final void push(EmitterContext ec) { final AbstractX86Stream os = ec.getStream(); final VirtualStack stack = ec.getVStack(); switch (getKind()) { case Kind.REGISTER: os.writePUSH(reg); break; case Kind.LOCAL: os.writePUSH(FP, offsetToFP); break; case Kind.CONSTANT: pushConstant(ec, os); break; case Kind.FPUSTACK: // Make sure this item is on top of the FPU stack final FPUStack fpuStack = stack.fpuStack; FPUHelper.fxch(os, fpuStack, this); stack.fpuStack.pop(this); // Convert & move to new space on normal stack os.writeLEA(SP, SP, 4); popFromFPU(os, SP, 0); break; case Kind.STACK: //nothing to do if (VirtualStack.checkOperandStack) { // the item is not really pushed and popped // but this checks that it is really the top // element stack.operandStack.pop(this); } break; default: throw new IllegalArgumentException("Invalid item kind"); } release(ec); kind = Kind.STACK; if (VirtualStack.checkOperandStack) { stack.operandStack.push(this); } }
&& parent.getHeight() > getUI().getMinimumSize(this).height;
&& parent.getHeight() >= getUI().getMinimumSize(this).height && parent.getHeight() <= getUI().getMaximumSize(this).height;
public boolean getScrollableTracksViewportHeight() { // Tests show that this returns true when the parent is a JViewport // and has a height > minimum UI height. Container parent = getParent(); return parent instanceof JViewport && parent.getHeight() > getUI().getMinimumSize(this).height; }