rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
charAttr.addAttribute(StyleConstants.StrikeThrough, new Boolean(true));
charAttr.addAttribute(StyleConstants.StrikeThrough, Boolean.TRUE);
public static boolean translateTag(MutableAttributeSet charAttr, Tag t, MutableAttributeSet a) { if(t == Tag.FONT) { if(a.getAttribute("color") != null) { Color c = getColor(""+a.getAttribute("color")); if( c == null ) return false; charAttr.addAttribute(StyleConstants.Foreground, c); return true; } if(a.getAttribute("size") != null) { // FIXME // charAttr.addAttribute(StyleConstants.FontSize, // new java.lang.Integer(72)); return true; } } if( t == Tag.B ) { charAttr.addAttribute(StyleConstants.Bold, new Boolean(true)); return true; } if( t == Tag.I ) { charAttr.addAttribute(StyleConstants.Italic, new Boolean(true)); return true; } if( t == Tag.U ) { charAttr.addAttribute(StyleConstants.Underline, new Boolean(true)); return true; } if( t == Tag.STRIKE ) { charAttr.addAttribute(StyleConstants.StrikeThrough, new Boolean(true)); return true; } if( t == Tag.SUP ) { charAttr.addAttribute(StyleConstants.Superscript, new Boolean(true)); return true; } if( t == Tag.SUB ) { charAttr.addAttribute(StyleConstants.Subscript, new Boolean(true)); return true; } return false; }
charAttr.addAttribute(StyleConstants.Superscript, new Boolean(true));
charAttr.addAttribute(StyleConstants.Superscript, Boolean.TRUE);
public static boolean translateTag(MutableAttributeSet charAttr, Tag t, MutableAttributeSet a) { if(t == Tag.FONT) { if(a.getAttribute("color") != null) { Color c = getColor(""+a.getAttribute("color")); if( c == null ) return false; charAttr.addAttribute(StyleConstants.Foreground, c); return true; } if(a.getAttribute("size") != null) { // FIXME // charAttr.addAttribute(StyleConstants.FontSize, // new java.lang.Integer(72)); return true; } } if( t == Tag.B ) { charAttr.addAttribute(StyleConstants.Bold, new Boolean(true)); return true; } if( t == Tag.I ) { charAttr.addAttribute(StyleConstants.Italic, new Boolean(true)); return true; } if( t == Tag.U ) { charAttr.addAttribute(StyleConstants.Underline, new Boolean(true)); return true; } if( t == Tag.STRIKE ) { charAttr.addAttribute(StyleConstants.StrikeThrough, new Boolean(true)); return true; } if( t == Tag.SUP ) { charAttr.addAttribute(StyleConstants.Superscript, new Boolean(true)); return true; } if( t == Tag.SUB ) { charAttr.addAttribute(StyleConstants.Subscript, new Boolean(true)); return true; } return false; }
charAttr.addAttribute(StyleConstants.Subscript, new Boolean(true));
charAttr.addAttribute(StyleConstants.Subscript, Boolean.TRUE);
public static boolean translateTag(MutableAttributeSet charAttr, Tag t, MutableAttributeSet a) { if(t == Tag.FONT) { if(a.getAttribute("color") != null) { Color c = getColor(""+a.getAttribute("color")); if( c == null ) return false; charAttr.addAttribute(StyleConstants.Foreground, c); return true; } if(a.getAttribute("size") != null) { // FIXME // charAttr.addAttribute(StyleConstants.FontSize, // new java.lang.Integer(72)); return true; } } if( t == Tag.B ) { charAttr.addAttribute(StyleConstants.Bold, new Boolean(true)); return true; } if( t == Tag.I ) { charAttr.addAttribute(StyleConstants.Italic, new Boolean(true)); return true; } if( t == Tag.U ) { charAttr.addAttribute(StyleConstants.Underline, new Boolean(true)); return true; } if( t == Tag.STRIKE ) { charAttr.addAttribute(StyleConstants.StrikeThrough, new Boolean(true)); return true; } if( t == Tag.SUP ) { charAttr.addAttribute(StyleConstants.Superscript, new Boolean(true)); return true; } if( t == Tag.SUB ) { charAttr.addAttribute(StyleConstants.Subscript, new Boolean(true)); return true; } return false; }
return super.hashCode ();
int hashCode = get(position()) + 31; int multiplier = 1; for (int i = position() + 1; i < limit(); ++i) { multiplier *= 31; hashCode += (get(i) + 30)*multiplier; } return hashCode;
public int hashCode () { // FIXME: Check what SUN calculates here. return super.hashCode (); }
final public static ShortBuffer wrap (short[] array, int offset, int length)
public static final ShortBuffer wrap (short[] array, int offset, int length)
final public static ShortBuffer wrap (short[] array, int offset, int length) { return new ShortBufferImpl (array, 0, array.length, offset + length, offset, -1, false); }
throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR);
throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);
public Text splitText(int offset) { if (isReadonly()) { throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); } try { String text = getNodeValue(); String before = text.substring(0, offset); String after = text.substring(offset); Text next; if (getNodeType() == TEXT_NODE) { next = owner.createTextNode(after); } else // CDATA_SECTION_NODE { next = owner.createCDATASection(after); } if (this.next != null) { parent.insertBefore(next, this.next); } else { parent.appendChild(next); } setNodeValue(before); return next; } catch (IndexOutOfBoundsException x) { throw new DomEx(DomEx.INDEX_SIZE_ERR); } }
throw new DomEx(DomEx.INDEX_SIZE_ERR);
throw new DomDOMException(DOMException.INDEX_SIZE_ERR);
public Text splitText(int offset) { if (isReadonly()) { throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); } try { String text = getNodeValue(); String before = text.substring(0, offset); String after = text.substring(offset); Text next; if (getNodeType() == TEXT_NODE) { next = owner.createTextNode(after); } else // CDATA_SECTION_NODE { next = owner.createCDATASection(after); } if (this.next != null) { parent.insertBefore(next, this.next); } else { parent.appendChild(next); } setNodeValue(before); return next; } catch (IndexOutOfBoundsException x) { throw new DomEx(DomEx.INDEX_SIZE_ERR); } }
public int deflate(byte[] output, int offset, int length)
public int deflate(byte[] output)
public int deflate(byte[] output, int offset, int length) { int origLength = length; if (state == CLOSED_STATE) throw new IllegalStateException("Deflater closed"); if (state < BUSY_STATE) { /* output header */ int header = (DEFLATED + ((DeflaterConstants.MAX_WBITS - 8) << 4)) << 8; int level_flags = (level - 1) >> 1; if (level_flags < 0 || level_flags > 3) level_flags = 3; header |= level_flags << 6; if ((state & IS_SETDICT) != 0) /* Dictionary was set */ header |= DeflaterConstants.PRESET_DICT; header += 31 - (header % 31); pending.writeShortMSB(header); if ((state & IS_SETDICT) != 0) { int chksum = engine.getAdler(); engine.resetAdler(); pending.writeShortMSB(chksum >> 16); pending.writeShortMSB(chksum & 0xffff); } state = BUSY_STATE | (state & (IS_FLUSHING | IS_FINISHING)); } for (;;) { int count = pending.flush(output, offset, length); offset += count; totalOut += count; length -= count; if (length == 0 || state == FINISHED_STATE) break; if (!engine.deflate((state & IS_FLUSHING) != 0, (state & IS_FINISHING) != 0)) { if (state == BUSY_STATE) /* We need more input now */ return origLength - length; else if (state == FLUSHING_STATE) { if (level != NO_COMPRESSION) { /* We have to supply some lookahead. 8 bit lookahead * are needed by the zlib inflater, and we must fill * the next byte, so that all bits are flushed. */ int neededbits = 8 + ((-pending.getBitCount()) & 7); while (neededbits > 0) { /* write a static tree block consisting solely of * an EOF: */ pending.writeBits(2, 10); neededbits -= 10; } } state = BUSY_STATE; } else if (state == FINISHING_STATE) { pending.alignToByte(); /* We have completed the stream */ if (!noHeader) { int adler = engine.getAdler(); pending.writeShortMSB(adler >> 16); pending.writeShortMSB(adler & 0xffff); } state = FINISHED_STATE; } } } return origLength - length; }
int origLength = length; if (state == CLOSED_STATE) throw new IllegalStateException("Deflater closed"); if (state < BUSY_STATE) { int header = (DEFLATED + ((DeflaterConstants.MAX_WBITS - 8) << 4)) << 8; int level_flags = (level - 1) >> 1; if (level_flags < 0 || level_flags > 3) level_flags = 3; header |= level_flags << 6; if ((state & IS_SETDICT) != 0) header |= DeflaterConstants.PRESET_DICT; header += 31 - (header % 31); pending.writeShortMSB(header); if ((state & IS_SETDICT) != 0) { int chksum = engine.getAdler(); engine.resetAdler(); pending.writeShortMSB(chksum >> 16); pending.writeShortMSB(chksum & 0xffff); } state = BUSY_STATE | (state & (IS_FLUSHING | IS_FINISHING)); } for (;;) { int count = pending.flush(output, offset, length); offset += count; totalOut += count; length -= count; if (length == 0 || state == FINISHED_STATE) break; if (!engine.deflate((state & IS_FLUSHING) != 0, (state & IS_FINISHING) != 0)) { if (state == BUSY_STATE) return origLength - length; else if (state == FLUSHING_STATE) { if (level != NO_COMPRESSION) { int neededbits = 8 + ((-pending.getBitCount()) & 7); while (neededbits > 0) { pending.writeBits(2, 10); neededbits -= 10; } } state = BUSY_STATE; } else if (state == FINISHING_STATE) { pending.alignToByte(); if (!noHeader) { int adler = engine.getAdler(); pending.writeShortMSB(adler >> 16); pending.writeShortMSB(adler & 0xffff); } state = FINISHED_STATE; } } } return origLength - length;
return deflate(output, 0, output.length);
public int deflate(byte[] output, int offset, int length) { int origLength = length; if (state == CLOSED_STATE) throw new IllegalStateException("Deflater closed"); if (state < BUSY_STATE) { /* output header */ int header = (DEFLATED + ((DeflaterConstants.MAX_WBITS - 8) << 4)) << 8; int level_flags = (level - 1) >> 1; if (level_flags < 0 || level_flags > 3) level_flags = 3; header |= level_flags << 6; if ((state & IS_SETDICT) != 0) /* Dictionary was set */ header |= DeflaterConstants.PRESET_DICT; header += 31 - (header % 31); pending.writeShortMSB(header); if ((state & IS_SETDICT) != 0) { int chksum = engine.getAdler(); engine.resetAdler(); pending.writeShortMSB(chksum >> 16); pending.writeShortMSB(chksum & 0xffff); } state = BUSY_STATE | (state & (IS_FLUSHING | IS_FINISHING)); } for (;;) { int count = pending.flush(output, offset, length); offset += count; totalOut += count; length -= count; if (length == 0 || state == FINISHED_STATE) break; if (!engine.deflate((state & IS_FLUSHING) != 0, (state & IS_FINISHING) != 0)) { if (state == BUSY_STATE) /* We need more input now */ return origLength - length; else if (state == FLUSHING_STATE) { if (level != NO_COMPRESSION) { /* We have to supply some lookahead. 8 bit lookahead * are needed by the zlib inflater, and we must fill * the next byte, so that all bits are flushed. */ int neededbits = 8 + ((-pending.getBitCount()) & 7); while (neededbits > 0) { /* write a static tree block consisting solely of * an EOF: */ pending.writeBits(2, 10); neededbits -= 10; } } state = BUSY_STATE; } else if (state == FINISHING_STATE) { pending.alignToByte(); /* We have completed the stream */ if (!noHeader) { int adler = engine.getAdler(); pending.writeShortMSB(adler >> 16); pending.writeShortMSB(adler & 0xffff); } state = FINISHED_STATE; } } } return origLength - length; }
public void setInput(byte[] input, int off, int len)
public void setInput(byte[] input)
public void setInput(byte[] input, int off, int len) { if ((state & IS_FINISHING) != 0) throw new IllegalStateException("finish()/end() already called"); engine.setInput(input, off, len); }
if ((state & IS_FINISHING) != 0) throw new IllegalStateException("finish()/end() already called"); engine.setInput(input, off, len);
setInput(input, 0, input.length);
public void setInput(byte[] input, int off, int len) { if ((state & IS_FINISHING) != 0) throw new IllegalStateException("finish()/end() already called"); engine.setInput(input, off, len); }
final Class mainClass = Class.forName(mainClassName);
final Class<?> mainClass = Class.forName(mainClassName);
public void run() { try { final Class mainClass = Class.forName(mainClassName); final Method mainMethod = mainClass.getMethod("main", new Class[] { String[].class }); try { mainMethod.invoke(null, new Object[] { args }); } catch (InvocationTargetException ex) { ex.getTargetException().printStackTrace(); } } catch (Exception ex) { ex.printStackTrace(); } }
setPriority(NORM_PRIORITY + 1);
EventDispatchThread(EventQueue queue) { super(); setName("AWT-EventQueue-" + ++dispatchThreadNum); this.queue = queue; setPriority(NORM_PRIORITY + 1); }
System.out.println("run of dispatch thread"); while (true) { try {
while (true) { try {
public void run() { System.out.println("run of dispatch thread"); while (true) { try { AWTEvent evt = queue.getNextEvent(); //Unsafe.debug("@@dispatch "); Unsafe.debug(evt.toString()); KeyboardFocusManager manager; manager = KeyboardFocusManager.getCurrentKeyboardFocusManager(); // Try to dispatch this event to the current keyboard focus // manager. It will dispatch all FocusEvents, all // WindowEvents related to focus, and all KeyEvents, // returning true. Otherwise, it returns false and we // dispatch the event normally. if (!manager.dispatchEvent(evt)) { queue.dispatchEvent(evt); } } catch (ThreadDeath death) { // If someone wants to kill us, let them. System.out.println("dispatch thread:threaddeath"); return; } catch (InterruptedException ie) { // We are interrupted when we should finish executing System.out.println("dispatch thread:interrupted"); return; } catch (Throwable x) { System.out.println("dispatch thread:exception"); x.printStackTrace(); System.err.println("Exception during event dispatch:"); x.printStackTrace(System.err); } } }
if (!manager.dispatchEvent(evt)) {
if (!manager.dispatchEvent (evt))
public void run() { System.out.println("run of dispatch thread"); while (true) { try { AWTEvent evt = queue.getNextEvent(); //Unsafe.debug("@@dispatch "); Unsafe.debug(evt.toString()); KeyboardFocusManager manager; manager = KeyboardFocusManager.getCurrentKeyboardFocusManager(); // Try to dispatch this event to the current keyboard focus // manager. It will dispatch all FocusEvents, all // WindowEvents related to focus, and all KeyEvents, // returning true. Otherwise, it returns false and we // dispatch the event normally. if (!manager.dispatchEvent(evt)) { queue.dispatchEvent(evt); } } catch (ThreadDeath death) { // If someone wants to kill us, let them. System.out.println("dispatch thread:threaddeath"); return; } catch (InterruptedException ie) { // We are interrupted when we should finish executing System.out.println("dispatch thread:interrupted"); return; } catch (Throwable x) { System.out.println("dispatch thread:exception"); x.printStackTrace(); System.err.println("Exception during event dispatch:"); x.printStackTrace(System.err); } } }
} catch (ThreadDeath death) {
catch (ThreadDeath death) {
public void run() { System.out.println("run of dispatch thread"); while (true) { try { AWTEvent evt = queue.getNextEvent(); //Unsafe.debug("@@dispatch "); Unsafe.debug(evt.toString()); KeyboardFocusManager manager; manager = KeyboardFocusManager.getCurrentKeyboardFocusManager(); // Try to dispatch this event to the current keyboard focus // manager. It will dispatch all FocusEvents, all // WindowEvents related to focus, and all KeyEvents, // returning true. Otherwise, it returns false and we // dispatch the event normally. if (!manager.dispatchEvent(evt)) { queue.dispatchEvent(evt); } } catch (ThreadDeath death) { // If someone wants to kill us, let them. System.out.println("dispatch thread:threaddeath"); return; } catch (InterruptedException ie) { // We are interrupted when we should finish executing System.out.println("dispatch thread:interrupted"); return; } catch (Throwable x) { System.out.println("dispatch thread:exception"); x.printStackTrace(); System.err.println("Exception during event dispatch:"); x.printStackTrace(System.err); } } }
System.out.println("dispatch thread:threaddeath");
public void run() { System.out.println("run of dispatch thread"); while (true) { try { AWTEvent evt = queue.getNextEvent(); //Unsafe.debug("@@dispatch "); Unsafe.debug(evt.toString()); KeyboardFocusManager manager; manager = KeyboardFocusManager.getCurrentKeyboardFocusManager(); // Try to dispatch this event to the current keyboard focus // manager. It will dispatch all FocusEvents, all // WindowEvents related to focus, and all KeyEvents, // returning true. Otherwise, it returns false and we // dispatch the event normally. if (!manager.dispatchEvent(evt)) { queue.dispatchEvent(evt); } } catch (ThreadDeath death) { // If someone wants to kill us, let them. System.out.println("dispatch thread:threaddeath"); return; } catch (InterruptedException ie) { // We are interrupted when we should finish executing System.out.println("dispatch thread:interrupted"); return; } catch (Throwable x) { System.out.println("dispatch thread:exception"); x.printStackTrace(); System.err.println("Exception during event dispatch:"); x.printStackTrace(System.err); } } }
System.out.println("dispatch thread:interrupted");
public void run() { System.out.println("run of dispatch thread"); while (true) { try { AWTEvent evt = queue.getNextEvent(); //Unsafe.debug("@@dispatch "); Unsafe.debug(evt.toString()); KeyboardFocusManager manager; manager = KeyboardFocusManager.getCurrentKeyboardFocusManager(); // Try to dispatch this event to the current keyboard focus // manager. It will dispatch all FocusEvents, all // WindowEvents related to focus, and all KeyEvents, // returning true. Otherwise, it returns false and we // dispatch the event normally. if (!manager.dispatchEvent(evt)) { queue.dispatchEvent(evt); } } catch (ThreadDeath death) { // If someone wants to kill us, let them. System.out.println("dispatch thread:threaddeath"); return; } catch (InterruptedException ie) { // We are interrupted when we should finish executing System.out.println("dispatch thread:interrupted"); return; } catch (Throwable x) { System.out.println("dispatch thread:exception"); x.printStackTrace(); System.err.println("Exception during event dispatch:"); x.printStackTrace(System.err); } } }
} catch (Throwable x) { System.out.println("dispatch thread:exception"); x.printStackTrace();
} catch (Throwable x) {
public void run() { System.out.println("run of dispatch thread"); while (true) { try { AWTEvent evt = queue.getNextEvent(); //Unsafe.debug("@@dispatch "); Unsafe.debug(evt.toString()); KeyboardFocusManager manager; manager = KeyboardFocusManager.getCurrentKeyboardFocusManager(); // Try to dispatch this event to the current keyboard focus // manager. It will dispatch all FocusEvents, all // WindowEvents related to focus, and all KeyEvents, // returning true. Otherwise, it returns false and we // dispatch the event normally. if (!manager.dispatchEvent(evt)) { queue.dispatchEvent(evt); } } catch (ThreadDeath death) { // If someone wants to kill us, let them. System.out.println("dispatch thread:threaddeath"); return; } catch (InterruptedException ie) { // We are interrupted when we should finish executing System.out.println("dispatch thread:interrupted"); return; } catch (Throwable x) { System.out.println("dispatch thread:exception"); x.printStackTrace(); System.err.println("Exception during event dispatch:"); x.printStackTrace(System.err); } } }
public LineBorder() { }
public LineBorder(Color color) { this(color, 1, false); }
public LineBorder() { }
{ return false; }
{ return (!roundedCorners) && (lineColor.getAlpha() == 255); }
public boolean isBorderOpaque() { return false; }
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height)
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Color oldColor = g.getColor(); try
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { }
finally { g.setColor(oldColor); } }
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { }
if (length < flags.length) { boolean newFlags [] = new boolean [length]; System.arraycopy (flags, 0, newFlags, 0, flags.length); flags = newFlags; boolean newDeclFlags[] = new boolean[length]; System.arraycopy (declaredFlags, 0, newDeclFlags, 0, declaredFlags.length); declaredFlags = newDeclFlags;
if (length < specified.length) { boolean newFlags []; newFlags = new boolean [length]; System.arraycopy (declared, 0, newFlags, 0, declared.length); declared = newFlags; newFlags = new boolean [length]; System.arraycopy (specified, 0, newFlags, 0, specified.length); specified = newFlags;
public void addAttribute (String uri, String localName, String qName, String type, String value) { super.addAttribute (uri, localName, qName, type, value); int length = getLength (); if (length < flags.length) { boolean newFlags [] = new boolean [length]; System.arraycopy (flags, 0, newFlags, 0, flags.length); flags = newFlags; boolean newDeclFlags[] = new boolean[length]; System.arraycopy (declaredFlags, 0, newDeclFlags, 0, declaredFlags.length); declaredFlags = newDeclFlags; } flags [length - 1] = true; declaredFlags[length - 1] = type.equals("CDATA"); }
flags [length - 1] = true; declaredFlags[length - 1] = type.equals("CDATA");
specified [length - 1] = true; declared [length - 1] = !"CDATA".equals (type);
public void addAttribute (String uri, String localName, String qName, String type, String value) { super.addAttribute (uri, localName, qName, type, value); int length = getLength (); if (length < flags.length) { boolean newFlags [] = new boolean [length]; System.arraycopy (flags, 0, newFlags, 0, flags.length); flags = newFlags; boolean newDeclFlags[] = new boolean[length]; System.arraycopy (declaredFlags, 0, newDeclFlags, 0, declaredFlags.length); declaredFlags = newDeclFlags; } flags [length - 1] = true; declaredFlags[length - 1] = type.equals("CDATA"); }
throw new ArrayIndexOutOfBoundsException ("No attribute at index: " + index); return declaredFlags [index];
throw new ArrayIndexOutOfBoundsException ( "No attribute at index: " + index); return declared [index];
public boolean isDeclared (int index) { if (index < 0 || index >= getLength ()) throw new ArrayIndexOutOfBoundsException ("No attribute at index: " + index); return declaredFlags [index]; }
return flags [index];
return specified [index];
public boolean isSpecified (int index) { if (index < 0 || index >= getLength ()) throw new ArrayIndexOutOfBoundsException ( "No attribute at index: " + index); return flags [index]; }
if (index != origMax) System.arraycopy (flags, index + 1, flags, index,
if (index != origMax) { System.arraycopy (declared, index + 1, declared, index, origMax - index); System.arraycopy (specified, index + 1, specified, index,
public void removeAttribute (int index) { int origMax = getLength () - 1; super.removeAttribute (index); if (index != origMax) System.arraycopy (flags, index + 1, flags, index, origMax - index); }
}
public void removeAttribute (int index) { int origMax = getLength () - 1; super.removeAttribute (index); if (index != origMax) System.arraycopy (flags, index + 1, flags, index, origMax - index); }
flags = new boolean [length]; declaredFlags = new boolean[length];
declared = new boolean [length]; specified = new boolean [length];
public void setAttributes (Attributes atts) { int length = atts.getLength (); super.setAttributes (atts); flags = new boolean [length]; declaredFlags = new boolean[length]; if (atts instanceof Attributes2) { Attributes2 a2 = (Attributes2) atts; for (int i = 0; i < length; i++) { flags [i] = a2.isSpecified (i); declaredFlags[i] = a2.isDeclared(i); } } else { for (int i = 0; i < length; i++) { flags [i] = true; declaredFlags[i] = getType(i).equals("CDATA"); } } }
flags [i] = a2.isSpecified (i); declaredFlags[i] = a2.isDeclared(i);
declared [i] = a2.isDeclared (i); specified [i] = a2.isSpecified (i);
public void setAttributes (Attributes atts) { int length = atts.getLength (); super.setAttributes (atts); flags = new boolean [length]; declaredFlags = new boolean[length]; if (atts instanceof Attributes2) { Attributes2 a2 = (Attributes2) atts; for (int i = 0; i < length; i++) { flags [i] = a2.isSpecified (i); declaredFlags[i] = a2.isDeclared(i); } } else { for (int i = 0; i < length; i++) { flags [i] = true; declaredFlags[i] = getType(i).equals("CDATA"); } } }
flags [i] = true; declaredFlags[i] = getType(i).equals("CDATA");
declared [i] = !"CDATA".equals (atts.getType (i)); specified [i] = true;
public void setAttributes (Attributes atts) { int length = atts.getLength (); super.setAttributes (atts); flags = new boolean [length]; declaredFlags = new boolean[length]; if (atts instanceof Attributes2) { Attributes2 a2 = (Attributes2) atts; for (int i = 0; i < length; i++) { flags [i] = a2.isSpecified (i); declaredFlags[i] = a2.isDeclared(i); } } else { for (int i = 0; i < length; i++) { flags [i] = true; declaredFlags[i] = getType(i).equals("CDATA"); } } }
throw new ArrayIndexOutOfBoundsException ("No attribute at index: " + index); declaredFlags [index] = value;
throw new ArrayIndexOutOfBoundsException ( "No attribute at index: " + index); declared [index] = value;
public void setDeclared (int index, boolean value) { if (index < 0 || index >= getLength ()) throw new ArrayIndexOutOfBoundsException ("No attribute at index: " + index); declaredFlags [index] = value; }
flags [index] = value;
specified [index] = value;
public void setSpecified (int index, boolean value) { if (index < 0 || index >= getLength ()) throw new ArrayIndexOutOfBoundsException ( "No attribute at index: " + index); flags [index] = value; }
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
protected void openInput(DeviceManager devMan) { AccessController.doPrivileged(new PrivilegedAction() { public Object run() { SwingPcTextScreen systemScreen = getTextScreenManager().getSystemScreen(); final JComponent screen = systemScreen.getScreenComponent(); initializeKeyboard(systemScreen.getKeyboardDevice()); addPointerDevice(systemScreen.getPointerDevivce()); frame = new JFrame("Console"); frame.addWindowListener(new WindowAdapter(){ public void windowClosed(WindowEvent e) { closeAll(); } }); frame.setLayout(new BorderLayout()); frame.add(screen, BorderLayout.CENTER); frame.pack(); SwingUtilities.invokeLater(new Runnable() { public void run() { frame.setVisible(true); screen.requestFocus(); } }); return null; } }); }
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
public Object run() { SwingPcTextScreen systemScreen = getTextScreenManager().getSystemScreen(); final JComponent screen = systemScreen.getScreenComponent(); initializeKeyboard(systemScreen.getKeyboardDevice()); addPointerDevice(systemScreen.getPointerDevivce()); frame = new JFrame("Console"); frame.addWindowListener(new WindowAdapter(){ public void windowClosed(WindowEvent e) { closeAll(); } }); frame.setLayout(new BorderLayout()); frame.add(screen, BorderLayout.CENTER); frame.pack(); SwingUtilities.invokeLater(new Runnable() { public void run() { frame.setVisible(true); screen.requestFocus(); } }); return null; }
FontMetrics metrics = view.getContainer().getFontMetrics(font);
FontMetrics metrics = Toolkit.getDefaultToolkit().getFontMetrics(font);
public float getHeight(GlyphView view) { Font font = view.getFont(); FontMetrics metrics = view.getContainer().getFontMetrics(font); float height = metrics.getHeight(); return height; }
FontMetrics fm = view.getContainer().getFontMetrics(font);
FontMetrics fm = Toolkit.getDefaultToolkit().getFontMetrics(font);
public float getSpan(GlyphView view, int p0, int p1, TabExpander te, float x) { Element el = view.getElement(); Font font = view.getFont(); FontMetrics fm = view.getContainer().getFontMetrics(font); Segment txt = view.getText(p0, p1); int span = Utilities.getTabbedTextWidth(txt, fm, (int) x, te, p0); return span; }
boolean moved_permanently = false;
private void p_invoke() throws SystemException { binaryReply response = submit(); ReplyHeader rh = response.header.create_reply_header(); cdrBufInput input = response.getStream(); input.setOrb(orb); rh.read(input); // The stream must be aligned sinve v1.2, but only once. boolean align = response.header.version.since_inclusive(1, 2); boolean moved_permanently = false; switch (rh.reply_status) { case ReplyHeader.NO_EXCEPTION : NamedValue arg; // Read return value, if set. if (m_result != null) { if (align) { input.align(8); align = false; } m_result.value().read_value(input, m_result.value().type()); } // Read returned parameters, if set. if (m_args != null) for (int i = 0; i < m_args.count(); i++) { try { arg = m_args.item(i); // Both ARG_INOUT and ARG_OUT have this binary flag set. if ((arg.flags() & ARG_OUT.value) != 0) { if (align) { input.align(8); align = false; } arg.value().read_value(input, arg.value().type()); } } catch (Bounds ex) { Unexpected.error(ex); } } break; case ReplyHeader.SYSTEM_EXCEPTION : if (align) { input.align(8); align = false; } SystemException exception = ObjectCreator.readSystemException(input); m_environment.exception(exception); throw exception; case ReplyHeader.USER_EXCEPTION : if (align) { input.align(8); align = false; } // Prepare an Any that will hold the exception. gnuAny exc = new gnuAny(); exc.insert_Streamable(new streamReadyHolder(input)); UnknownUserException unuex = new UnknownUserException(exc); m_environment.exception(unuex); break; case ReplyHeader.LOCATION_FORWARD_PERM : case ReplyHeader.LOCATION_FORWARD : if (response.header.version.since_inclusive(1, 2)) input.align(8); IOR forwarded = new IOR(); try { forwarded._read_no_endian(input); } catch (IOException ex) { throw new MARSHAL(ex + " while reading the forwarding info"); } setIor(forwarded); // Repeat with the forwarded information. p_invoke(); return; default : throw new MARSHAL("Unknow reply status: " + rh.reply_status); } }
throw new MARSHAL(ex + " while reading the forwarding info");
new MARSHAL("Cant read forwarding info", 5103, CompletionStatus.COMPLETED_NO );
private void p_invoke() throws SystemException { binaryReply response = submit(); ReplyHeader rh = response.header.create_reply_header(); cdrBufInput input = response.getStream(); input.setOrb(orb); rh.read(input); // The stream must be aligned sinve v1.2, but only once. boolean align = response.header.version.since_inclusive(1, 2); boolean moved_permanently = false; switch (rh.reply_status) { case ReplyHeader.NO_EXCEPTION : NamedValue arg; // Read return value, if set. if (m_result != null) { if (align) { input.align(8); align = false; } m_result.value().read_value(input, m_result.value().type()); } // Read returned parameters, if set. if (m_args != null) for (int i = 0; i < m_args.count(); i++) { try { arg = m_args.item(i); // Both ARG_INOUT and ARG_OUT have this binary flag set. if ((arg.flags() & ARG_OUT.value) != 0) { if (align) { input.align(8); align = false; } arg.value().read_value(input, arg.value().type()); } } catch (Bounds ex) { Unexpected.error(ex); } } break; case ReplyHeader.SYSTEM_EXCEPTION : if (align) { input.align(8); align = false; } SystemException exception = ObjectCreator.readSystemException(input); m_environment.exception(exception); throw exception; case ReplyHeader.USER_EXCEPTION : if (align) { input.align(8); align = false; } // Prepare an Any that will hold the exception. gnuAny exc = new gnuAny(); exc.insert_Streamable(new streamReadyHolder(input)); UnknownUserException unuex = new UnknownUserException(exc); m_environment.exception(unuex); break; case ReplyHeader.LOCATION_FORWARD_PERM : case ReplyHeader.LOCATION_FORWARD : if (response.header.version.since_inclusive(1, 2)) input.align(8); IOR forwarded = new IOR(); try { forwarded._read_no_endian(input); } catch (IOException ex) { throw new MARSHAL(ex + " while reading the forwarding info"); } setIor(forwarded); // Repeat with the forwarded information. p_invoke(); return; default : throw new MARSHAL("Unknow reply status: " + rh.reply_status); } }
throw new MARSHAL("Unknow reply status: " + rh.reply_status);
throw new MARSHAL("Unknow reply status", 8100 + rh.reply_status, CompletionStatus.COMPLETED_NO );
private void p_invoke() throws SystemException { binaryReply response = submit(); ReplyHeader rh = response.header.create_reply_header(); cdrBufInput input = response.getStream(); input.setOrb(orb); rh.read(input); // The stream must be aligned sinve v1.2, but only once. boolean align = response.header.version.since_inclusive(1, 2); boolean moved_permanently = false; switch (rh.reply_status) { case ReplyHeader.NO_EXCEPTION : NamedValue arg; // Read return value, if set. if (m_result != null) { if (align) { input.align(8); align = false; } m_result.value().read_value(input, m_result.value().type()); } // Read returned parameters, if set. if (m_args != null) for (int i = 0; i < m_args.count(); i++) { try { arg = m_args.item(i); // Both ARG_INOUT and ARG_OUT have this binary flag set. if ((arg.flags() & ARG_OUT.value) != 0) { if (align) { input.align(8); align = false; } arg.value().read_value(input, arg.value().type()); } } catch (Bounds ex) { Unexpected.error(ex); } } break; case ReplyHeader.SYSTEM_EXCEPTION : if (align) { input.align(8); align = false; } SystemException exception = ObjectCreator.readSystemException(input); m_environment.exception(exception); throw exception; case ReplyHeader.USER_EXCEPTION : if (align) { input.align(8); align = false; } // Prepare an Any that will hold the exception. gnuAny exc = new gnuAny(); exc.insert_Streamable(new streamReadyHolder(input)); UnknownUserException unuex = new UnknownUserException(exc); m_environment.exception(unuex); break; case ReplyHeader.LOCATION_FORWARD_PERM : case ReplyHeader.LOCATION_FORWARD : if (response.header.version.since_inclusive(1, 2)) input.align(8); IOR forwarded = new IOR(); try { forwarded._read_no_endian(input); } catch (IOException ex) { throw new MARSHAL(ex + " while reading the forwarding info"); } setIor(forwarded); // Repeat with the forwarded information. p_invoke(); return; default : throw new MARSHAL("Unknow reply status: " + rh.reply_status); } }
ior.Internet.port
ior.Internet.port, 10000 + ior.Internet.port, CompletionStatus.COMPLETED_NO
public synchronized binaryReply submit() { gnu.CORBA.GIOP.MessageHeader header = new gnu.CORBA.GIOP.MessageHeader(); header.setBigEndian(Big_endian); // The byte order will be Big Endian by default. header.message_type = gnu.CORBA.GIOP.MessageHeader.REQUEST; header.version = useVersion(ior.Internet.version); RequestHeader rh = header.create_request_header(); rh.object_key = ior.key; rh.operation = m_operation; // Prepare the submission. cdrBufOutput request_part = new cdrBufOutput(); request_part.setOffset(header.getHeaderSize()); request_part.setVersion(header.version); request_part.setCodeSet(cxCodeSet.negotiate(ior.CodeSets)); request_part.setOrb(orb); request_part.setBigEndian(header.isBigEndian()); // This also sets the stream encoding to the encoding, specified // in the header. rh.write(request_part); if (m_args != null && m_args.count() > 0) { write_parameters(header, request_part); if (m_parameter_buffer != null) throw new BAD_INV_ORDER("Please either add parameters or " + "write them into stream, but not both " + "at once." ); } if (m_parameter_buffer != null) { write_parameter_buffer(header, request_part); } // Now the message size is available. header.message_size = request_part.buffer.size(); Socket socket = null; java.lang.Object key = ior.Internet.host + ":" + ior.Internet.port; synchronized (SocketRepository.class) { socket = SocketRepository.get_socket(key); } try { long pause = PAUSE_INITIAL; if (socket == null) { // The BindException may be thrown under very heavy parallel // load. For some time, just wait, exceptiong the socket to free. Open: for (int i = 0; i < PAUSE_STEPS; i++) { try { socket = new Socket(ior.Internet.host, ior.Internet.port); break Open; } catch (BindException ex) { try { // Expecting to free a socket via finaliser. System.gc(); Thread.sleep(pause); pause = pause * 2; if (pause > PAUSE_MAX) pause = PAUSE_MAX; } catch (InterruptedException iex) { } } } } if (socket == null) throw new NO_RESOURCES(ior.Internet.host + ":" + ior.Internet.port + " in use" ); socket.setKeepAlive(true); OutputStream socketOutput = socket.getOutputStream(); // Write the message header. header.write(socketOutput); // Write the request header and parameters (if present). request_part.buffer.writeTo(socketOutput); socketOutput.flush(); if (!socket.isClosed()) { MessageHeader response_header = new MessageHeader(); InputStream socketInput = socket.getInputStream(); response_header.read(socketInput); byte[] r = new byte[ response_header.message_size ]; int n = 0; reading: while (n < r.length) { n += socketInput.read(r, n, r.length - n); } return new binaryReply(orb, response_header, r); } else return EMPTY; } catch (IOException io_ex) { MARSHAL m = new MARSHAL("Unable to open a socket at " + ior.Internet.host + ":" + ior.Internet.port ); m.initCause(io_ex); throw m; } finally { try { if (socket != null && !socket.isClosed()) { socket.setSoTimeout(Functional_ORB.TANDEM_REQUESTS); SocketRepository.put_socket(key, socket); } } catch (IOException scx) { InternalError ierr = new InternalError(); ierr.initCause(scx); throw ierr; } } }
private void write_parameter_buffer(MessageHeader header,
protected void write_parameter_buffer(MessageHeader header,
private void write_parameter_buffer(MessageHeader header, cdrBufOutput request_part ) throws MARSHAL { try { if (header.version.since_inclusive(1, 2)) { request_part.align(8); } m_parameter_buffer.buffer.writeTo(request_part); } catch (IOException ex) { throw new MARSHAL("Unable to write method arguments to CDR output."); } }
private void write_parameters(MessageHeader header, cdrBufOutput request_part)
protected void write_parameters(MessageHeader header, cdrBufOutput request_part )
private void write_parameters(MessageHeader header, cdrBufOutput request_part) throws MARSHAL { // Align after 1.2, but only once. boolean align = header.version.since_inclusive(1, 2); NamedValue para; try { // Write parameters now. for (int i = 0; i < m_args.count(); i++) { para = m_args.item(i); //This bit is set both for ARG_IN and ARG_INOUT if ((para.flags() & ARG_IN.value) != 0) { if (align) { request_part.align(8); align = false; } para.value().write_value(request_part); } } } catch (Bounds ex) { throw new MARSHAL("Unable to write method arguments to CDR output."); } }
throw new MARSHAL("Unable to write method arguments to CDR output.");
InternalError ierr = new InternalError(); ierr.initCause(ex); throw ierr;
private void write_parameters(MessageHeader header, cdrBufOutput request_part) throws MARSHAL { // Align after 1.2, but only once. boolean align = header.version.since_inclusive(1, 2); NamedValue para; try { // Write parameters now. for (int i = 0; i < m_args.count(); i++) { para = m_args.item(i); //This bit is set both for ARG_IN and ARG_INOUT if ((para.flags() & ARG_IN.value) != 0) { if (align) { request_part.align(8); align = false; } para.value().write_value(request_part); } } } catch (Bounds ex) { throw new MARSHAL("Unable to write method arguments to CDR output."); } }
return null;
private TTFFontData getFontData(Font font) { if (font instanceof TTFFont) { return ((TTFFont) font).getFontData(); } return null; }
return null;
FontMetrics fm = (FontMetrics) metrics.get(font); if (fm == null) { try { fm = new TTFFontMetrics(font, getFontData(font)); metrics.put(font, fm); } catch (IOException ex) { log.error("Cannot create font metrics for " + font, ex); } } return fm;
public FontMetrics getFontMetrics(Font font) { return null; }
try { return (TransformerFactory) ClassStuff.createFactory ( "javax.xml.transform.TransformerFactory", "com.icl.saxon.TransformerFactoryImpl" ); } catch (ClassCastException e) {
ClassLoader loader = Thread.currentThread().getContextClassLoader(); if (loader == null) { loader = TransformerFactory.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 (TransformerFactory) t.newInstance(); } catch (ClassNotFoundException e) { className = null; } catch (Exception e) { throw new TransformerFactoryConfigurationError(e, "error instantiating class " + className); } } } while (className == null && count < 3); try { Class t = Class.forName("gnu.xml.transform.TransformerFactoryImpl"); return (TransformerFactory) t.newInstance(); } catch (Exception e) {
public static TransformerFactory newInstance() throws TransformerFactoryConfigurationError { try { return (TransformerFactory) ClassStuff.createFactory ( "javax.xml.transform.TransformerFactory", "com.icl.saxon.TransformerFactoryImpl" // "gnu.xml.util.SAXNullTransformerFactory" // "org.apache.xalan.processor.TransformerFactoryImpl" ); } catch (ClassCastException e) { throw new TransformerFactoryConfigurationError(e); } }
public String getAttributeName(int index)
public QName getAttributeName(int index)
public String getAttributeName(int index) { if (current != null) { NamedNodeMap attrs = current.getAttributes(); if (attrs == null) return null; Node attr = attrs.item(index); return attr.getLocalName(); } return super.getAttributeName(index); }
return attr.getLocalName();
String localName = attr.getLocalName(); String uri = attr.getNamespaceURI(); String prefix = attr.getPrefix(); return new QName(uri, localName, prefix);
public String getAttributeName(int index) { if (current != null) { NamedNodeMap attrs = current.getAttributes(); if (attrs == null) return null; Node attr = attrs.item(index); return attr.getLocalName(); } return super.getAttributeName(index); }
public abstract Object getProperty (String id) throws SAXNotRecognizedException, SAXNotSupportedException;
public abstract Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException;
public abstract Object getProperty (String id) throws SAXNotRecognizedException, SAXNotSupportedException;
public void parse(InputStream stream, HandlerBase handler)
public void parse(InputStream is, HandlerBase hb)
public void parse(InputStream stream, HandlerBase handler) throws SAXException, IOException { parse (new InputSource (stream), handler); }
{ parse (new InputSource (stream), handler); }
{ if (is == null) { throw new IllegalArgumentException("input stream is null"); } parse(new InputSource(is), hb); }
public void parse(InputStream stream, HandlerBase handler) throws SAXException, IOException { parse (new InputSource (stream), handler); }
public abstract void setProperty (String id, Object value) throws SAXNotRecognizedException, SAXNotSupportedException;
public abstract void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException;
public abstract void setProperty (String id, Object value) throws SAXNotRecognizedException, SAXNotSupportedException;
void addListSelectionListener(ListSelectionListener listener) { sel_model.addListSelectionListener(listener); }
public void addListSelectionListener (ListSelectionListener listener) { sel_model.addListSelectionListener (listener); }
void addListSelectionListener(ListSelectionListener listener) { sel_model.addListSelectionListener(listener); }
public String getUIClassID() { return "JList"; }
public String getUIClassID() { return "ListUI"; }
public String getUIClassID() { return "JList"; }
void init() { render = new DefaultCellRenderer();
void init() { render = new DefaultCellRenderer(); sel_model = new DefaultListSelectionModel(); setModel(new DefaultListModel());
void init() { render = new DefaultCellRenderer(); sel_model = new DefaultListSelectionModel(); setModel(new DefaultListModel()); select_back = new Color(0, 0, 255); select_fore = new Color(255, 255, 255); updateUI(); }
sel_model = new DefaultListSelectionModel(); setModel(new DefaultListModel());
select_back = new Color(0,0,255); select_fore = new Color(255,255,255);
void init() { render = new DefaultCellRenderer(); sel_model = new DefaultListSelectionModel(); setModel(new DefaultListModel()); select_back = new Color(0, 0, 255); select_fore = new Color(255, 255, 255); updateUI(); }
select_back = new Color(0, 0, 255); select_fore = new Color(255, 255, 255); updateUI(); }
updateUI(); }
void init() { render = new DefaultCellRenderer(); sel_model = new DefaultListSelectionModel(); setModel(new DefaultListModel()); select_back = new Color(0, 0, 255); select_fore = new Color(255, 255, 255); updateUI(); }
void removeListSelectionListener(ListSelectionListener listener) { sel_model.removeListSelectionListener(listener); }
public void removeListSelectionListener (ListSelectionListener listener) { sel_model.removeListSelectionListener (listener); }
void removeListSelectionListener(ListSelectionListener listener) { sel_model.removeListSelectionListener(listener); }
public void setListData(final Object[] listData) { class AL extends AbstractListModel { public int getSize() { return listData.length; } public Object getElementAt(int i) { return listData[i]; } } setModel(new AL()); }
public void setListData(final Object[] listData) { class AL extends AbstractListModel { public int getSize() { return listData.length; } public Object getElementAt(int i) { return listData[i]; } }; setModel (new AL()); }
public void setListData(final Object[] listData) { class AL extends AbstractListModel { public int getSize() { return listData.length; } public Object getElementAt(int i) { return listData[i]; } } setModel(new AL()); }
public Object getElementAt(int i) { return listData[i]; }
public Object getElementAt(int i) { return listData.elementAt(i); }
public Object getElementAt(int i) { return listData[i]; }
public int getSize() { return listData.length; }
public int getSize() { return listData.size(); }
public int getSize() { return listData.length; }
this.noFocusBorder = new EmptyBorder(0, 0, 0, 0);
public DefaultTableCellRenderer() { super(); this.noFocusBorder = new EmptyBorder(0, 0, 0, 0); }
public final static VmNormalClass getPrimitiveClass(char type) {
public final static VmNormalClass<?> getPrimitiveClass(char type) {
public final static VmNormalClass getPrimitiveClass(char type) { switch (type) { case 'Z': return BooleanClass; case 'B': return ByteClass; case 'C': return CharClass; case 'S': return ShortClass; case 'I': return IntClass; case 'F': return FloatClass; case 'J': return LongClass; case 'D': return DoubleClass; case 'V': return VoidClass; default: throw new IllegalArgumentException("Unknown type " + type); } }
private final synchronized int decRefCount(boolean forceClose) { refCount--; log.debug("refCount.dec=" + refCount); if ((refCount == 0) || forceClose) {
private final int decRefCount(boolean forceClose) { final int rc; synchronized (initCloseLock) { refCount--; rc = refCount; } log.debug("refCount.dec=" + rc); if ((rc == 0) || forceClose) {
private final synchronized int decRefCount(boolean forceClose) { refCount--; log.debug("refCount.dec=" + refCount); if ((refCount == 0) || forceClose) { onClose(); if (keyboardHandler != null) { this.keyboardHandler.close(); } if (mouseHandler != null) { this.mouseHandler.close(); } if (graphics != null) { this.graphics.close(); } this.api = null; this.graphics = null; this.keyboardHandler = null; this.mouseHandler = null; this.refCount = 0; notifyAll(); } return refCount; }
this.keyboardHandler.close();
keyboardHandler.close();
private final synchronized int decRefCount(boolean forceClose) { refCount--; log.debug("refCount.dec=" + refCount); if ((refCount == 0) || forceClose) { onClose(); if (keyboardHandler != null) { this.keyboardHandler.close(); } if (mouseHandler != null) { this.mouseHandler.close(); } if (graphics != null) { this.graphics.close(); } this.api = null; this.graphics = null; this.keyboardHandler = null; this.mouseHandler = null; this.refCount = 0; notifyAll(); } return refCount; }
this.mouseHandler.close();
mouseHandler.close();
private final synchronized int decRefCount(boolean forceClose) { refCount--; log.debug("refCount.dec=" + refCount); if ((refCount == 0) || forceClose) { onClose(); if (keyboardHandler != null) { this.keyboardHandler.close(); } if (mouseHandler != null) { this.mouseHandler.close(); } if (graphics != null) { this.graphics.close(); } this.api = null; this.graphics = null; this.keyboardHandler = null; this.mouseHandler = null; this.refCount = 0; notifyAll(); } return refCount; }
this.graphics.close();
graphics.close();
private final synchronized int decRefCount(boolean forceClose) { refCount--; log.debug("refCount.dec=" + refCount); if ((refCount == 0) || forceClose) { onClose(); if (keyboardHandler != null) { this.keyboardHandler.close(); } if (mouseHandler != null) { this.mouseHandler.close(); } if (graphics != null) { this.graphics.close(); } this.api = null; this.graphics = null; this.keyboardHandler = null; this.mouseHandler = null; this.refCount = 0; notifyAll(); } return refCount; }
this.refCount = 0; notifyAll(); } return refCount;
synchronized (initCloseLock) { this.refCount = 0; initCloseLock.notifyAll(); } return 0; } else { return rc; }
private final synchronized int decRefCount(boolean forceClose) { refCount--; log.debug("refCount.dec=" + refCount); if ((refCount == 0) || forceClose) { onClose(); if (keyboardHandler != null) { this.keyboardHandler.close(); } if (mouseHandler != null) { this.mouseHandler.close(); } if (graphics != null) { this.graphics.close(); } this.api = null; this.graphics = null; this.keyboardHandler = null; this.mouseHandler = null; this.refCount = 0; notifyAll(); } return refCount; }
private final synchronized void doWaitUntilStopped() { while (graphics != null) { try { wait(); } catch (InterruptedException ex) { } }
private final void doWaitUntilStopped() { synchronized (initCloseLock) { while (graphics != null) { try { initCloseLock.wait(); } catch (InterruptedException ex) { } } }
private final synchronized void doWaitUntilStopped() { while (graphics != null) { try { wait(); } catch (InterruptedException ex) { // Ignore } } }
synchronized (this) {
synchronized (initCloseLock) {
private final int incRefCount() { final boolean initialize; final int rc; synchronized (this) { refCount++; rc = refCount; initialize = (refCount == 1); } log.debug("refCount.inc=" + rc); if (initialize) { final JNodeFrameBufferDevice dev = (JNodeFrameBufferDevice) GraphicsEnvironment .getLocalGraphicsEnvironment().getDefaultScreenDevice(); if (dev == null) { throw new AWTError("No framebuffer device found"); } config = (JNodeGraphicsConfiguration) dev.getDefaultConfiguration(); this.api = dev.getAPI(); try { log.debug("Opening AWT: Using device " + dev.getIDstring()); this.graphics = api.open(config.getConfig()); if (graphics == null) { log.debug("No Graphics for device: " + dev.getIDstring()); } screenSize.width = config.getConfig().getScreenWidth(); screenSize.height = config.getConfig().getScreenHeight(); this.keyboardHandler = new KeyboardHandler(); this.mouseHandler = new MouseHandler(dev.getDevice(), screenSize); onInitialize(); this.refCount = rc; } catch (DeviceException ex) { decRefCount(true); throw (AWTError) new AWTError(ex.getMessage()).initCause(ex); } catch (UnknownConfigurationException ex) { decRefCount(true); throw (AWTError) new AWTError(ex.getMessage()).initCause(ex); } catch (AlreadyOpenException ex) { decRefCount(true); throw (AWTError) new AWTError(ex.getMessage()).initCause(ex); } catch (Throwable ex) { decRefCount(true); log.error("Unknown exception", ex); throw (AWTError) new AWTError(ex.getMessage()).initCause(ex); } } return rc; }
if (block) { this.waitingNativeQueue = locked; synchronized (locked) { try { locked.wait(); } catch (InterruptedException e) { } this.waitingNativeQueue = null; } }
public void iterateNativeQueue(EventQueue locked, boolean block) { // TODO Auto-generated method stub }
final EventQueue q = this.waitingNativeQueue; if (q != null) { synchronized (q) { q.notifyAll(); } }
public void wakeNativeQueue() { // Do nothing }
return null;
if (accessibleContext == null) { if (getEditorKit() instanceof HTMLEditorKit) accessibleContext = new AccessibleJEditorPaneHTML(); else accessibleContext = new AccessibleJEditorPane(); } return accessibleContext;
public AccessibleContext getAccessibleContext() { return null; }
accessibleContext = null;
public void setEditorKit(EditorKit newValue) { if (editorKit == newValue) return; if (editorKit != null) editorKit.deinstall(this); EditorKit oldValue = editorKit; editorKit = newValue; if (editorKit != null) { editorKit.install(this); setDocument(editorKit.createDefaultDocument()); } firePropertyChange("editorKit", oldValue, newValue); invalidate(); repaint(); }
if (DEBUG && debuglevel > 8)
if (Configuration.DEBUG)
private static final int decode4to3(final byte[] src, final int sOffset, final byte[] dest, final int dOffset) { if (src[sOffset + 2] == EQUALS_SIGN) { // Example: Dk== final int outBuff = ((DECODABET[src[sOffset]] & 0xFF) << 18) | ((DECODABET[src[sOffset + 1]] & 0xFF) << 12); dest[dOffset] = (byte) (outBuff >>> 16); return 1; } if (src[sOffset + 3] == EQUALS_SIGN) { // Example: DkL= final int outBuff = ((DECODABET[src[sOffset]] & 0xFF) << 18) | ((DECODABET[src[sOffset + 1]] & 0xFF) << 12) | ((DECODABET[src[sOffset + 2]] & 0xFF) << 6); dest[dOffset] = (byte) (outBuff >>> 16); dest[dOffset + 1] = (byte) (outBuff >>> 8); return 2; } try { // Example: DkLE final int outBuff = ((DECODABET[src[sOffset]] & 0xFF) << 18) | ((DECODABET[src[sOffset + 1]] & 0xFF) << 12) | ((DECODABET[src[sOffset + 2]] & 0xFF) << 6) | ((DECODABET[src[sOffset + 3]] & 0xFF)); dest[dOffset] = (byte) (outBuff >> 16); dest[dOffset + 1] = (byte) (outBuff >> 8); dest[dOffset + 2] = (byte) outBuff; return 3; } catch (Exception x) { if (DEBUG && debuglevel > 8) { debug("" + src[sOffset] + ": " + (DECODABET[src[sOffset]])); debug("" + src[sOffset + 1] + ": " + (DECODABET[src[sOffset + 1]])); debug("" + src[sOffset + 2] + ": " + (DECODABET[src[sOffset + 2]])); debug("" + src[sOffset + 3] + ": " + (DECODABET[src[sOffset + 3]])); } return -1; } }
debug("" + src[sOffset] + ": " + (DECODABET[src[sOffset]])); debug("" + src[sOffset + 1] + ": " + (DECODABET[src[sOffset + 1]])); debug("" + src[sOffset + 2] + ": " + (DECODABET[src[sOffset + 2]])); debug("" + src[sOffset + 3] + ": " + (DECODABET[src[sOffset + 3]]));
log.fine("" + src[sOffset ] + ": " + (DECODABET[src[sOffset ]])); log.fine("" + src[sOffset + 1] + ": " + (DECODABET[src[sOffset + 1]])); log.fine("" + src[sOffset + 2] + ": " + (DECODABET[src[sOffset + 2]])); log.fine("" + src[sOffset + 3] + ": " + (DECODABET[src[sOffset + 3]]));
private static final int decode4to3(final byte[] src, final int sOffset, final byte[] dest, final int dOffset) { if (src[sOffset + 2] == EQUALS_SIGN) { // Example: Dk== final int outBuff = ((DECODABET[src[sOffset]] & 0xFF) << 18) | ((DECODABET[src[sOffset + 1]] & 0xFF) << 12); dest[dOffset] = (byte) (outBuff >>> 16); return 1; } if (src[sOffset + 3] == EQUALS_SIGN) { // Example: DkL= final int outBuff = ((DECODABET[src[sOffset]] & 0xFF) << 18) | ((DECODABET[src[sOffset + 1]] & 0xFF) << 12) | ((DECODABET[src[sOffset + 2]] & 0xFF) << 6); dest[dOffset] = (byte) (outBuff >>> 16); dest[dOffset + 1] = (byte) (outBuff >>> 8); return 2; } try { // Example: DkLE final int outBuff = ((DECODABET[src[sOffset]] & 0xFF) << 18) | ((DECODABET[src[sOffset + 1]] & 0xFF) << 12) | ((DECODABET[src[sOffset + 2]] & 0xFF) << 6) | ((DECODABET[src[sOffset + 3]] & 0xFF)); dest[dOffset] = (byte) (outBuff >> 16); dest[dOffset + 1] = (byte) (outBuff >> 8); dest[dOffset + 2] = (byte) outBuff; return 3; } catch (Exception x) { if (DEBUG && debuglevel > 8) { debug("" + src[sOffset] + ": " + (DECODABET[src[sOffset]])); debug("" + src[sOffset + 1] + ": " + (DECODABET[src[sOffset + 1]])); debug("" + src[sOffset + 2] + ": " + (DECODABET[src[sOffset + 2]])); debug("" + src[sOffset + 3] + ": " + (DECODABET[src[sOffset + 3]])); } return -1; } }
PersistenceDelegate pd = out.getPersistenceDelegate( oldInstance.getClass().getSuperclass());
PersistenceDelegate pd = out.getPersistenceDelegate(type);
protected void initialize(Class type, Object oldInstance, Object newInstance, Encoder out) { if (type != Object.class) { type = type.getSuperclass(); PersistenceDelegate pd = out.getPersistenceDelegate( oldInstance.getClass().getSuperclass()); pd.initialize(type, oldInstance, newInstance, out); } }
public ULongSeqHolder(int[] initial_value)
public ULongSeqHolder()
public ULongSeqHolder(int[] initial_value) { value = initial_value; typecode.setLength(value.length); }
value = initial_value; typecode.setLength(value.length);
public ULongSeqHolder(int[] initial_value) { value = initial_value; typecode.setLength(value.length); }
if (jarFile == null) { connect(); }
public InputStream getInputStream() throws IOException { return jarFile.getResourceAsStream(path); }
MenuPeer peer = (MenuPeer) getPeer(); if (peer == null) return;
insert(MenuItem item, int index){ if (index < 0) throw new IllegalArgumentException("Index is less than zero"); MenuPeer peer = (MenuPeer) getPeer(); if (peer == null) return; int count = getItemCount (); if (index >= count) peer.addItem (item); else { for (int i = count - 1; i >= index; i--) peer.delItem (i); peer.addItem (item); for (int i = index; i < count; i++) peer.addItem ((MenuItem) items.elementAt (i)); } items.insertElementAt(item, index);}
peer.addItem (item);
add(item);
insert(MenuItem item, int index){ if (index < 0) throw new IllegalArgumentException("Index is less than zero"); MenuPeer peer = (MenuPeer) getPeer(); if (peer == null) return; int count = getItemCount (); if (index >= count) peer.addItem (item); else { for (int i = count - 1; i >= index; i--) peer.delItem (i); peer.addItem (item); for (int i = index; i < count; i++) peer.addItem ((MenuItem) items.elementAt (i)); } items.insertElementAt(item, index);}
peer.addItem (item);
item.addNotify(); peer.addItem(item);
insert(MenuItem item, int index){ if (index < 0) throw new IllegalArgumentException("Index is less than zero"); MenuPeer peer = (MenuPeer) getPeer(); if (peer == null) return; int count = getItemCount (); if (index >= count) peer.addItem (item); else { for (int i = count - 1; i >= index; i--) peer.delItem (i); peer.addItem (item); for (int i = index; i < count; i++) peer.addItem ((MenuItem) items.elementAt (i)); } items.insertElementAt(item, index);}
items.insertElementAt(item, index);
insert(MenuItem item, int index){ if (index < 0) throw new IllegalArgumentException("Index is less than zero"); MenuPeer peer = (MenuPeer) getPeer(); if (peer == null) return; int count = getItemCount (); if (index >= count) peer.addItem (item); else { for (int i = count - 1; i >= index; i--) peer.delItem (i); peer.addItem (item); for (int i = index; i < count; i++) peer.addItem ((MenuItem) items.elementAt (i)); } items.insertElementAt(item, index);}
items.removeElementAt(index);
MenuItem item = (MenuItem) items.remove(index);
remove(int index){ items.removeElementAt(index); MenuPeer mp = (MenuPeer)getPeer(); if (mp != null) mp.delItem(index);}
item.removeNotify(); } item.setParent(null);
remove(int index){ items.removeElementAt(index); MenuPeer mp = (MenuPeer)getPeer(); if (mp != null) mp.delItem(index);}
return new CommentNode((children == null) ? null : children.clone(stylesheet), (next == null) ? null : next.clone(stylesheet));
TemplateNode ret = new CommentNode(); if (children != null) { ret.children = children.clone(stylesheet);
TemplateNode clone(Stylesheet stylesheet) { return new CommentNode((children == null) ? null : children.clone(stylesheet), (next == null) ? null : next.clone(stylesheet)); }
if (next != null) { ret.next = next.clone(stylesheet); } return ret; }
TemplateNode clone(Stylesheet stylesheet) { return new CommentNode((children == null) ? null : children.clone(stylesheet), (next == null) ? null : next.clone(stylesheet)); }
System.out.println("Listed " + entries.length + " entries on File(\"" + name + "\")");
System.out.println("Listed " + ((entries != null) ? ""+entries.length : "#null#") + " entries on File(\"" + name + "\")");
public static void main(String[] args) { final String name = (args.length > 0) ? args[0] : ""; System.out.println("Creating File(\"" + name + "\")"); final File f = new File(name); System.out.println("Created File(\"" + name + "\")"); System.out.println("List entries on File(\"" + name + "\")"); final String[] entries = f.list(); System.out.println("Listed " + entries.length + " entries on File(\"" + name + "\")"); }
+ insets.right,
+ insets.right + b.getHorizontalAlignment(),
public static Dimension getPreferredButtonSize(AbstractButton b, int textIconGap) { Rectangle contentRect; Rectangle viewRect; Rectangle iconRect = new Rectangle(); Rectangle textRect = new Rectangle(); Insets insets = b.getInsets(); viewRect = new Rectangle(); /* java.awt.Toolkit.getFontMetrics is deprecated. However, it * seems not obvious how to get to the correct FontMetrics object * otherwise. The real problem probably is that the method * javax.swing.SwingUtilities.layoutCompundLabel should take a * LineMetrics, not a FontMetrics argument. But fixing this that * would change the public API. */ SwingUtilities.layoutCompoundLabel( b, // for the component orientation b.getToolkit().getFontMetrics(b.getFont()), // see comment above b.getText(), b.getIcon(), b.getVerticalAlignment(), b.getHorizontalAlignment(), b.getVerticalTextPosition(), b.getHorizontalTextPosition(), viewRect, iconRect, textRect, textIconGap); /* +------------------------+ +------------------------+ * | | | | * | ICON | | CONTENTCONTENTCONTENT | * | TEXTTEXTTEXT | --> | CONTENTCONTENTCONTENT | * | TEXTTEXTTEXT | | CONTENTCONTENTCONTENT | * +------------------------+ +------------------------+ */ contentRect = textRect.union(iconRect); return new Dimension(insets.left + contentRect.width + insets.right, insets.top + contentRect.height + insets.bottom); }
public LineMetrics getLineMetrics(String str, FontRenderContext frc) { return getLineMetrics (str, 0, str.length () - 1, frc); }
public LineMetrics getLineMetrics(String text, int begin, int limit, FontRenderContext rc) { return peer.getLineMetrics (this, new StringCharacterIterator (text), begin, limit, rc); }
public LineMetrics getLineMetrics(String str, FontRenderContext frc) { return getLineMetrics (str, 0, str.length () - 1, frc); }
{ AttributedString as = new AttributedString (string); as.addAttribute (TextAttribute.FONT, font); ClasspathToolkit tk = (ClasspathToolkit)(Toolkit.getDefaultToolkit ()); peer = tk.getClasspathTextLayoutPeer(as, frc);
{ this.font = font; this.frc = frc; this.string = string; lm = font.getLineMetrics(string, frc); getStringProperties(); if( Bidi.requiresBidi( string.toCharArray(), 0, string.length() ) ) { Bidi bidi = new Bidi( string, leftToRight ? Bidi.DIRECTION_LEFT_TO_RIGHT : Bidi.DIRECTION_RIGHT_TO_LEFT ); int rc = bidi.getRunCount(); byte[] table = new byte[ rc ]; for(int i = 0; i < table.length; i++) table[i] = (byte)bidi.getRunLevel(i); runs = new GlyphVector[ rc ]; runIndices = new int[rc][2]; for(int i = 0; i < runs.length; i++) { runIndices[i][0] = bidi.getRunStart( i ); runIndices[i][1] = bidi.getRunLimit( i ); if( runIndices[i][0] != runIndices[i][1] ) { runs[i] = font.layoutGlyphVector ( frc, string.toCharArray(), runIndices[i][0], runIndices[i][1], ((table[i] & 1) == 0) ? Font.LAYOUT_LEFT_TO_RIGHT : Font.LAYOUT_RIGHT_TO_LEFT ); } } Bidi.reorderVisually( table, 0, runs, 0, runs.length ); } else { runs = new GlyphVector[ 1 ]; runIndices = new int[1][2]; runIndices[0][0] = 0; runIndices[0][1] = string.length(); runs[ 0 ] = font.layoutGlyphVector( frc, string.toCharArray(), 0, string.length(), leftToRight ? Font.LAYOUT_LEFT_TO_RIGHT : Font.LAYOUT_RIGHT_TO_LEFT ); }
public TextLayout (String string, Font font, FontRenderContext frc) { AttributedString as = new AttributedString (string); as.addAttribute (TextAttribute.FONT, font); ClasspathToolkit tk = (ClasspathToolkit)(Toolkit.getDefaultToolkit ()); peer = tk.getClasspathTextLayoutPeer(as, frc); }
peer.draw(g2, x, y);
for(int i = 0; i < runs.length; i++) { g2.drawGlyphVector(runs[i], x, y); Rectangle2D r = runs[i].getLogicalBounds(); x += r.getWidth(); }
public void draw (Graphics2D g2, float x, float y) { peer.draw(g2, x, y); }
loc);
loc, ClassLoader.getSystemClassLoader());
private static final NumberFormat computeInstance (Locale loc, String resource, String def) { ResourceBundle res; try { res = ResourceBundle.getBundle("gnu.java.locale.LocaleInformation", loc); } catch (MissingResourceException x) { res = null; } String fmt; try { fmt = res == null ? def : res.getString(resource); } catch (MissingResourceException x) { fmt = def; } DecimalFormatSymbols dfs = new DecimalFormatSymbols (loc); return new DecimalFormat (fmt, dfs); }
int len = sortKeys.size();
int len = sortKeys != null ? sortKeys.size() : 0;
TemplateNode clone(Stylesheet stylesheet) { int len = sortKeys.size(); List sortKeys2 = new ArrayList(len); for (int i = 0; i < len; i++) sortKeys2.add(((Key) sortKeys.get(i)).clone(stylesheet)); TemplateNode ret = new ForEachNode(select.clone(stylesheet), sortKeys2); if (children != null) ret.children = children.clone(stylesheet); if (next != null) ret.next = next.clone(stylesheet); return ret; }
public boolean implies(Permission perm) { if (allPermission != null) { return true; } final PermissionCollection pc = (PermissionCollection) perms.get(perm .getClass()); if (pc == null) { return false; } else { return pc.implies(perm); }
public boolean implies(Permission perm) { if (allPermission != null) return true; PermissionCollection pc = (PermissionCollection) perms.get(perm.getClass()); return pc == null ? false : pc.implies(perm);
public boolean implies(Permission perm) { if (allPermission != null) { return true; } final PermissionCollection pc = (PermissionCollection) perms.get(perm .getClass()); if (pc == null) { return false; } else { return pc.implies(perm); } }
public final void bootArchitecture(boolean emptyMMap) throws UninterruptiblePragma {
public final void bootArchitecture(boolean emptyMMap) {
public final void bootArchitecture(boolean emptyMMap) throws UninterruptiblePragma { Vm.getArch().boot(emptyMMap); }
VmProcessor.current().enableReschedule();
VmMagic.currentProcessor().enableReschedule(true);
public void restartThreads() { VmProcessor.current().enableReschedule(); }