bugged
stringlengths 6
599k
| fixed
stringlengths 10
599k
| __index_level_0__
int64 0
1.13M
|
|---|---|---|
protected ArrayList findAllChildHrefObjects () { ArrayList list = new ArrayList(); if (this instanceof Structure) { List arrayList = ((Structure) this).getArrayList(); synchronized (arrayList) { Iterator iter = arrayList.iterator(); // Must be in synchronized block while (iter.hasNext()) { Array childArray = (Array) iter.next(); Href hrefObj = childArray.getDataCube().getHref(); if (hrefObj != null) list.add(hrefObj); } } // sychronized arrayList List structList = ((Structure) this).getStructList(); synchronized (structList) { Iterator iter = structList.iterator(); // Must be in synchronized block while (iter.hasNext()) { Structure childStruct = (Structure) iter.next(); ArrayList childList = childStruct.findAllChildHrefObjects(); if (childList.size() > 0) list.add(childList); } } // sychronized structList } return list; }
|
protected ArrayList findAllChildHrefObjects () { ArrayList list = new ArrayList(); if (this instanceof Structure) { List arrayList = ((Structure) this).getArrayList(); synchronized (arrayList) { Iterator iter = arrayList.iterator(); // Must be in synchronized block while (iter.hasNext()) { Array childArray = (Array) iter.next(); Href hrefObj = childArray.getDataCube().getHref(); if (hrefObj != null) list.add(hrefObj); } } // sychronized arrayList List structList = ((Structure) this).getStructList(); synchronized (structList) { Iterator iter = structList.iterator(); // Must be in synchronized block while (iter.hasNext()) { Structure childStruct = (Structure) iter.next(); ArrayList childList = childStruct.findAllChildHrefObjects(); if (childList.size() > 0) list.add(childList); } } // sychronized structList } return list; }
| 4,287
|
public abstract void getInts(int memPtr, char[] dst, int dstOfs, int length);
|
public abstract void getInts(int memPtr, int[] dst, int dstOfs, int length);
| 4,288
|
public BOOTPHeader(SocketBuffer skbuf) { this.opcode = skbuf.get(0); this.hwType = skbuf.get(1); this.hopCount = skbuf.get(3); this.transactionID = skbuf.get32(4); this.secondsElapsed = skbuf.get16(8); this.flags = skbuf.get16(10); this.clientIPAddress = IPv4Address.readFrom(skbuf, 12); this.yourIPAddress = IPv4Address.readFrom(skbuf, 16); this.serverIPAddress = IPv4Address.readFrom(skbuf, 20); this.gatewayIPAddress = IPv4Address.readFrom(skbuf, 24); if (hwType == 1) { clientHwAddress = new EthernetAddress(skbuf, 28); } else { clientHwAddress = null; } byte[] tmp = new byte[128]; skbuf.get(tmp, 0, 32, 64); serverHostName = new String(tmp, "US-ASCII").trim(); skbuf.get(tmp, 0, 96, 128); bootFileName = new String(tmp, "US-ASCII").trim(); }
|
public BOOTPHeader(SocketBuffer skbuf) { this.opcode = skbuf.get(0); this.hwType = skbuf.get(1); this.hopCount = skbuf.get(3); this.transactionID = skbuf.get32(4); this.secondsElapsed = skbuf.get16(8); this.flags = skbuf.get16(10); this.clientIPAddress = IPv4Address.readFrom(skbuf, 12); this.yourIPAddress = IPv4Address.readFrom(skbuf, 16); this.serverIPAddress = IPv4Address.readFrom(skbuf, 20); this.gatewayIPAddress = IPv4Address.readFrom(skbuf, 24); if (hwType == 1) { clientHwAddress = new EthernetAddress(skbuf, 28); } else { clientHwAddress = null; } byte[] tmp = new byte[128]; skbuf.get(tmp, 0, 32, 64); try { serverHostName = new String(tmp, "US-ASCII").trim(); } catch(UnsupportedEncodingException ex) { throw new RuntimeException(ex); } skbuf.get(tmp, 0, 96, 128); bootFileName = new String(tmp, "US-ASCII").trim(); }
| 4,289
|
public BOOTPHeader(SocketBuffer skbuf) { this.opcode = skbuf.get(0); this.hwType = skbuf.get(1); this.hopCount = skbuf.get(3); this.transactionID = skbuf.get32(4); this.secondsElapsed = skbuf.get16(8); this.flags = skbuf.get16(10); this.clientIPAddress = IPv4Address.readFrom(skbuf, 12); this.yourIPAddress = IPv4Address.readFrom(skbuf, 16); this.serverIPAddress = IPv4Address.readFrom(skbuf, 20); this.gatewayIPAddress = IPv4Address.readFrom(skbuf, 24); if (hwType == 1) { clientHwAddress = new EthernetAddress(skbuf, 28); } else { clientHwAddress = null; } byte[] tmp = new byte[128]; skbuf.get(tmp, 0, 32, 64); serverHostName = new String(tmp, "US-ASCII").trim(); skbuf.get(tmp, 0, 96, 128); bootFileName = new String(tmp, "US-ASCII").trim(); }
|
public BOOTPHeader(SocketBuffer skbuf) { this.opcode = skbuf.get(0); this.hwType = skbuf.get(1); this.hopCount = skbuf.get(3); this.transactionID = skbuf.get32(4); this.secondsElapsed = skbuf.get16(8); this.flags = skbuf.get16(10); this.clientIPAddress = IPv4Address.readFrom(skbuf, 12); this.yourIPAddress = IPv4Address.readFrom(skbuf, 16); this.serverIPAddress = IPv4Address.readFrom(skbuf, 20); this.gatewayIPAddress = IPv4Address.readFrom(skbuf, 24); if (hwType == 1) { clientHwAddress = new EthernetAddress(skbuf, 28); } else { clientHwAddress = null; } byte[] tmp = new byte[128]; skbuf.get(tmp, 0, 32, 64); serverHostName = new String(tmp, "US-ASCII").trim(); skbuf.get(tmp, 0, 96, 128); try { bootFileName = new String(tmp, "US-ASCII").trim(); } catch(UnsupportedEncodingException ex) { throw new RuntimeException(ex); } }
| 4,290
|
public void prefixTo(SocketBuffer skbuf) { skbuf.insert(SIZE); skbuf.set(0, opcode); skbuf.set(1, hwType); skbuf.set(2, clientHwAddress.getLength()); skbuf.set(3, hopCount); skbuf.set32(4, transactionID); skbuf.set16(8, secondsElapsed); skbuf.set16(10, flags); if (clientIPAddress != null) { IPv4Address.writeTo(skbuf, 12, clientIPAddress); } if (yourIPAddress != null) { IPv4Address.writeTo(skbuf, 16, yourIPAddress); } if (serverIPAddress != null) { IPv4Address.writeTo(skbuf, 20, serverIPAddress); } if (gatewayIPAddress != null) { IPv4Address.writeTo(skbuf, 24, gatewayIPAddress); } if (clientHwAddress != null) { clientHwAddress.writeTo(skbuf, 28); } if (serverHostName != null) { skbuf.set(32, serverHostName.getBytes("US-ASCII"), 0, serverHostName.length()); } if (bootFileName != null) { skbuf.set(96, bootFileName.getBytes("US-ASCII"), 0, bootFileName.length()); } }
|
public void prefixTo(SocketBuffer skbuf) { skbuf.insert(SIZE); skbuf.set(0, opcode); skbuf.set(1, hwType); skbuf.set(2, clientHwAddress.getLength()); skbuf.set(3, hopCount); skbuf.set32(4, transactionID); skbuf.set16(8, secondsElapsed); skbuf.set16(10, flags); if (clientIPAddress != null) { IPv4Address.writeTo(skbuf, 12, clientIPAddress); } if (yourIPAddress != null) { IPv4Address.writeTo(skbuf, 16, yourIPAddress); } if (serverIPAddress != null) { IPv4Address.writeTo(skbuf, 20, serverIPAddress); } if (gatewayIPAddress != null) { IPv4Address.writeTo(skbuf, 24, gatewayIPAddress); } if (clientHwAddress != null) { clientHwAddress.writeTo(skbuf, 28); } if (serverHostName != null) { try { skbuf.set(32, serverHostName.getBytes("US-ASCII"), 0, serverHostName.length()); } catch(UnsupportedEncodingException ex) { throw new RuntimeException(ex); } } if (bootFileName != null) { skbuf.set(96, bootFileName.getBytes("US-ASCII"), 0, bootFileName.length()); } }
| 4,291
|
public void prefixTo(SocketBuffer skbuf) { skbuf.insert(SIZE); skbuf.set(0, opcode); skbuf.set(1, hwType); skbuf.set(2, clientHwAddress.getLength()); skbuf.set(3, hopCount); skbuf.set32(4, transactionID); skbuf.set16(8, secondsElapsed); skbuf.set16(10, flags); if (clientIPAddress != null) { IPv4Address.writeTo(skbuf, 12, clientIPAddress); } if (yourIPAddress != null) { IPv4Address.writeTo(skbuf, 16, yourIPAddress); } if (serverIPAddress != null) { IPv4Address.writeTo(skbuf, 20, serverIPAddress); } if (gatewayIPAddress != null) { IPv4Address.writeTo(skbuf, 24, gatewayIPAddress); } if (clientHwAddress != null) { clientHwAddress.writeTo(skbuf, 28); } if (serverHostName != null) { skbuf.set(32, serverHostName.getBytes("US-ASCII"), 0, serverHostName.length()); } if (bootFileName != null) { skbuf.set(96, bootFileName.getBytes("US-ASCII"), 0, bootFileName.length()); } }
|
public void prefixTo(SocketBuffer skbuf) { skbuf.insert(SIZE); skbuf.set(0, opcode); skbuf.set(1, hwType); skbuf.set(2, clientHwAddress.getLength()); skbuf.set(3, hopCount); skbuf.set32(4, transactionID); skbuf.set16(8, secondsElapsed); skbuf.set16(10, flags); if (clientIPAddress != null) { IPv4Address.writeTo(skbuf, 12, clientIPAddress); } if (yourIPAddress != null) { IPv4Address.writeTo(skbuf, 16, yourIPAddress); } if (serverIPAddress != null) { IPv4Address.writeTo(skbuf, 20, serverIPAddress); } if (gatewayIPAddress != null) { IPv4Address.writeTo(skbuf, 24, gatewayIPAddress); } if (clientHwAddress != null) { clientHwAddress.writeTo(skbuf, 28); } if (serverHostName != null) { skbuf.set(32, serverHostName.getBytes("US-ASCII"), 0, serverHostName.length()); } if (bootFileName != null) { try { skbuf.set(96, bootFileName.getBytes("US-ASCII"), 0, bootFileName.length()); } catch(UnsupportedEncodingException ex) { throw new RuntimeException(ex); } } }
| 4,292
|
public abstract XMLEventWriter createXMLEventWriter(Result result) throws XMLStreamException;
|
public abstract XMLEventWriter createXMLEventWriter(OutputStream stream) throws XMLStreamException;
| 4,294
|
public static XMLInputFactory newInstance(String factoryId, ClassLoader classLoader) throws FactoryConfigurationError { ClassLoader loader = classLoader; if (loader == null) { loader = Thread.currentThread().getContextClassLoader(); } if (loader == null) { loader = XMLInputFactory.class.getClassLoader(); } String className = null; int count = 0; do { className = getFactoryClassName(loader, count++); if (className != null) { try { Class t = (loader != null) ? loader.loadClass(className) : Class.forName(className); return (XMLInputFactory) t.newInstance(); } catch (ClassNotFoundException e) { className = null; } catch (Exception e) { throw new FactoryConfigurationError(e, "error instantiating class " + className); } } } while (className == null && count < 3); //return new gnu.xml.stream.XMLInputFactoryImpl(); throw new FactoryConfigurationError(); }
|
public static XMLInputFactory newInstance(String factoryId, ClassLoader classLoader) throws FactoryConfigurationError { ClassLoader loader = classLoader; if (loader == null) { loader = Thread.currentThread().getContextClassLoader(); } if (loader == null) { loader = XMLInputFactory.class.getClassLoader(); } String className = null; int count = 0; do { className = getFactoryClassName(loader, count++); if (className != null) { try { Class t = (loader != null) ? loader.loadClass(className) : Class.forName(className); return (XMLInputFactory) t.newInstance(); } catch (ClassNotFoundException e) { className = null; } catch (Exception e) { throw new FactoryConfigurationError(e, "error instantiating class " + className); } } } while (className == null && count < 3); //return new gnu.xml.stream.XMLInputFactoryImpl(); throw new FactoryConfigurationError(); }
| 4,295
|
public static XMLInputFactory newInstance(String factoryId, ClassLoader classLoader) throws FactoryConfigurationError { ClassLoader loader = classLoader; if (loader == null) { loader = Thread.currentThread().getContextClassLoader(); } if (loader == null) { loader = XMLInputFactory.class.getClassLoader(); } String className = null; int count = 0; do { className = getFactoryClassName(loader, count++); if (className != null) { try { Class t = (loader != null) ? loader.loadClass(className) : Class.forName(className); return (XMLInputFactory) t.newInstance(); } catch (ClassNotFoundException e) { className = null; } catch (Exception e) { throw new FactoryConfigurationError(e, "error instantiating class " + className); } } } while (className == null && count < 3); //return new gnu.xml.stream.XMLInputFactoryImpl(); throw new FactoryConfigurationError(); }
|
public static XMLInputFactory newInstance(String factoryId, ClassLoader classLoader) throws FactoryConfigurationError { ClassLoader loader = classLoader; if (loader == null) { loader = Thread.currentThread().getContextClassLoader(); } if (loader == null) { loader = XMLInputFactory.class.getClassLoader(); } String className = null; int count = 0; do { className = getFactoryClassName(loader, count++); if (className != null) { try { Class t = (loader != null) ? loader.loadClass(className) : Class.forName(className); return (XMLInputFactory) t.newInstance(); } catch (ClassNotFoundException e) { className = null; } catch (Exception e) { throw new FactoryConfigurationError(e, "error instantiating class " + className); } } } while (className == null && count < 3); //return new gnu.xml.stream.XMLInputFactoryImpl(); throw new FactoryConfigurationError(); }
| 4,296
|
public synchronized void addMouseMotionListener(MouseMotionListener listener) { mouseMotionListener = AWTEventMulticaster.add(mouseMotionListener, listener); if (mouseMotionListener != null) enableEvents(AWTEvent.MOUSE_EVENT_MASK); }
|
public synchronized void addMouseMotionListener(MouseMotionListener listener) { mouseMotionListener = AWTEventMulticaster.add(mouseMotionListener, listener); if (mouseMotionListener != null) enableEvents(AWTEvent.MOUSE_MOTION_EVENT_MASK); }
| 4,297
|
void dispatchEventImpl(AWTEvent e) { Event oldEvent = translateEvent (e); if (oldEvent != null) postEvent (oldEvent); if (eventTypeEnabled (e.id)) { // the trick we use to communicate between dispatch and redispatch // is to have KeyboardFocusManager.redispatch synchronize on the // object itself. we then do not redispatch to KeyboardFocusManager // if we are already holding the lock. if (! Thread.holdsLock(e)) { switch (e.id) { case WindowEvent.WINDOW_GAINED_FOCUS: case WindowEvent.WINDOW_LOST_FOCUS: case KeyEvent.KEY_PRESSED: case KeyEvent.KEY_RELEASED: case KeyEvent.KEY_TYPED: case FocusEvent.FOCUS_GAINED: case FocusEvent.FOCUS_LOST: if (KeyboardFocusManager .getCurrentKeyboardFocusManager() .dispatchEvent(e)) return; case MouseEvent.MOUSE_PRESSED: if (isLightweight()) requestFocus(); break; } } if (e.id != PaintEvent.PAINT && e.id != PaintEvent.UPDATE) processEvent(e); } if (peer != null) peer.handleEvent(e); }
|
void dispatchEventImpl(AWTEvent e) { Event oldEvent = translateEvent (e); if (oldEvent != null) postEvent (oldEvent); if (eventTypeEnabled (e.id)) { // the trick we use to communicate between dispatch and redispatch // is to have KeyboardFocusManager.redispatch synchronize on the // object itself. we then do not redispatch to KeyboardFocusManager // if we are already holding the lock. if (! Thread.holdsLock(e)) { switch (e.id) { case WindowEvent.WINDOW_GAINED_FOCUS: case WindowEvent.WINDOW_LOST_FOCUS: case KeyEvent.KEY_PRESSED: case KeyEvent.KEY_RELEASED: case KeyEvent.KEY_TYPED: case FocusEvent.FOCUS_GAINED: case FocusEvent.FOCUS_LOST: if (KeyboardFocusManager .getCurrentKeyboardFocusManager() .dispatchEvent(e)) return; case MouseEvent.MOUSE_PRESSED: if (isLightweight()) requestFocus(); break; } } if (e.id != PaintEvent.PAINT && e.id != PaintEvent.UPDATE && !ignoreFocus) processEvent(e); } if (peer != null) peer.handleEvent(e); }
| 4,298
|
boolean eventTypeEnabled (int type) { if (type > AWTEvent.RESERVED_ID_MAX) return true; switch (type) { case ComponentEvent.COMPONENT_HIDDEN: case ComponentEvent.COMPONENT_MOVED: case ComponentEvent.COMPONENT_RESIZED: case ComponentEvent.COMPONENT_SHOWN: return (componentListener != null || (eventMask & AWTEvent.COMPONENT_EVENT_MASK) != 0); case KeyEvent.KEY_PRESSED: case KeyEvent.KEY_RELEASED: case KeyEvent.KEY_TYPED: return (keyListener != null || (eventMask & AWTEvent.KEY_EVENT_MASK) != 0); case MouseEvent.MOUSE_CLICKED: case MouseEvent.MOUSE_ENTERED: case MouseEvent.MOUSE_EXITED: case MouseEvent.MOUSE_PRESSED: case MouseEvent.MOUSE_RELEASED: case MouseEvent.MOUSE_MOVED: case MouseEvent.MOUSE_DRAGGED: return (mouseListener != null || mouseMotionListener != null || (eventMask & AWTEvent.MOUSE_EVENT_MASK) != 0); case FocusEvent.FOCUS_GAINED: case FocusEvent.FOCUS_LOST: return (focusListener != null || (eventMask & AWTEvent.FOCUS_EVENT_MASK) != 0); case InputMethodEvent.INPUT_METHOD_TEXT_CHANGED: case InputMethodEvent.CARET_POSITION_CHANGED: return (inputMethodListener != null || (eventMask & AWTEvent.INPUT_METHOD_EVENT_MASK) != 0); case PaintEvent.PAINT: case PaintEvent.UPDATE: return (eventMask & AWTEvent.PAINT_EVENT_MASK) != 0; default: return false; } }
|
boolean eventTypeEnabled (int type) { if (type > AWTEvent.RESERVED_ID_MAX) return true; switch (type) { case ComponentEvent.COMPONENT_HIDDEN: case ComponentEvent.COMPONENT_MOVED: case ComponentEvent.COMPONENT_RESIZED: case ComponentEvent.COMPONENT_SHOWN: return (componentListener != null || (eventMask & AWTEvent.COMPONENT_EVENT_MASK) != 0); case KeyEvent.KEY_PRESSED: case KeyEvent.KEY_RELEASED: case KeyEvent.KEY_TYPED: return (keyListener != null || (eventMask & AWTEvent.KEY_EVENT_MASK) != 0); case MouseEvent.MOUSE_CLICKED: case MouseEvent.MOUSE_ENTERED: case MouseEvent.MOUSE_EXITED: case MouseEvent.MOUSE_PRESSED: case MouseEvent.MOUSE_RELEASED: case MouseEvent.MOUSE_MOVED: case MouseEvent.MOUSE_DRAGGED: return (mouseListener != null || mouseMotionListener != null || (eventMask & AWTEvent.MOUSE_EVENT_MASK) != 0); case FocusEvent.FOCUS_GAINED: case FocusEvent.FOCUS_LOST: return (focusListener != null || (eventMask & AWTEvent.FOCUS_EVENT_MASK) != 0); case InputMethodEvent.INPUT_METHOD_TEXT_CHANGED: case InputMethodEvent.CARET_POSITION_CHANGED: return (inputMethodListener != null || (eventMask & AWTEvent.INPUT_METHOD_EVENT_MASK) != 0); case PaintEvent.PAINT: case PaintEvent.UPDATE: return (eventMask & AWTEvent.PAINT_EVENT_MASK) != 0; default: return false; } }
| 4,299
|
public void invalidate() { valid = false; prefSize = null; minSize = null; if (parent != null && parent.valid) parent.invalidate(); }
|
public void invalidate() { valid = false; prefSize = null; minSize = null; if (parent != null && parent.isValid()) parent.invalidate(); }
| 4,301
|
public void repaint() { if(!isShowing()) { Component p = parent; if (p != null) p.repaint(0, getX(), getY(), width, height); } else repaint(0, 0, 0, width, height); }
|
public void repaint() { if(!isShowing()) { Component p = parent; if (p != null) p.repaint(0, getX(), getY(), width, height); } else repaint(0, 0, 0, width, height); }
| 4,302
|
public void reshape(int x, int y, int width, int height) { int oldx = this.x; int oldy = this.y; int oldwidth = this.width; int oldheight = this.height; if (this.x == x && this.y == y && this.width == width && this.height == height) return; invalidate (); this.x = x; this.y = y; this.width = width; this.height = height; if (peer != null) peer.setBounds (x, y, width, height); // Erase old bounds and repaint new bounds for lightweights. if (isLightweight() && isShowing ()) { if (parent != null) { Rectangle parentBounds = parent.getBounds(); Rectangle oldBounds = new Rectangle(oldx, oldy, oldwidth, oldheight); Rectangle newBounds = new Rectangle(x, y, width, height); Rectangle destroyed = oldBounds.union(newBounds); if (!destroyed.isEmpty()) parent.repaint(0, destroyed.x, destroyed.y, destroyed.width, destroyed.height); } } // Only post event if this component is visible and has changed size. if (isShowing () && (oldx != x || oldy != y)) { ComponentEvent ce = new ComponentEvent(this, ComponentEvent.COMPONENT_MOVED); getToolkit().getSystemEventQueue().postEvent(ce); } if (isShowing () && (oldwidth != width || oldheight != height)) { ComponentEvent ce = new ComponentEvent(this, ComponentEvent.COMPONENT_RESIZED); getToolkit().getSystemEventQueue().postEvent(ce); } }
|
public void reshape(int x, int y, int width, int height) { int oldx = this.x; int oldy = this.y; int oldwidth = this.width; int oldheight = this.height; if (this.x == x && this.y == y && this.width == width && this.height == height) return; invalidate (); this.x = x; this.y = y; this.width = width; this.height = height; if (peer != null) peer.setBounds (x, y, width, height); // Erase old bounds and repaint new bounds for lightweights. if (isLightweight() && isShowing ()) { if (parent != null) { Rectangle oldBounds = new Rectangle(oldx, oldy, oldwidth, oldheight); Rectangle newBounds = new Rectangle(x, y, width, height); Rectangle destroyed = oldBounds.union(newBounds); if (!destroyed.isEmpty()) parent.repaint(0, destroyed.x, destroyed.y, destroyed.width, destroyed.height); } } // Only post event if this component is visible and has changed size. if (isShowing () && (oldx != x || oldy != y)) { ComponentEvent ce = new ComponentEvent(this, ComponentEvent.COMPONENT_MOVED); getToolkit().getSystemEventQueue().postEvent(ce); } if (isShowing () && (oldwidth != width || oldheight != height)) { ComponentEvent ce = new ComponentEvent(this, ComponentEvent.COMPONENT_RESIZED); getToolkit().getSystemEventQueue().postEvent(ce); } }
| 4,303
|
public void setBackground(Color c) { // return if the background is already set to that color. if ((c != null) && c.equals(background)) return; // If c is null, inherit from closest ancestor whose bg is set. if (c == null && parent != null) c = parent.getBackground(); if (peer != null && c != null) peer.setBackground(c); Color previous = background; background = c; firePropertyChange("background", previous, c); }
|
public void setBackground(Color c) { // return if the background is already set to that color. if ((c != null) && c.equals(background)) return; // If c is null, inherit from closest ancestor whose bg is set. if (c == null && parent != null) c = parent.getBackground(); if (peer != null && c != null) peer.setBackground(c); Color previous = background; background = c; firePropertyChange("background", previous, c); }
| 4,304
|
protected String basicXMLWriter ( Writer outputWriter, String indent, boolean dontCloseNode, String newNodeNameString, String noChildObjectNodeName ) throws java.io.IOException { // while writing out, attribHash should not be changed synchronized (attribHash) { 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; // 1. open this node, print its simple XML attributes if (nodeNameString != null) { if (Specification.getInstance().isPrettyXDFOutput()) outputWriter.write(indent); // indent node if desired outputWriter.write("<" + nodeNameString); // print opening statement } // gather info about Attributes 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) { int size = attribs.size(); for (int i = 0; i < size; i++) { Hashtable item = (Hashtable) attribs.get(i); outputWriter.write( " " + item.get("name") + "=\""); // this slows things down, should we use? writeOutAttribute(outputWriter, (String) item.get("value")); // outputWriter.write( (String) item.get("value")); outputWriter.write( "\"" ); } } // 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"); List childXMLElements = getElementNodeList(); String pcdata = (String) xmlInfo.get("PCDATA"); if ( childObjs.size() > 0 || childXMLElements.size() > 0 || pcdata != null || noChildObjectNodeName != null) { // close the opening tag if (nodeNameString != null) { outputWriter.write( ">"); if ((Specification.getInstance().isPrettyXDFOutput()) && (pcdata == null)) outputWriter.write( Constants.NEW_LINE); } // by definition these are printed first int size = childXMLElements.size(); String childindent = indent + Specification.getInstance().getPrettyXDFOutputIndentation(); for (int i = 0; i < size; i++) { ((ElementNode) childXMLElements.get(i)).toXMLWriter(outputWriter, childindent); } // deal with object/list XML attributes, if any in our list size = childObjs.size(); for (int i = 0; i < size; i++) { Hashtable item = (Hashtable) childObjs.get(i); if (item.get("type") == Constants.LIST_TYPE) { if (hasValueListCompactDescription && valueListXMLItemName.equals(item.get("name"))) { Iterator iter = valueListObjects.iterator(); while(iter.hasNext()) { ValueListInterface valueListObj = (ValueListInterface) iter.next(); // first determine if groups should open or close // using the first value in the values list. List values = valueListObj.getValues(); Value valueObj = (Value) values.get(0); // *sigh* Yes, we have to check that all values belong to // the same groups, or problems will arise in the output. Do that here. boolean canUseCompactValueDescription = true; Set firstValueGroups = valueObj.openGroupNodeHash; Iterator valueIter = values.iterator(); valueIter.next(); // no need to do first group while (valueIter.hasNext()) { Value thisValue = (Value) valueIter.next(); if (thisValue != null) { Set thisValuesGroups = thisValue.openGroupNodeHash; if (!firstValueGroups.equals(thisValuesGroups)) { // Note this comparison also does size too Log.infoln("Cant use short description for values because some values have differing groups! Using long description instead."); canUseCompactValueDescription = false; break; } } } if (canUseCompactValueDescription) { // use compact description indent = dealWithClosingGroupNodes((BaseObject) valueObj, outputWriter, indent); indent = dealWithOpeningGroupNodes((BaseObject) valueObj, outputWriter, indent); String newindent = indent + Specification.getInstance().getPrettyXDFOutputIndentation(); // now print the valuelist itself valueListObj.toXMLWriter(outputWriter, newindent); } else { // use regular (long) method List objectList = (List) item.get("value"); indent = objectListToXMLWriter(outputWriter, objectList, indent); } } } else { // use regular method List objectList = (List) item.get("value"); indent = objectListToXMLWriter(outputWriter, objectList, indent); } } 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) { indent = dealWithClosingGroupNodes(containedObj, outputWriter, indent); indent = dealWithOpeningGroupNodes(containedObj, outputWriter, indent); String newindent = indent + Specification.getInstance().getPrettyXDFOutputIndentation(); containedObj.toXMLWriter(outputWriter, newindent); } } } else { // error: weird type, actually shouldnt occur. Is this needed?? Log.errorln("Weird error: unknown XML attribute type for item:"+item); } } // print out PCDATA, if any if(pcdata != null) { outputWriter.write(entifyString(pcdata)); }; // if there are no PCDATA or child objects/nodes then // we print out noChildObjectNodeName and close the node if ( childObjs.size() == 0 && pcdata == null && noChildObjectNodeName != null) { if (Specification.getInstance().isPrettyXDFOutput()) outputWriter.write( indent + Specification.getInstance().getPrettyXDFOutputIndentation()); outputWriter.write("<" + noChildObjectNodeName + "/>"); if (Specification.getInstance().isPrettyXDFOutput()) outputWriter.write( Constants.NEW_LINE); } // ok, now deal with closing the node if (nodeNameString != null) { indent = dealWithClosingGroupNodes((BaseObject) this, outputWriter, indent); if (Specification.getInstance().isPrettyXDFOutput() && pcdata == null) outputWriter.write( indent); if (!dontCloseNode) outputWriter.write( "</"+nodeNameString+">"); } } else { if (nodeNameString != null) { if (dontCloseNode) { // it may not have sub-objects, but we dont want to close it // (happens for group objects) outputWriter.write( ">"); } else { // no sub-objects, just close this node outputWriter.write( "/>"); } } } // if (Specification.getInstance().isPrettyXDFOutput() && nodeNameString != null ) // outputWriter.write( Constants.NEW_LINE); return nodeNameString; } //end synchronize }
|
protected String basicXMLWriter ( Writer outputWriter, String indent, boolean dontCloseNode, String newNodeNameString, String noChildObjectNodeName ) throws java.io.IOException { // while writing out, attribHash should not be changed synchronized (attribHash) { 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; // 1. open this node, print its simple XML attributes if (nodeNameString != null) { if (Specification.getInstance().isPrettyXDFOutput()) outputWriter.write(indent); // indent node if desired outputWriter.write("<" + nodeNameString); // print opening statement } // gather info about Attributes 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) { int size = attribs.size(); for (int i = 0; i < size; i++) { Hashtable item = (Hashtable) attribs.get(i); outputWriter.write( " " + item.get("name") + "=\""); // this slows things down, should we use? writeOutAttribute(outputWriter, (String) item.get("value")); // outputWriter.write( (String) item.get("value")); outputWriter.write( "\"" ); } } // 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"); List childXMLElements = getElementNodeList(); String pcdata = (String) xmlInfo.get("PCDATA"); if ( childObjs.size() > 0 || childXMLElements.size() > 0 || pcdata != null || noChildObjectNodeName != null) { // close the opening tag if (nodeNameString != null) { outputWriter.write( ">"); if ((Specification.getInstance().isPrettyXDFOutput()) && (pcdata == null)) outputWriter.write( Constants.NEW_LINE); } // by definition these are printed first int size = childXMLElements.size(); String childindent = indent + Specification.getInstance().getPrettyXDFOutputIndentation(); for (int i = 0; i < size; i++) { ((ElementNode) childXMLElements.get(i)).toXMLWriter(outputWriter, childindent); } // deal with object/list XML attributes, if any in our list size = childObjs.size(); for (int i = 0; i < size; i++) { Hashtable item = (Hashtable) childObjs.get(i); if (item.get("type") == Constants.LIST_TYPE) { if (hasValueListCompactDescription && valueListXMLItemName.equals(item.get("name"))) { Iterator iter = valueListObjects.iterator(); while(iter.hasNext()) { ValueList valueListObj = (ValueList) iter.next(); // first determine if groups should open or close // using the first value in the values list. List values = valueListObj.getValues(); Value valueObj = (Value) values.get(0); // *sigh* Yes, we have to check that all values belong to // the same groups, or problems will arise in the output. Do that here. boolean canUseCompactValueDescription = true; Set firstValueGroups = valueObj.openGroupNodeHash; Iterator valueIter = values.iterator(); valueIter.next(); // no need to do first group while (valueIter.hasNext()) { Value thisValue = (Value) valueIter.next(); if (thisValue != null) { Set thisValuesGroups = thisValue.openGroupNodeHash; if (!firstValueGroups.equals(thisValuesGroups)) { // Note this comparison also does size too Log.infoln("Cant use short description for values because some values have differing groups! Using long description instead."); canUseCompactValueDescription = false; break; } } } if (canUseCompactValueDescription) { // use compact description indent = dealWithClosingGroupNodes((BaseObject) valueObj, outputWriter, indent); indent = dealWithOpeningGroupNodes((BaseObject) valueObj, outputWriter, indent); String newindent = indent + Specification.getInstance().getPrettyXDFOutputIndentation(); // now print the valuelist itself valueListObj.toXMLWriter(outputWriter, newindent); } else { // use regular (long) method List objectList = (List) item.get("value"); indent = objectListToXMLWriter(outputWriter, objectList, indent); } } } else { // use regular method List objectList = (List) item.get("value"); indent = objectListToXMLWriter(outputWriter, objectList, indent); } } 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) { indent = dealWithClosingGroupNodes(containedObj, outputWriter, indent); indent = dealWithOpeningGroupNodes(containedObj, outputWriter, indent); String newindent = indent + Specification.getInstance().getPrettyXDFOutputIndentation(); containedObj.toXMLWriter(outputWriter, newindent); } } } else { // error: weird type, actually shouldnt occur. Is this needed?? Log.errorln("Weird error: unknown XML attribute type for item:"+item); } } // print out PCDATA, if any if(pcdata != null) { outputWriter.write(entifyString(pcdata)); }; // if there are no PCDATA or child objects/nodes then // we print out noChildObjectNodeName and close the node if ( childObjs.size() == 0 && pcdata == null && noChildObjectNodeName != null) { if (Specification.getInstance().isPrettyXDFOutput()) outputWriter.write( indent + Specification.getInstance().getPrettyXDFOutputIndentation()); outputWriter.write("<" + noChildObjectNodeName + "/>"); if (Specification.getInstance().isPrettyXDFOutput()) outputWriter.write( Constants.NEW_LINE); } // ok, now deal with closing the node if (nodeNameString != null) { indent = dealWithClosingGroupNodes((BaseObject) this, outputWriter, indent); if (Specification.getInstance().isPrettyXDFOutput() && pcdata == null) outputWriter.write( indent); if (!dontCloseNode) outputWriter.write( "</"+nodeNameString+">"); } } else { if (nodeNameString != null) { if (dontCloseNode) { // it may not have sub-objects, but we dont want to close it // (happens for group objects) outputWriter.write( ">"); } else { // no sub-objects, just close this node outputWriter.write( "/>"); } } } // if (Specification.getInstance().isPrettyXDFOutput() && nodeNameString != null ) // outputWriter.write( Constants.NEW_LINE); return nodeNameString; } //end synchronize }
| 4,306
|
protected void setValueListObj (ValueListInterface valueListObj) { resetValueListObjects(); addValueListObj(valueListObj); }
|
protected void setValueListObj (ValueList valueListObj) { resetValueListObjects(); addValueListObj(valueListObj); }
| 4,307
|
public MyInternalFrame() { super("#" + (++openFrameCount), true, //resizable true, //closable true, //maximizable true);//iconifiable internalId = openFrameCount; //...Create the GUI and put it in the window... //...Then set the window size or call pack... setSize(600,500); //Set the window's location. setLocation(xOffset*openFrameCount, yOffset*openFrameCount); addInternalFrameListener(new InternalFrameAdapter() { public void internalFrameClosing(InternalFrameEvent e) {// displayMessage("Internal frame closing", e); disconnectMe(); } public void internalFrameClosed(InternalFrameEvent e) {// displayMessage("Internal frame closed", e); disconnectMe(); } public void internalFrameOpened(InternalFrameEvent e) {// displayMessage("Internal frame opened", e); } public void internalFrameIconified(InternalFrameEvent e) {// displayMessage("Internal frame iconified", e); } public void internalFrameDeiconified(InternalFrameEvent e) {// displayMessage("Internal frame deiconified", e); repaint(); } public void internalFrameActivated(InternalFrameEvent e) {// displayMessage("Internal frame activated", e); activated = true; repaint(); } public void internalFrameDeactivated(InternalFrameEvent e) { activated = false;// displayMessage("Internal frame deactivated", e); } }); }
|
public MyInternalFrame() { super("#" + (++openFrameCount), true, //resizable true, //closable true, //maximizable true);//iconifiable internalId = openFrameCount; //...Create the GUI and put it in the window... //...Then set the window size or call pack... setSize(600,500); //Set the window's location. setLocation(xOffset*openFrameCount, yOffset*openFrameCount); addInternalFrameListener(new InternalFrameAdapter() { public void internalFrameClosing(InternalFrameEvent e) {// displayMessage("Internal frame closing", e); disconnectMe(); } public void internalFrameClosed(InternalFrameEvent e) {// displayMessage("Internal frame closed", e); disconnectMe(); } public void internalFrameOpened(InternalFrameEvent e) {// displayMessage("Internal frame opened", e); } public void internalFrameIconified(InternalFrameEvent e) {// displayMessage("Internal frame iconified", e); } public void internalFrameDeiconified(InternalFrameEvent e) {// displayMessage("Internal frame deiconified", e); calculateVisibility(); } public void internalFrameActivated(InternalFrameEvent e) {// displayMessage("Internal frame activated", e); activated = true; calculateVisibility(); } public void internalFrameDeactivated(InternalFrameEvent e) { activated = false;// displayMessage("Internal frame deactivated", e); } }); }
| 4,308
|
public void internalFrameActivated(InternalFrameEvent e) {// displayMessage("Internal frame activated", e); activated = true; repaint(); }
|
public void internalFrameActivated(InternalFrameEvent e) {// displayMessage("Internal frame activated", e); activated = true; calculateVisibility(); }
| 4,310
|
public void internalFrameDeiconified(InternalFrameEvent e) {// displayMessage("Internal frame deiconified", e); repaint(); }
|
public void internalFrameDeiconified(InternalFrameEvent e) {// displayMessage("Internal frame deiconified", e); calculateVisibility(); }
| 4,314
|
private void nextSession() { MyInternalFrame mif = getNextInternalFrame(); if (mif != null) { try { mif.setSelected(true); if (mif.isIcon()) mif.setIcon(false); } catch (java.beans.PropertyVetoException e) { System.out.println(e.getMessage()); } }// System.out.println(" current index " + index + " count " + desktop.getComponentCount()); }
|
private void nextSession() { MyInternalFrame mif = getNextInternalFrame(); if (mif != null) { try { mif.setSelected(true); if (mif.isIcon()) mif.setIcon(false); } catch (java.beans.PropertyVetoException e) { System.out.println(e.getMessage()); } }// System.out.println(" current index " + index + " count " + desktop.getComponentCount()); }
| 4,317
|
public void onSessionChanged(SessionChangeEvent changeEvent) { Session ses = (Session)changeEvent.getSource(); switch (changeEvent.getState()) { case STATE_CONNECTED: final String d = ses.getAllocDeviceName(); if (d != null) { System.out.println(changeEvent.getState() + " " + d); final int index = getIndexOfSession(ses); System.out.println(" index of session " + index + " num frames " + desktop.getAllFrames().length); if (index == -1) return; Runnable tc = new Runnable () { public void run() { JInternalFrame[] frames = desktop.getAllFrames(); frames[index].setTitle(frames[index].getTitle() + " " + d); } }; SwingUtilities.invokeLater(tc); } break; } }
|
public void onSessionChanged(SessionChangeEvent changeEvent) { Session ses = (Session)changeEvent.getSource(); switch (changeEvent.getState()) { case STATE_CONNECTED: final String d = ses.getAllocDeviceName(); if (d != null) { System.out.println(changeEvent.getState() + " " + d); final int index = getIndexOfSession(ses); if (index == -1) return; Runnable tc = new Runnable () { public void run() { JInternalFrame[] frames = desktop.getAllFrames(); frames[index].setTitle(frames[index].getTitle() + " " + d); } }; SwingUtilities.invokeLater(tc); } break; } }
| 4,318
|
public void onSessionChanged(SessionChangeEvent changeEvent) { Session ses = (Session)changeEvent.getSource(); switch (changeEvent.getState()) { case STATE_CONNECTED: final String d = ses.getAllocDeviceName(); if (d != null) { System.out.println(changeEvent.getState() + " " + d); final int index = getIndexOfSession(ses); System.out.println(" index of session " + index + " num frames " + desktop.getAllFrames().length); if (index == -1) return; Runnable tc = new Runnable () { public void run() { JInternalFrame[] frames = desktop.getAllFrames(); frames[index].setTitle(frames[index].getTitle() + " " + d); } }; SwingUtilities.invokeLater(tc); } break; } }
|
public void onSessionChanged(SessionChangeEvent changeEvent) { Session ses = (Session)changeEvent.getSource(); switch (changeEvent.getState()) { case STATE_CONNECTED: final String d = ses.getAllocDeviceName(); if (d != null) { System.out.println(changeEvent.getState() + " " + d); final int index = getIndexOfSession(ses); System.out.println(" index of session " + index + " num frames " + desktop.getAllFrames().length); if (index == -1) return; Runnable tc = new Runnable () { public void run() { JInternalFrame[] frames = desktop.getAllFrames(); int id = ((MyInternalFrame)frames[index]).getInternalId(); frames[index].setTitle("#" + id + " " + d); } }; SwingUtilities.invokeLater(tc); } break; } }
| 4,319
|
public void run() { JInternalFrame[] frames = desktop.getAllFrames(); frames[index].setTitle(frames[index].getTitle() + " " + d); }
|
public void run() { JInternalFrame[] frames = desktop.getAllFrames(); int id = ((MyInternalFrame)frames[index]).getInternalId(); frames[index].setTitle("#" + id + " " + d); }
| 4,320
|
private void prevSession() { JInternalFrame[] frames = (JInternalFrame[])desktop.getAllFrames(); JInternalFrame miv = desktop.getSelectedFrame(); if (miv == null) return; int index = desktop.getIndexOf(miv); if (index == -1) return; MyInternalFrame mix = (MyInternalFrame)frames[index]; int seq = mix.getInternalId(); index = 0; for (int x = 0; x < myFrameList.size(); x++) { MyInternalFrame mif = (MyInternalFrame)myFrameList.get(x);// System.out.println(" current index " + x + " count " + frames.length + " has focus " +// mif.isActive() + " title " + mif.getTitle() + " seq " + seq +// " id " + mif.getInternalId()); if (mix.equals(mif)) { index = x - 1; break; } } if (index < 0) { index = myFrameList.size() - 1; } try { ((MyInternalFrame)myFrameList.get(index)).setSelected(true); if (((MyInternalFrame)myFrameList.get(index)).isIcon()) ((MyInternalFrame)myFrameList.get(index)).setIcon(false); } catch (java.beans.PropertyVetoException e) { System.out.println(e.getMessage()); }// System.out.println(" current index " + index + " count " + desktop.getComponentCount()); }
|
private void prevSession() { JInternalFrame[] frames = (JInternalFrame[])desktop.getAllFrames(); JInternalFrame miv = desktop.getSelectedFrame(); if (miv == null) return; int index = desktop.getIndexOf(miv); if (index == -1) return; MyInternalFrame mix = (MyInternalFrame)frames[index]; int seq = mix.getInternalId(); index = 0; for (int x = 0; x < myFrameList.size(); x++) { MyInternalFrame mif = (MyInternalFrame)myFrameList.get(x);// System.out.println(" current index " + x + " count " + frames.length + " has focus " +// mif.isActive() + " title " + mif.getTitle() + " seq " + seq +// " id " + mif.getInternalId()); if (mix.equals(mif)) { index = x - 1; break; } } if (index < 0) { index = myFrameList.size() - 1; } try { ((MyInternalFrame)myFrameList.get(index)).setSelected(true); if (((MyInternalFrame)myFrameList.get(index)).isIcon()) ((MyInternalFrame)myFrameList.get(index)).setIcon(false); } catch (java.beans.PropertyVetoException e) { System.out.println(e.getMessage()); }// System.out.println(" current index " + index + " count " + desktop.getComponentCount()); }
| 4,321
|
public final static String getKeyStrokeText(KeyEvent ke) { if (!workStroke.equals(ke)) { workStroke.setAttributes(ke); lastKeyMnemonic = (String)mappedKeys.get(workStroke); } return lastKeyMnemonic; }
|
public final static String getKeyStrokeText(KeyEvent ke) { if (!workStroke.equals(ke)) { workStroke.setAttributes(ke); lastKeyMnemonic = (String)mappedKeys.get(workStroke); } return lastKeyMnemonic; }
| 4,322
|
private void checkLegacy() { // we check if the sessions file already exists in the directory // if it does exist we are working with an old install so we // need to set the settings directory to the users directory // SESSIONS is declared as a string, so we just can use the keyword here. if(ses.exists()) { int cfc; cfc = JOptionPane.showConfirmDialog(null, "Dear User,\n\n" + "Seems you are using an old version of tn5250j.\n" + "In meanwhile the application became multi-user capable,\n" + "which means ALL the config- and settings-files are\n" + "placed in your home-dir to avoid further problems in\n" + "the near future.\n\n" + "You have the choice to choose if you want the files\n" + "to be copied or not, please make your choice !\n\n" + "Shall we copy the files to the new location ?", "Old install detected", JOptionPane.WARNING_MESSAGE, JOptionPane.YES_NO_OPTION); if (cfc == 0) { settings.setProperty("emulator.settingsDirectory", System.getProperty("user.home") + File.separator + ".tn5250j" + File.separator); // Here we do a checkdir so we know the destination-dir exists checkDirs(); copyConfigs(SESSIONS); copyConfigs(MACROS); copyConfigs(KEYMAP); } else { JOptionPane.showMessageDialog(null, "Dear User,\n\n" + "You choosed not to copy the file.\n" + "This means the program will end here.\n\n" + "To use this NON-STANDARD behaviour start tn5250j\n" + "with -Demulator.settingsDirectory=<settings-dir> \n" + "as a parameter to avoid this question all the time.", "Using NON-STANDARD behaviour", JOptionPane.WARNING_MESSAGE); System.exit(0); } } else { settings.setProperty("emulator.settingsDirectory", System.getProperty("user.home") + File.separator + ".tn5250j" + File.separator); System.out.println("User Home = " + System.getProperty("user.home")); } }
|
private void checkLegacy() { // we check if the sessions file already exists in the directory // if it does exist we are working with an old install so we // need to set the settings directory to the users directory // SESSIONS is declared as a string, so we just can use the keyword here. if(ses.exists()) { int cfc; cfc = JOptionPane.showConfirmDialog(null, "Dear User,\n\n" + "Seems you are using an old version of tn5250j.\n" + "In meanwhile the application became multi-user capable,\n" + "which means ALL the config- and settings-files are\n" + "placed in your home-dir to avoid further problems in\n" + "the near future.\n\n" + "You have the choice to choose if you want the files\n" + "to be copied or not, please make your choice !\n\n" + "Shall we copy the files to the new location ?", "Old install detected", JOptionPane.WARNING_MESSAGE, JOptionPane.YES_NO_OPTION); if (cfc == 0) { settings.setProperty("emulator.settingsDirectory", System.getProperty("user.home") + File.separator + ".tn5250j" + File.separator); // Here we do a checkdir so we know the destination-dir exists checkDirs(); copyConfigs(SESSIONS); copyConfigs(MACROS); copyConfigs(KEYMAP); } else { JOptionPane.showMessageDialog(null, "Dear User,\n\n" + "You choosed not to copy the file.\n" + "This means the program will end here.\n\n" + "To use this NON-STANDARD behaviour start tn5250j\n" + "with -Demulator.settingsDirectory=<settings-dir> \n" + "as a parameter to avoid this question all the time.", "Using NON-STANDARD behaviour", JOptionPane.WARNING_MESSAGE); System.exit(0); } } else { settings.setProperty("emulator.settingsDirectory", System.getProperty("user.home") + File.separator + ".tn5250j" + File.separator); System.out.println("User Home = " + System.getProperty("user.home")); } }
| 4,323
|
private void checkLegacy() { // we check if the sessions file already exists in the directory // if it does exist we are working with an old install so we // need to set the settings directory to the users directory // SESSIONS is declared as a string, so we just can use the keyword here. if(ses.exists()) { int cfc; cfc = JOptionPane.showConfirmDialog(null, "Dear User,\n\n" + "Seems you are using an old version of tn5250j.\n" + "In meanwhile the application became multi-user capable,\n" + "which means ALL the config- and settings-files are\n" + "placed in your home-dir to avoid further problems in\n" + "the near future.\n\n" + "You have the choice to choose if you want the files\n" + "to be copied or not, please make your choice !\n\n" + "Shall we copy the files to the new location ?", "Old install detected", JOptionPane.WARNING_MESSAGE, JOptionPane.YES_NO_OPTION); if (cfc == 0) { settings.setProperty("emulator.settingsDirectory", System.getProperty("user.home") + File.separator + ".tn5250j" + File.separator); // Here we do a checkdir so we know the destination-dir exists checkDirs(); copyConfigs(SESSIONS); copyConfigs(MACROS); copyConfigs(KEYMAP); } else { JOptionPane.showMessageDialog(null, "Dear User,\n\n" + "You choosed not to copy the file.\n" + "This means the program will end here.\n\n" + "To use this NON-STANDARD behaviour start tn5250j\n" + "with -Demulator.settingsDirectory=<settings-dir> \n" + "as a parameter to avoid this question all the time.", "Using NON-STANDARD behaviour", JOptionPane.WARNING_MESSAGE); System.exit(0); } } else { settings.setProperty("emulator.settingsDirectory", System.getProperty("user.home") + File.separator + ".tn5250j" + File.separator); System.out.println("User Home = " + System.getProperty("user.home")); } }
|
private void checkLegacy() { // we check if the sessions file already exists in the directory // if it does exist we are working with an old install so we // need to set the settings directory to the users directory // SESSIONS is declared as a string, so we just can use the keyword here. if(ses.exists()) { int cfc; cfc = JOptionPane.showConfirmDialog(null, "Dear User,\n\n" + "Seems you are using an old version of tn5250j.\n" + "In meanwhile the application became multi-user capable,\n" + "which means ALL the config- and settings-files are\n" + "placed in your home-dir to avoid further problems in\n" + "the near future.\n\n" + "You have the choice to choose if you want the files\n" + "to be copied or not, please make your choice !\n\n" + "Shall we copy the files to the new location ?", "Old install detected", JOptionPane.WARNING_MESSAGE, JOptionPane.YES_NO_OPTION); if (cfc == 0) { settings.setProperty("emulator.settingsDirectory", System.getProperty("user.home") + File.separator + ".tn5250j" + File.separator); // Here we do a checkdir so we know the destination-dir exists checkDirs(); copyConfigs(SESSIONS); copyConfigs(MACROS); copyConfigs(KEYMAP); } else { JOptionPane.showMessageDialog(null, "Dear User,\n\n" + "You choosed not to copy the file.\n" + "This means the program will end here.\n\n" + "To use this NON-STANDARD behaviour start tn5250j\n" + "with -Demulator.settingsDirectory=<settings-dir> \n" + "as a parameter to avoid this question all the time.", "Using NON-STANDARD behaviour", JOptionPane.WARNING_MESSAGE); System.exit(0); } } else { settings.setProperty("emulator.settingsDirectory", System.getProperty("user.home") + File.separator + ".tn5250j" + File.separator); System.out.println("User Home = " + System.getProperty("user.home")); } }
| 4,324
|
private void loadSettings() { FileInputStream in = null; FileInputStream again = null; settings = new Properties(); // here we will check for a system property is provided first. if (System.getProperties().containsKey("emulator.settingsDirectory")) { settings.setProperty("emulator.settingsDirectory", System.getProperty("emulator.settingsDirectory") + File.separator); checkDirs(); } else { try { in = new FileInputStream(settingsFile); settings.load(in); } catch (FileNotFoundException fnfe) { try { again = new FileInputStream(System.getProperty("user.home") + File.separator + ".tn5250j" + File.separator + settingsFile); settings.load(again); } catch (FileNotFoundException fnfea) { System.out.println(" Information Message: " + fnfea.getMessage() + ". The file " + settingsFile + " will be created for first time use."); checkLegacy(); saveSettings(); } catch (IOException ioea) { System.out.println("IO Exception accessing File " + settingsFile + " for the following reason : " + ioea.getMessage()); } catch (SecurityException sea) { System.out.println("Security Exception for file " + settingsFile + " This file can not be " + "accessed because : " + sea.getMessage()); } } catch (IOException ioe) { System.out.println("IO Exception accessing File " + settingsFile + " for the following reason : " + ioe.getMessage()); } catch (SecurityException se) { System.out.println("Security Exception for file " + settingsFile + " This file can not be " + "accessed because : " + se.getMessage()); } } }
|
private void loadSettings() { FileInputStream in = null; FileInputStream again = null; settings = new Properties(); // here we will check for a system property is provided first. if (System.getProperties().containsKey("emulator.settingsDirectory")) { settings.setProperty("emulator.settingsDirectory", System.getProperty("emulator.settingsDirectory") + File.separator); checkDirs(); } else { try { in = new FileInputStream(settingsFile); settings.load(in); } catch (FileNotFoundException fnfe) { try { again = new FileInputStream(System.getProperty("user.home") + File.separator + ".tn5250j" + File.separator + settingsFile); settings.load(again); } catch (FileNotFoundException fnfea) { System.out.println(" Information Message: " + fnfea.getMessage() + ". The file " + settingsFile + " will be created for first time use."); checkLegacy(); saveSettings(); } catch (IOException ioea) { System.out.println("IO Exception accessing File " + settingsFile + " for the following reason : " + ioea.getMessage()); } catch (SecurityException sea) { System.out.println("Security Exception for file " + settingsFile + " This file can not be " + "accessed because : " + sea.getMessage()); } } catch (IOException ioe) { System.out.println("IO Exception accessing File " + settingsFile + " for the following reason : " + ioe.getMessage()); } catch (SecurityException se) { System.out.println("Security Exception for file " + settingsFile + " This file can not be " + "accessed because : " + se.getMessage()); } } }
| 4,325
|
public void saveSettings() { try { FileOutputStream out = new FileOutputStream(settingsFile); settings.store(out,"----------------- tn5250j Global Settings --------------"); } catch (FileNotFoundException fnfe) {} catch (IOException ioe) {} }
|
public void saveSettings() { try { FileOutputStream out = new FileOutputStream(settingsDirectory() + settingsFile); settings.store(out,"----------------- tn5250j Global Settings --------------"); } catch (FileNotFoundException fnfe) {} catch (IOException ioe) {} }
| 4,326
|
public ChunkedInputStream(InputStream in, Headers headers) { super(in); this.headers = headers; size = -1; count = 0; meta = true; }
|
public ChunkedInputStream(InputStream in, Headers headers) { this.in = in; this.headers = headers; size = -1; count = 0; meta = true; }
| 4,327
|
public void setTitleJustification(int titleJustification) { if ((titleJustification < DEFAULT_JUSTIFICATION) || (titleJustification > TRAILING)) throw new IllegalArgumentException(); // Swing borders are not JavaBeans, thus no need to fire an event. this.titleJustification = titleJustification; }
|
public void setTitleJustification(int titleJustification) { if ((titleJustification < DEFAULT_JUSTIFICATION) || (titleJustification > TRAILING)) throw new IllegalArgumentException(titleJustification + " is not a valid title justification."); // Swing borders are not JavaBeans, thus no need to fire an event. this.titleJustification = titleJustification; }
| 4,328
|
public void setTitlePosition(int titlePosition) { if ((titlePosition < DEFAULT_POSITION) || (titlePosition > BELOW_BOTTOM)) throw new IllegalArgumentException(); // Swing borders are not JavaBeans, thus no need to fire an event. this.titlePosition = titlePosition; }
|
public void setTitlePosition(int titlePosition) { if ((titlePosition < DEFAULT_POSITION) || (titlePosition > BELOW_BOTTOM)) throw new IllegalArgumentException(titlePosition + " is not a valid title position."); // Swing borders are not JavaBeans, thus no need to fire an event. this.titlePosition = titlePosition; }
| 4,329
|
Object getPreviousVisibleNode(Object node) { if (currentVisiblePath != null) { Object[] nodes = currentVisiblePath.getPath(); int i = 0; while (i < nodes.length && !node.equals(nodes[i])) i++; // return the next node if (i-1 > 0) return nodes[i-1]; } return null; }
|
Object getPreviousVisibleNode(Object node) { if (currentVisiblePath != null) { Object[] nodes = currentVisiblePath.getPath(); int i = 0; while (i < nodes.length && !node.equals(nodes[i])) i++; // return the next node if (i-1 >= 0) return nodes[i-1]; } return null; }
| 4,331
|
public void paint(Graphics g, JComponent c) { JTree tree = (JTree) c; if (currentVisiblePath == null) updateCurrentVisiblePath(); if (treeModel != null) { Object root = treeModel.getRoot(); paintRecursive(g, 0, 0, 0, tree, treeModel, root); if (hasControlIcons()) paintControlIcons(g, 0, 0, 0, tree, treeModel, root); } }
|
public void paint(Graphics g, JComponent c) { JTree tree = (JTree) c; if (currentVisiblePath == null) updateCurrentVisiblePath(); if (currentVisiblePath != null && treeModel != null) { Object root = treeModel.getRoot(); paintRecursive(g, 0, 0, 0, tree, treeModel, root); if (hasControlIcons()) paintControlIcons(g, 0, 0, 0, tree, treeModel, root); } }
| 4,333
|
int paintControlIcons(Graphics g, int indentation, int descent, int depth, JTree tree, TreeModel mod, Object node) { int rowHeight = getRowHeight(); TreePath path = new TreePath(getPathToRoot(node, 0)); Icon icon = getCurrentControlIcon(path); Rectangle clip = tree.getVisibleRect(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; if (mod.isLeaf(node)) descent += rowHeight; else { if (!node.equals(mod.getRoot()) && (tree.isRootVisible() || getLevel(node) != 1)) { int width = icon.getIconWidth(); int height = icon.getIconHeight() + 2; int posX = indentation - rightChildIndent; int posY = descent; if (width > rightChildIndent) posX -= gap; else posX += width/2; if (height < rowHeight) posY += height/2; icon.paintIcon(tree, g, posX, posY); } if (depth > 0 || tree.isRootVisible()) descent += rowHeight; if (tree.isExpanded(path)) { int max = 0; if (!mod.isLeaf(node)) max = mod.getChildCount(node); for (int i = 0; i < max; i++) { int indent = indentation + rightChildIndent; if (depth == 0 && !tree.isRootVisible()) indent = 1; descent = paintControlIcons(g, indent, descent, depth + 1, tree, mod, mod.getChild(node, i)); } } } return descent; }
|
int paintControlIcons(Graphics g, int indentation, int descent, int depth, JTree tree, TreeModel mod, Object node) { int rowHeight = getRowHeight(); TreePath path = new TreePath(getPathToRoot(node, 0)); Icon icon = getCurrentControlIcon(path); Rectangle clip = tree.getVisibleRect(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; if (mod.isLeaf(node)) descent += rowHeight; else { if (!node.equals(mod.getRoot()) && (tree.isRootVisible() || getLevel(node) != 1)) { int width = icon.getIconWidth(); int height = icon.getIconHeight() + 2; int posX = indentation - rightChildIndent; int posY = descent; if (width > rightChildIndent) posX -= gap; else posX += width/2; if (height < rowHeight) posY += height/2; icon.paintIcon(tree, g, posX, posY); } if (depth > 0 || tree.isRootVisible()) descent += rowHeight; if (tree.isExpanded(path)) { int max = 0; if (!mod.isLeaf(node)) max = mod.getChildCount(node); for (int i = 0; i < max; i++) { int indent = indentation + rightChildIndent; if (depth == 0 && !tree.isRootVisible()) indent = 1; descent = paintControlIcons(g, indent, descent, depth + 1, tree, mod, child); } } } return descent; }
| 4,335
|
int paintRecursive(Graphics g, int indentation, int descent, int depth, JTree tree, TreeModel mod, Object curr) { Rectangle clip = tree.getVisibleRect(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; TreePath path = new TreePath(getPathToRoot(curr, 0)); int halfHeight = getRowHeight() / 2; int halfWidth = rightChildIndent / 2; int y0 = descent + halfHeight; int heightOfLine = descent + halfHeight; int row = getRowForPath(tree, path); boolean isRootVisible = tree.isRootVisible(); boolean isExpanded = tree.isExpanded(path); boolean isLeaf = mod.isLeaf(curr); Rectangle bounds = getPathBounds(tree, path); Object root = mod.getRoot(); if (isLeaf) { paintRow(g, clip, null, bounds, path, row, true, false, true); descent += getRowHeight(); } else { if (depth > 0 || isRootVisible) { paintRow(g, clip, null, bounds, path, row, isExpanded, false, false); descent += getRowHeight(); y0 += halfHeight; } if (isExpanded) { int max = mod.getChildCount(curr); for (int i = 0; i < max; i++) { int indent = indentation + rightChildIndent; if (!isRootVisible && depth == 0) indent = 0; else if (isRootVisible || (!isRootVisible && !curr.equals(root))) { g.setColor(getHashColor()); heightOfLine = descent + halfHeight; paintHorizontalLine(g, (JComponent) tree, heightOfLine, indentation + halfWidth, indentation + rightChildIndent); } descent = paintRecursive(g, indent, descent, depth + 1, tree, mod, mod.getChild(curr, i)); } } } if (isExpanded) if (y0 != heightOfLine && !isLeaf && mod.getChildCount(curr) > 0) { g.setColor(getHashColor()); paintVerticalLine(g, (JComponent) tree, indentation + halfWidth, y0, heightOfLine); } return descent; }
|
int paintRecursive(Graphics g, int indentation, int descent, int depth, JTree tree, TreeModel mod, Object curr) { Rectangle clip = tree.getVisibleRect(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; TreePath path = new TreePath(getPathToRoot(curr, 0)); int halfHeight = getRowHeight() / 2; int halfWidth = rightChildIndent / 2; int y0 = descent + halfHeight; int heightOfLine = descent + halfHeight; int row = getRowForPath(tree, path); boolean isRootVisible = tree.isRootVisible(); boolean isExpanded = tree.isExpanded(path); boolean isLeaf = mod.isLeaf(curr); Rectangle bounds = getPathBounds(tree, path); Object root = mod.getRoot(); if (isLeaf) { paintRow(g, clip, null, bounds, path, row, true, false, true); descent += getRowHeight(); } else { if (depth > 0 || isRootVisible) { paintRow(g, clip, null, bounds, path, row, isExpanded, false, false); descent += getRowHeight(); y0 += halfHeight; } if (isExpanded) { int max = mod.getChildCount(curr); for (int i = 0; i < max; i++) { int indent = indentation + rightChildIndent; if (!isRootVisible && depth == 0) indent = 0; else if (isRootVisible || (!isRootVisible && !curr.equals(root)) && childVis) { g.setColor(getHashColor()); heightOfLine = descent + halfHeight; paintHorizontalLine(g, (JComponent) tree, heightOfLine, indentation + halfWidth, indentation + rightChildIndent); } descent = paintRecursive(g, indent, descent, depth + 1, tree, mod, mod.getChild(curr, i)); } } } if (isExpanded) if (y0 != heightOfLine && !isLeaf && mod.getChildCount(curr) > 0) { g.setColor(getHashColor()); paintVerticalLine(g, (JComponent) tree, indentation + halfWidth, y0, heightOfLine); } return descent; }
| 4,336
|
int paintRecursive(Graphics g, int indentation, int descent, int depth, JTree tree, TreeModel mod, Object curr) { Rectangle clip = tree.getVisibleRect(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; TreePath path = new TreePath(getPathToRoot(curr, 0)); int halfHeight = getRowHeight() / 2; int halfWidth = rightChildIndent / 2; int y0 = descent + halfHeight; int heightOfLine = descent + halfHeight; int row = getRowForPath(tree, path); boolean isRootVisible = tree.isRootVisible(); boolean isExpanded = tree.isExpanded(path); boolean isLeaf = mod.isLeaf(curr); Rectangle bounds = getPathBounds(tree, path); Object root = mod.getRoot(); if (isLeaf) { paintRow(g, clip, null, bounds, path, row, true, false, true); descent += getRowHeight(); } else { if (depth > 0 || isRootVisible) { paintRow(g, clip, null, bounds, path, row, isExpanded, false, false); descent += getRowHeight(); y0 += halfHeight; } if (isExpanded) { int max = mod.getChildCount(curr); for (int i = 0; i < max; i++) { int indent = indentation + rightChildIndent; if (!isRootVisible && depth == 0) indent = 0; else if (isRootVisible || (!isRootVisible && !curr.equals(root))) { g.setColor(getHashColor()); heightOfLine = descent + halfHeight; paintHorizontalLine(g, (JComponent) tree, heightOfLine, indentation + halfWidth, indentation + rightChildIndent); } descent = paintRecursive(g, indent, descent, depth + 1, tree, mod, mod.getChild(curr, i)); } } } if (isExpanded) if (y0 != heightOfLine && !isLeaf && mod.getChildCount(curr) > 0) { g.setColor(getHashColor()); paintVerticalLine(g, (JComponent) tree, indentation + halfWidth, y0, heightOfLine); } return descent; }
|
int paintRecursive(Graphics g, int indentation, int descent, int depth, JTree tree, TreeModel mod, Object curr) { Rectangle clip = tree.getVisibleRect(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; TreePath path = new TreePath(getPathToRoot(curr, 0)); int halfHeight = getRowHeight() / 2; int halfWidth = rightChildIndent / 2; int y0 = descent + halfHeight; int heightOfLine = descent + halfHeight; int row = getRowForPath(tree, path); boolean isRootVisible = tree.isRootVisible(); boolean isExpanded = tree.isExpanded(path); boolean isLeaf = mod.isLeaf(curr); Rectangle bounds = getPathBounds(tree, path); Object root = mod.getRoot(); if (isLeaf) { paintRow(g, clip, null, bounds, path, row, true, false, true); descent += getRowHeight(); } else { if (depth > 0 || isRootVisible) { paintRow(g, clip, null, bounds, path, row, isExpanded, false, false); descent += getRowHeight(); y0 += halfHeight; } if (isExpanded) { int max = mod.getChildCount(curr); for (int i = 0; i < max; i++) { int indent = indentation + rightChildIndent; if (!isRootVisible && depth == 0) indent = 0; else if (isRootVisible || (!isRootVisible && !curr.equals(root))) { g.setColor(getHashColor()); heightOfLine = descent + halfHeight; paintHorizontalLine(g, (JComponent) tree, heightOfLine, indentation + halfWidth, indentation + rightChildIndent); } descent = paintRecursive(g, indent, descent, depth + 1, tree, mod, child); } } } if (isExpanded) if (y0 != heightOfLine && !isLeaf && mod.getChildCount(curr) > 0) { g.setColor(getHashColor()); paintVerticalLine(g, (JComponent) tree, indentation + halfWidth, y0, heightOfLine); } return descent; }
| 4,337
|
int paintRecursive(Graphics g, int indentation, int descent, int depth, JTree tree, TreeModel mod, Object curr) { Rectangle clip = tree.getVisibleRect(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; TreePath path = new TreePath(getPathToRoot(curr, 0)); int halfHeight = getRowHeight() / 2; int halfWidth = rightChildIndent / 2; int y0 = descent + halfHeight; int heightOfLine = descent + halfHeight; int row = getRowForPath(tree, path); boolean isRootVisible = tree.isRootVisible(); boolean isExpanded = tree.isExpanded(path); boolean isLeaf = mod.isLeaf(curr); Rectangle bounds = getPathBounds(tree, path); Object root = mod.getRoot(); if (isLeaf) { paintRow(g, clip, null, bounds, path, row, true, false, true); descent += getRowHeight(); } else { if (depth > 0 || isRootVisible) { paintRow(g, clip, null, bounds, path, row, isExpanded, false, false); descent += getRowHeight(); y0 += halfHeight; } if (isExpanded) { int max = mod.getChildCount(curr); for (int i = 0; i < max; i++) { int indent = indentation + rightChildIndent; if (!isRootVisible && depth == 0) indent = 0; else if (isRootVisible || (!isRootVisible && !curr.equals(root))) { g.setColor(getHashColor()); heightOfLine = descent + halfHeight; paintHorizontalLine(g, (JComponent) tree, heightOfLine, indentation + halfWidth, indentation + rightChildIndent); } descent = paintRecursive(g, indent, descent, depth + 1, tree, mod, mod.getChild(curr, i)); } } } if (isExpanded) if (y0 != heightOfLine && !isLeaf && mod.getChildCount(curr) > 0) { g.setColor(getHashColor()); paintVerticalLine(g, (JComponent) tree, indentation + halfWidth, y0, heightOfLine); } return descent; }
|
int paintRecursive(Graphics g, int indentation, int descent, int depth, JTree tree, TreeModel mod, Object curr) { Rectangle clip = tree.getVisibleRect(); if (indentation > clip.x + clip.width + rightChildIndent || descent > clip.y + clip.height + getRowHeight()) return descent; TreePath path = new TreePath(getPathToRoot(curr, 0)); int halfHeight = getRowHeight() / 2; int halfWidth = rightChildIndent / 2; int y0 = descent + halfHeight; int heightOfLine = descent + halfHeight; int row = getRowForPath(tree, path); boolean isRootVisible = tree.isRootVisible(); boolean isExpanded = tree.isExpanded(path); boolean isLeaf = mod.isLeaf(curr); Rectangle bounds = getPathBounds(tree, path); Object root = mod.getRoot(); if (isLeaf) { paintRow(g, clip, null, bounds, path, row, true, false, true); descent += getRowHeight(); } else { if (depth > 0 || isRootVisible) { paintRow(g, clip, null, bounds, path, row, isExpanded, false, false); descent += getRowHeight(); y0 += halfHeight; } if (isExpanded) { int max = mod.getChildCount(curr); for (int i = 0; i < max; i++) { int indent = indentation + rightChildIndent; if (!isRootVisible && depth == 0) indent = 0; else if (isRootVisible || (!isRootVisible && !curr.equals(root))) { g.setColor(getHashColor()); heightOfLine = descent + halfHeight; paintHorizontalLine(g, (JComponent) tree, heightOfLine, indentation + halfWidth, indentation + rightChildIndent); } descent = paintRecursive(g, indent, descent, depth + 1, tree, mod, mod.getChild(curr, i)); } } } if (isExpanded) if (y0 != heightOfLine && !isLeaf && mod.getChildCount(curr) > 0) { g.setColor(getHashColor()); paintVerticalLine(g, (JComponent) tree, indentation + halfWidth, y0, heightOfLine); } return descent; }
| 4,338
|
protected void paintRow(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf) { boolean selected = tree.isPathSelected(path); boolean hasIcons = false; Object node = path.getLastPathComponent(); if (tree.isVisible(path)) { if (!validCachedPreferredSize) updateCachedPreferredSize(); bounds.x += gap; bounds.width = preferredSize.width + bounds.x; if (editingComponent != null && editingPath != null && isEditing(tree) && node.equals(editingPath.getLastPathComponent())) { rendererPane.paintComponent(g, editingComponent.getParent(), null, bounds); } else { TreeCellRenderer dtcr = tree.getCellRenderer(); if (dtcr == null) dtcr = createDefaultCellRenderer(); Component c = dtcr.getTreeCellRendererComponent(tree, node, selected, isExpanded, isLeaf, row, false); rendererPane.paintComponent(g, c, c.getParent(), bounds); } } }
|
protected void paintRow(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf) { boolean selected = tree.isPathSelected(path); boolean hasIcons = false; Object node = path.getLastPathComponent(); if (tree.isVisible(path)) { if (!validCachedPreferredSize) updateCachedPreferredSize(); bounds.x += gap; bounds.width = preferredSize.width + bounds.x; if (editingComponent != null && editingPath != null && isEditing(tree) && node.equals(editingPath.getLastPathComponent())) { rendererPane.paintComponent(g, editingComponent.getParent(), null, bounds); } else { TreeCellRenderer dtcr = tree.getCellRenderer(); if (dtcr == null) dtcr = createDefaultCellRenderer(); Component c = dtcr.getTreeCellRendererComponent(tree, node, selected, isExpanded, isLeaf, row, true); rendererPane.paintComponent(g, c, c.getParent(), bounds); } } }
| 4,339
|
void updateCurrentVisiblePath() { if (treeModel == null) return; Object next = treeModel.getRoot(); Rectangle bounds = getCellBounds(0, 0, next); // 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); TreePath current = null; while (next != null) { if (current == null) current = new TreePath(next); else current = current.pathByAddingChild(next); do { TreePath path = new TreePath(getPathToRoot(next, 0)); if (tree.isVisible(path) && tree.isExpanded(path)) next = getNextNode(next); else next = getNextSibling(next); } 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) tree.addSelectionRow(0); }
|
void updateCurrentVisiblePath() { if (treeModel == null) return; Object next = treeModel.getRoot(); Rectangle bounds = getCellBounds(0, 0, next); // 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) || (!rootVisible && tree.isExpanded(new TreePath(next)))) next = getNextNode(next); TreePath current = null; while (next != null) { if (current == null) current = new TreePath(next); else current = current.pathByAddingChild(next); do { TreePath path = new TreePath(getPathToRoot(next, 0)); if (tree.isVisible(path) && tree.isExpanded(path)) next = getNextNode(next); else next = getNextSibling(next); } 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) tree.addSelectionRow(0); }
| 4,340
|
void updateCurrentVisiblePath() { if (treeModel == null) return; Object next = treeModel.getRoot(); Rectangle bounds = getCellBounds(0, 0, next); // 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); TreePath current = null; while (next != null) { if (current == null) current = new TreePath(next); else current = current.pathByAddingChild(next); do { TreePath path = new TreePath(getPathToRoot(next, 0)); if (tree.isVisible(path) && tree.isExpanded(path)) next = getNextNode(next); else next = getNextSibling(next); } 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) tree.addSelectionRow(0); }
|
void updateCurrentVisiblePath() { if (treeModel == null) return; Object next = treeModel.getRoot(); Rectangle bounds = getCellBounds(0, 0, next); // 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); TreePath current = null; while (next != null) { if (current == null) current = new TreePath(next); 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 next = getNextSibling(next); } 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) tree.addSelectionRow(0); }
| 4,341
|
void updateCurrentVisiblePath() { if (treeModel == null) return; Object next = treeModel.getRoot(); Rectangle bounds = getCellBounds(0, 0, next); // 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); TreePath current = null; while (next != null) { if (current == null) current = new TreePath(next); else current = current.pathByAddingChild(next); do { TreePath path = new TreePath(getPathToRoot(next, 0)); if (tree.isVisible(path) && tree.isExpanded(path)) next = getNextNode(next); else next = getNextSibling(next); } 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) tree.addSelectionRow(0); }
|
void updateCurrentVisiblePath() { if (treeModel == null) return; Object next = treeModel.getRoot(); Rectangle bounds = getCellBounds(0, 0, next); // 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); TreePath current = null; while (next != null) { if (current == null) current = new TreePath(next); else current = current.pathByAddingChild(next); do { TreePath path = new TreePath(getPathToRoot(next, 0)); if (tree.isVisible(path) && tree.isExpanded(path)) next = getNextNode(next); else next = getNextSibling(next); } while (next != null && !tree.isVisible(new TreePath(getPathToRoot(next, 0)))); } currentVisiblePath = current; if (currentVisiblePath != null) tree.setVisibleRowCount(currentVisiblePath.getPathCount()); else tree.setVisibleRowCount(0); if (tree.getSelectionModel() != null && tree.getSelectionCount() == 0 && currentVisiblePath != null) tree.addSelectionRow(0); }
| 4,342
|
void updateCurrentVisiblePath() { if (treeModel == null) return; Object next = treeModel.getRoot(); Rectangle bounds = getCellBounds(0, 0, next); // 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); TreePath current = null; while (next != null) { if (current == null) current = new TreePath(next); else current = current.pathByAddingChild(next); do { TreePath path = new TreePath(getPathToRoot(next, 0)); if (tree.isVisible(path) && tree.isExpanded(path)) next = getNextNode(next); else next = getNextSibling(next); } 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) tree.addSelectionRow(0); }
|
void updateCurrentVisiblePath() { if (treeModel == null) return; Object next = treeModel.getRoot(); Rectangle bounds = getCellBounds(0, 0, next); // 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); TreePath current = null; while (next != null) { if (current == null) current = new TreePath(next); else current = current.pathByAddingChild(next); do { TreePath path = new TreePath(getPathToRoot(next, 0)); if (tree.isVisible(path) && tree.isExpanded(path)) next = getNextNode(next); else next = getNextSibling(next); } 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(currentVisiblePath.getPathComponent(0))); }
| 4,343
|
OutputStream super_invoke(String method, InputStream in, ResponseHandler rh) { OutputStream out = null; Integer call_method = (Integer) _NamingContextImplBase.methods.get(method); if (call_method == null) throw new BAD_OPERATION(0, CompletionStatus.COMPLETED_MAYBE); switch (call_method.intValue()) { case 0: // bind { try { NameComponent[] a_name = NameHelper.read(in); org.omg.CORBA.Object an_object = ObjectHelper.read(in); bind(a_name, an_object); out = rh.createReply(); } catch (NotFound ex) { out = rh.createExceptionReply(); NotFoundHelper.write(out, ex); } catch (CannotProceed ex) { out = rh.createExceptionReply(); CannotProceedHelper.write(out, ex); } catch (InvalidName ex) { out = rh.createExceptionReply(); InvalidNameHelper.write(out, ex); } catch (AlreadyBound ex) { out = rh.createExceptionReply(); AlreadyBoundHelper.write(out, ex); } break; } case 1: // rebind { try { NameComponent[] a_name = NameHelper.read(in); org.omg.CORBA.Object an_object = ObjectHelper.read(in); rebind(a_name, an_object); out = rh.createReply(); } catch (NotFound ex) { out = rh.createExceptionReply(); NotFoundHelper.write(out, ex); } catch (CannotProceed ex) { out = rh.createExceptionReply(); CannotProceedHelper.write(out, ex); } catch (InvalidName ex) { out = rh.createExceptionReply(); InvalidNameHelper.write(out, ex); } break; } case 2: // bind_context { try { NameComponent[] a_name = NameHelper.read(in); NamingContext a_context = NamingContextHelper.read(in); bind_context(a_name, a_context); out = rh.createReply(); } catch (NotFound ex) { out = rh.createExceptionReply(); NotFoundHelper.write(out, ex); } catch (CannotProceed ex) { out = rh.createExceptionReply(); CannotProceedHelper.write(out, ex); } catch (InvalidName ex) { out = rh.createExceptionReply(); InvalidNameHelper.write(out, ex); } catch (AlreadyBound ex) { out = rh.createExceptionReply(); AlreadyBoundHelper.write(out, ex); } break; } case 3: // rebind_context { try { NameComponent[] a_name = NameHelper.read(in); NamingContext a_context = NamingContextHelper.read(in); rebind_context(a_name, a_context); out = rh.createReply(); } catch (NotFound ex) { out = rh.createExceptionReply(); NotFoundHelper.write(out, ex); } catch (CannotProceed ex) { out = rh.createExceptionReply(); CannotProceedHelper.write(out, ex); } catch (InvalidName ex) { out = rh.createExceptionReply(); InvalidNameHelper.write(out, ex); } break; } case 4: // resolve { try { NameComponent[] a_name = NameHelper.read(in); org.omg.CORBA.Object __result = null; __result = resolve(a_name); out = rh.createReply(); ObjectHelper.write(out, __result); } catch (NotFound ex) { out = rh.createExceptionReply(); NotFoundHelper.write(out, ex); } catch (CannotProceed ex) { out = rh.createExceptionReply(); CannotProceedHelper.write(out, ex); } catch (InvalidName ex) { out = rh.createExceptionReply(); InvalidNameHelper.write(out, ex); } break; } case 5: // unbind { try { NameComponent[] a_name = NameHelper.read(in); unbind(a_name); out = rh.createReply(); } catch (NotFound ex) { out = rh.createExceptionReply(); NotFoundHelper.write(out, ex); } catch (CannotProceed ex) { out = rh.createExceptionReply(); CannotProceedHelper.write(out, ex); } catch (InvalidName ex) { out = rh.createExceptionReply(); InvalidNameHelper.write(out, ex); } break; } case 6: // new_context { NamingContext __result = null; __result = new_context(); out = rh.createReply(); NamingContextHelper.write(out, __result); break; } case 7: // bind_new_context { try { NameComponent[] a_name = NameHelper.read(in); NamingContext __result = null; __result = bind_new_context(a_name); out = rh.createReply(); NamingContextHelper.write(out, __result); } catch (NotFound ex) { out = rh.createExceptionReply(); NotFoundHelper.write(out, ex); } catch (AlreadyBound ex) { out = rh.createExceptionReply(); AlreadyBoundHelper.write(out, ex); } catch (CannotProceed ex) { out = rh.createExceptionReply(); CannotProceedHelper.write(out, ex); } catch (InvalidName ex) { out = rh.createExceptionReply(); InvalidNameHelper.write(out, ex); } break; } case 8: // destroy { try { destroy(); out = rh.createReply(); } catch (NotEmpty ex) { out = rh.createExceptionReply(); NotEmptyHelper.write(out, ex); } break; } case 9: // list { int amount = in.read_ulong(); BindingListHolder a_list = new BindingListHolder(); BindingIteratorHolder an_iter = new BindingIteratorHolder(); list(amount, a_list, an_iter); out = rh.createReply(); BindingListHelper.write(out, a_list.value); BindingIteratorHelper.write(out, an_iter.value); break; } default: throw new BAD_OPERATION(0, CompletionStatus.COMPLETED_MAYBE); } return out; }
|
OutputStream super_invoke(String method, InputStream in, ResponseHandler rh) { OutputStream out = null; Integer call_method = (Integer) _NamingContextImplBase.methods.get(method); if (call_method == null) throw new BAD_OPERATION(Minor.Method, CompletionStatus.COMPLETED_MAYBE); switch (call_method.intValue()) { case 0: // bind { try { NameComponent[] a_name = NameHelper.read(in); org.omg.CORBA.Object an_object = ObjectHelper.read(in); bind(a_name, an_object); out = rh.createReply(); } catch (NotFound ex) { out = rh.createExceptionReply(); NotFoundHelper.write(out, ex); } catch (CannotProceed ex) { out = rh.createExceptionReply(); CannotProceedHelper.write(out, ex); } catch (InvalidName ex) { out = rh.createExceptionReply(); InvalidNameHelper.write(out, ex); } catch (AlreadyBound ex) { out = rh.createExceptionReply(); AlreadyBoundHelper.write(out, ex); } break; } case 1: // rebind { try { NameComponent[] a_name = NameHelper.read(in); org.omg.CORBA.Object an_object = ObjectHelper.read(in); rebind(a_name, an_object); out = rh.createReply(); } catch (NotFound ex) { out = rh.createExceptionReply(); NotFoundHelper.write(out, ex); } catch (CannotProceed ex) { out = rh.createExceptionReply(); CannotProceedHelper.write(out, ex); } catch (InvalidName ex) { out = rh.createExceptionReply(); InvalidNameHelper.write(out, ex); } break; } case 2: // bind_context { try { NameComponent[] a_name = NameHelper.read(in); NamingContext a_context = NamingContextHelper.read(in); bind_context(a_name, a_context); out = rh.createReply(); } catch (NotFound ex) { out = rh.createExceptionReply(); NotFoundHelper.write(out, ex); } catch (CannotProceed ex) { out = rh.createExceptionReply(); CannotProceedHelper.write(out, ex); } catch (InvalidName ex) { out = rh.createExceptionReply(); InvalidNameHelper.write(out, ex); } catch (AlreadyBound ex) { out = rh.createExceptionReply(); AlreadyBoundHelper.write(out, ex); } break; } case 3: // rebind_context { try { NameComponent[] a_name = NameHelper.read(in); NamingContext a_context = NamingContextHelper.read(in); rebind_context(a_name, a_context); out = rh.createReply(); } catch (NotFound ex) { out = rh.createExceptionReply(); NotFoundHelper.write(out, ex); } catch (CannotProceed ex) { out = rh.createExceptionReply(); CannotProceedHelper.write(out, ex); } catch (InvalidName ex) { out = rh.createExceptionReply(); InvalidNameHelper.write(out, ex); } break; } case 4: // resolve { try { NameComponent[] a_name = NameHelper.read(in); org.omg.CORBA.Object __result = null; __result = resolve(a_name); out = rh.createReply(); ObjectHelper.write(out, __result); } catch (NotFound ex) { out = rh.createExceptionReply(); NotFoundHelper.write(out, ex); } catch (CannotProceed ex) { out = rh.createExceptionReply(); CannotProceedHelper.write(out, ex); } catch (InvalidName ex) { out = rh.createExceptionReply(); InvalidNameHelper.write(out, ex); } break; } case 5: // unbind { try { NameComponent[] a_name = NameHelper.read(in); unbind(a_name); out = rh.createReply(); } catch (NotFound ex) { out = rh.createExceptionReply(); NotFoundHelper.write(out, ex); } catch (CannotProceed ex) { out = rh.createExceptionReply(); CannotProceedHelper.write(out, ex); } catch (InvalidName ex) { out = rh.createExceptionReply(); InvalidNameHelper.write(out, ex); } break; } case 6: // new_context { NamingContext __result = null; __result = new_context(); out = rh.createReply(); NamingContextHelper.write(out, __result); break; } case 7: // bind_new_context { try { NameComponent[] a_name = NameHelper.read(in); NamingContext __result = null; __result = bind_new_context(a_name); out = rh.createReply(); NamingContextHelper.write(out, __result); } catch (NotFound ex) { out = rh.createExceptionReply(); NotFoundHelper.write(out, ex); } catch (AlreadyBound ex) { out = rh.createExceptionReply(); AlreadyBoundHelper.write(out, ex); } catch (CannotProceed ex) { out = rh.createExceptionReply(); CannotProceedHelper.write(out, ex); } catch (InvalidName ex) { out = rh.createExceptionReply(); InvalidNameHelper.write(out, ex); } break; } case 8: // destroy { try { destroy(); out = rh.createReply(); } catch (NotEmpty ex) { out = rh.createExceptionReply(); NotEmptyHelper.write(out, ex); } break; } case 9: // list { int amount = in.read_ulong(); BindingListHolder a_list = new BindingListHolder(); BindingIteratorHolder an_iter = new BindingIteratorHolder(); list(amount, a_list, an_iter); out = rh.createReply(); BindingListHelper.write(out, a_list.value); BindingIteratorHelper.write(out, an_iter.value); break; } default: throw new BAD_OPERATION(Minor.Method, CompletionStatus.COMPLETED_MAYBE); } return out; }
| 4,344
|
public boolean equals(Object obj) { if (!(obj instanceof ActivationDesc)) { return (false); } ActivationDesc that = (ActivationDesc)obj; if (this.groupid.equals(that.groupid) && this.classname.equals(that.classname) && this.location.equals(that.location) && this.data.equals(that.data) && this.restart == that.restart) { return (true); } return (false);}
|
public boolean equals(Object obj) { if (!(obj instanceof ActivationDesc)) { return (false); } ActivationDesc that = (ActivationDesc)obj; if (this.groupid.equals(that.groupid) && this.classname.equals(that.classname) && this.location.equals(that.location) && this.data.equals(that.data) && this.restart == that.restart) { return (true); } return (false);}
| 4,345
|
public String getClassName() { return (classname);}
|
public String getClassName() { return (classname);}
| 4,346
|
public MarshalledObject getData() { return (data);}
|
public MarshalledObject getData() { return (data);}
| 4,347
|
public ActivationGroupID getGroupID() { return (groupid);}
|
public ActivationGroupID getGroupID() { return (groupid);}
| 4,348
|
public String getLocation() { return (location);}
|
public String getLocation() { return (location);}
| 4,349
|
public boolean getRestartMode() { return (restart);}
|
public boolean getRestartMode() { return (restart);}
| 4,350
|
public int hashCode() { return (groupid.hashCode() ^ classname.hashCode() ^ location.hashCode() ^ data.hashCode());}
|
public int hashCode() { return (groupid.hashCode() ^ classname.hashCode() ^ location.hashCode() ^ data.hashCode());}
| 4,351
|
protected int calculateBreakPosition(int p0, int p1) { Container c = getContainer(); Rectangle alloc = c.isValid() ? c.getBounds() : new Rectangle(c.getPreferredSize()); updateMetrics(); try { getDocument().getText(p0, p1 - p0, getLineBuffer()); } catch (BadLocationException ble) { // this shouldn't happen } // FIXME: Should we account for the insets of the container? if (wordWrap) return p0 + Utilities.getBreakLocation(lineBuffer, metrics, alloc.x, alloc.x + alloc.width, this, 0); else { return p0 + Utilities.getTabbedTextOffset(lineBuffer, metrics, alloc.x, alloc.x + alloc.width, this, 0); } }
|
protected int calculateBreakPosition(int p0, int p1) { Container c = getContainer(); Rectangle alloc = c.isValid() ? c.getBounds() : new Rectangle(c.getPreferredSize()); updateMetrics(); try { getDocument().getText(p0, p1 - p0, getLineBuffer()); } catch (BadLocationException ble) { // this shouldn't happen } // FIXME: Should we account for the insets of the container? if (wordWrap) return p0 + Utilities.getBreakLocation(lineBuffer, metrics, alloc.x, alloc.x + alloc.width, this, 0); else { return p0 + Utilities.getTabbedTextOffset(lineBuffer, metrics, alloc.x, alloc.x + alloc.width, this, 0); } }
| 4,352
|
public Document createDefaultDocument() { HTMLDocument document = new HTMLDocument(); document.setParser(getParser()); return document; }
|
public Document createDefaultDocument() { HTMLDocument document = new HTMLDocument(getStyleSheet()); document.setParser(getParser()); return document; }
| 4,353
|
public void importStyleSheet(URL url) { try { // FIXME: Need to make sure url points to a valid CSS document. loadRules(new BufferedReader(new InputStreamReader(url.openStream())), url); } catch (IOException ioe) { // Do nothing here. } }
|
public void importStyleSheet(URL url) { try { // FIXME: Need to make sure url points to a valid CSS document. loadRules(new BufferedReader(new InputStreamReader(url.openStream())), url); } catch (IOException ioe) { // Do nothing here. } }
| 4,356
|
private void handleLongOption(String real, int index) throws OptionException { String option = real.substring(index); String justName = option; int eq = option.indexOf('='); if (eq != - 1) justName = option.substring(0, eq); char shortName = 0; if (justName.length() == 1) shortName = justName.charAt(0); Option found = null; for (int i = options.size() - 1; i >= 0; --i) { Option opt = (Option) options.get(i); if (justName.equals(opt.getLongName())) { found = opt; break; } if (shortName != 0 && opt.getShortName() == shortName) { found = opt; break; } } if (found == null) { String msg = MessageFormat.format(Messages.getString("Parser.Unrecognized"), //$NON-NLS-1$ new Object[] { real }); throw new OptionException(msg); } String argument = null; if (found.getTakesArgument()) { if (eq == - 1) argument = getArgument(real); else argument = option.substring(eq + 1); } else if (eq != - 1) { String msg = MessageFormat.format(Messages.getString("Parser.NoArg"), //$NON-NLS-1$ new Object[] { real.substring(0, eq + index) }); throw new OptionException(msg); } found.parsed(argument); }
|
private void handleLongOption(String real, int index) throws OptionException { String option = real.substring(index); String justName = option; int eq = option.indexOf('='); if (eq != - 1) justName = option.substring(0, eq); char shortName = 0; if (justName.length() == 1) shortName = justName.charAt(0); Option found = null; for (int i = options.size() - 1; i >= 0; --i) { Option opt = (Option) options.get(i); if (justName.equals(opt.getLongName())) { found = opt; break; } if (shortName != 0 && opt.getShortName() == shortName) { found = opt; break; } } if (found == null) { String msg = MessageFormat.format(Messages.getString("Parser.Unrecognized"), //$NON-NLS-1$ new Object[] { real }); throw new OptionException(msg); } String argument = null; if (found.getTakesArgument()) { if (eq == - 1) argument = getArgument(real); else argument = option.substring(eq + 1); } else if (eq != - 1) { String msg = MessageFormat.format(Messages.getString("Parser.NoArg"), //$NON-NLS-1$ new Object[] { real.substring(0, eq + index) }); throw new OptionException(msg); } found.parsed(argument); }
| 4,357
|
private void handleLongOption(String real, int index) throws OptionException { String option = real.substring(index); String justName = option; int eq = option.indexOf('='); if (eq != - 1) justName = option.substring(0, eq); char shortName = 0; if (justName.length() == 1) shortName = justName.charAt(0); Option found = null; for (int i = options.size() - 1; i >= 0; --i) { Option opt = (Option) options.get(i); if (justName.equals(opt.getLongName())) { found = opt; break; } if (shortName != 0 && opt.getShortName() == shortName) { found = opt; break; } } if (found == null) { String msg = MessageFormat.format(Messages.getString("Parser.Unrecognized"), //$NON-NLS-1$ new Object[] { real }); throw new OptionException(msg); } String argument = null; if (found.getTakesArgument()) { if (eq == - 1) argument = getArgument(real); else argument = option.substring(eq + 1); } else if (eq != - 1) { String msg = MessageFormat.format(Messages.getString("Parser.NoArg"), //$NON-NLS-1$ new Object[] { real.substring(0, eq + index) }); throw new OptionException(msg); } found.parsed(argument); }
|
private void handleLongOption(String real, int index) throws OptionException { String option = real.substring(index); String justName = option; int eq = option.indexOf('='); if (eq != - 1) justName = option.substring(0, eq); char shortName = 0; if (justName.length() == 1) shortName = justName.charAt(0); Option found = null; for (int i = options.size() - 1; i >= 0; --i) { Option opt = (Option) options.get(i); if (justName.equals(opt.getLongName())) { found = opt; break; } if ((isPlainShort || opt.isJoined()) && opt.getShortName() == shortName) { found = opt; break; } } if (found == null) { String msg = MessageFormat.format(Messages.getString("Parser.Unrecognized"), //$NON-NLS-1$ new Object[] { real }); throw new OptionException(msg); } String argument = null; if (found.getTakesArgument()) { if (eq == - 1) argument = getArgument(real); else argument = option.substring(eq + 1); } else if (eq != - 1) { String msg = MessageFormat.format(Messages.getString("Parser.NoArg"), //$NON-NLS-1$ new Object[] { real.substring(0, eq + index) }); throw new OptionException(msg); } found.parsed(argument); }
| 4,358
|
private void handleShortOptions(String option) throws OptionException { for (int i = 1; i < option.length(); ++i) { handleShortOption(option.charAt(i)); } }
|
private void handleShortOptions(String option) throws OptionException { for (int charIndex = 1; charIndex < option.length(); ++charIndex) { handleShortOption(option.charAt(i)); } }
| 4,359
|
private void handleShortOptions(String option) throws OptionException { for (int i = 1; i < option.length(); ++i) { handleShortOption(option.charAt(i)); } }
|
private void handleShortOptions(String option) throws OptionException { for (int i = 1; i < option.length(); ++i) { char optChar = option.charAt(charIndex); Option found = null; for (int i = options.size() - 1; i >= 0; --i) { Option opt = (Option) options.get(i); if (optChar == opt.getShortName()) { found = opt; break; } } if (found == null) { String msg = MessageFormat.format(Messages.getString("Parser.UnrecDash"), new Object[] { "" + optChar }); throw new OptionException(msg); } String argument = null; if (found.getTakesArgument()) { if (found.isJoined() && charIndex + 1 < option.length()) { argument = option.substring(charIndex + 1); charIndex = option.length(); } else argument = getArgument("-" + optChar); } found.parsed(argument); } }
| 4,360
|
public void printHelp(PrintStream out, boolean longOnly) { // Compute maximum lengths. int maxArgLen = 0; boolean shortOptionSeen = false; Iterator it; // The first pass only looks to see if we have a short option. it = options.iterator(); while (it.hasNext()) { Option option = (Option) it.next(); if (option.getShortName() != '\0') { shortOptionSeen = true; break; } } it = options.iterator(); while (it.hasNext()) { Option option = (Option) it.next(); String argName = option.getArgumentName(); // First compute the width required for the short // option. "2" is the initial indentation. In the // GNU style we don't print an argument name for // a short option if there is also a long name for // the option. int thisArgLen = 2; if (shortOptionSeen) thisArgLen += 4; if (option.getLongName() != null) { // Handle either '-' or '--'. thisArgLen += 1 + option.getLongName().length(); if (! longOnly) ++thisArgLen; } // Add in the width of the argument name. if (argName != null) thisArgLen += 1 + argName.length(); maxArgLen = Math.max(maxArgLen, thisArgLen); } // Print the help. if (name != null) out.println(name + ":"); it = options.iterator(); while (it.hasNext()) { Option option = (Option) it.next(); String argName = option.getArgumentName(); int column = 0; if (option.getShortName() != '\0') { out.print(" -"); out.print(option.getShortName()); column += 4; if (option.getLongName() == null) { if (argName != null) { // This is a silly hack just for '-J'. We don't // support joined options in general, but this option // is filtered out before argument processing can see it. if (option.getShortName() != 'J') { out.print(' '); ++column; } out.print(argName); column += argName.length(); } out.print(" "); } else out.print(", "); column += 2; } // Indent the long option past the short options, if one // was seen. for (; column < (shortOptionSeen ? 6 : 2); ++column) out.print(' '); if (option.getLongName() != null) { out.print(longOnly ? "-" : "--"); out.print(option.getLongName()); column += (longOnly ? 1 : 2) + option.getLongName().length(); if (argName != null) { out.print(" " + argName); column += 1 + argName.length(); } } // FIXME: should have a better heuristic for padding. out.print(FILLER.substring(0, maxArgLen + 4 - column)); formatText(out, option.getDescription(), maxArgLen + 4); } }
|
public void printHelp(PrintStream out, boolean longOnly) { // Compute maximum lengths. int maxArgLen = 0; boolean shortOptionSeen = false; Iterator it; // The first pass only looks to see if we have a short option. it = options.iterator(); while (it.hasNext()) { Option option = (Option) it.next(); if (option.getShortName() != '\0') { shortOptionSeen = true; break; } } it = options.iterator(); while (it.hasNext()) { Option option = (Option) it.next(); String argName = option.getArgumentName(); // First compute the width required for the short // option. "2" is the initial indentation. In the // GNU style we don't print an argument name for // a short option if there is also a long name for // the option. int thisArgLen = 2; if (shortOptionSeen) thisArgLen += 4; if (option.getLongName() != null) { // Handle either '-' or '--'. thisArgLen += 1 + option.getLongName().length(); if (! longOnly) ++thisArgLen; } // Add in the width of the argument name. if (argName != null) thisArgLen += 1 + argName.length(); maxArgLen = Math.max(maxArgLen, thisArgLen); } // Print the help. if (name != null) out.println(name + ":"); it = options.iterator(); while (it.hasNext()) { Option option = (Option) it.next(); String argName = option.getArgumentName(); int column = 0; if (option.getShortName() != '\0') { out.print(" -"); out.print(option.getShortName()); column += 4; if (option.getLongName() == null) { if (argName != null) { // This is a silly hack just for '-J'. We don't // support joined options in general, but this option // is filtered out before argument processing can see it. if (! option.isJoined()) { out.print(' '); ++column; } out.print(argName); column += argName.length(); } out.print(" "); } else out.print(", "); column += 2; } // Indent the long option past the short options, if one // was seen. for (; column < (shortOptionSeen ? 6 : 2); ++column) out.print(' '); if (option.getLongName() != null) { out.print(longOnly ? "-" : "--"); out.print(option.getLongName()); column += (longOnly ? 1 : 2) + option.getLongName().length(); if (argName != null) { out.print(" " + argName); column += 1 + argName.length(); } } // FIXME: should have a better heuristic for padding. out.print(FILLER.substring(0, maxArgLen + 4 - column)); formatText(out, option.getDescription(), maxArgLen + 4); } }
| 4,361
|
public void run() { for (;serverThread != null;) { // if serverThread==null, then exit thread try {//System.out.println("Waiting for connection on " + serverPort); UnicastConnection conn = getServerConnection(); // use a thread pool to improve performance //ConnectionRunnerPool.dispatchConnection(conn); (new Thread(conn)).start(); } catch (Exception e) { e.printStackTrace(); } }}
|
public void run() { for (;serverThread != null;) { // if serverThread==null, then exit thread try {//System.out.println("Waiting for connection on " + serverPort); UnicastConnection conn = getServerConnection(); // use a thread pool to improve performance //ConnectionRunnerPool.dispatchConnection(conn); (new RMIIncomingThread(conn, remoteHost)).start(); } catch (Exception e) { e.printStackTrace(); } }}
| 4,363
|
public void connect() { failIfConnected(); if (!isSignificant(this.user)) { connectSimple(); } else { if (this.embeddedSignon) connectEmbedded(); else connectSimulated(); Runnable runnable = new Runnable() { int tryConnection; public void run() { if ((tryConnection++ < 30) && //If it is still not connected after 3 seconds, //stop with trying (session.isConnected() == false)) { try { Thread.currentThread().sleep(100); } catch (InterruptedException ex) { ; } SwingUtilities.invokeLater(this); } else { doAfterSignon(); doInitialCommand(); } } }; runnable.run(); } }
|
public void connect() { failIfConnected(); if (!isSignificant(this.user)) { connectSimple(); } else { if (this.embeddedSignon) connectEmbedded(); else connectSimulated(); Runnable runnable = new Runnable() { int tryConnection; public void run() { if ((tryConnection++ < 30) && //If it is still not connected after 3 seconds, //stop with trying (session.isConnected() == false)) { try { Thread.sleep(100); } catch (InterruptedException ex) { ; } SwingUtilities.invokeLater(this); } else { doAfterSignon(); doInitialCommand(); } } }; runnable.run(); } }
| 4,364
|
public void run() { if ((tryConnection++ < 30) && //If it is still not connected after 3 seconds, //stop with trying (session.isConnected() == false)) { try { Thread.currentThread().sleep(100); } catch (InterruptedException ex) { ; } SwingUtilities.invokeLater(this); } else { doAfterSignon(); doInitialCommand(); } }
|
public void run() { if ((tryConnection++ < 30) && //If it is still not connected after 3 seconds, //stop with trying (session.isConnected() == false)) { try { Thread.sleep(100); } catch (InterruptedException ex) { ; } SwingUtilities.invokeLater(this); } else { doAfterSignon(); doInitialCommand(); } }
| 4,365
|
public void executeCall() throws Exception { byte returncode; ObjectInput oin; // signal the call when constructing try { DataOutputStream dout = conn.getDataOutputStream(); dout.write(MESSAGE_CALL); oout = conn.getObjectOutputStream(); objid.write(oout); oout.writeInt(opnum); oout.writeLong(hash); } catch(IOException ex) { throw new MarshalException("Try to write header but failed.", ex); } try { releaseOutputStream(); DataInputStream din = conn.getDataInputStream(); if (din.readByte() != MESSAGE_CALL_ACK) throw new RemoteException("Call not acked"); oin = getInputStream(); returncode = oin.readByte(); UID.read(oin); } catch(IOException ex) { throw new UnmarshalException("Try to read header but failed:", ex); } //check return code switch(returncode) { case RETURN_ACK: //it's ok return; case RETURN_NACK: Object returnobj; try { returnobj = oin.readObject(); } catch(Exception ex2) { throw new UnmarshalException ("Try to read exception object but failed", ex2); } if(!(returnobj instanceof Exception)) throw new UnmarshalException("Should be Exception type here: " + returnobj); throw (Exception)returnobj; default: throw new UnmarshalException("Invalid return code"); } }
|
public void executeCall() throws Exception { byte returncode; ObjectInput oin; // signal the call when constructing try { DataOutputStream dout = conn.getDataOutputStream(); dout.write(MESSAGE_CALL); oout = conn.startObjectOutputStream(); objid.write(oout); oout.writeInt(opnum); oout.writeLong(hash); } catch(IOException ex) { throw new MarshalException("Try to write header but failed.", ex); } try { releaseOutputStream(); DataInputStream din = conn.getDataInputStream(); if (din.readByte() != MESSAGE_CALL_ACK) throw new RemoteException("Call not acked"); oin = getInputStream(); returncode = oin.readByte(); UID.read(oin); } catch(IOException ex) { throw new UnmarshalException("Try to read header but failed:", ex); } //check return code switch(returncode) { case RETURN_ACK: //it's ok return; case RETURN_NACK: Object returnobj; try { returnobj = oin.readObject(); } catch(Exception ex2) { throw new UnmarshalException ("Try to read exception object but failed", ex2); } if(!(returnobj instanceof Exception)) throw new UnmarshalException("Should be Exception type here: " + returnobj); throw (Exception)returnobj; default: throw new UnmarshalException("Invalid return code"); } }
| 4,366
|
public void executeCall() throws Exception { byte returncode; ObjectInput oin; // signal the call when constructing try { DataOutputStream dout = conn.getDataOutputStream(); dout.write(MESSAGE_CALL); oout = conn.getObjectOutputStream(); objid.write(oout); oout.writeInt(opnum); oout.writeLong(hash); } catch(IOException ex) { throw new MarshalException("Try to write header but failed.", ex); } try { releaseOutputStream(); DataInputStream din = conn.getDataInputStream(); if (din.readByte() != MESSAGE_CALL_ACK) throw new RemoteException("Call not acked"); oin = getInputStream(); returncode = oin.readByte(); UID.read(oin); } catch(IOException ex) { throw new UnmarshalException("Try to read header but failed:", ex); } //check return code switch(returncode) { case RETURN_ACK: //it's ok return; case RETURN_NACK: Object returnobj; try { returnobj = oin.readObject(); } catch(Exception ex2) { throw new UnmarshalException ("Try to read exception object but failed", ex2); } if(!(returnobj instanceof Exception)) throw new UnmarshalException("Should be Exception type here: " + returnobj); throw (Exception)returnobj; default: throw new UnmarshalException("Invalid return code"); } }
|
public void executeCall() throws Exception { byte returncode; ObjectInput oin; // signal the call when constructing try { DataOutputStream dout = conn.getDataOutputStream(); dout.write(MESSAGE_CALL); oout = conn.getObjectOutputStream(); objid.write(oout); oout.writeInt(opnum); oout.writeLong(hash); } catch(IOException ex) { throw new MarshalException("Try to write header but failed.", ex); } try { releaseOutputStream(); DataInputStream din = conn.getDataInputStream(); if (din.readByte() != MESSAGE_CALL_ACK) throw new RemoteException("Call not acked"); oin = startInputStream(); returncode = oin.readByte(); UID.read(oin); } catch(IOException ex) { throw new UnmarshalException("Try to read header but failed:", ex); } //check return code switch(returncode) { case RETURN_ACK: //it's ok return; case RETURN_NACK: Object returnobj; try { returnobj = oin.readObject(); } catch(Exception ex2) { throw new UnmarshalException ("Try to read exception object but failed", ex2); } if(!(returnobj instanceof Exception)) throw new UnmarshalException("Should be Exception type here: " + returnobj); throw (Exception)returnobj; default: throw new UnmarshalException("Invalid return code"); } }
| 4,367
|
public static UID read(DataInput in) throws IOException { UID id = new UID(); id.unique = in.readInt(); id.time = in.readLong(); id.count = in.readShort(); return (id);}
|
public static UID read(DataInput in) throws IOException { UID id = new UID(); id.unique = in.readInt(); id.time = in.readLong(); id.count = in.readShort(); return (id);}
| 4,368
|
private void jbInit() throws Exception { this.setTitle(LangTool.getString("spool.title")); this.setIconImage(GUIGraphicsUtils.getApplicationIcon().getImage()); this.getContentPane().add(createFilterPanel(), BorderLayout.NORTH); // get an instance of our table model stm = new SpoolTableModel(); // create a table using our custom table model spools = new JSortTable(stm); TableColumn column = null; for (int x = 0;x < stm.getColumnCount(); x++) { column = spools.getColumnModel().getColumn(x); column.setPreferredWidth(stm.getColumnPreferredSize(x)); } spools.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); // create our mouse listener on the table spools.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(MouseEvent e) { spools_mouseClicked(e); } public void mousePressed (MouseEvent event) { if (SwingUtilities.isRightMouseButton(event)) showPopupMenu(event); } public void mouseReleased (MouseEvent event) { if (SwingUtilities.isRightMouseButton(event)) showPopupMenu(event); } }); spools.setShowGrid(false); //Create the scroll pane and add the table to it. scrollPane = new JScrollPane(spools); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); // setup the number of rows we should be working with spools.setPreferredScrollableViewportSize( new Dimension( spools.getPreferredScrollableViewportSize().width, spools.getFontMetrics(spools.getFont()).getHeight() * 8) ); scrollPane.getViewport().setBackground(spools.getBackground()); scrollPane.setBackground(spools.getBackground()); //Setup our selection model listener rowSM = spools.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { //Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel)e.getSource(); } }); rowSM.setSelectionMode(rowSM.SINGLE_SELECTION); this.getContentPane().add(scrollPane, BorderLayout.CENTER); status = new JLabel("0 " + LangTool.getString("spool.count")); status.setBorder(BorderFactory.createEtchedBorder()); this.getContentPane().add(status, BorderLayout.SOUTH); pack(); //Center the window Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = getSize(); if (frameSize.height > screenSize.height) frameSize.height = screenSize.height; if (frameSize.width > screenSize.width) frameSize.width = screenSize.width; setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent event) { // close the spool file list// if (splfList != null)// splfList.close(); // close the system connection if (system != null) system.disconnectAllServices(); setVisible(false); dispose(); } }); }
|
private void jbInit() throws Exception { this.setTitle(LangTool.getString("spool.title")); this.setIconImage(GUIGraphicsUtils.getApplicationIcon().getImage()); this.getContentPane().add(createFilterPanel(), BorderLayout.NORTH); // get an instance of our table model stm = new SpoolTableModel(); // create a table using our custom table model spools = new JSortTable(stm); TableColumn column = null; for (int x = 0;x < stm.getColumnCount(); x++) { column = spools.getColumnModel().getColumn(x); column.setPreferredWidth(stm.getColumnPreferredSize(x)); } spools.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); // create our mouse listener on the table spools.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(MouseEvent e) { spools_mouseClicked(e); } public void mousePressed (MouseEvent event) { if (SwingUtilities.isRightMouseButton(event)) showPopupMenu(event); } public void mouseReleased (MouseEvent event) { if (SwingUtilities.isRightMouseButton(event)) showPopupMenu(event); } }); spools.setShowGrid(false); //Create the scroll pane and add the table to it. scrollPane = new JScrollPane(spools); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); // setup the number of rows we should be working with spools.setPreferredScrollableViewportSize( new Dimension( spools.getPreferredScrollableViewportSize().width, spools.getFontMetrics(spools.getFont()).getHeight() * 8) ); scrollPane.getViewport().setBackground(spools.getBackground()); scrollPane.setBackground(spools.getBackground()); //Setup our selection model listener rowSM = spools.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { //Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel)e.getSource(); } }); rowSM.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); this.getContentPane().add(scrollPane, BorderLayout.CENTER); status = new JLabel("0 " + LangTool.getString("spool.count")); status.setBorder(BorderFactory.createEtchedBorder()); this.getContentPane().add(status, BorderLayout.SOUTH); pack(); //Center the window Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = getSize(); if (frameSize.height > screenSize.height) frameSize.height = screenSize.height; if (frameSize.width > screenSize.width) frameSize.width = screenSize.width; setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent event) { // close the spool file list// if (splfList != null)// splfList.close(); // close the system connection if (system != null) system.disconnectAllServices(); setVisible(false); dispose(); } }); }
| 4,369
|
public void drawImageBuffer(Graphics2D gg2d,int x, int y, int width, int height) { /** * @todo this is a hack and should be fixed at the root of the problem */ if (gg2d == null) { System.out.println(" we got a null graphic object "); return; } synchronized (lock) { gg2d.drawImage(bi.getSubimage(x,y,width,height),null,x,y); // tell waiting threads to wake up lock.notifyAll(); } }
|
public synchronized void drawImageBuffer(Graphics2D gg2d,int x, int y, int width, int height) { /** * @todo this is a hack and should be fixed at the root of the problem */ if (gg2d == null) { System.out.println(" we got a null graphic object "); return; } synchronized (lock) { gg2d.drawImage(bi.getSubimage(x,y,width,height),null,x,y); // tell waiting threads to wake up lock.notifyAll(); } }
| 4,370
|
public void drawImageBuffer(Graphics2D gg2d,int x, int y, int width, int height) { /** * @todo this is a hack and should be fixed at the root of the problem */ if (gg2d == null) { System.out.println(" we got a null graphic object "); return; } synchronized (lock) { gg2d.drawImage(bi.getSubimage(x,y,width,height),null,x,y); // tell waiting threads to wake up lock.notifyAll(); } }
|
public void drawImageBuffer(Graphics2D gg2d,int x, int y, int width, int height) { /** * @todo this is a hack and should be fixed at the root of the problem */ if (gg2d == null) { System.out.println(" we got a null graphic object "); return; } gg2d.drawImage(bi.getSubimage(x,y,width,height),null,x,y); // tell waiting threads to wake up lock.notifyAll(); } }
| 4,371
|
public void drawImageBuffer(Graphics2D gg2d,int x, int y, int width, int height) { /** * @todo this is a hack and should be fixed at the root of the problem */ if (gg2d == null) { System.out.println(" we got a null graphic object "); return; } synchronized (lock) { gg2d.drawImage(bi.getSubimage(x,y,width,height),null,x,y); // tell waiting threads to wake up lock.notifyAll(); } }
|
public void drawImageBuffer(Graphics2D gg2d,int x, int y, int width, int height) { /** * @todo this is a hack and should be fixed at the root of the problem */ if (gg2d == null) { System.out.println(" we got a null graphic object "); return; } synchronized (lock) { gg2d.drawImage(bi.getSubimage(x,y,width,height),null,x,y); // tell waiting threads to wake up lock.notifyAll(); } }
| 4,372
|
private void writeObject(ObjectOutputStream is) throws IOException { }
|
private void writeObject(ObjectOutputStream os) throws IOException { }
| 4,375
|
public static void set32(byte[] data, int offset, long value) { data[offset] = (byte)(value & 0xFF); data[offset+1] = (byte)((value >> 8) & 0xFF); data[offset+2] = (byte)((value >> 16) & 0xFF); data[offset+3] = (byte)((value >> 32) & 0xFF); }
|
public static void set32(byte[] data, int offset, long value) { data[offset] = (byte)(value & 0xFF); data[offset+1] = (byte)((value >> 8) & 0xFF); data[offset+2] = (byte)((value >> 16) & 0xFF); data[offset+3] = (byte)((value >> 24) & 0xFF); }
| 4,377
|
public synchronized void setData(byte[] buf) { // This form of setData requires setLength to be called separately // and subsequently. if (buf == null) throw new NullPointerException("Null buffer"); buffer = buf; }
|
public synchronized void setData(byte[] buf) { // This form of setData requires setLength to be called separately // and subsequently. if (buf == null) throw new NullPointerException("Null buffer"); buffer = buf; }
| 4,378
|
public SwingChoicePeer(Choice choice) { super(); SwingToolkit.add(choice, this); SwingToolkit.copyAwtProperties(choice, this); final int cnt = choice.getItemCount(); for (int i = 0; i < cnt; i++) { addItem(choice.getItem(i), i); } }
|
public SwingChoicePeer(Choice choice) { this.choice = choice; SwingToolkit.add(choice, this); SwingToolkit.copyAwtProperties(choice, this); final int cnt = choice.getItemCount(); for (int i = 0; i < cnt; i++) { addItem(choice.getItem(i), i); } }
| 4,379
|
public boolean isLeaf() { return (childValue == null || !(childValue instanceof Hashtable || childValue instanceof Vector || childValue.getClass() .isArray())); }
|
public boolean isLeaf() { return (childValue == null || !(childValue instanceof Hashtable || childValue instanceof Vector || childValue.getClass() .isArray())); }
| 4,380
|
protected RegisterGroupUsage[] initialize() { // The order of this array determines the cost of using the // register. // The cost of a register is lower when its index in this // array is higher. return new RegisterGroupUsage[] { new RegisterGroupUsage(new RegisterEntry(X86Register.EAX, JvmType.INT), new RegisterEntry(X86Register.EAX, JvmType.REFERENCE), new RegisterEntry( X86Register.EAX, JvmType.FLOAT), false), new RegisterGroupUsage(new RegisterEntry(X86Register.EDX, JvmType.INT), new RegisterEntry(X86Register.EDX, JvmType.REFERENCE), new RegisterEntry( X86Register.EDX, JvmType.FLOAT), false), new RegisterGroupUsage(new RegisterEntry(X86Register.ECX, JvmType.INT), new RegisterEntry(X86Register.ECX, JvmType.REFERENCE), new RegisterEntry( X86Register.ECX, JvmType.FLOAT), false), new RegisterGroupUsage(new RegisterEntry(X86Register.EBX, JvmType.INT), new RegisterEntry(X86Register.EBX, JvmType.REFERENCE), new RegisterEntry( X86Register.EBX, JvmType.FLOAT), false), new RegisterGroupUsage(new RegisterEntry(X86Register.ESI, JvmType.INT), new RegisterEntry(X86Register.ESI, JvmType.REFERENCE), new RegisterEntry( X86Register.ESI, JvmType.FLOAT), false) }; // EDI always points to the statics, do not use }
|
protected RegisterGroupUsage[] initialize() { // The order of this array determines the cost of using the // register. // The cost of a register is lower when its index in this // array is higher. return new RegisterGroupUsage[] { new RegisterGroupUsage(new RegisterEntry(X86Register.EAX, JvmType.INT), new RegisterEntry(X86Register.EAX, JvmType.REFERENCE), new RegisterEntry( X86Register.EAX, JvmType.FLOAT), false), new RegisterGroupUsage(new RegisterEntry(X86Register.EDX, JvmType.INT), new RegisterEntry(X86Register.EDX, JvmType.REFERENCE), new RegisterEntry( X86Register.EDX, JvmType.FLOAT), false), new RegisterGroupUsage(new RegisterEntry(X86Register.ECX, JvmType.INT), new RegisterEntry(X86Register.ECX, JvmType.REFERENCE), new RegisterEntry( X86Register.ECX, JvmType.FLOAT), false), new RegisterGroupUsage(new RegisterEntry(X86Register.EBX, JvmType.INT), new RegisterEntry(X86Register.EBX, JvmType.REFERENCE), new RegisterEntry( X86Register.EBX, JvmType.FLOAT), false), new RegisterGroupUsage(new RegisterEntry(X86Register.ESI, JvmType.INT), new RegisterEntry(X86Register.ESI, JvmType.REFERENCE), new RegisterEntry( X86Register.ESI, JvmType.FLOAT), false) }; // EDI always points to the statics, do not use }
| 4,381
|
public X86RegisterPool() { this.registers = initialize(); this.regCount = registers.length; }
|
public X86RegisterPool(boolean lastFirst, int minimumRequestIndex) { this.lastFirst = lastFirst; this.minimumRequestIndex = minimumRequestIndex; this.registers = initialize(); this.regCount = registers.length; }
| 4,382
|
boolean shouldScroll(int direction) { int value; if (scrollbar.getOrientation() == HORIZONTAL) value = valueForXPosition(currentMouseX); else value = valueForYPosition(currentMouseY); if (thumbRect.contains(currentMouseX, currentMouseY)) return false; if (direction == POSITIVE_SCROLL) return (value > scrollbar.getValue()); else return (value < scrollbar.getValue()); }
|
boolean shouldScroll(int direction) { int value; if (scrollbar.getOrientation() == HORIZONTAL) value = valueForXPosition(currentMouseX); else value = valueForYPosition(currentMouseY); if (thumbRect.contains(currentMouseX, currentMouseY)) return false; if (direction == POSITIVE_SCROLL) return value > scrollbar.getValue(); else return (value < scrollbar.getValue()); }
| 4,386
|
boolean shouldScroll(int direction) { int value; if (scrollbar.getOrientation() == HORIZONTAL) value = valueForXPosition(currentMouseX); else value = valueForYPosition(currentMouseY); if (thumbRect.contains(currentMouseX, currentMouseY)) return false; if (direction == POSITIVE_SCROLL) return (value > scrollbar.getValue()); else return (value < scrollbar.getValue()); }
|
boolean shouldScroll(int direction) { int value; if (scrollbar.getOrientation() == HORIZONTAL) value = valueForXPosition(currentMouseX); else value = valueForYPosition(currentMouseY); if (thumbRect.contains(currentMouseX, currentMouseY)) return false; if (direction == POSITIVE_SCROLL) return (value > scrollbar.getValue()); else return value < scrollbar.getValue(); }
| 4,387
|
protected void installComponents() { int orientation = scrollbar.getOrientation(); switch (orientation) { case (JScrollBar.HORIZONTAL): incrButton = createIncreaseButton(EAST); decrButton = createDecreaseButton(WEST); break; default: incrButton = createIncreaseButton(SOUTH); decrButton = createDecreaseButton(NORTH); break; } if (incrButton != null) scrollbar.add(incrButton); if (decrButton != null) scrollbar.add(decrButton); }
|
protected void installComponents() { int orientation = scrollbar.getOrientation(); switch (orientation) { case JScrollBar.HORIZONTAL: incrButton = createIncreaseButton(EAST); decrButton = createDecreaseButton(WEST); break; default: incrButton = createIncreaseButton(SOUTH); decrButton = createDecreaseButton(NORTH); break; } if (incrButton != null) scrollbar.add(incrButton); if (decrButton != null) scrollbar.add(decrButton); }
| 4,388
|
int valueForXPosition(int xPos) { int min = scrollbar.getMinimum(); int max = scrollbar.getMaximum(); int len = trackRect.width; int value; // If the length is 0, you shouldn't be able to even see where the slider is. // This really shouldn't ever happen, but just in case, we'll return the middle. if (len == 0) return ((max - min) / 2); value = ((xPos - trackRect.x) * (max - min) / len + min); // If this isn't a legal value, then we'll have to move to one now. if (value > max) value = max; else if (value < min) value = min; return value; }
|
int valueForXPosition(int xPos) { int min = scrollbar.getMinimum(); int max = scrollbar.getMaximum(); int len = trackRect.width; int value; // If the length is 0, you shouldn't be able to even see where the slider is. // This really shouldn't ever happen, but just in case, we'll return the middle. if (len == 0) return (max - min) / 2; value = ((xPos - trackRect.x) * (max - min) / len + min); // If this isn't a legal value, then we'll have to move to one now. if (value > max) value = max; else if (value < min) value = min; return value; }
| 4,391
|
int valueForXPosition(int xPos) { int min = scrollbar.getMinimum(); int max = scrollbar.getMaximum(); int len = trackRect.width; int value; // If the length is 0, you shouldn't be able to even see where the slider is. // This really shouldn't ever happen, but just in case, we'll return the middle. if (len == 0) return ((max - min) / 2); value = ((xPos - trackRect.x) * (max - min) / len + min); // If this isn't a legal value, then we'll have to move to one now. if (value > max) value = max; else if (value < min) value = min; return value; }
|
int valueForXPosition(int xPos) { int min = scrollbar.getMinimum(); int max = scrollbar.getMaximum(); int len = trackRect.width; int value; // If the length is 0, you shouldn't be able to even see where the slider is. // This really shouldn't ever happen, but just in case, we'll return the middle. if (len == 0) return ((max - min) / 2); value = (xPos - trackRect.x) * (max - min) / len + min; // If this isn't a legal value, then we'll have to move to one now. if (value > max) value = max; else if (value < min) value = min; return value; }
| 4,392
|
int valueForYPosition(int yPos) { int min = scrollbar.getMinimum(); int max = scrollbar.getMaximum(); int len = trackRect.height; int value; // If the length is 0, you shouldn't be able to even see where the thumb is. // This really shouldn't ever happen, but just in case, we'll return the middle. if (len == 0) return ((max - min) / 2); value = ((yPos - trackRect.y) * (max - min) / len + min); // If this isn't a legal value, then we'll have to move to one now. if (value > max) value = max; else if (value < min) value = min; return value; }
|
int valueForYPosition(int yPos) { int min = scrollbar.getMinimum(); int max = scrollbar.getMaximum(); int len = trackRect.height; int value; // If the length is 0, you shouldn't be able to even see where the thumb is. // This really shouldn't ever happen, but just in case, we'll return the middle. if (len == 0) return (max - min) / 2; value = ((yPos - trackRect.y) * (max - min) / len + min); // If this isn't a legal value, then we'll have to move to one now. if (value > max) value = max; else if (value < min) value = min; return value; }
| 4,393
|
int valueForYPosition(int yPos) { int min = scrollbar.getMinimum(); int max = scrollbar.getMaximum(); int len = trackRect.height; int value; // If the length is 0, you shouldn't be able to even see where the thumb is. // This really shouldn't ever happen, but just in case, we'll return the middle. if (len == 0) return ((max - min) / 2); value = ((yPos - trackRect.y) * (max - min) / len + min); // If this isn't a legal value, then we'll have to move to one now. if (value > max) value = max; else if (value < min) value = min; return value; }
|
int valueForYPosition(int yPos) { int min = scrollbar.getMinimum(); int max = scrollbar.getMaximum(); int len = trackRect.height; int value; // If the length is 0, you shouldn't be able to even see where the thumb is. // This really shouldn't ever happen, but just in case, we'll return the middle. if (len == 0) return ((max - min) / 2); value = (yPos - trackRect.y) * (max - min) / len + min; // If this isn't a legal value, then we'll have to move to one now. if (value > max) value = max; else if (value < min) value = min; return value; }
| 4,394
|
public void mousePressed(MouseEvent e) { scrollTimer.stop(); scrollListener.setScrollByBlock(false); if (e.getSource() == incrButton) scrollListener.setDirection(POSITIVE_SCROLL); else scrollListener.setDirection(NEGATIVE_SCROLL); scrollTimer.start(); }
|
public void mousePressed(MouseEvent e) { scrollTimer.stop(); scrollListener.setScrollByBlock(false); if (e.getSource() == incrButton) scrollListener.setDirection(POSITIVE_SCROLL); else scrollListener.setDirection(NEGATIVE_SCROLL); scrollTimer.start(); }
| 4,395
|
public void mousePressed(MouseEvent e) { currentMouseX = e.getX(); currentMouseY = e.getY(); int value; if (scrollbar.getOrientation() == SwingConstants.HORIZONTAL) value = valueForXPosition(currentMouseX); else value = valueForYPosition(currentMouseY); if (value == scrollbar.getValue()) return; if (! thumbRect.contains(e.getPoint())) { scrollTimer.stop(); scrollListener.setScrollByBlock(true); if (value > scrollbar.getValue()) { trackHighlight = INCREASE_HIGHLIGHT; scrollListener.setDirection(POSITIVE_SCROLL); } else { trackHighlight = DECREASE_HIGHLIGHT; scrollListener.setDirection(NEGATIVE_SCROLL); } scrollTimer.start(); } else { // We'd like to keep track of where the cursor // is inside the thumb. // This works because the scrollbar's value represents // "lower" edge of the thumb. The value at which // the cursor is at must be greater or equal // to that value. scrollbar.setValueIsAdjusting(true); offset = value - scrollbar.getValue(); } scrollbar.repaint(); }
|
public void mousePressed(MouseEvent e) { currentMouseX = e.getX(); currentMouseY = e.getY(); int value; if (scrollbar.getOrientation() == SwingConstants.HORIZONTAL) value = valueForXPosition(currentMouseX); else value = valueForYPosition(currentMouseY); if (value == scrollbar.getValue()) return; if (! thumbRect.contains(e.getPoint())) { scrollTimer.stop(); scrollListener.setScrollByBlock(true); if (value > scrollbar.getValue()) { trackHighlight = INCREASE_HIGHLIGHT; scrollListener.setDirection(POSITIVE_SCROLL); } else { trackHighlight = DECREASE_HIGHLIGHT; scrollListener.setDirection(NEGATIVE_SCROLL); } scrollTimer.start(); } else { // We'd like to keep track of where the cursor // is inside the thumb. // This works because the scrollbar's value represents // "lower" edge of the thumb. The value at which // the cursor is at must be greater or equal // to that value. scrollbar.setValueIsAdjusting(true); offset = value - scrollbar.getValue(); } scrollbar.repaint(); }
| 4,397
|
public void mouseReleased(MouseEvent e) { trackHighlight = NO_HIGHLIGHT; scrollTimer.stop(); if (scrollbar.getValueIsAdjusting()) scrollbar.setValueIsAdjusting(false); scrollbar.repaint(); }
|
public void mouseReleased(MouseEvent e) { trackHighlight = NO_HIGHLIGHT; scrollTimer.stop(); if (scrollbar.getValueIsAdjusting()) scrollbar.setValueIsAdjusting(false); scrollbar.repaint(); }
| 4,398
|
protected Rectangle getThumbBounds() { int max = scrollbar.getMaximum(); int min = scrollbar.getMinimum(); int value = scrollbar.getValue(); int extent = scrollbar.getVisibleAmount(); // System.err.println(this + ".getThumbBounds()"); if (max == min) { thumbRect.x = trackRect.x; thumbRect.y = trackRect.y; if (scrollbar.getOrientation() == HORIZONTAL) { thumbRect.width = getMinimumThumbSize().width; thumbRect.height = trackRect.height; } else { thumbRect.width = trackRect.width; thumbRect.height = getMinimumThumbSize().height; } return thumbRect; } if (scrollbar.getOrientation() == HORIZONTAL) { thumbRect.x = trackRect.x; thumbRect.x += (value - min) * trackRect.width / (max - min); thumbRect.y = trackRect.y; thumbRect.width = Math.max(extent * trackRect.width / (max - min), getMinimumThumbSize().width); thumbRect.height = trackRect.height; } else { thumbRect.x = trackRect.x; thumbRect.y = trackRect.y + value * trackRect.height / (max - min); thumbRect.width = trackRect.width; thumbRect.height = Math.max(extent * trackRect.height / (max - min), getMinimumThumbSize().height); } return thumbRect; }
|
protected Rectangle getThumbBounds() { int max = scrollbar.getMaximum(); int min = scrollbar.getMinimum(); int value = scrollbar.getValue(); int extent = scrollbar.getVisibleAmount(); // System.err.println(this + ".getThumbBounds()"); if (max == min) { thumbRect.x = trackRect.x; thumbRect.y = trackRect.y; if (scrollbar.getOrientation() == HORIZONTAL) { thumbRect.width = getMinimumThumbSize().width; thumbRect.height = trackRect.height; } else { thumbRect.width = trackRect.width; thumbRect.height = getMinimumThumbSize().height; } return thumbRect; } if (scrollbar.getOrientation() == HORIZONTAL) { thumbRect.x = trackRect.x; thumbRect.x += (value - min) * trackRect.width / (max - min); thumbRect.y = trackRect.y; thumbRect.width = Math.max(extent * trackRect.width / (max - min), getMinimumThumbSize().width); thumbRect.height = trackRect.height; } else { thumbRect.x = trackRect.x; thumbRect.y = trackRect.y + value * trackRect.height / (max - min); thumbRect.width = trackRect.width; thumbRect.height = Math.max(extent * trackRect.height / (max - min), getMinimumThumbSize().height); } return thumbRect; }
| 4,399
|
protected Rectangle getThumbBounds() { int max = scrollbar.getMaximum(); int min = scrollbar.getMinimum(); int value = scrollbar.getValue(); int extent = scrollbar.getVisibleAmount(); // System.err.println(this + ".getThumbBounds()"); if (max == min) { thumbRect.x = trackRect.x; thumbRect.y = trackRect.y; if (scrollbar.getOrientation() == HORIZONTAL) { thumbRect.width = getMinimumThumbSize().width; thumbRect.height = trackRect.height; } else { thumbRect.width = trackRect.width; thumbRect.height = getMinimumThumbSize().height; } return thumbRect; } if (scrollbar.getOrientation() == HORIZONTAL) { thumbRect.x = trackRect.x; thumbRect.x += (value - min) * trackRect.width / (max - min); thumbRect.y = trackRect.y; thumbRect.width = Math.max(extent * trackRect.width / (max - min), getMinimumThumbSize().width); thumbRect.height = trackRect.height; } else { thumbRect.x = trackRect.x; thumbRect.y = trackRect.y + value * trackRect.height / (max - min); thumbRect.width = trackRect.width; thumbRect.height = Math.max(extent * trackRect.height / (max - min), getMinimumThumbSize().height); } return thumbRect; }
|
protected Rectangle getThumbBounds() { int max = scrollbar.getMaximum(); int min = scrollbar.getMinimum(); int value = scrollbar.getValue(); int extent = scrollbar.getVisibleAmount(); // System.err.println(this + ".getThumbBounds()"); if (max == min) { thumbRect.x = trackRect.x; thumbRect.y = trackRect.y; if (scrollbar.getOrientation() == HORIZONTAL) { thumbRect.width = getMinimumThumbSize().width; thumbRect.height = trackRect.height; } else { thumbRect.width = trackRect.width; thumbRect.height = getMinimumThumbSize().height; } return thumbRect; } if (scrollbar.getOrientation() == HORIZONTAL) { thumbRect.x = trackRect.x; thumbRect.x += (value - min) * trackRect.width / (max - min); thumbRect.y = trackRect.y; thumbRect.width = Math.max(extent * trackRect.width / (max - min), getMinimumThumbSize().width); thumbRect.height = trackRect.height; } else { thumbRect.x = trackRect.x; thumbRect.y = trackRect.y + value * trackRect.height / (max - min); thumbRect.width = trackRect.width; thumbRect.height = Math.max(extent * trackRect.height / (max - min), getMinimumThumbSize().height); } return thumbRect; }
| 4,400
|
protected Rectangle getThumbBounds() { int max = scrollbar.getMaximum(); int min = scrollbar.getMinimum(); int value = scrollbar.getValue(); int extent = scrollbar.getVisibleAmount(); // System.err.println(this + ".getThumbBounds()"); if (max == min) { thumbRect.x = trackRect.x; thumbRect.y = trackRect.y; if (scrollbar.getOrientation() == HORIZONTAL) { thumbRect.width = getMinimumThumbSize().width; thumbRect.height = trackRect.height; } else { thumbRect.width = trackRect.width; thumbRect.height = getMinimumThumbSize().height; } return thumbRect; } if (scrollbar.getOrientation() == HORIZONTAL) { thumbRect.x = trackRect.x; thumbRect.x += (value - min) * trackRect.width / (max - min); thumbRect.y = trackRect.y; thumbRect.width = Math.max(extent * trackRect.width / (max - min), getMinimumThumbSize().width); thumbRect.height = trackRect.height; } else { thumbRect.x = trackRect.x; thumbRect.y = trackRect.y + value * trackRect.height / (max - min); thumbRect.width = trackRect.width; thumbRect.height = Math.max(extent * trackRect.height / (max - min), getMinimumThumbSize().height); } return thumbRect; }
|
protected Rectangle getThumbBounds() { int max = scrollbar.getMaximum(); int min = scrollbar.getMinimum(); int value = scrollbar.getValue(); int extent = scrollbar.getVisibleAmount(); // System.err.println(this + ".getThumbBounds()"); if (max == min) { thumbRect.x = trackRect.x; thumbRect.y = trackRect.y; if (scrollbar.getOrientation() == HORIZONTAL) { thumbRect.width = getMinimumThumbSize().width; thumbRect.height = trackRect.height; } else { thumbRect.width = trackRect.width; thumbRect.height = getMinimumThumbSize().height; } return thumbRect; } if (scrollbar.getOrientation() == HORIZONTAL) { thumbRect.x = trackRect.x; thumbRect.x += (value - min) * trackRect.width / (max - min); thumbRect.y = trackRect.y; thumbRect.width = Math.max(extent * trackRect.width / (max - min), getMinimumThumbSize().width); thumbRect.height = trackRect.height; } else { thumbRect.x = trackRect.x; thumbRect.y = trackRect.y + value * trackRect.height / (max - min); thumbRect.width = trackRect.width; thumbRect.height = Math.max(extent * trackRect.height / (max - min), getMinimumThumbSize().height); } return thumbRect; }
| 4,401
|
public void installUI(JComponent c) { super.installUI(c); if (c instanceof JScrollBar) { scrollbar = (JScrollBar) c; trackRect = new Rectangle(); thumbRect = new Rectangle(); scrollTimer = new Timer(50, null); scrollTimer.setRepeats(true); installComponents(); installDefaults(); configureScrollBarColors(); installListeners(); calculatePreferredSize(); } }
|
public void installUI(JComponent c) { super.installUI(c); if (c instanceof JScrollBar) { scrollbar = (JScrollBar) c; trackRect = new Rectangle(); thumbRect = new Rectangle(); scrollTimer = new Timer(50, null); scrollTimer.setRepeats(true); installComponents(); installDefaults(); configureScrollBarColors(); installListeners(); calculatePreferredSize(); } }
| 4,402
|
public void updateDirty() { // update the image updateImage(dirty); // update dirty to show that we have already painted that region of the // screen so do not do it again. dirty.setBounds(dirty.x,dirty.height,dirty.width,(int)(tArea.getHeight() - dirty.height)); }
|
public void updateDirty() { // update the image updateImage(r); // update dirty to show that we have already painted that region of the // screen so do not do it again. dirty.setBounds(dirty.x,dirty.height,dirty.width,(int)(tArea.getHeight() - dirty.height)); }
| 4,403
|
public float getSpan(GlyphView view, int p0, int p1, TabExpander te, float x) { Element el = view.getElement(); Font font = view.getFont(); FontMetrics fm = Toolkit.getDefaultToolkit().getFontMetrics(font); Segment txt = view.getText(p0, p1); int span = Utilities.getTabbedTextWidth(txt, fm, (int) x, te, p0); return span; }
|
public float getSpan(GlyphView view, int p0, int p1, TabExpander te, float x) { Font font = view.getFont(); FontMetrics fm = Toolkit.getDefaultToolkit().getFontMetrics(font); Segment txt = view.getText(p0, p1); int span = Utilities.getTabbedTextWidth(txt, fm, (int) x, te, p0); return span; }
| 4,404
|
public Shape modelToView(GlyphView view, int pos, Position.Bias b, Shape a) throws BadLocationException { Element el = view.getElement(); Font font = view.getFont(); FontMetrics fm = view.getContainer().getFontMetrics(font); Segment txt = view.getText(el.getStartOffset(), pos); int width = fm.charsWidth(txt.array, txt.offset, txt.count); int height = fm.getHeight(); Rectangle bounds = a.getBounds(); Rectangle result = new Rectangle(bounds.x + width, bounds.y, bounds.x + width, height); return result; }
|
public Shape modelToView(GlyphView view, int pos, Position.Bias b, Shape a) throws BadLocationException { Element el = view.getElement(); Font font = view.getFont(); FontMetrics fm = view.getContainer().getFontMetrics(font); Segment txt = view.getText(el.getStartOffset(), pos); Rectangle bounds = a instanceof Rectangle ? (Rectangle) a : a.getBounds(); TabExpander expander = view.getTabExpander(); int width = Utilities.getTabbedTextWidth(txt, fm, bounds.x, expander, view.getStartOffset()); int height = fm.getHeight(); Rectangle bounds = a.getBounds(); Rectangle result = new Rectangle(bounds.x + width, bounds.y, bounds.x + width, height); return result; }
| 4,405
|
public Shape modelToView(GlyphView view, int pos, Position.Bias b, Shape a) throws BadLocationException { Element el = view.getElement(); Font font = view.getFont(); FontMetrics fm = view.getContainer().getFontMetrics(font); Segment txt = view.getText(el.getStartOffset(), pos); int width = fm.charsWidth(txt.array, txt.offset, txt.count); int height = fm.getHeight(); Rectangle bounds = a.getBounds(); Rectangle result = new Rectangle(bounds.x + width, bounds.y, bounds.x + width, height); return result; }
|
public Shape modelToView(GlyphView view, int pos, Position.Bias b, Shape a) throws BadLocationException { Element el = view.getElement(); Font font = view.getFont(); FontMetrics fm = view.getContainer().getFontMetrics(font); Segment txt = view.getText(el.getStartOffset(), pos); int width = fm.charsWidth(txt.array, txt.offset, txt.count); int height = fm.getHeight(); Rectangle result = new Rectangle(bounds.x + width, bounds.y, bounds.x + width, height); return result; }
| 4,406
|
public Shape modelToView(GlyphView view, int pos, Position.Bias b, Shape a) throws BadLocationException { Element el = view.getElement(); Font font = view.getFont(); FontMetrics fm = view.getContainer().getFontMetrics(font); Segment txt = view.getText(el.getStartOffset(), pos); int width = fm.charsWidth(txt.array, txt.offset, txt.count); int height = fm.getHeight(); Rectangle bounds = a.getBounds(); Rectangle result = new Rectangle(bounds.x + width, bounds.y, bounds.x + width, height); return result; }
|
public Shape modelToView(GlyphView view, int pos, Position.Bias b, Shape a) throws BadLocationException { Element el = view.getElement(); Font font = view.getFont(); FontMetrics fm = view.getContainer().getFontMetrics(font); Segment txt = view.getText(el.getStartOffset(), pos); int width = fm.charsWidth(txt.array, txt.offset, txt.count); int height = fm.getHeight(); Rectangle bounds = a.getBounds(); Rectangle result = new Rectangle(bounds.x + width, bounds.y, 0, height); return result; }
| 4,407
|
public void paint(GlyphView view, Graphics g, Shape a, int p0, int p1) { Color oldColor = g.getColor(); int height = (int) getHeight(view); Segment txt = view.getText(p0, p1); Rectangle bounds = a.getBounds(); TabExpander tabEx = null; View parent = view.getParent(); if (parent instanceof TabExpander) tabEx = (TabExpander) parent; int width = Utilities.getTabbedTextWidth(txt, g.getFontMetrics(), bounds.x, tabEx, txt.offset); // Fill the background of the text run. Color background = view.getBackground(); if (background != null) { g.setColor(background); g.fillRect(bounds.x, bounds.y, width, height); } // Draw the actual text. g.setColor(view.getForeground()); g.setFont(view.getFont()); int ascent = g.getFontMetrics().getAscent(); if (view.isSuperscript()) // TODO: Adjust font for superscripting. Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent - height / 2, g, tabEx, txt.offset); else if (view.isSubscript()) // TODO: Adjust font for subscripting. Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent + height / 2, g, tabEx, txt.offset); else Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent, g, tabEx, txt.offset); if (view.isStrikeThrough()) { int strikeHeight = (int) (getAscent(view) / 2); g.drawLine(bounds.x, bounds.y + strikeHeight, bounds.height + width, bounds.y + strikeHeight); } if (view.isUnderline()) { int lineHeight = (int) getAscent(view); g.drawLine(bounds.x, bounds.y + lineHeight, bounds.height + width, bounds.y + lineHeight); } g.setColor(oldColor); }
|
public void paint(GlyphView view, Graphics g, Shape a, int p0, int p1) { Color oldColor = g.getColor(); int height = (int) getHeight(view); Segment txt = view.getText(p0, p1); Rectangle bounds = a.getBounds(); TabExpander tabEx = null; View parent = view.getParent(); if (parent instanceof TabExpander) tabEx = (TabExpander) parent; int width = Utilities.getTabbedTextWidth(txt, g.getFontMetrics(), bounds.x, tabEx, txt.offset); // Fill the background of the text run. Color background = view.getBackground(); if (background != null) { g.setColor(background); g.fillRect(bounds.x, bounds.y, width, height); } // Draw the actual text. g.setColor(view.getForeground()); g.setFont(view.getFont()); int ascent = g.getFontMetrics().getAscent(); if (view.isSuperscript()) // TODO: Adjust font for superscripting. Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent - height / 2, g, tabEx, txt.offset); else if (view.isSubscript()) // TODO: Adjust font for subscripting. Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent + height / 2, g, tabEx, txt.offset); else Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent, g, tabEx, txt.offset); if (view.isStrikeThrough()) { int strikeHeight = (int) (getAscent(view) / 2); g.drawLine(bounds.x, bounds.y + strikeHeight, bounds.height + width, bounds.y + strikeHeight); } if (view.isUnderline()) { int lineHeight = (int) getAscent(view); g.drawLine(bounds.x, bounds.y + lineHeight, bounds.height + width, bounds.y + lineHeight); } g.setColor(oldColor); }
| 4,408
|
public void paint(GlyphView view, Graphics g, Shape a, int p0, int p1) { Color oldColor = g.getColor(); int height = (int) getHeight(view); Segment txt = view.getText(p0, p1); Rectangle bounds = a.getBounds(); TabExpander tabEx = null; View parent = view.getParent(); if (parent instanceof TabExpander) tabEx = (TabExpander) parent; int width = Utilities.getTabbedTextWidth(txt, g.getFontMetrics(), bounds.x, tabEx, txt.offset); // Fill the background of the text run. Color background = view.getBackground(); if (background != null) { g.setColor(background); g.fillRect(bounds.x, bounds.y, width, height); } // Draw the actual text. g.setColor(view.getForeground()); g.setFont(view.getFont()); int ascent = g.getFontMetrics().getAscent(); if (view.isSuperscript()) // TODO: Adjust font for superscripting. Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent - height / 2, g, tabEx, txt.offset); else if (view.isSubscript()) // TODO: Adjust font for subscripting. Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent + height / 2, g, tabEx, txt.offset); else Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent, g, tabEx, txt.offset); if (view.isStrikeThrough()) { int strikeHeight = (int) (getAscent(view) / 2); g.drawLine(bounds.x, bounds.y + strikeHeight, bounds.height + width, bounds.y + strikeHeight); } if (view.isUnderline()) { int lineHeight = (int) getAscent(view); g.drawLine(bounds.x, bounds.y + lineHeight, bounds.height + width, bounds.y + lineHeight); } g.setColor(oldColor); }
|
public void paint(GlyphView view, Graphics g, Shape a, int p0, int p1) { Color oldColor = g.getColor(); int height = (int) getHeight(view); Segment txt = view.getText(p0, p1); Rectangle bounds = a.getBounds(); TabExpander tabEx = null; View parent = view.getParent(); if (parent instanceof TabExpander) tabEx = (TabExpander) parent; int width = Utilities.getTabbedTextWidth(txt, g.getFontMetrics(), bounds.x, tabEx, txt.offset); // Fill the background of the text run. Color background = view.getBackground(); if (background != null) { g.setColor(background); g.fillRect(bounds.x, bounds.y, width, height); } // Draw the actual text. g.setColor(view.getForeground()); g.setFont(view.getFont()); int ascent = g.getFontMetrics().getAscent(); if (view.isSuperscript()) // TODO: Adjust font for superscripting. Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent - height / 2, g, tabEx, txt.offset); else if (view.isSubscript()) // TODO: Adjust font for subscripting. Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent + height / 2, g, tabEx, txt.offset); else Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent, g, tabEx, txt.offset); if (view.isStrikeThrough()) { int strikeHeight = (int) (getAscent(view) / 2); g.drawLine(bounds.x, bounds.y + strikeHeight, bounds.x + width, bounds.y + strikeHeight); } if (view.isUnderline()) { int lineHeight = (int) getAscent(view); g.drawLine(bounds.x, bounds.y + lineHeight, bounds.height + width, bounds.y + lineHeight); } g.setColor(oldColor); }
| 4,409
|
public void paint(GlyphView view, Graphics g, Shape a, int p0, int p1) { Color oldColor = g.getColor(); int height = (int) getHeight(view); Segment txt = view.getText(p0, p1); Rectangle bounds = a.getBounds(); TabExpander tabEx = null; View parent = view.getParent(); if (parent instanceof TabExpander) tabEx = (TabExpander) parent; int width = Utilities.getTabbedTextWidth(txt, g.getFontMetrics(), bounds.x, tabEx, txt.offset); // Fill the background of the text run. Color background = view.getBackground(); if (background != null) { g.setColor(background); g.fillRect(bounds.x, bounds.y, width, height); } // Draw the actual text. g.setColor(view.getForeground()); g.setFont(view.getFont()); int ascent = g.getFontMetrics().getAscent(); if (view.isSuperscript()) // TODO: Adjust font for superscripting. Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent - height / 2, g, tabEx, txt.offset); else if (view.isSubscript()) // TODO: Adjust font for subscripting. Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent + height / 2, g, tabEx, txt.offset); else Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent, g, tabEx, txt.offset); if (view.isStrikeThrough()) { int strikeHeight = (int) (getAscent(view) / 2); g.drawLine(bounds.x, bounds.y + strikeHeight, bounds.height + width, bounds.y + strikeHeight); } if (view.isUnderline()) { int lineHeight = (int) getAscent(view); g.drawLine(bounds.x, bounds.y + lineHeight, bounds.height + width, bounds.y + lineHeight); } g.setColor(oldColor); }
|
public void paint(GlyphView view, Graphics g, Shape a, int p0, int p1) { Color oldColor = g.getColor(); int height = (int) getHeight(view); Segment txt = view.getText(p0, p1); Rectangle bounds = a.getBounds(); TabExpander tabEx = null; View parent = view.getParent(); if (parent instanceof TabExpander) tabEx = (TabExpander) parent; int width = Utilities.getTabbedTextWidth(txt, g.getFontMetrics(), bounds.x, tabEx, txt.offset); // Fill the background of the text run. Color background = view.getBackground(); if (background != null) { g.setColor(background); g.fillRect(bounds.x, bounds.y, width, height); } // Draw the actual text. g.setColor(view.getForeground()); g.setFont(view.getFont()); int ascent = g.getFontMetrics().getAscent(); if (view.isSuperscript()) // TODO: Adjust font for superscripting. Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent - height / 2, g, tabEx, txt.offset); else if (view.isSubscript()) // TODO: Adjust font for subscripting. Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent + height / 2, g, tabEx, txt.offset); else Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent, g, tabEx, txt.offset); if (view.isStrikeThrough()) { int strikeHeight = (int) (getAscent(view) / 2); g.drawLine(bounds.x, bounds.y + strikeHeight, bounds.height + width, bounds.y + strikeHeight); } if (view.isUnderline()) { int lineHeight = (int) getAscent(view); g.drawLine(bounds.x, bounds.y + lineHeight, bounds.x + width, bounds.y + lineHeight); } g.setColor(oldColor); }
| 4,410
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.