rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
return className;
return declaringClass;
public String getClassName() { return className; }
return hashCode(fileName) ^ lineNumber ^ hashCode(className)
return hashCode(fileName) ^ lineNumber ^ hashCode(declaringClass)
public int hashCode() { return hashCode(fileName) ^ lineNumber ^ hashCode(className) ^ hashCode(methodName); }
if (className != null)
if (declaringClass != null)
public String toString() { StringBuffer sb = new StringBuffer(); if (className != null) { sb.append(className); if (methodName != null) sb.append('.'); } if (methodName != null) sb.append(methodName); sb.append(" ("); if (fileName != null) sb.append(fileName); else sb.append(isNative ? "Native Method" : "Unknown Source"); if (lineNumber >= 0) sb.append(':').append(lineNumber); sb.append(')'); return sb.toString(); }
sb.append(className);
sb.append(declaringClass);
public String toString() { StringBuffer sb = new StringBuffer(); if (className != null) { sb.append(className); if (methodName != null) sb.append('.'); } if (methodName != null) sb.append(methodName); sb.append(" ("); if (fileName != null) sb.append(fileName); else sb.append(isNative ? "Native Method" : "Unknown Source"); if (lineNumber >= 0) sb.append(':').append(lineNumber); sb.append(')'); return sb.toString(); }
Border border = getBorder(); if (border != null) border.paintBorder(this, g, 0, 0, s.width, s.height);
public void paint(Graphics g) { Dimension s = getSize(); MetalUtils.fillMetalPattern(splitPane, g, 2, 2, s.width - 4, s.height - 4, light, dark); if (splitPane.isOneTouchExpandable()) { ((BasicArrowButton) rightButton).paint(g); ((BasicArrowButton) leftButton).paint(g); } }
byte buf[] = new byte [1]; int bytes_read = read(buf, 0, 1); if (bytes_read == -1) return -1; return buf[0] & 0xFF;
if (channel == null) throw new SocketException("not connected"); while (true) { try { return channel.getVMChannel().read(); } catch (SocketTimeoutException ste) { throw ste; } catch (InterruptedIOException iioe) { } }
public int read() throws IOException { byte buf[] = new byte [1]; int bytes_read = read(buf, 0, 1); if (bytes_read == -1) return -1; return buf[0] & 0xFF; }
byte buf[] = { (byte) b }; write(buf, 0, 1);
if (channel == null) throw new SocketException("not connected"); while (true) { try { channel.getVMChannel().write(b); return; } catch (InterruptedIOException iioe) { } }
public void write(int b) throws IOException { byte buf[] = { (byte) b }; write(buf, 0, 1); }
throws IOException { throw new SocketException("Not implemented");
throws IOException { if (channel == null) create(true); if (!(impl instanceof PlainSocketImpl)) throw new IOException("incompatible SocketImpl: " + impl.getClass().getName()); PlainSocketImpl that = (PlainSocketImpl) impl; VMChannel c = channel.getVMChannel().accept(); that.impl.getState().setChannelFD(c.getState()); that.channel = new SocketChannelImpl(c); that.setOption(SO_REUSEADDR, Boolean.TRUE); that.setOption(SO_TIMEOUT, Integer.valueOf(0));
protected synchronized void accept(SocketImpl impl) throws IOException { // @vm-specific no natives //TODO implement me throw new SocketException("Not implemented"); }
protected int available() throws IOException { throw new SocketException("Not implemented");
protected int available() throws IOException { if (channel == null) throw new SocketException("not connected"); return channel.getVMChannel().available();
protected int available() throws IOException { // @vm-specific no natives //TODO implement me throw new SocketException("Not implemented"); }
throws IOException { throw new SocketException("Not implemented");
throws IOException { if (channel == null) create(true); impl.bind(new InetSocketAddress(addr, port)); localport = channel.getVMChannel().getLocalAddress().getPort();
protected synchronized void bind(InetAddress addr, int port) throws IOException { // @vm-specific no natives throw new SocketException("Not implemented"); }
protected void close() throws IOException { throw new SocketException("Not implemented");
protected void close() throws IOException { if (impl.getState().isValid()) impl.close(); address = null; port = -1;
protected void close() throws IOException { // @vm-specific no natives //TODO implement me throw new SocketException("Not implemented"); }
protected synchronized void connect(String host, int port) throws IOException
protected synchronized void connect(String hostname, int port) throws IOException
protected synchronized void connect(String host, int port) throws IOException { connect(InetAddress.getByName(host), port); }
connect(InetAddress.getByName(host), port);
connect(InetAddress.getByName(hostname), port);
protected synchronized void connect(String host, int port) throws IOException { connect(InetAddress.getByName(host), port); }
public Object getOption(int optID) throws SocketException { throw new SocketException("Not implemented");
public Object getOption(int optionId) throws SocketException { if (optionId == SO_BINDADDR) { try { return channel.getVMChannel().getLocalAddress().getAddress(); } catch (IOException ioe) { SocketException se = new SocketException(); se.initCause(ioe); throw se; } } switch (optionId) { case SO_LINGER: case IP_MULTICAST_LOOP: case SO_BROADCAST: case SO_KEEPALIVE: case SO_OOBINLINE: case TCP_NODELAY: case IP_TOS: case SO_RCVBUF: case SO_SNDBUF: case SO_TIMEOUT: case SO_REUSEADDR: return impl.getOption(optionId); default: throw new SocketException("Unrecognized TCP option: " + optionId); }
public Object getOption(int optID) throws SocketException { // @vm-specific no natives //TODO implement me throw new SocketException("Not implemented"); }
throws IOException { throw new SocketException("Not implemented");
throws IOException { impl.listen(queuelen);
protected synchronized void listen(int queuelen) throws IOException { // @vm-specific no natives //TODO implement me throw new SocketException("Not implemented"); }
public void sendUrgentData(int data)
public void sendUrgentData(int data) throws IOException
public void sendUrgentData(int data) { throw new InternalError ("PlainSocketImpl::sendUrgentData not implemented"); }
throw new InternalError ("PlainSocketImpl::sendUrgentData not implemented");
impl.sendUrgentData(data);
public void sendUrgentData(int data) { throw new InternalError ("PlainSocketImpl::sendUrgentData not implemented"); }
public void setOption(int optID, Object value) throws SocketException { throw new SocketException("Not implemented");
public void setOption(int optionId, Object value) throws SocketException { switch (optionId) { case SO_LINGER: case IP_MULTICAST_LOOP: case SO_BROADCAST: case SO_KEEPALIVE: case SO_OOBINLINE: case TCP_NODELAY: case IP_TOS: case SO_RCVBUF: case SO_SNDBUF: case SO_TIMEOUT: case SO_REUSEADDR: impl.setOption(optionId, value); return; default: throw new SocketException("Unrecognized TCP option: " + optionId); }
public void setOption(int optID, Object value) throws SocketException { // @vm-specific no natives //TODO implement me throw new SocketException("Not implemented"); }
public void shutdownInput()
public void shutdownInput() throws IOException
public void shutdownInput() { // @vm-specific no natives //TODO implement me throw new InternalError ("PlainSocketImpl::shutdownInput not implemented"); }
throw new InternalError ("PlainSocketImpl::shutdownInput not implemented");
impl.shutdownInput();
public void shutdownInput() { // @vm-specific no natives //TODO implement me throw new InternalError ("PlainSocketImpl::shutdownInput not implemented"); }
throw new InternalError ("PlainSocketImpl::shutdownOutput not implemented");
impl.shutdownOutput();
public void shutdownOutput() throws IOException { // @vm-specific no natives //TODO implement me throw new InternalError ("PlainSocketImpl::shutdownOutput not implemented"); }
if (event.getPropertyName().equals("editable")) { if (textComponent.isEditable()) textComponent.setBackground(background); else textComponent.setBackground(inactiveBackground); }
protected void propertyChange(PropertyChangeEvent event) { // Does nothing by default. }
if (!initStageDone)
if (isRootPaneCheckingEnabled()) getContentPane().add(comp, constraints, index); else
protected void addImpl(Component comp, Object constraints, int index) { // If we're in the initialization stage use super.add. Here we add the // rootPane as well as the title bar and other stuff. // Otherwise pass the add onto the content pane. if (!initStageDone) super.addImpl(comp,constraints, index); else { if (isRootPaneCheckingEnabled()) throw new Error("Do not use add() on JInternalFrame directly. Use " + "getContentPane().add() instead"); getContentPane().add(comp, constraints, index); } }
else { if (isRootPaneCheckingEnabled()) throw new Error("Do not use add() on JInternalFrame directly. Use " + "getContentPane().add() instead"); getContentPane().add(comp, constraints, index); }
protected void addImpl(Component comp, Object constraints, int index) { // If we're in the initialization stage use super.add. Here we add the // rootPane as well as the title bar and other stuff. // Otherwise pass the add onto the content pane. if (!initStageDone) super.addImpl(comp,constraints, index); else { if (isRootPaneCheckingEnabled()) throw new Error("Do not use add() on JInternalFrame directly. Use " + "getContentPane().add() instead"); getContentPane().add(comp, constraints, index); } }
return "JInternalFrame";
return super.paramString();
protected String paramString() { return "JInternalFrame"; }
invalidate(); doLayout();
revalidate();
public void reshape(int x, int y, int width, int height) { super.reshape(x, y, width, height); invalidate(); doLayout(); }
setRootPaneCheckingEnabled(old);
public void setUI(InternalFrameUI ui) { super.setUI(ui); }
setRootPaneCheckingEnabled(old);
public void updateUI() { setUI((InternalFrameUI) UIManager.getUI(this)); }
public IRBasicBlock(int address) { this(address, -1, false);
public IRBasicBlock( int startPC, int endPC, boolean startOfExceptionHandler) { this.startPC = startPC; this.endPC = endPC; this.startOfExceptionHandler = startOfExceptionHandler; this.stackOffset = -1; this.name = "B" + startPC; predecessors = new BootableArrayList(); successors = new BootableArrayList(); dominatedBlocks = new BootableArrayList(); postOrderNumber = -1; dominanceFrontier = new BootableArrayList(); quads = new BootableArrayList(); defList = new BootableArrayList();
public IRBasicBlock(int address) { this(address, -1, false); }
writeOut(outputstream,"<" + indexNodeName + " axisIdRef=\""+axisIdRef+"\">");
writeOut(outputstream,"<" + indexNodeName + " axisIdRef=\""+axisIdRef+"\"/>");
public void toXMLOutputStream ( OutputStream outputstream, Hashtable XMLDeclAttribs, String indent, boolean dontCloseNode, String newNodeNameString, String noChildObjectNodeName ) { String nodeNameString = this.classXDFNodeName; // Setup. Sometimes the name of the node we are opening is different from // that specified in the classXDFNodeName (*sigh*) if (newNodeNameString != null) nodeNameString = newNodeNameString; // 0. To be valid XML, we always start an XML block with an // XML declaration (e.g. somehting like "<?xml standalone="no"?>"). // Here we deal with printing out XML Declaration && its attributes/* if ((XMLDeclAttribs !=null) &&(!XMLDeclAttribs.isEmpty())) { indent = ""; writeXMLDeclToOutputStream(outputstream, XMLDeclAttribs); }*/ // 1. open this node, print its simple XML attributes if (sPrettyXDFOutput) writeOut(outputstream, indent); // indent node if desired writeOut(outputstream,"<" + nodeNameString + ">"); // print opening statement if (sPrettyXDFOutput) writeOut(outputstream, Constants.NEW_LINE); String newindent = indent + sPrettyXDFOutputIndentation; // bump up the indentation // 2. Print out the axisIdRefs as child nodes Iterator iter = axisIdRefOrder.iterator(); while (iter.hasNext()) { String axisIdRef = (String) iter.next(); if (sPrettyXDFOutput) writeOut(outputstream, newindent); // indent node if desired writeOut(outputstream,"<" + indexNodeName + " axisIdRef=\""+axisIdRef+"\">"); if (sPrettyXDFOutput) writeOut(outputstream, Constants.NEW_LINE); } // 3. Close this node if (sPrettyXDFOutput) writeOut(outputstream, indent); // indent node if desired writeOut(outputstream,"</" + nodeNameString + ">"); // print opening statement if (sPrettyXDFOutput) writeOut(outputstream, Constants.NEW_LINE); }
if (fatNr > 0) { offset += (fatNr-1) * sectsPerFat * sectSize; }
offset += fatNr * fatSize;
public static long getFatOffset(BootSector bs, int fatNr) { long sectSize = bs.getBytesPerSector(); long sectsPerFat = bs.getSectorsPerFat(); long resSects = bs.getNrReservedSectors(); long offset = resSects * sectSize; if (fatNr > 0) { offset += (fatNr-1) * sectsPerFat * sectSize; } return offset; }
if (this.gui.isShowing()) { Rectangle r = new Rectangle(dirty); updateImage(r); }
Rectangle r = new Rectangle(dirty); updateImage(r);
public void updateDirty() { //LDC - 12/02/2003 - check if we must repaint it if (drawing == false) return; //LDC - 18/02/2003 - only update the screen when the window is showing if (this.gui.isShowing()) { Rectangle r = new Rectangle(dirty); // 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.// int height = (int)(tArea.getHeight() - dirty.height);// if (height > 0)// dirty.setBounds(dirty.x,dirty.height,dirty.width,(int)(tArea.getHeight() - dirty.height)); //LDC - 12/02/2003 - set drawing to false drawing = false; }
attr.addAttribute(StyleConstants.NameAttribute, t); element = new DefaultStyledDocument.ElementSpec(attr,
AbstractDocument.AttributeContext ctx = getAttributeContext(); AttributeSet copy = attr.copyAttributes(); copy = ctx.addAttribute(copy, StyleConstants.NameAttribute, t); element = new DefaultStyledDocument.ElementSpec(copy,
protected void blockOpen(HTML.Tag t, MutableAttributeSet attr) { printBuffer(); DefaultStyledDocument.ElementSpec element; attr.addAttribute(StyleConstants.NameAttribute, t); element = new DefaultStyledDocument.ElementSpec(attr, DefaultStyledDocument.ElementSpec.StartTagType); parseBuffer.addElement(element); printBuffer(); }
AttributeContext ctx = getAttributeContext();
AbstractDocument.AttributeContext ctx = getAttributeContext();
protected AbstractElement createDefaultRoot() { AttributeContext ctx = getAttributeContext(); // Create html element. AttributeSet atts = ctx.getEmptySet(); atts = ctx.addAttribute(atts, StyleConstants.NameAttribute, HTML.Tag.HTML); BranchElement html = (BranchElement) createBranchElement(null, atts); // Create body element. atts = ctx.getEmptySet(); atts = ctx.addAttribute(atts, StyleConstants.NameAttribute, HTML.Tag.BODY); BranchElement body = (BranchElement) createBranchElement(html, atts); html.replace(0, 0, new Element[] { body }); // Create p element. atts = ctx.getEmptySet(); atts = ctx.addAttribute(atts, StyleConstants.NameAttribute, HTML.Tag.P); BranchElement p = (BranchElement) createBranchElement(body, atts); body.replace(0, 0, new Element[] { p }); // Create an empty leaf element. atts = ctx.getEmptySet(); atts = ctx.addAttribute(atts, StyleConstants.NameAttribute, HTML.Tag.CONTENT); Element leaf = createLeafElement(p, atts, 0, 1); p.replace(0, 0, new Element[]{ leaf }); return html; }
if (rowLead != rowModel.getLeadSelectionIndex() || colLead != colModel.getLeadSelectionIndex()) if (table.isEditing()) table.editingStopped(new ChangeEvent(e));
public void mousePressed(MouseEvent e) { begin = new Point(e.getX(), e.getY()); curr = new Point(e.getX(), e.getY()); //if control is pressed and the cell is already selected, deselect it if (e.isControlDown() && table. isCellSelected(table.rowAtPoint(begin),table.columnAtPoint(begin))) { table.getSelectionModel(). removeSelectionInterval(table.rowAtPoint(begin), table.rowAtPoint(begin)); table.getColumnModel().getSelectionModel(). removeSelectionInterval(table.columnAtPoint(begin), table.columnAtPoint(begin)); } else updateSelection(e.isControlDown()); }
}
private void updateSelection(boolean controlPressed) { // Update the rows int lo_row = table.rowAtPoint(begin); int hi_row = table.rowAtPoint(curr); ListSelectionModel rowModel = table.getSelectionModel(); if (lo_row != -1 && hi_row != -1) { if (controlPressed && rowModel.getSelectionMode() != ListSelectionModel.SINGLE_SELECTION) rowModel.addSelectionInterval(lo_row, hi_row); else rowModel.setSelectionInterval(lo_row, hi_row); } // Update the columns int lo_col = table.columnAtPoint(begin); int hi_col = table.columnAtPoint(curr); ListSelectionModel colModel = table.getColumnModel(). getSelectionModel(); if (lo_col != -1 && hi_col != -1) { if (controlPressed && colModel.getSelectionMode() != ListSelectionModel.SINGLE_SELECTION) colModel.addSelectionInterval(lo_col, hi_col); else colModel.setSelectionInterval(lo_col, hi_col); } }
{ }
{ UIDefaults defaults = UIManager.getLookAndFeelDefaults(); InputMap ancestorMap = (InputMap)defaults.get("Table.ancestorInputMap"); action = new TableAction(); Object keys[] = ancestorMap.allKeys(); for (int i = 0; i < keys.length; i++) { table.registerKeyboardAction(action,(String)ancestorMap.get((KeyStroke)keys[i]), KeyStroke.getKeyStroke (((KeyStroke)keys[i]).getKeyCode(), convertModifiers(((KeyStroke)keys[i]).getModifiers())), JComponent.WHEN_FOCUSED); table.registerKeyboardAction(action,(String)ancestorMap.get((KeyStroke)keys[i]), KeyStroke.getKeyStroke (((KeyStroke)keys[i]).getKeyCode(), ((KeyStroke)keys[i]).getModifiers()), JComponent.WHEN_FOCUSED); } }
protected void installKeyboardActions() { }
keyListener = createKeyListener();
public void installUI(JComponent comp) { table = (JTable)comp; focusListener = createFocusListener(); keyListener = createKeyListener(); mouseInputListener = createMouseInputListener(); installDefaults(); installKeyboardActions(); installListeners(); }
writeOut(outputstream, " count=\"" + getCount() + "\"");
writeOut(outputstream, " count=\""); writeOutAttribute(outputstream, getCount().toString()); writeOut(outputstream, "\"");
protected void specificIOStyleToXDF( OutputStream outputstream,String indent) { //open the code writeOut(outputstream, "<" + classXDFNodeName); writeOut(outputstream, " count=\"" + getCount() + "\""); writeOut(outputstream, ">"); //write out nodes in formatCommandList synchronized (formatCommandList) { int stop = formatCommandList.size(); String moreIndent = indent + Specification.getInstance().getPrettyXDFOutputIndentation(); for (int i = 0; i <stop; i++) { if (Specification.getInstance().isPrettyXDFOutput()) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, moreIndent); } ((XMLDataIOStyle) formatCommandList.get(i)).specificIOStyleToXDF(outputstream, moreIndent); } } //close the node if (Specification.getInstance().isPrettyXDFOutput()) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "</" + classXDFNodeName + ">"); }
throws NameNotFoundException {
throws NameNotFoundException, HelpException {
public static void main(String[] args) throws NameNotFoundException { Help.Info info = HELP_INFO; // defaults to print own help ParsedArguments cmdLine = HELP_INFO.parse(args); if (PARAM_COMMAND.isSet(cmdLine)) try { String cmd = ARG_COMMAND.getValue(cmdLine); Class clazz = null; try { final Shell shell = ShellUtils.getShellManager().getCurrentShell(); clazz = shell.getAliasManager().getAliasClass(cmd); } catch (NoSuchAliasException ex) { clazz = Class.forName(cmd); } Field clInfo = clazz.getField(Help.INFO_FIELD_NAME); info = (Help.Info)clInfo.get(null); // static access } catch (ClassNotFoundException ex) { System.err.println("Class not found"); } catch (NoSuchFieldException ex) { System.err.println("Class does not provide requested information"); } catch (ClassCastException ex) { System.err.println("Embedded information is in wrong format"); } catch (IllegalAccessException ex) { System.err.println("Embedded information is not public"); } catch (SecurityException ex) { System.err.println("Access to class restricted"); } info.help(); }
testSize(dstReg, mode.getSize());
testSize(dstReg, BITS32 | BITS64);
public void writeADD(GPR dstReg, int imm32) { testSize(dstReg, mode.getSize()); if (X86Utils.isByte(imm32)) { write1bOpcodeModRR(0x83, dstReg.getSize(), dstReg, 0); write8(imm32); } else { write1bOpcodeModRR(0x81, dstReg.getSize(), dstReg, 0); write32(imm32); } }
testSize(dstReg, mode.getSize());
testSize(dstReg, BITS32 | BITS64);
public final void writeAND(GPR dstReg, int imm32) { testSize(dstReg, mode.getSize()); if (X86Utils.isByte(imm32)) { write1bOpcodeModRR(0x83, dstReg.getSize(), dstReg, 4); write8(imm32); } else { write1bOpcodeModRR(0x81, dstReg.getSize(), dstReg, 4); write32(imm32); } }
testSize(reg1, mode.getSize()); testSize(reg2, mode.getSize());
testSize(reg1, BITS32 | BITS64); testSize(reg2, BITS32 | BITS64);
public void writeCMP(GPR reg1, int disp, GPR reg2) { testSize(reg1, mode.getSize()); testSize(reg2, mode.getSize()); write1bOpcodeModRM(0x39, reg2.getSize(), reg1, disp, reg2.getNr()); }
testSize(reg, mode.getSize());
testSize(reg, BITS32 | BITS64);
public final void writeCMP_Const(GPR reg, int imm32) { testSize(reg, mode.getSize()); if (X86Utils.isByte(imm32)) { write1bOpcodeModRR(0x83, reg.getSize(), reg, 7); write8(imm32); } else { write1bOpcodeModRR(0x81, reg.getSize(), reg, 7); write32(imm32); } }
testSize(dstReg, mode.getSize());
testSize(dstReg, BITS32 | BITS64);
public final void writeDEC(GPR dstReg) { testSize(dstReg, mode.getSize()); if (code32) { write8(0x48 + dstReg.getNr()); } else { write1bOpcodeModRR(0xFF, dstReg.getSize(), dstReg, 1); } }
testSize(dstReg, mode.getSize());
testSize(dstReg, BITS32 | BITS64);
public final void writeINC(GPR dstReg) { testSize(dstReg, mode.getSize()); if (code32) { write8(0x40 + dstReg.getNr()); } else { write1bOpcodeModRR(0xFF, dstReg.getSize(), dstReg, 0); } }
testSize(dstReg, mode.getSize()); testSize(srcReg, mode.getSize());
testSize(dstReg, BITS32 | BITS64); testSize(srcReg, BITS32 | BITS64);
public final void writeMOV(int operandSize, GPR dstReg, int dstDisp, GPR srcReg) { testSize(dstReg, mode.getSize()); testSize(srcReg, mode.getSize()); testDst(dstReg, dstDisp); final int opcode; switch (operandSize) { case X86Constants.BITS8: opcode = 0x88; break; case X86Constants.BITS16: opcode = 0x89; write8(OSIZE_PREFIX); break; case X86Constants.BITS32: case X86Constants.BITS64: opcode = 0x89; break; default: throw new IllegalArgumentException("Invalid operandSize " + operandSize); } write1bOpcodeModRM(opcode, operandSize, dstReg, dstDisp, srcReg.getNr()); }
testSize(dstReg, mode.getSize());
public final void writeMOV_Const(GPR dstReg, int imm32) { testSize(dstReg, mode.getSize()); testSize(dstReg, BITS32 | BITS64); if (dstReg.getSize() == BITS32) { write1bOpcodeReg(0xB8, dstReg); write32(imm32); } else { writeMOV_Const(dstReg, (long) imm32); } }
testSize(dstReg, mode.getSize());
testSize(dstReg, BITS32 | BITS64);
public final void writeNEG(GPR dstReg) { testSize(dstReg, mode.getSize()); write1bOpcodeModRR(0xf7, dstReg.getSize(), dstReg, 3); }
testSize(dstReg, mode.getSize());
testSize(dstReg, BITS32 | BITS64);
public void writeOR(GPR dstReg, int imm32) { testSize(dstReg, mode.getSize()); if (X86Utils.isByte(imm32)) { write1bOpcodeModRR(0x83, dstReg.getSize(), dstReg, 1); write8(imm32); } else { write1bOpcodeModRR(0x81, dstReg.getSize(), dstReg, 1); write32(imm32); } }
testSize(dstReg, mode.getSize());
testSize(dstReg, BITS32 | BITS64);
public final void writePOP(GPR dstReg) { testSize(dstReg, mode.getSize()); write1bOpcodeReg(0x58, dstReg); }
testSize(dstReg, mode.getSize());
testSize(dstReg, BITS32 | BITS64);
public final void writeSHR(GPR dstReg, int imm8) { testSize(dstReg, mode.getSize()); write1bOpcodeModRR(0xc1, dstReg.getSize(), dstReg, 5); write8(imm8); }
testSize(dstReg, mode.getSize());
testSize(dstReg, BITS32 | BITS64);
public final void writeSHR_CL(GPR dstReg) { testSize(dstReg, mode.getSize()); write1bOpcodeModRR(0xd3, dstReg.getSize(), dstReg, 5); }
testSize(reg, mode.getSize());
testSize(reg, BITS32 | BITS64);
public final void writeSUB(GPR reg, int imm32) { testSize(reg, mode.getSize()); if (X86Utils.isByte(imm32)) { write1bOpcodeModRR(0x83, reg.getSize(), reg, 5); write8(imm32); } else { write1bOpcodeModRR(0x81, reg.getSize(), reg, 5); write32(imm32); } }
testSize(reg, mode.getSize());
testSize(reg, BITS32 | BITS64);
public final void writeTEST(GPR reg, int imm32) { testSize(reg, mode.getSize()); write1bOpcodeModRR(0xF7, reg.getSize(), reg, 0); write32(imm32); }
testSize(dstReg, mode.getSize());
testSize(dstReg, BITS32 | BITS64);
public void writeXOR(GPR dstReg, int imm32) { testSize(dstReg, mode.getSize()); if (X86Utils.isByte(imm32)) { write1bOpcodeModRR(0x83, dstReg.getSize(), dstReg, 6); write8(imm32); } else { write1bOpcodeModRR(0x81, dstReg.getSize(), dstReg, 6); write32(imm32); } }
proc.loadPlugins(pluginRegistry);
List descriptors = proc.loadPlugins(pluginRegistry);
public static int vmMain() throws PragmaUninterruptible, PragmaLoadStatics { //return 15; try { Unsafe.debug("Starting JNode\n"); final long start = VmSystem.currentKernelMillis(); Unsafe.debug("VmSystem.initialize\n"); VmSystem.initialize(); // Load the plugins from the initjar BootLog.info("Loading initjar plugins"); final InitJarProcessor proc = new InitJarProcessor(VmSystem.getInitJar()); proc.loadPlugins(pluginRegistry); BootLog.info("Starting PluginManager"); final PluginManager piMgr = new DefaultPluginManager(pluginRegistry); piMgr.startSystemPlugins(); final ClassLoader loader = pluginRegistry.getPluginsClassLoader(); final String mainClassName = proc.getMainClassName(); final Runnable main; if (mainClassName != null) { final Class mainClass = loader.loadClass(mainClassName); main = (Runnable) mainClass.newInstance(); } else { BootLog.warn("No Main-Class found"); main = null; } final long end = VmSystem.currentKernelMillis(); System.out.println("JNode initialization finished in " + (end - start) + "ms."); if (main != null) { main.run(); } } catch (Throwable ex) { BootLog.error("Error in bootstrap", ex); sleepForever(); return -2; } Unsafe.debug("System has finished"); return 0; }
piMgr.startSystemPlugins();
piMgr.startSystemPlugins(descriptors);
public static int vmMain() throws PragmaUninterruptible, PragmaLoadStatics { //return 15; try { Unsafe.debug("Starting JNode\n"); final long start = VmSystem.currentKernelMillis(); Unsafe.debug("VmSystem.initialize\n"); VmSystem.initialize(); // Load the plugins from the initjar BootLog.info("Loading initjar plugins"); final InitJarProcessor proc = new InitJarProcessor(VmSystem.getInitJar()); proc.loadPlugins(pluginRegistry); BootLog.info("Starting PluginManager"); final PluginManager piMgr = new DefaultPluginManager(pluginRegistry); piMgr.startSystemPlugins(); final ClassLoader loader = pluginRegistry.getPluginsClassLoader(); final String mainClassName = proc.getMainClassName(); final Runnable main; if (mainClassName != null) { final Class mainClass = loader.loadClass(mainClassName); main = (Runnable) mainClass.newInstance(); } else { BootLog.warn("No Main-Class found"); main = null; } final long end = VmSystem.currentKernelMillis(); System.out.println("JNode initialization finished in " + (end - start) + "ms."); if (main != null) { main.run(); } } catch (Throwable ex) { BootLog.error("Error in bootstrap", ex); sleepForever(); return -2; } Unsafe.debug("System has finished"); return 0; }
if (sPrettyXDFOutput)
if (Specification.getInstance().isPrettyXDFOutput())
public void toXMLOutputStream ( OutputStream outputstream, Hashtable XMLDeclAttribs, String indent, boolean dontCloseNode, String newNodeNameString, String noChildObjectNodeName ) { String nodeNameString = classXDFNodeName; // 1. open this node, print its simple XML attributes if (sPrettyXDFOutput) writeOut(outputstream, indent); // indent node if desired writeOut(outputstream,"<" + nodeNameString + ">"); // print opening statement //writeOut the body of DataFormat writeOut(outputstream, "<" + specificDataFormatName); // gather info about XMLAttributes in this object/node Hashtable xmlInfo = getXMLInfo(); // 2. Print out string object XML attributes EXCEPT for the one that // matches PCDATAAttribute. ArrayList attribs = (ArrayList) xmlInfo.get("attribList"); synchronized(attribs) { int stop = attribs.size(); for (int i = 0; i < stop; i++) { Hashtable item = (Hashtable) attribs.get(i); writeOut(outputstream, " "+ item.get("name") + "=\"" + item.get("value") + "\""); } } //writeout end of the boby writeOut(outputstream, "/>"); //writeout closing node writeOut(outputstream, "</" + nodeNameString+ ">"); if (sPrettyXDFOutput) writeOut(outputstream, Constants.NEW_LINE); }
if (instance == null) instance = new MetalToolBarUI(); return instance;
return new MetalToolBarUI();
public static ComponentUI createUI(JComponent component) { if (instance == null) instance = new MetalToolBarUI(); return instance; }
SwingToolkit.add(canvas, this); SwingToolkit.copyAwtProperties(canvas, this); }
this.canvas = canvas; SwingToolkit.add(canvas, this); SwingToolkit.copyAwtProperties(canvas, this); }
public SwingCanvasPeer(Canvas canvas) { SwingToolkit.add(canvas, this); SwingToolkit.copyAwtProperties(canvas, this); }
{ if (menuItem.isContentAreaFilled()) {
protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor) { // Menu item is considered to be highlighted when it is selected. // But we don't want to paint the background of JCheckBoxMenuItems ButtonModel mod = menuItem.getModel(); if ((menuItem.isSelected() && checkIcon == null) || (mod != null && mod.isArmed()) && (menuItem.getParent() instanceof MenuElement)) { if (menuItem.isContentAreaFilled()) { g.setColor(selectionBackground); g.fillRect(0, 0, menuItem.getWidth(), menuItem.getHeight()); } } }
}
protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor) { // Menu item is considered to be highlighted when it is selected. // But we don't want to paint the background of JCheckBoxMenuItems ButtonModel mod = menuItem.getModel(); if ((menuItem.isSelected() && checkIcon == null) || (mod != null && mod.isArmed()) && (menuItem.getParent() instanceof MenuElement)) { if (menuItem.isContentAreaFilled()) { g.setColor(selectionBackground); g.fillRect(0, 0, menuItem.getWidth(), menuItem.getHeight()); } } }
paintBackground(g, m, m.getBackground());
paintBackground(g, m, background);
protected void paintMenuItem(Graphics g, JComponent c, Icon checkIcon, Icon arrowIcon, Color background, Color foreground, int defaultTextIconGap) { JMenuItem m = (JMenuItem) c; Rectangle tr = new Rectangle(); // text rectangle Rectangle ir = new Rectangle(); // icon rectangle Rectangle vr = new Rectangle(); // view rectangle Rectangle br = new Rectangle(); // border rectangle Rectangle ar = new Rectangle(); // accelerator rectangle Rectangle cr = new Rectangle(); // checkIcon rectangle int vertAlign = m.getVerticalAlignment(); int horAlign = m.getHorizontalAlignment(); int vertTextPos = m.getVerticalTextPosition(); int horTextPos = m.getHorizontalTextPosition(); Font f = m.getFont(); g.setFont(f); FontMetrics fm = g.getFontMetrics(f); SwingUtilities.calculateInnerArea(m, br); SwingUtilities.calculateInsetArea(br, m.getInsets(), vr); paintBackground(g, m, m.getBackground()); /* * MenuItems insets are equal to menuItems margin, space between text and * menuItems border. We need to paint insets region as well. */ Insets insets = m.getInsets(); br.x -= insets.left; br.y -= insets.top; br.width += insets.right + insets.left; br.height += insets.top + insets.bottom; // If this menu item is a JCheckBoxMenuItem then paint check icon if (checkIcon != null) { SwingUtilities.layoutCompoundLabel(m, fm, null, checkIcon, vertAlign, horAlign, vertTextPos, horTextPos, vr, cr, tr, defaultTextIconGap); checkIcon.paintIcon(m, g, cr.x, cr.y); // We need to calculate position of the menu text and position of // user menu icon if there exists one relative to the check icon. // So we need to adjust view rectangle s.t. its starting point is at // checkIcon.width + defaultTextIconGap. vr.x = cr.x + cr.width + defaultTextIconGap; } // if this is a submenu, then paint arrow icon to indicate it. if (arrowIcon != null && (c instanceof JMenu)) { if (!((JMenu) c).isTopLevelMenu()) { int width = arrowIcon.getIconWidth(); int height = arrowIcon.getIconHeight(); int offset = (vr.height - height) / 2; arrowIcon.paintIcon(m, g, vr.width - width, vr.y + offset); } } // paint text and user menu icon if it exists Icon i = m.getIcon(); SwingUtilities.layoutCompoundLabel(c, fm, m.getText(), i, vertAlign, horAlign, vertTextPos, horTextPos, vr, ir, tr, defaultTextIconGap); if (i != null) i.paintIcon(c, g, ir.x, ir.y); paintText(g, m, tr, m.getText()); // paint accelerator String acceleratorText = ""; if (m.getAccelerator() != null) { acceleratorText = getAcceleratorText(m.getAccelerator()); fm = g.getFontMetrics(acceleratorFont); ar.width = fm.stringWidth(acceleratorText); ar.x = br.width - ar.width; vr.x = br.width - ar.width - defaultTextIconGap; SwingUtilities.layoutCompoundLabel(m, fm, acceleratorText, null, vertAlign, horAlign, vertTextPos, horTextPos, vr, ir, ar, defaultTextIconGap); paintAccelerator(g, m, ar, acceleratorText); } }
StyleConstants.setItalic(atts, ! isBold);
StyleConstants.setBold(atts, ! isBold);
public void actionPerformed(ActionEvent event) { JEditorPane editor = getEditor(event); StyledDocument doc = getStyledDocument(editor); Element el = doc.getCharacterElement(editor.getSelectionStart()); boolean isBold = StyleConstants.isBold(el.getAttributes()); SimpleAttributeSet atts = new SimpleAttributeSet(); StyleConstants.setItalic(atts, ! isBold); setCharacterAttributes(editor, atts, false); }
Document doc = editor.getDocument(); if (doc instanceof StyledDocument)
int p0 = editor.getSelectionStart(); int p1 = editor.getSelectionEnd(); if (p0 != p1)
protected final void setCharacterAttributes(JEditorPane editor, AttributeSet atts, boolean replace) { Document doc = editor.getDocument(); if (doc instanceof StyledDocument) { StyledDocument styleDoc = (StyledDocument) editor.getDocument(); EditorKit kit = editor.getEditorKit(); if (!(kit instanceof StyledEditorKit)) { StyledEditorKit styleKit = (StyledEditorKit) kit; int start = editor.getSelectionStart(); int end = editor.getSelectionEnd(); int dot = editor.getCaret().getDot(); if (start == dot && end == dot) { // If there is no selection, then we only update the // input attributes. MutableAttributeSet inputAttributes = styleKit.getInputAttributes(); inputAttributes.addAttributes(atts); } else styleDoc.setCharacterAttributes(start, end, atts, replace); } else throw new AssertionError("The EditorKit for StyledTextActions " + "is expected to be a StyledEditorKit"); } else throw new AssertionError("The Document for StyledTextActions is " + "expected to be a StyledDocument."); }
StyledDocument styleDoc = (StyledDocument) editor.getDocument(); EditorKit kit = editor.getEditorKit(); if (!(kit instanceof StyledEditorKit)) { StyledEditorKit styleKit = (StyledEditorKit) kit; int start = editor.getSelectionStart(); int end = editor.getSelectionEnd(); int dot = editor.getCaret().getDot(); if (start == dot && end == dot) { MutableAttributeSet inputAttributes = styleKit.getInputAttributes(); inputAttributes.addAttributes(atts);
StyledDocument doc = getStyledDocument(editor); doc.setCharacterAttributes(p0, p1 - p0, atts, replace);
protected final void setCharacterAttributes(JEditorPane editor, AttributeSet atts, boolean replace) { Document doc = editor.getDocument(); if (doc instanceof StyledDocument) { StyledDocument styleDoc = (StyledDocument) editor.getDocument(); EditorKit kit = editor.getEditorKit(); if (!(kit instanceof StyledEditorKit)) { StyledEditorKit styleKit = (StyledEditorKit) kit; int start = editor.getSelectionStart(); int end = editor.getSelectionEnd(); int dot = editor.getCaret().getDot(); if (start == dot && end == dot) { // If there is no selection, then we only update the // input attributes. MutableAttributeSet inputAttributes = styleKit.getInputAttributes(); inputAttributes.addAttributes(atts); } else styleDoc.setCharacterAttributes(start, end, atts, replace); } else throw new AssertionError("The EditorKit for StyledTextActions " + "is expected to be a StyledEditorKit"); } else throw new AssertionError("The Document for StyledTextActions is " + "expected to be a StyledDocument."); }
else styleDoc.setCharacterAttributes(start, end, atts, replace); } else throw new AssertionError("The EditorKit for StyledTextActions " + "is expected to be a StyledEditorKit");
StyledEditorKit kit = getStyledEditorKit(editor); MutableAttributeSet inputAtts = kit.getInputAttributes(); if (replace) { inputAtts.removeAttributes(inputAtts);
protected final void setCharacterAttributes(JEditorPane editor, AttributeSet atts, boolean replace) { Document doc = editor.getDocument(); if (doc instanceof StyledDocument) { StyledDocument styleDoc = (StyledDocument) editor.getDocument(); EditorKit kit = editor.getEditorKit(); if (!(kit instanceof StyledEditorKit)) { StyledEditorKit styleKit = (StyledEditorKit) kit; int start = editor.getSelectionStart(); int end = editor.getSelectionEnd(); int dot = editor.getCaret().getDot(); if (start == dot && end == dot) { // If there is no selection, then we only update the // input attributes. MutableAttributeSet inputAttributes = styleKit.getInputAttributes(); inputAttributes.addAttributes(atts); } else styleDoc.setCharacterAttributes(start, end, atts, replace); } else throw new AssertionError("The EditorKit for StyledTextActions " + "is expected to be a StyledEditorKit"); } else throw new AssertionError("The Document for StyledTextActions is " + "expected to be a StyledDocument."); }
else throw new AssertionError("The Document for StyledTextActions is " + "expected to be a StyledDocument.");
inputAtts.addAttributes(atts);
protected final void setCharacterAttributes(JEditorPane editor, AttributeSet atts, boolean replace) { Document doc = editor.getDocument(); if (doc instanceof StyledDocument) { StyledDocument styleDoc = (StyledDocument) editor.getDocument(); EditorKit kit = editor.getEditorKit(); if (!(kit instanceof StyledEditorKit)) { StyledEditorKit styleKit = (StyledEditorKit) kit; int start = editor.getSelectionStart(); int end = editor.getSelectionEnd(); int dot = editor.getCaret().getDot(); if (start == dot && end == dot) { // If there is no selection, then we only update the // input attributes. MutableAttributeSet inputAttributes = styleKit.getInputAttributes(); inputAttributes.addAttributes(atts); } else styleDoc.setCharacterAttributes(start, end, atts, replace); } else throw new AssertionError("The EditorKit for StyledTextActions " + "is expected to be a StyledEditorKit"); } else throw new AssertionError("The Document for StyledTextActions is " + "expected to be a StyledDocument."); }
boolean addEdit(UndoableEdit anEdit);
boolean addEdit(UndoableEdit edit);
boolean addEdit(UndoableEdit anEdit);
boolean replaceEdit(UndoableEdit anEdit);
boolean replaceEdit(UndoableEdit edit);
boolean replaceEdit(UndoableEdit anEdit);
return 0;
for (int i = 0; i < getChildCount(parent); i++) { if (getChild(parent, i).equals(child)) return i; } return -1;
public int getIndexOfChild(Object parent, Object child) { return 0; // TODO }
SwingUtilities.convertPointToScreen(sourcePointOnScreen, source);
if (source.isShowing()) SwingUtilities.convertPointToScreen(sourcePointOnScreen, source);
public Component componentForPoint(Component source, Point sourcePoint) { // Convert sourcePoint to screen coordinates. Point sourcePointOnScreen = sourcePoint; SwingUtilities.convertPointToScreen(sourcePointOnScreen, source); Point compPointOnScreen; Component resultComp = null; // For each menu element on the selected path, express its location // in terms of screen coordinates and check if there is any // menu element on the selected path that contains given source point. for (int i = 0; i < selectedPath.size(); i++) { Component comp = ((Component) selectedPath.get(i)); Dimension size = comp.getSize(); // convert location of this menu item to screen coordinates compPointOnScreen = comp.getLocationOnScreen(); if (compPointOnScreen.x <= sourcePointOnScreen.x && sourcePointOnScreen.x < compPointOnScreen.x + size.width && compPointOnScreen.y <= sourcePointOnScreen.y && sourcePointOnScreen.y < compPointOnScreen.y + size.height) { Point p = sourcePointOnScreen; SwingUtilities.convertPointFromScreen(p, comp); resultComp = SwingUtilities.getDeepestComponentAt(comp, p.x, p.y); break; } } return resultComp; }
SwingUtilities.convertPointFromScreen(p, comp);
if (comp.isShowing()) SwingUtilities.convertPointFromScreen(p, comp);
public Component componentForPoint(Component source, Point sourcePoint) { // Convert sourcePoint to screen coordinates. Point sourcePointOnScreen = sourcePoint; SwingUtilities.convertPointToScreen(sourcePointOnScreen, source); Point compPointOnScreen; Component resultComp = null; // For each menu element on the selected path, express its location // in terms of screen coordinates and check if there is any // menu element on the selected path that contains given source point. for (int i = 0; i < selectedPath.size(); i++) { Component comp = ((Component) selectedPath.get(i)); Dimension size = comp.getSize(); // convert location of this menu item to screen coordinates compPointOnScreen = comp.getLocationOnScreen(); if (compPointOnScreen.x <= sourcePointOnScreen.x && sourcePointOnScreen.x < compPointOnScreen.x + size.width && compPointOnScreen.y <= sourcePointOnScreen.y && sourcePointOnScreen.y < compPointOnScreen.y + size.height) { Point p = sourcePointOnScreen; SwingUtilities.convertPointFromScreen(p, comp); resultComp = SwingUtilities.getDeepestComponentAt(comp, p.x, p.y); break; } } return resultComp; }
colSep = true;
public final void setAttribute(int i) { colSep = false; underLine = false; nonDisplay = false; isChanged = attr == i ? false : true; attr = i; if(i == 0) return; switch(i) { case 32: // green normal fg = s.colorGreen; bg = s.colorBg; break; case 33: // green/revers fg = s.colorBg; bg = s.colorGreen; break; case 34: // white normal fg = s.colorWhite; bg = s.colorBg; break; case 35: // white/reverse fg = s.colorBg; bg = s.colorWhite; break; case 36: // green/underline fg = s.colorGreen; bg = s.colorBg; underLine = true; break; case 37: // green/reverse/underline fg = s.colorBg; bg = s.colorGreen; underLine = true; break; case 38: // white/underline fg = s.colorWhite; bg = s.colorBg; underLine = true; break; case 39: nonDisplay = true; break; case 40: case 42: // red/normal fg = s.colorRed; bg = s.colorBg; break; case 41: case 43: // red/reverse fg = s.colorBg; bg = s.colorRed; break; case 44: case 46: // red/underline fg = s.colorRed; bg = s.colorBg; underLine = true; break; case 45: // red/reverse/underline fg = s.colorBg; bg = s.colorRed; underLine = true; break; case 47: nonDisplay = true; break; case 48: fg = s.colorTurq; bg = s.colorBg; colSep = true; break; case 49: fg = s.colorBg; bg = s.colorTurq; colSep = true; break; case 50: fg = s.colorYellow; bg = s.colorBg; colSep = true; break; case 51: fg = s.colorBg; bg = s.colorYellow; colSep = true; break; case 52: fg = s.colorTurq; bg = s.colorBg; colSep = true; underLine = true; break; case 53: fg = s.colorBg; bg = s.colorTurq; colSep = true; underLine = true; break; case 54: fg = s.colorYellow; bg = s.colorBg; colSep = true; underLine = true; break; case 55: nonDisplay = true; break; case 56: // pink fg = s.colorPink; bg = s.colorBg; break; case 57: // pink/reverse fg = s.colorBg; bg = s.colorPink; break; case 58: // blue/reverse fg = s.colorBlue; bg = s.colorBg; break; case 59: // blue fg = s.colorBg; bg = s.colorBlue; break; case 60: // pink/underline fg = s.colorPink; bg = s.colorBg; underLine = true; break; case 61: // pink/reverse/underline fg = s.colorBg; bg = s.colorPink; underLine = true; break; case 62: // blue/underline fg = s.colorBlue; bg = s.colorBg; underLine = true; break; case 63: nonDisplay = true; break; default: fg = s.colorYellow; break; } }
char[] chars = str.toCharArray();
final char[] chars = str.toCharArray(); final int bdfFontDepth = bdfFont.getDepth();
final public void render(Surface surface, Shape clip, AffineTransform tx, String str, int x, int y, Color color) { if (str == null || str.length() == 0) { System.err.println("empty string!"); return; } BDFMetrics fm = (BDFMetrics)bdfFont.getFontMetrics(); int charsCount = str.length(); if ((bdfFont != null) && (charsCount > 0)) { int offset = 0; char[] chars = str.toCharArray(); for(int i=0;i<charsCount;i++) { int base = fm.getDescent(); BDFGlyph glyph = bdfFont.getGlyph(chars[i]); if(glyph==null) { continue; } int fHeight= glyph.getBbx().height; int[] fData = glyph.getData(); int scan = fData.length/fHeight; for(int k=0;k<fHeight;k++) { for(int j=0;j<scan;j++) { int fPixel = fData[(k*scan)+j]; if(fPixel!=0) { int r = color.getRed(); //(color & 0x00FF0000) >> 16; int g = color.getGreen(); //(color & 0x0000FF00) >> 8; int b = color.getBlue(); //(color & 0x000000FF); r = ((r * fPixel)>>bdfFont.getDepth()) & 0xFF; g = ((g * fPixel)>>bdfFont.getDepth()) & 0xFF; b = ((b * fPixel)>>bdfFont.getDepth()) & 0xFF; fPixel = (((r << 16)+ (g << 8) + b )| 0xFF000000); int px = x+offset+j; int py = y+(bdfFont.getBoundingBox().height+base-fHeight)+k-glyph.getBbx().y; surface.setRGBPixel(px, py, fPixel); } } } offset+=glyph.getDWidth().width-glyph.getBbx().x; } } }
int fHeight= glyph.getBbx().height; int[] fData = glyph.getData(); int scan = fData.length/fHeight;
final int fHeight= glyph.getBbx().height; final int glyphBbxY = glyph.getBbx().y; final int bdfFontBbxHeight = bdfFont.getBoundingBox().height; final int[] fData = glyph.getData(); final int scan = fData.length/fHeight; final Point2D src = new Point2D.Double(); final Point2D dst = new Point2D.Double();
final public void render(Surface surface, Shape clip, AffineTransform tx, String str, int x, int y, Color color) { if (str == null || str.length() == 0) { System.err.println("empty string!"); return; } BDFMetrics fm = (BDFMetrics)bdfFont.getFontMetrics(); int charsCount = str.length(); if ((bdfFont != null) && (charsCount > 0)) { int offset = 0; char[] chars = str.toCharArray(); for(int i=0;i<charsCount;i++) { int base = fm.getDescent(); BDFGlyph glyph = bdfFont.getGlyph(chars[i]); if(glyph==null) { continue; } int fHeight= glyph.getBbx().height; int[] fData = glyph.getData(); int scan = fData.length/fHeight; for(int k=0;k<fHeight;k++) { for(int j=0;j<scan;j++) { int fPixel = fData[(k*scan)+j]; if(fPixel!=0) { int r = color.getRed(); //(color & 0x00FF0000) >> 16; int g = color.getGreen(); //(color & 0x0000FF00) >> 8; int b = color.getBlue(); //(color & 0x000000FF); r = ((r * fPixel)>>bdfFont.getDepth()) & 0xFF; g = ((g * fPixel)>>bdfFont.getDepth()) & 0xFF; b = ((b * fPixel)>>bdfFont.getDepth()) & 0xFF; fPixel = (((r << 16)+ (g << 8) + b )| 0xFF000000); int px = x+offset+j; int py = y+(bdfFont.getBoundingBox().height+base-fHeight)+k-glyph.getBbx().y; surface.setRGBPixel(px, py, fPixel); } } } offset+=glyph.getDWidth().width-glyph.getBbx().x; } } }
int fPixel = fData[(k*scan)+j];
int fPixel = fData[offsetLine+j];
final public void render(Surface surface, Shape clip, AffineTransform tx, String str, int x, int y, Color color) { if (str == null || str.length() == 0) { System.err.println("empty string!"); return; } BDFMetrics fm = (BDFMetrics)bdfFont.getFontMetrics(); int charsCount = str.length(); if ((bdfFont != null) && (charsCount > 0)) { int offset = 0; char[] chars = str.toCharArray(); for(int i=0;i<charsCount;i++) { int base = fm.getDescent(); BDFGlyph glyph = bdfFont.getGlyph(chars[i]); if(glyph==null) { continue; } int fHeight= glyph.getBbx().height; int[] fData = glyph.getData(); int scan = fData.length/fHeight; for(int k=0;k<fHeight;k++) { for(int j=0;j<scan;j++) { int fPixel = fData[(k*scan)+j]; if(fPixel!=0) { int r = color.getRed(); //(color & 0x00FF0000) >> 16; int g = color.getGreen(); //(color & 0x0000FF00) >> 8; int b = color.getBlue(); //(color & 0x000000FF); r = ((r * fPixel)>>bdfFont.getDepth()) & 0xFF; g = ((g * fPixel)>>bdfFont.getDepth()) & 0xFF; b = ((b * fPixel)>>bdfFont.getDepth()) & 0xFF; fPixel = (((r << 16)+ (g << 8) + b )| 0xFF000000); int px = x+offset+j; int py = y+(bdfFont.getBoundingBox().height+base-fHeight)+k-glyph.getBbx().y; surface.setRGBPixel(px, py, fPixel); } } } offset+=glyph.getDWidth().width-glyph.getBbx().x; } } }
r = ((r * fPixel)>>bdfFont.getDepth()) & 0xFF; g = ((g * fPixel)>>bdfFont.getDepth()) & 0xFF; b = ((b * fPixel)>>bdfFont.getDepth()) & 0xFF;
r = ((r * fPixel)>>bdfFontDepth) & 0xFF; g = ((g * fPixel)>>bdfFontDepth) & 0xFF; b = ((b * fPixel)>>bdfFontDepth) & 0xFF;
final public void render(Surface surface, Shape clip, AffineTransform tx, String str, int x, int y, Color color) { if (str == null || str.length() == 0) { System.err.println("empty string!"); return; } BDFMetrics fm = (BDFMetrics)bdfFont.getFontMetrics(); int charsCount = str.length(); if ((bdfFont != null) && (charsCount > 0)) { int offset = 0; char[] chars = str.toCharArray(); for(int i=0;i<charsCount;i++) { int base = fm.getDescent(); BDFGlyph glyph = bdfFont.getGlyph(chars[i]); if(glyph==null) { continue; } int fHeight= glyph.getBbx().height; int[] fData = glyph.getData(); int scan = fData.length/fHeight; for(int k=0;k<fHeight;k++) { for(int j=0;j<scan;j++) { int fPixel = fData[(k*scan)+j]; if(fPixel!=0) { int r = color.getRed(); //(color & 0x00FF0000) >> 16; int g = color.getGreen(); //(color & 0x0000FF00) >> 8; int b = color.getBlue(); //(color & 0x000000FF); r = ((r * fPixel)>>bdfFont.getDepth()) & 0xFF; g = ((g * fPixel)>>bdfFont.getDepth()) & 0xFF; b = ((b * fPixel)>>bdfFont.getDepth()) & 0xFF; fPixel = (((r << 16)+ (g << 8) + b )| 0xFF000000); int px = x+offset+j; int py = y+(bdfFont.getBoundingBox().height+base-fHeight)+k-glyph.getBbx().y; surface.setRGBPixel(px, py, fPixel); } } } offset+=glyph.getDWidth().width-glyph.getBbx().x; } } }
int py = y+(bdfFont.getBoundingBox().height+base-fHeight)+k-glyph.getBbx().y; surface.setRGBPixel(px, py, fPixel);
int py = y+(base-fHeight)+k-glyphBbxY; src.setLocation(px, py); tx.transform(src, dst); px = (int) dst.getX(); py = (int) dst.getY(); surface.setRGBPixel(px, py, fPixel);
final public void render(Surface surface, Shape clip, AffineTransform tx, String str, int x, int y, Color color) { if (str == null || str.length() == 0) { System.err.println("empty string!"); return; } BDFMetrics fm = (BDFMetrics)bdfFont.getFontMetrics(); int charsCount = str.length(); if ((bdfFont != null) && (charsCount > 0)) { int offset = 0; char[] chars = str.toCharArray(); for(int i=0;i<charsCount;i++) { int base = fm.getDescent(); BDFGlyph glyph = bdfFont.getGlyph(chars[i]); if(glyph==null) { continue; } int fHeight= glyph.getBbx().height; int[] fData = glyph.getData(); int scan = fData.length/fHeight; for(int k=0;k<fHeight;k++) { for(int j=0;j<scan;j++) { int fPixel = fData[(k*scan)+j]; if(fPixel!=0) { int r = color.getRed(); //(color & 0x00FF0000) >> 16; int g = color.getGreen(); //(color & 0x0000FF00) >> 8; int b = color.getBlue(); //(color & 0x000000FF); r = ((r * fPixel)>>bdfFont.getDepth()) & 0xFF; g = ((g * fPixel)>>bdfFont.getDepth()) & 0xFF; b = ((b * fPixel)>>bdfFont.getDepth()) & 0xFF; fPixel = (((r << 16)+ (g << 8) + b )| 0xFF000000); int px = x+offset+j; int py = y+(bdfFont.getBoundingBox().height+base-fHeight)+k-glyph.getBbx().y; surface.setRGBPixel(px, py, fPixel); } } } offset+=glyph.getDWidth().width-glyph.getBbx().x; } } }
changes.firePropertyChange(this,"print.portWidth", getStringProperty("print.portWidth"), new Double(pappyPort.getWidth())); setProperty("print.portWidth",Double.toString(pappyPort.getWidth())); changes.firePropertyChange(this,"print.portImageWidth", getStringProperty("print.portImageWidth"), new Double(pappyPort.getImageableWidth())); setProperty("print.portImageWidth",Double.toString(pappyPort.getImageableWidth())); changes.firePropertyChange(this,"print.portHeight", getStringProperty("print.portHeight"), new Double(pappyPort.getHeight())); setProperty("print.portHeight",Double.toString(pappyPort.getHeight())); changes.firePropertyChange(this,"print.portImageHeight", getStringProperty("print.portImageHeight"), new Double(pappyPort.getImageableHeight())); setProperty("print.portImageHeight",Double.toString(pappyPort.getImageableHeight())); changes.firePropertyChange(this,"print.portImage.X", getStringProperty("print.portImage.X"), new Double(pappyPort.getImageableX())); setProperty("print.portImage.X",Double.toString(pappyPort.getImageableX())); changes.firePropertyChange(this,"print.portImage.Y", getStringProperty("print.portImage.Y"), new Double(pappyPort.getImageableY())); setProperty("print.portImage.Y",Double.toString(pappyPort.getImageableY())); changes.firePropertyChange(this,"print.landWidth", getStringProperty("print.landWidth"), new Double(pappyLand.getWidth())); setProperty("print.landWidth",Double.toString(pappyLand.getWidth())); changes.firePropertyChange(this,"print.landImageWidth", getStringProperty("print.landImageWidth"), new Double(pappyLand.getImageableWidth())); setProperty("print.landImageWidth",Double.toString(pappyLand.getImageableWidth())); changes.firePropertyChange(this,"print.landHeight", getStringProperty("print.landHeight"), new Double(pappyLand.getHeight())); setProperty("print.landHeight",Double.toString(pappyLand.getHeight())); changes.firePropertyChange(this,"print.landImageHeight", getStringProperty("print.landImageHeight"), new Double(pappyLand.getImageableHeight())); setProperty("print.landImageHeight",Double.toString(pappyLand.getImageableHeight())); changes.firePropertyChange(this,"print.landImage.X", getStringProperty("print.landImage.X"), new Double(pappyLand.getImageableX())); setProperty("print.landImage.X",Double.toString(pappyLand.getImageableX())); changes.firePropertyChange(this,"print.landImage.Y", getStringProperty("print.landImage.Y"), new Double(pappyLand.getImageableY())); setProperty("print.landImage.Y",Double.toString(pappyLand.getImageableY()));
public void applyAttributes() { if (defaultPrinter.isSelected()) { changes.firePropertyChange(this,"defaultPrinter", getStringProperty("defaultPrinter"), "Yes"); setProperty("defaultPrinter","Yes"); } else { changes.firePropertyChange(this,"defaultPrinter", getStringProperty("defaultPrinter"), "No"); setProperty("defaultPrinter","No"); } }
contentPane.add(page);
public void initPanel() throws Exception { setLayout(new BorderLayout()); contentPane = new JPanel(); contentPane.setLayout(new BoxLayout(contentPane,BoxLayout.Y_AXIS)); add(contentPane,BorderLayout.NORTH); // define ppPanel panel JPanel ppp = new JPanel(); ppp.setBorder(BorderFactory.createTitledBorder(LangTool.getString("sa.print"))); defaultPrinter = new JCheckBox(LangTool.getString("sa.defaultPrinter")); if (getStringProperty("defaultPrinter").equals("Yes")) defaultPrinter.setSelected(true); ppp.add(defaultPrinter); contentPane.add(ppp); }
iNode.decLocked();
private void addDirectoryRecord(Ext2DirectoryRecord dr) throws IOException, FileSystemException { //synchronize to the inode cache to make sure that the inode does not // get //flushed between reading it and locking it synchronized (((Ext2FileSystem) getFileSystem()).getInodeCache()) { //reread the inode before synchronizing to it to make sure //all threads use the same instance int iNodeNr = iNode.getINodeNr(); iNode = ((Ext2FileSystem) getFileSystem()).getINode(iNodeNr); //lock the inode into the cache so it is not flushed before // synchronizing to it //(otherwise a new instance of INode referring to the same inode // could be put //in the cache resulting in the possibility of two threads // manipulating the same //inode at the same time because they would synchronize to // different INode instances) iNode.incLocked(); } //a single inode may be represented by more than one Ext2Directory // instances, //but each will use the same instance of the underlying inode (see // Ext2FileSystem.getINode()), //so synchronize to the inode. synchronized (iNode) { try { Ext2File dir = new Ext2File(iNode); //read itself as a file //find the last directory record (if any) Ext2FSEntryIterator iterator = new Ext2FSEntryIterator(iNode); Ext2DirectoryRecord rec = null; while (iterator.hasNext()) { rec = iterator.nextDirectoryRecord(); } Ext2FileSystem fs = (Ext2FileSystem) getFileSystem(); if (rec != null) { long lastPos = rec.getFileOffset(); long lastLen = rec.getRecLen(); //truncate the last record to its minimal size (cut the // padding from the end) rec.truncateRecord(); //directoryRecords may not extend over block boundaries: // see if the new record fits in the same block after // truncating the last record long remainingLength = fs.getBlockSize() - (lastPos % fs.getBlockSize()) - rec.getRecLen(); log.debug("LAST-1 record: begins at: " + lastPos + ", length: " + lastLen); log.debug("LAST-1 truncated length: " + rec.getRecLen()); log.debug("Remaining length: " + remainingLength); if (remainingLength >= dr.getRecLen()) { //write back the last record truncated dir.write(lastPos, rec.getData(), rec.getOffset(), rec .getRecLen()); //pad the end of the new record with zeroes dr.expandRecord(lastPos + rec.getRecLen(), lastPos + rec.getRecLen() + remainingLength); //append the new record at the end of the list dir.write(lastPos + rec.getRecLen(), dr.getData(), dr .getOffset(), dr.getRecLen()); log .debug("addDirectoryRecord(): LAST record: begins at: " + (rec.getFileOffset() + rec .getRecLen()) + ", length: " + dr.getRecLen()); } else { //the new record must go to the next block //(the previously last record (rec) stays padded to the // end of the block, so we can // append after that) dr.expandRecord(lastPos + lastLen, lastPos + lastLen + fs.getBlockSize()); dir.write(lastPos + lastLen, dr.getData(), dr .getOffset(), dr.getRecLen()); log .debug("addDirectoryRecord(): LAST record: begins at: " + (lastPos + lastLen) + ", length: " + dr.getRecLen()); } } else { //rec==null, ie. this is the first record in the // directory dr.expandRecord(0, fs.getBlockSize()); dir.write(0, dr.getData(), dr.getOffset(), dr.getRecLen()); log .debug("addDirectoryRecord(): LAST record: begins at: 0, length: " + dr.getRecLen()); } //dir.flush(); iNode.setMtime(System.currentTimeMillis() / 1000); // update the directory inode iNode.update(); //unlock the inode from the cache iNode.decLocked(); return; } catch (Throwable ex) { //could not fininsh the operation, unlock the inode from the // cache iNode.decLocked(); final IOException ioe = new IOException(); ioe.initCause(ex); throw ioe; } } }
} finally { iNode.decLocked();
private void addDirectoryRecord(Ext2DirectoryRecord dr) throws IOException, FileSystemException { //synchronize to the inode cache to make sure that the inode does not // get //flushed between reading it and locking it synchronized (((Ext2FileSystem) getFileSystem()).getInodeCache()) { //reread the inode before synchronizing to it to make sure //all threads use the same instance int iNodeNr = iNode.getINodeNr(); iNode = ((Ext2FileSystem) getFileSystem()).getINode(iNodeNr); //lock the inode into the cache so it is not flushed before // synchronizing to it //(otherwise a new instance of INode referring to the same inode // could be put //in the cache resulting in the possibility of two threads // manipulating the same //inode at the same time because they would synchronize to // different INode instances) iNode.incLocked(); } //a single inode may be represented by more than one Ext2Directory // instances, //but each will use the same instance of the underlying inode (see // Ext2FileSystem.getINode()), //so synchronize to the inode. synchronized (iNode) { try { Ext2File dir = new Ext2File(iNode); //read itself as a file //find the last directory record (if any) Ext2FSEntryIterator iterator = new Ext2FSEntryIterator(iNode); Ext2DirectoryRecord rec = null; while (iterator.hasNext()) { rec = iterator.nextDirectoryRecord(); } Ext2FileSystem fs = (Ext2FileSystem) getFileSystem(); if (rec != null) { long lastPos = rec.getFileOffset(); long lastLen = rec.getRecLen(); //truncate the last record to its minimal size (cut the // padding from the end) rec.truncateRecord(); //directoryRecords may not extend over block boundaries: // see if the new record fits in the same block after // truncating the last record long remainingLength = fs.getBlockSize() - (lastPos % fs.getBlockSize()) - rec.getRecLen(); log.debug("LAST-1 record: begins at: " + lastPos + ", length: " + lastLen); log.debug("LAST-1 truncated length: " + rec.getRecLen()); log.debug("Remaining length: " + remainingLength); if (remainingLength >= dr.getRecLen()) { //write back the last record truncated dir.write(lastPos, rec.getData(), rec.getOffset(), rec .getRecLen()); //pad the end of the new record with zeroes dr.expandRecord(lastPos + rec.getRecLen(), lastPos + rec.getRecLen() + remainingLength); //append the new record at the end of the list dir.write(lastPos + rec.getRecLen(), dr.getData(), dr .getOffset(), dr.getRecLen()); log .debug("addDirectoryRecord(): LAST record: begins at: " + (rec.getFileOffset() + rec .getRecLen()) + ", length: " + dr.getRecLen()); } else { //the new record must go to the next block //(the previously last record (rec) stays padded to the // end of the block, so we can // append after that) dr.expandRecord(lastPos + lastLen, lastPos + lastLen + fs.getBlockSize()); dir.write(lastPos + lastLen, dr.getData(), dr .getOffset(), dr.getRecLen()); log .debug("addDirectoryRecord(): LAST record: begins at: " + (lastPos + lastLen) + ", length: " + dr.getRecLen()); } } else { //rec==null, ie. this is the first record in the // directory dr.expandRecord(0, fs.getBlockSize()); dir.write(0, dr.getData(), dr.getOffset(), dr.getRecLen()); log .debug("addDirectoryRecord(): LAST record: begins at: 0, length: " + dr.getRecLen()); } //dir.flush(); iNode.setMtime(System.currentTimeMillis() / 1000); // update the directory inode iNode.update(); //unlock the inode from the cache iNode.decLocked(); return; } catch (Throwable ex) { //could not fininsh the operation, unlock the inode from the // cache iNode.decLocked(); final IOException ioe = new IOException(); ioe.initCause(ex); throw ioe; } } }
throw new BAD_OPERATION(0, CompletionStatus.COMPLETED_MAYBE);
throw new BAD_OPERATION(Minor.Method, CompletionStatus.COMPLETED_MAYBE);
public OutputStream _invoke(String method, InputStream in, ResponseHandler rh) { OutputStream out = null; Integer call_method = (Integer) 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; }
throw new BAD_OPERATION(0, CompletionStatus.COMPLETED_MAYBE);
throw new BAD_OPERATION(Minor.Method, CompletionStatus.COMPLETED_MAYBE);
public void invoke(ServerRequest request) { Streamable result = null; // The server request contains no required result type. Integer call_method = (Integer) methods.get(request.operation()); if (call_method == null) throw new BAD_OPERATION(0, CompletionStatus.COMPLETED_MAYBE); switch (call_method.intValue()) { case 4 : // resolve, object result = new ObjectHolder(); break; case 6 : // new_context, NamingContext case 7 : // bind_new_context, NamingContext { result = new NamingContextHolder(); break; } default : // void for others. result = null; } gnu.CORBA.ServiceRequestAdapter.invoke(request, this, result); }
public static HostnameVerifier getDefaultHostnameVerifier()
public static synchronized HostnameVerifier getDefaultHostnameVerifier()
public static HostnameVerifier getDefaultHostnameVerifier() { return defaultVerifier; }
if (defaultVerifier == null) { defaultVerifier = new TrivialHostnameVerifier(); }
public static HostnameVerifier getDefaultHostnameVerifier() { return defaultVerifier; }
public static SSLSocketFactory getDefaultSSLSocketFactory()
public static synchronized SSLSocketFactory getDefaultSSLSocketFactory()
public static SSLSocketFactory getDefaultSSLSocketFactory() { return defaultFactory; }
if (defaultFactory == null) { try { defaultFactory = (SSLSocketFactory) SSLSocketFactory.getDefault(); } catch (Throwable t) { t.printStackTrace(); } }
public static SSLSocketFactory getDefaultSSLSocketFactory() { return defaultFactory; }
}
public static void setDefaultHostnameVerifier(HostnameVerifier newDefault) { if (newDefault == null) throw new IllegalArgumentException("default verifier cannot be null"); SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkPermission(new SSLPermission("setHostnameVerifier")); defaultVerifier = newDefault; }
}
public static void setDefaultSSLSocketFactory(SSLSocketFactory newDefault) { if (newDefault == null) throw new IllegalArgumentException("default factory cannot be null"); SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkSetFactory(); defaultFactory = newDefault; }
protected abstract void resolve() throws PluginException;
protected abstract void resolve(PluginRegistryModel registry) throws PluginException;
protected abstract void resolve() throws PluginException;
protected abstract void unresolve() throws PluginException;
protected abstract void unresolve(PluginRegistryModel registry) throws PluginException;
protected abstract void unresolve() throws PluginException;
} else {
} else if (graphic.isSelected()){
public SendEMailDialog(Frame parent, Session session) { if (!isEMailAvailable()) { JOptionPane.showMessageDialog( parent, LangTool.getString("messages.noEmailAPI"), "Error", JOptionPane.ERROR_MESSAGE, null); } else { this.session = session; Screen5250 screen = session.getScreen(); Object[] message = new Object[1]; message[0] = setupMailPanel("tn5250j.txt"); String[] options = new String[3]; int result = 0; while (result == 0 || result == 2) { // setup the dialog options setOptions(options); result = JOptionPane.showOptionDialog(parent, // the parent that the dialog blocks message, // the dialog message array LangTool.getString("em.title"), // the title of the dialog window JOptionPane.DEFAULT_OPTION, // option type JOptionPane.PLAIN_MESSAGE, // message type null, // optional icon, use null to use the default icon options, // options string array, will be made into buttons options[0] // option that should be made into a default btn ); switch (result) { case 0 : // Send it SendEMail sem = new SendEMail(); sem.setConfigFile("SMTPProperties.cfg"); sem.setTo((String) toAddress.getSelectedItem()); sem.setSubject(subject.getText()); if (bodyText.getText().length() > 0) sem.setMessage(bodyText.getText()); if (attachmentName.getText().length() > 0) sem.setAttachmentName(attachmentName.getText()); if (text.isSelected()) { StringBuffer sb = new StringBuffer(); char[] s = screen.getScreenAsChars(); int c = screen.getCols(); int l = screen.getRows() * c; int col = 0; for (int x = 0; x < l; x++, col++) { sb.append(s[x]); if (col == c) { sb.append('\n'); col = 0; } } sem.setAttachment(sb.toString()); } else { File dir = new File(System.getProperty("user.dir")); // setup the temp file name String tempFile = "tn5250jTemp"; try { // create the temporary file File f = File.createTempFile(tempFile, ".png", dir); System.out.println(f.getName()); System.out.println(f.getCanonicalPath()); // set it to delete on exit f.deleteOnExit(); EncodeComponent.encode( EncodeComponent.PNG, session, f); sem.setFileName(f.getName()); } catch (Exception ex) { System.out.println(ex.getMessage()); } } // send the information sendIt(parent, sem); sem.release(); sem = null; break; case 1 : // Cancel // System.out.println("Cancel"); break; case 2 : // Configure SMTP configureSMTP(parent); // System.out.println("Cancel"); break; default : break; } } } }
currentTip = null;
void hideTip() { if (currentTip == null || ! currentTip.isVisible() || ! enabled) return; currentTip.setVisible(false); if (containerPanel != null) { Container parent = containerPanel.getParent(); if (parent == null) return; parent.remove(containerPanel); parent = currentTip.getParent(); if (parent == null) return; parent.remove(currentTip); containerPanel = null; } if (tooltipWindow != null) { tooltipWindow.hide(); tooltipWindow.dispose(); tooltipWindow = null; } }
currentTip.setVisible(true); currentTip.revalidate(); currentTip.repaint();
void showTip() { if (!enabled || currentComponent == null || !currentComponent.isEnabled() || (currentTip != null && currentTip.isVisible())) return; if (currentTip == null || currentTip.getComponent() != currentComponent && currentComponent instanceof JComponent) currentTip = ((JComponent) currentComponent).createToolTip(); Container parent = currentComponent.getParent(); Point p = currentPoint; Dimension dims = currentTip.getPreferredSize(); if (parent instanceof JPopupMenu) setLightWeightPopupEnabled(((JPopupMenu) parent).isLightWeightPopupEnabled()); else setLightWeightPopupEnabled(true); if (isLightWeightPopupEnabled()) { JLayeredPane pane = ((JRootPane) SwingUtilities. getAncestorOfClass(JRootPane.class, currentComponent)). getLayeredPane(); // This should never happen, but just in case. if (pane == null) return; if (containerPanel != null) hideTip(); containerPanel = new Panel(); JRootPane root = new JRootPane(); root.getContentPane().add(currentTip); containerPanel.add(root); LayoutManager lm = containerPanel.getLayout(); if (lm instanceof FlowLayout) { FlowLayout fm = (FlowLayout) lm; fm.setVgap(0); fm.setHgap(0); } p = SwingUtilities.convertPoint(currentComponent, p, pane); p = adjustLocation(p, pane, dims); pane.add(containerPanel); containerPanel.setBounds(p.x, p.y, dims.width, dims.height); currentTip.setBounds(0, 0, dims.width, dims.height); containerPanel.validate(); containerPanel.repaint(); } else if (currentComponent.isShowing()) { SwingUtilities.convertPointToScreen(p, currentComponent); p = adjustLocation(p, SwingUtilities.getWindowAncestor(currentComponent), dims); tooltipWindow = new JDialog(); tooltipWindow.setContentPane(currentTip); tooltipWindow.setUndecorated(true); tooltipWindow.getRootPane(). setWindowDecorationStyle(JRootPane.PLAIN_DIALOG); tooltipWindow.pack(); tooltipWindow.setBounds(p.x, p.y, dims.width, dims.height); tooltipWindow.show(); tooltipWindow.validate(); tooltipWindow.repaint(); } currentTip.setVisible(true); currentTip.revalidate(); currentTip.repaint(); }
focusColor = UIManager.getColor(getPropertyPrefix() + "focus"); selectColor = UIManager.getColor(getPropertyPrefix() + "select"); disabledTextColor = UIManager.getColor(getPropertyPrefix() + "disabledText");
public MetalButtonUI() { super(); focusColor = UIManager.getColor(getPropertyPrefix() + "focus"); selectColor = UIManager.getColor(getPropertyPrefix() + "select"); disabledTextColor = UIManager.getColor(getPropertyPrefix() + "disabledText"); }
return new MetalButtonUI();
if (sharedUI == null) sharedUI = new MetalButtonUI(); return sharedUI;
public static ComponentUI createUI(JComponent c) { return new MetalButtonUI(); }
disabledTextColor = UIManager.getColor(getPropertyPrefix() + "disabledText");
protected Color getDisabledTextColor() { return disabledTextColor; }