rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
e.printStackTrace();
private boolean writeToDisplay(boolean controlsExist) { int pos = 0; boolean error=false; boolean done=false; int attr; byte nextOne; byte control0 = 0; byte control1 = 0; int saRows = screen52.getRows(); int saCols = screen52.getCols(); try { if (controlsExist) { control0 = bk.getNextByte(); control1 = bk.getNextByte(); processCC0(control0); } while (bk.hasNext() && !done) {// pos = bk.getCurrentPos();// int rowc = screen52.getCurrentRow();// int colc = screen52.getCurrentCol(); switch (bk.getNextByte()) { case 1: // SOH - Start of Header Order error = processSOH(); break; case 02: // RA - Repeat to address int row = screen52.getCurrentRow(); int col = screen52.getCurrentCol(); int toRow = bk.getNextByte(); int toCol = bk.getNextByte() & 0xff; if (toRow >= row) { int repeat = bk.getNextByte(); // a little intelligence here I hope if (row == 1 && col == 2 && toRow == screen52.getRows() && toCol == screen52.getCols()) screen52.clearScreen(); else { if (repeat != 0) { //LDC - 13/02/2003 - convert it to unicode repeat = this.ebcdic2uni(repeat); //repeat = getASCIIChar(repeat); } int times = ((toRow * screen52.getCols()) + toCol) - ((row * screen52.getCols()) + col); while (times-- >= 0) { screen52.setChar(repeat); } } } else { sendNegResponse(NR_REQUEST_ERROR,0x05,0x01,0x23," RA invalid"); error =true; } break; case 03: // EA - Erase to address int EArow = screen52.getCurrentRow(); int EAcol = screen52.getCurrentCol(); int toEARow = bk.getNextByte(); int toEACol = bk.getNextByte() & 0xff; int EALength = bk.getNextByte() & 0xff; while (--EALength > 0) { bk.getNextByte(); } char EAAttr = (char)0; // a little intelligence here I hope if (EArow == 1 && EAcol == 2 && toEARow == screen52.getRows() && toEACol == screen52.getCols()) screen52.clearScreen(); else { int times = ((toEARow * screen52.getCols()) + toEACol) - ((EArow * screen52.getCols()) + EAcol); while (times-- >= 0) { screen52.setChar(EAAttr); } } break; case 04: // Command - Escape done = true; break; case 16: // TD - Transparent Data bk.getNextByte(); int j = bk.getNextByte(); // length while (j-- > 0) bk.getNextByte(); break; case 17: // SBA - set buffer address order (row column) int saRow = bk.getNextByte(); int saCol = bk.getNextByte() & 0xff; // make sure it is in bounds if (saRow >= 0 && saRow <= screen52.getRows() && saCol >= 0 && saCol <= screen52.getCols()) { screen52.goto_XY(saRow,saCol); // now set screen position for output } else { sendNegResponse(NR_REQUEST_ERROR,0x05,0x01,0x22,"invalid row/col order" + " saRow = " + saRow + " saRows = " + screen52.getRows() + " saCol = " + saCol); error = true; } break; case 18: // WEA - Extended Attribute bk.getNextByte(); bk.getNextByte(); break; case 19: // IC - Insert Cursor int icX = bk.getNextByte(); int icY = bk.getNextByte() & 0xff; if (icX >= 0 && icX <= saRows && icY >= 0 && icY <= saCols) {// System.out.println(" IC " + icX + " " + icY); screen52.setPendingInsert(true,icX,icY); } else { sendNegResponse(NR_REQUEST_ERROR,0x05,0x01,0x22," IC/IM position invalid "); error = true; } break; case 20: // MC - Move Cursor int imcX = bk.getNextByte(); int imcY = bk.getNextByte() & 0xff; if (imcX >= 0 && imcX <= saRows && imcY >= 0 && imcY <= saCols) {// System.out.println(" MC " + imcX + " " + imcY); screen52.setPendingInsert(false,imcX,imcY); } else { sendNegResponse(NR_REQUEST_ERROR,0x05,0x01,0x22," IC/IM position invalid "); error = true; } break; case 21: // WTDSF - Write To Display Structured Field order error = writeToDisplayStructuredField(); break; case 29: // SF - Start of Field int fcw1 = 0; int fcw2 = 0; int ffw1 = 0; int ffw0 = bk.getNextByte() & 0xff; // FFW if ((ffw0 & 0x40) == 0x40) { ffw1 = bk.getNextByte() & 0xff; // FFW 1 fcw1 = bk.getNextByte() & 0xff; // check for field control word // check if the first fcw1 is an 0x81 if it is then get the // next pair for checking if (fcw1 == 0x81) { bk.getNextByte(); fcw1 = bk.getNextByte() & 0xff; // check for field control word } if (!isAttribute(fcw1)) { fcw2 = bk.getNextByte() & 0xff; // FCW 2 attr = bk.getNextByte() & 0xff; // attribute field while(!isAttribute(attr)) { System.out.print(Integer.toHexString(fcw1) + " " + Integer.toHexString(fcw2) + " "); System.out.println(Integer.toHexString(attr) + " " + Integer.toHexString(bk.getNextByte() & 0xff));// bk.getNextByte(); attr = bk.getNextByte() & 0xff; // attribute field } } else { attr = fcw1; // attribute of field fcw1 = 0; } } else { attr = ffw0; } int fLength = (bk.getNextByte() & 0xff) << 8 | bk.getNextByte() & 0xff; screen52.addField(attr,fLength, ffw0,ffw1,fcw1,fcw2); break; default: // all others must be output to screen byte byte0 = bk.getByteOffset(-1); if (isAttribute(byte0)) { screen52.setAttr(byte0); } else { if (!screen52.isStatusErrorCode()) { if (!isDataEBCDIC(byte0)) {// if (byte0 == 255) {// sendNegResponse(NR_REQUEST_ERROR,0x05,0x01,0x42,// " Attempt to send FF to screen");// }// else screen52.setChar(byte0); } else //LDC - 13/02/2003 - Convert it to unicode //screen52.setChar(getASCIIChar(byte0)); screen52.setChar(codePage.ebcdic2uni(byte0)); } else { if (byte0 == 0) screen52.setChar(byte0); else //LDC - 13/02/2003 - Convert it to unicode //screen52.setChar(getASCIIChar(byte0)); screen52.setChar(codePage.ebcdic2uni(byte0)); } } break; } if (error) done = true; } } catch (Exception e) { System.out.println("write to display " + e.getMessage()); }; processCC1(control1); return error; }
windowDefined = true;
private boolean writeToDisplayStructuredField() { boolean error = false; boolean done = false; int nextone; try { int length = (( bk.getNextByte() & 0xff )<< 8 | (bk.getNextByte() & 0xff)); while (!done) { int s = bk.getNextByte() & 0xff; switch (s) { case 0xD9: // Class Type 0xD9 - Create Window switch (bk.getNextByte()) {// case 0x50: // Define Selection Field//// defineSelectionField(length);// done = true;// break; case 0x51: // Create Window boolean cr = false; int rows = 0; int cols = 0; // pull down not supported yet if ((bk.getNextByte() & 0x80) == 0x80) cr = true; // restrict cursor bk.getNextByte(); // get reserved field pos 6 bk.getNextByte(); // get reserved field pos 7 rows = bk.getNextByte(); // get window depth rows pos 8 cols = bk.getNextByte(); // get window width cols pos 9 length -= 9; if (length == 0) { done = true;// System.out.println("Create Window");// System.out.println(" restrict cursor " + cr);// System.out.println(" Depth = " + rows + " Width = " + cols); screen52.createWindow(rows,cols,1,true,32,58, '.', '.', '.', ':', ':', ':', '.', ':'); break; } // pos 10 is Minor Structure int ml = 0; int type = 0; int lastPos = screen52.getLastPos();// if (cr)// screen52.setPendingInsert(true,// screen52.getCurrentRow(),// screen52.getCurrentCol()); int mAttr = 0; int cAttr = 0; while (length > 0) { // get minor length ml = ( bk.getNextByte() & 0xff ); length -= ml; // only normal windows are supported at this time type = bk.getNextByte(); switch (type) { case 0x01 : // Border presentation boolean gui = false; if ((bk.getNextByte() & 0x80) == 0x80) gui = true; mAttr = bk.getNextByte(); cAttr = bk.getNextByte(); char ul = '.'; char upper = '.'; char ur = '.'; char left = ':'; char right = ':'; char ll = ':'; char bottom = '.'; char lr = ':'; // if minor length is greater than 5 then // the border characters are specified if (ml > 5) { ul = codePage.ebcdic2uni(bk.getNextByte());// ul = getASCIIChar(bk.getNextByte()); if (ul == 0) ul = '.'; upper = codePage.ebcdic2uni(bk.getNextByte());// upper = getASCIIChar(bk.getNextByte()); if (upper == 0) upper = '.'; ur = codePage.ebcdic2uni(bk.getNextByte());// ur = getASCIIChar(bk.getNextByte()); if (ur == 0) ur = '.'; left = codePage.ebcdic2uni(bk.getNextByte());// left = getASCIIChar(bk.getNextByte()); if (left == 0) left = ':'; right = codePage.ebcdic2uni(bk.getNextByte());// right = getASCIIChar(bk.getNextByte()); if (right == 0) right = ':'; ll = codePage.ebcdic2uni(bk.getNextByte());// ll = getASCIIChar(bk.getNextByte()); if (ll == 0) ll = ':'; bottom = codePage.ebcdic2uni(bk.getNextByte());// bottom = getASCIIChar(bk.getNextByte()); if (bottom == 0) bottom = '.'; lr = codePage.ebcdic2uni(bk.getNextByte());// lr = getASCIIChar(bk.getNextByte()); if (lr == 0) lr = ':'; }// System.out.println("Create Window");// System.out.println(" restrict cursor " + cr);// System.out.println(" Depth = " + rows + " Width = " + cols);// System.out.println(" type = " + type + " gui = " + gui);// System.out.println(" mono attr = " + mAttr + " color attr = " + cAttr);// System.out.println(" ul = " + ul + " upper = " + upper +// " ur = " + ur +// " left = " + left +// " right = " + right +// " ll = " + ll +// " bottom = " + bottom +// " lr = " + lr// ); screen52.createWindow(rows,cols,type,gui,mAttr,cAttr, ul, upper, ur, left, right, ll, bottom, lr); break; // // The following shows the input for window with a title // // +0000 019A12A0 00000400 00020411 00200107 .......... // +0010 00000018 00000011 06131500 37D95180 ...........R // +0020 00000A24 0D018023 23404040 40404040 ....؃ // +0030 40211000 000000D7 C2C1D9C4 C5D4D67A \uFFFD.....PBARDEMO: // +0040 40D79996 879985A2 A2408281 99408485 Progress bar de // +0050 94961108 1520D5A4 94828599 40968640 mo.Number of // +0060 8595A399 8985A24B 4B4B4B4B 4B7A2011 entries......:. // +0070 082E2040 404040F5 F0F06BF0 F0F02011 . 500,000. // +0080 091520C3 A4999985 95A34085 95A399A8 \uFFFDCurrent entry // +0090 4095A494 8285994B 4B4B7A20 11092E20 number...:.\uFFFD. // +00A0 40404040 4040F56B F0F0F020 110A1520 5,000. // +00B0 D9859481 89958995 87408595 A3998985 Remaining entrie // +00C0 A24B4B4B 4B4B4B7A 20110A2E 20404040 s......:.. // +00D0 40F4F9F5 6BF0F0F0 20110C15 20E2A381 495,000..Sta // +00E0 99A340A3 8994854B 4B4B4B4B 4B4B4B4B rt time......... // +00F0 4B4B4B4B 7A20110C 2F2040F7 7AF5F37A ....:... 7:53: case 0x10 : // Window title/footer byte orientation = bk.getNextByte(); mAttr = bk.getNextByte(); cAttr = bk.getNextByte(); //reserved bk.getNextByte(); ml -= 6; StringBuffer hfBuffer = new StringBuffer(ml); while (ml-- > 0) { //LDC - 13/02/2003 - Convert it to unicode hfBuffer.append(codePage.ebcdic2uni(bk.getNextByte()));// hfBuffer.append(getASCIIChar(bk.getNextByte())); } System.out.println( " orientation " + Integer.toBinaryString(orientation) + " mAttr " + mAttr + " cAttr " + cAttr + " Header/Footer " + hfBuffer); screen52.writeWindowTitle(lastPos, rows, cols, orientation, mAttr, cAttr, hfBuffer); break; default: System.out.println("Invalid Window minor structure"); length = 0; done = true; } } done = true; break; case 0x53: // Scroll Bar int sblen = 15; byte sbflag = bk.getNextByte(); // flag position 5 bk.getNextByte(); // reserved position 6 // position 7,8 int totalRowScrollable = (( bk.getNextByte() & 0xff )<< 8 | (bk.getNextByte() & 0xff)); // position 9,10 int totalColScrollable = (( bk.getNextByte() & 0xff )<< 8 | (bk.getNextByte() & 0xff)); // position 11,12 int sliderRowPos = (( bk.getNextByte() & 0xff )<< 8 | (bk.getNextByte() & 0xff)); // position 13,14 int sliderColPos = (( bk.getNextByte() & 0xff )<< 8 | (bk.getNextByte() & 0xff)); // position 15 int sliderRC = bk.getNextByte(); screen52.createScrollBar(sbflag,totalRowScrollable, totalColScrollable, sliderRowPos, sliderColPos, sliderRC); length -= 15; done = true; break; case 0x5B: // Remove GUI ScrollBar field bk.getNextByte(); // reserved must be set to off pos 5 bk.getNextByte(); // reserved must be set to zero pos 6 done = true; break; case 0x5F: // Remove All GUI Constructs// System.out.println("remove all gui contructs"); int len = 4; int d = 0; length -= s; while (--len > 0) d = bk.getNextByte();// if (length > 0) {// len = (bk.getNextByte() & 0xff )<< 8;//// while (--len > 0)// d = bk.getNextByte();// } screen52.clearGuiStuff(); // per 14.6.13.4 documentation we should clear the // format table after this command screen52.clearTable(); done = true; break; case 0x60: // Erase/Draw Grid Lines - not supported // do not know what they are // as of 03/11/2002 we should not be getting // this anymore but I will leave it here // just in case.// System.out.println("erase/draw grid lines " + length); len = 6; d = 0; length -= 9; while (--len > 0) d = bk.getNextByte(); if (length > 0) { len = (bk.getNextByte() & 0xff )<< 8; while (--len > 0) { d = bk.getNextByte(); } } done = true; break; default: sendNegResponse(NR_REQUEST_ERROR,0x03,0x01,0x01,"invalid wtd structured field sub command " + bk.getByteOffset(-1)); error = true; break; } break; default: sendNegResponse(NR_REQUEST_ERROR,0x03,0x01,0x01, "invalid wtd structured field command " + bk.getByteOffset(-1)); error = true; break; } if (error) done = true; } } catch (Exception e) {}; return error; }
super(); SwingToolkit.add(scrollPane, this); SwingToolkit.copyAwtProperties(scrollPane, this); }
this.scrollPane = scrollPane; SwingToolkit.add(scrollPane, this); SwingToolkit.copyAwtProperties(scrollPane, this); }
public SwingScrollPanePeer(ScrollPane scrollPane) { super(); SwingToolkit.add(scrollPane, this); SwingToolkit.copyAwtProperties(scrollPane, this); }
bad.minor = Minor.Any;
public static TypeMismatch extract(Any any) { try { EmptyExceptionHolder h = (EmptyExceptionHolder) any.extract_Streamable(); return (TypeMismatch) h.value; } catch (ClassCastException cex) { BAD_OPERATION bad = new BAD_OPERATION("TypeMismatch expected"); bad.initCause(cex); throw bad; } }
{
public AccessibleContext getAccessibleContext(){ /* Create the context if this is the first request */ if (accessibleContext == null) { /* Create the context */ accessibleContext = new AccessibleAWTMenuBar(); } return accessibleContext;}
}
public AccessibleContext getAccessibleContext(){ /* Create the context if this is the first request */ if (accessibleContext == null) { /* Create the context */ accessibleContext = new AccessibleAWTMenuBar(); } return accessibleContext;}
getPeer() { return(peer); }
public MenuComponentPeer getPeer() { return peer; }
getPeer(){ return(peer);}
getToolkit() { return(toolkit); }
final Toolkit getToolkit() { return toolkit; }
getToolkit(){ return(toolkit);}
setPeer(MenuComponentPeer peer) {
final void setPeer(MenuComponentPeer peer) {
setPeer(MenuComponentPeer peer){ this.peer = peer;}
removeNotify() {
public void removeNotify() {
removeNotify(){ if (peer != null) peer.dispose(); peer = null;}
int height = getHeight();
int height = getRowHeight(row);
public Rectangle getCellRect(int row, int column, boolean includeSpacing) { int height = getHeight(); int width = columnModel.getColumn(column).getWidth(); int x_gap = columnModel.getColumnMargin(); int y_gap = rowMargin; column = Math.max(0, Math.min(column, getColumnCount() - 1)); row = Math.max(0, Math.min(row, getRowCount() - 1)); int x = 0; int y = (height + y_gap) * row; for (int i = 0; i < column; ++i) { x += columnModel.getColumn(i).getWidth(); x += x_gap; } if (includeSpacing) return new Rectangle(x, y, width, height); else return new Rectangle(x, y, width - x_gap, height - y_gap); }
addColumnSelectionInterval(colLead,colLead); addRowSelectionInterval(rowLead, rowLead);
public void selectAll() { setColumnSelectionInterval(0, getColumnCount() - 1); setRowSelectionInterval(0, getRowCount() - 1); }
public JSpinner(SpinnerModel model)
public JSpinner()
public JSpinner(SpinnerModel model) { this.model = model; model.addChangeListener(listener); setEditor(createEditor(model)); updateUI(); }
this.model = model; model.addChangeListener(listener); setEditor(createEditor(model)); updateUI();
this(new SpinnerNumberModel());
public JSpinner(SpinnerModel model) { this.model = model; model.addChangeListener(listener); setEditor(createEditor(model)); updateUI(); }
public DateFormatter(DateFormat format)
public DateFormatter()
public DateFormatter(DateFormat format) { super(); setFormat(format); }
super(); setFormat(format);
this(DateFormat.getDateInstance());
public DateFormatter(DateFormat format) { super(); setFormat(format); }
void installDefaults(JComponent c)
protected void installDefaults(JComponent c)
void installDefaults(JComponent c) { c.setOpaque(true); }
c.setBackground(UIManager.getColor("Viewport.background"));
void installDefaults(JComponent c) { c.setOpaque(true); }
installListeners(c);
installDefaults(c);
public void installUI(JComponent c) { super.installUI(c); installListeners(c); }
void uninstallDefaults(JComponent c)
protected void uninstallDefaults(JComponent c)
void uninstallDefaults(JComponent c) { }
uninstallListeners(c);
super.uninstallUI(c); uninstallDefaults(c);
public void uninstallUI(JComponent c) { uninstallListeners(c); }
public AccessibleJViewport()
protected AccessibleJViewport()
public AccessibleJViewport() { // Nothing to do here. }
if ((dx != 0 && dy != 0) || damaged)
if ((dx != 0 && dy != 0) || (dy == 0 && dy == 0) || damaged)
protected boolean computeBlit(int dx, int dy, Point blitFrom, Point blitTo, Dimension blitSize, Rectangle blitPaint) { if ((dx != 0 && dy != 0) || damaged) // We cannot blit if the viewport is scrolled in both directions at // once. return false; Rectangle portBounds = SwingUtilities.calculateInnerArea(this, getBounds()); // Compute the blitFrom and blitTo parameters. blitFrom.x = portBounds.x; blitFrom.y = portBounds.y; blitTo.x = portBounds.x; blitTo.y = portBounds.y; if (dy > 0) { blitFrom.y = portBounds.y + dy; } else if (dy < 0) { blitTo.y = portBounds.y - dy; } else if (dx > 0) { blitFrom.x = portBounds.x + dx; } else if (dx < 0) { blitTo.x = portBounds.x - dx; } // Compute size of the blit area. if (dx != 0) { blitSize.width = portBounds.width - Math.abs(dx); blitSize.height = portBounds.height; } else if (dy != 0) { blitSize.width = portBounds.width; blitSize.height = portBounds.height - Math.abs(dy); } // Compute the blitPaint parameter. blitPaint.setBounds(portBounds); if (dy > 0) { blitPaint.y = portBounds.y + portBounds.height - dy; blitPaint.height = dy; } else if (dy < 0) { blitPaint.height = -dy; } if (dx > 0) { blitPaint.x = portBounds.x + portBounds.width - dx; blitPaint.width = dx; } else if (dx < 0) { blitPaint.width = -dx; } return true; }
fd.addItem(LangTool.getString("delm.labelTab"));
fd.addItem(LangTool.getString("delm.labelNone")); if (delimiter.length() > 0) if (delimiter.equals("\t")) fd.setSelectedItem(LangTool.getString("delm.labelTab")); else if (delimiter.equals(" ")) fd.setSelectedItem(LangTool.getString("delm.labelSpace")); else { if (!delimiter.equals(",") && !delimiter.equals(";") && !delimiter.equals(":") && !delimiter.equals("|")) fd.addItem(delimiter); fd.setSelectedItem(delimiter); } else fd.setSelectedItem(LangTool.getString("delm.labelNone"));
public DelimitedDialog(JFrame parent) { JPanel opts = new JPanel(); opts.setBorder(BorderFactory.createTitledBorder( LangTool.getString("delm.labelOptions"))); opts.setLayout(new AlignLayout(2,5,5)); JLabel fdl = new JLabel(LangTool.getString("delm.labelField")); JComboBox fd = new JComboBox(); fd.addItem(","); fd.addItem(";"); fd.addItem(":"); fd.addItem("|"); fd.addItem(LangTool.getString("delm.labelSpace")); fd.addItem(LangTool.getString("delm.labelTab")); fd.setEditable(true); fd.setSelectedIndex(0); JLabel tdl = new JLabel(LangTool.getString("delm.labelText")); JComboBox td = new JComboBox(); td.addItem("\""); td.addItem("'"); td.setEditable(true); td.setSelectedIndex(0); opts.add(fdl); opts.add(fd); opts.add(tdl); opts.add(td); Object[] message = new Object[1]; message[0] = opts; String[] options = {UIManager.getString("OptionPane.okButtonText"), UIManager.getString("OptionPane.cancelButtonText")}; int result = JOptionPane.showOptionDialog( parent, // the parent that the dialog blocks message, // the dialog message array LangTool.getString("delm.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 button ); switch(result) { case 0: // change options delimiter = (String)fd.getSelectedItem(); if (delimiter.equals(LangTool.getString("delm.labelSpace"))) delimiter = " "; if (delimiter.equals(LangTool.getString("delm.labelTab"))) delimiter = "\t"; stringQualifier = (String)td.getSelectedItem(); break; case 1: // Cancel // System.out.println("Cancel"); break; default: break; } }
fd.setSelectedIndex(0);
public DelimitedDialog(JFrame parent) { JPanel opts = new JPanel(); opts.setBorder(BorderFactory.createTitledBorder( LangTool.getString("delm.labelOptions"))); opts.setLayout(new AlignLayout(2,5,5)); JLabel fdl = new JLabel(LangTool.getString("delm.labelField")); JComboBox fd = new JComboBox(); fd.addItem(","); fd.addItem(";"); fd.addItem(":"); fd.addItem("|"); fd.addItem(LangTool.getString("delm.labelSpace")); fd.addItem(LangTool.getString("delm.labelTab")); fd.setEditable(true); fd.setSelectedIndex(0); JLabel tdl = new JLabel(LangTool.getString("delm.labelText")); JComboBox td = new JComboBox(); td.addItem("\""); td.addItem("'"); td.setEditable(true); td.setSelectedIndex(0); opts.add(fdl); opts.add(fd); opts.add(tdl); opts.add(td); Object[] message = new Object[1]; message[0] = opts; String[] options = {UIManager.getString("OptionPane.okButtonText"), UIManager.getString("OptionPane.cancelButtonText")}; int result = JOptionPane.showOptionDialog( parent, // the parent that the dialog blocks message, // the dialog message array LangTool.getString("delm.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 button ); switch(result) { case 0: // change options delimiter = (String)fd.getSelectedItem(); if (delimiter.equals(LangTool.getString("delm.labelSpace"))) delimiter = " "; if (delimiter.equals(LangTool.getString("delm.labelTab"))) delimiter = "\t"; stringQualifier = (String)td.getSelectedItem(); break; case 1: // Cancel // System.out.println("Cancel"); break; default: break; } }
td.setSelectedIndex(0);
public DelimitedDialog(JFrame parent) { JPanel opts = new JPanel(); opts.setBorder(BorderFactory.createTitledBorder( LangTool.getString("delm.labelOptions"))); opts.setLayout(new AlignLayout(2,5,5)); JLabel fdl = new JLabel(LangTool.getString("delm.labelField")); JComboBox fd = new JComboBox(); fd.addItem(","); fd.addItem(";"); fd.addItem(":"); fd.addItem("|"); fd.addItem(LangTool.getString("delm.labelSpace")); fd.addItem(LangTool.getString("delm.labelTab")); fd.setEditable(true); fd.setSelectedIndex(0); JLabel tdl = new JLabel(LangTool.getString("delm.labelText")); JComboBox td = new JComboBox(); td.addItem("\""); td.addItem("'"); td.setEditable(true); td.setSelectedIndex(0); opts.add(fdl); opts.add(fd); opts.add(tdl); opts.add(td); Object[] message = new Object[1]; message[0] = opts; String[] options = {UIManager.getString("OptionPane.okButtonText"), UIManager.getString("OptionPane.cancelButtonText")}; int result = JOptionPane.showOptionDialog( parent, // the parent that the dialog blocks message, // the dialog message array LangTool.getString("delm.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 button ); switch(result) { case 0: // change options delimiter = (String)fd.getSelectedItem(); if (delimiter.equals(LangTool.getString("delm.labelSpace"))) delimiter = " "; if (delimiter.equals(LangTool.getString("delm.labelTab"))) delimiter = "\t"; stringQualifier = (String)td.getSelectedItem(); break; case 1: // Cancel // System.out.println("Cancel"); break; default: break; } }
if (stringQualifier.equals(LangTool.getString("delm.labelNone"))) stringQualifier = "";
public DelimitedDialog(JFrame parent) { JPanel opts = new JPanel(); opts.setBorder(BorderFactory.createTitledBorder( LangTool.getString("delm.labelOptions"))); opts.setLayout(new AlignLayout(2,5,5)); JLabel fdl = new JLabel(LangTool.getString("delm.labelField")); JComboBox fd = new JComboBox(); fd.addItem(","); fd.addItem(";"); fd.addItem(":"); fd.addItem("|"); fd.addItem(LangTool.getString("delm.labelSpace")); fd.addItem(LangTool.getString("delm.labelTab")); fd.setEditable(true); fd.setSelectedIndex(0); JLabel tdl = new JLabel(LangTool.getString("delm.labelText")); JComboBox td = new JComboBox(); td.addItem("\""); td.addItem("'"); td.setEditable(true); td.setSelectedIndex(0); opts.add(fdl); opts.add(fd); opts.add(tdl); opts.add(td); Object[] message = new Object[1]; message[0] = opts; String[] options = {UIManager.getString("OptionPane.okButtonText"), UIManager.getString("OptionPane.cancelButtonText")}; int result = JOptionPane.showOptionDialog( parent, // the parent that the dialog blocks message, // the dialog message array LangTool.getString("delm.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 button ); switch(result) { case 0: // change options delimiter = (String)fd.getSelectedItem(); if (delimiter.equals(LangTool.getString("delm.labelSpace"))) delimiter = " "; if (delimiter.equals(LangTool.getString("delm.labelTab"))) delimiter = "\t"; stringQualifier = (String)td.getSelectedItem(); break; case 1: // Cancel // System.out.println("Cancel"); break; default: break; } }
sb.append(vt.getASCIIChar(cByte[f] & 0xff));
sb.append(vt.ebcdic2uni(cByte[f] & 0xff));
public String parseData(byte[] cByte) { if (!translateIt) { return sbdata.toString(); } StringBuffer sb = new StringBuffer(bufferLength); int end = startOffset + length - 1; switch (type) { case 'P': // Packed decimal format // example field of buffer length 4 with decimal precision 0 // output length is (4 * 2) -1 = 7 // // each byte of the buffer contains 2 digits, one in the zone // portion and one in the zone portion of the byte, the last // byte of the field contains the last digit in the ZONE // portion and the sign is contained in the DIGIT portion. // // The number 1234567 would be represented as follows: // byte 1 of 4 -> 12 // byte 2 of 4 -> 34 // byte 3 of 4 -> 56 // byte 4 of 4 -> 7F The F siginifies a positive number // // The number -1234567 would be represented as follows: // byte 1 of 4 -> 12 // byte 2 of 4 -> 34 // byte 3 of 4 -> 56 // byte 4 of 4 -> 7D The D siginifies a negative number // for (int f = startOffset-1;f < end -1; f++) { byte bzd = cByte[f]; int byteZ = (bzd >> 4) & 0x0f ; // get the zone portion int byteD = (bzd & 0x0f); // get the digit portion sb.append(byteZ); // assign the zone portion as the first digit sb.append(byteD); // assign the digit portion as the second digit } // here we obtain the last byte to determine the sign of the field byte bzd = cByte[end-1]; int byteZ = (bzd >> 4) & 0x0f ; // get the zone portion int byteD = (bzd & 0x0f); // get the digit portion sb.append(byteZ); // append the zone portion as the // the last digit of the number // Here we interrogate the the DIGIT portion for the sign // 0x0f = positive -> 0x0f | 0x0d = 0x0f // 0x0d = negative -> 0x0d | 0x0d = 0x0d if ((byteD | 0x0d) == 0x0d) sb.insert(0,'-'); else sb.insert(0,'+'); break; case 'S': // Signed decimal format // example field of buffer length 5 with decimal precision 0 // output length is 5 // // each byte of the buffer contains a digit. The zone portion // contain F for the EBCDIC number not 3 for ASCII, the digit // portion contains the number, the last byte of the field // contains the last digit in the DIGIT portion and the sign is // contained in the ZONE portion. // // The number 12345 would be represented as follows: // byte 1 of 5 -> F1 // byte 2 of 5 -> F2 // byte 3 of 5 -> F3 // byte 4 of 5 -> F4 // byte 5 of 5 -> F5 The F in the zone portion signifies positive // // The number -12345 would be represented as follows: // byte 1 of 5 -> F1 // byte 2 of 5 -> F2 // byte 3 of 5 -> F3 // byte 4 of 5 -> F4 // byte 5 of 5 -> D5 The D in the zone portion signifies negative for (int f = startOffset-1;f < end; f++) { // we only take the digit portion of the byte sb.append((cByte[f] & 0x0f)); } // Here we interrogate the the ZONE portion for the sign // 0xf0 = positive -> 0xf5 & 0xf0 = 0xf0 // 0xd0 = negative -> 0xd5 & 0xf0 = 0xd0 if ((cByte[end - 1] & 0xf0) == 0xd0) sb.insert(0,'-'); else sb.insert(0,'+'); break; default: for (int f = startOffset-1;f < end; f++) { sb.append(vt.getASCIIChar(cByte[f] & 0xff)); } } if (decPos > 0) { int o = sb.length(); sb.insert(o - decPos,decChar); } data = sb.toString(); return data; }
this.className = className;
myClassName = className;
public DocFlavor(String mimeType, String className) { if (mimeType == null || className == null) throw new NullPointerException(); parseMimeType(mimeType); this.className = className; }
return (String) params.get(paramName);
return (String) params.get(paramName.toLowerCase());
public String getParameter(String paramName) { if (paramName == null) throw new NullPointerException(); return (String) params.get(paramName); }
return className;
return myClassName;
public String getRepresentationClassName() { return className; }
* className.hashCode()) ^ params.hashCode());
* myClassName.hashCode()) ^ params.hashCode());
public int hashCode() { return ((mediaType.hashCode() * mediaSubtype.hashCode() * className.hashCode()) ^ params.hashCode()); }
int MEDIA = 1; int MEDIASUB = 2; int PARAM_NAME = 3; int PARAM_VALUE = 4; int COMMENT_START = 5;
private void parseMimeType(String mimeType) { // FIXME: This method is know to be not completely correct, but it works for now. int pos = mimeType.indexOf(';'); if (pos != -1) { String tmp = mimeType.substring(pos + 2); mimeType = mimeType.substring(0, pos); pos = tmp.indexOf('='); params.put(tmp.substring(0, pos), tmp.substring(pos + 1)); } pos = mimeType.indexOf('/'); if (pos == -1) throw new IllegalArgumentException(); mediaType = mimeType.substring(0, pos); mediaSubtype = mimeType.substring(pos + 1); }
int pos = mimeType.indexOf(';');
int state = 0; int lastState = 0; int tok; try { String paramName = null; StreamTokenizer in = new StreamTokenizer(new StringReader(mimeType)); in.resetSyntax(); in.whitespaceChars(0x00, 0x20); in.whitespaceChars(0x7F, 0x7F); in.wordChars('A', 'Z'); in.wordChars('a', 'z'); in.wordChars('0', '9'); in.wordChars(0xA0, 0xFF); in.wordChars(0x21, 0x21); in.wordChars(0x23, 0x27); in.wordChars(0x2A, 0x2B); in.wordChars(0x2D, 0x2E); in.wordChars(0x5E, 0x60); in.wordChars(0x7B, 0x7E); in.quoteChar('"');
private void parseMimeType(String mimeType) { // FIXME: This method is know to be not completely correct, but it works for now. int pos = mimeType.indexOf(';'); if (pos != -1) { String tmp = mimeType.substring(pos + 2); mimeType = mimeType.substring(0, pos); pos = tmp.indexOf('='); params.put(tmp.substring(0, pos), tmp.substring(pos + 1)); } pos = mimeType.indexOf('/'); if (pos == -1) throw new IllegalArgumentException(); mediaType = mimeType.substring(0, pos); mediaSubtype = mimeType.substring(pos + 1); }
if (pos != -1)
while ((tok = in.nextToken()) != StreamTokenizer.TT_EOF) { switch (tok) { case StreamTokenizer.TT_WORD: if (state == 0) { mediaType = in.sval.toLowerCase(); state = MEDIA; break; } if (state == MEDIA) { mediaSubtype = in.sval.toLowerCase(); state = MEDIASUB; break; } if (state == MEDIASUB || state == PARAM_VALUE) { paramName = in.sval.toLowerCase(); state = PARAM_NAME; break; } if (state == PARAM_NAME) { String paramValue = in.sval; if (paramName.equals("charset")) paramValue = paramValue.toLowerCase(); state = PARAM_VALUE; params.put(paramName, paramValue); break; } if (state == COMMENT_START) { break; } break; case '/': if (state != MEDIA) throw new IllegalArgumentException(); break; case '=': if (state != PARAM_NAME) throw new IllegalArgumentException(); break; case ';': if (state != MEDIASUB && state != PARAM_VALUE) throw new IllegalArgumentException(); break; case '(': lastState = state; state = COMMENT_START; break; case ')': state = lastState; break; case '"': if (state == PARAM_NAME) { String paramValue = in.sval; if (paramName.equals("charset")) paramValue = paramValue.toLowerCase(); state = PARAM_VALUE; params.put(paramName, paramValue); break; } throw new IllegalArgumentException(); default: throw new IllegalArgumentException(); } } } catch (IOException e)
private void parseMimeType(String mimeType) { // FIXME: This method is know to be not completely correct, but it works for now. int pos = mimeType.indexOf(';'); if (pos != -1) { String tmp = mimeType.substring(pos + 2); mimeType = mimeType.substring(0, pos); pos = tmp.indexOf('='); params.put(tmp.substring(0, pos), tmp.substring(pos + 1)); } pos = mimeType.indexOf('/'); if (pos == -1) throw new IllegalArgumentException(); mediaType = mimeType.substring(0, pos); mediaSubtype = mimeType.substring(pos + 1); }
String tmp = mimeType.substring(pos + 2); mimeType = mimeType.substring(0, pos); pos = tmp.indexOf('='); params.put(tmp.substring(0, pos), tmp.substring(pos + 1));
throw new InternalError("IOException during parsing String " + mimeType);
private void parseMimeType(String mimeType) { // FIXME: This method is know to be not completely correct, but it works for now. int pos = mimeType.indexOf(';'); if (pos != -1) { String tmp = mimeType.substring(pos + 2); mimeType = mimeType.substring(0, pos); pos = tmp.indexOf('='); params.put(tmp.substring(0, pos), tmp.substring(pos + 1)); } pos = mimeType.indexOf('/'); if (pos == -1) throw new IllegalArgumentException(); mediaType = mimeType.substring(0, pos); mediaSubtype = mimeType.substring(pos + 1); }
pos = mimeType.indexOf('/'); if (pos == -1) throw new IllegalArgumentException(); mediaType = mimeType.substring(0, pos); mediaSubtype = mimeType.substring(pos + 1);
private void parseMimeType(String mimeType) { // FIXME: This method is know to be not completely correct, but it works for now. int pos = mimeType.indexOf(';'); if (pos != -1) { String tmp = mimeType.substring(pos + 2); mimeType = mimeType.substring(0, pos); pos = tmp.indexOf('='); params.put(tmp.substring(0, pos), tmp.substring(pos + 1)); } pos = mimeType.indexOf('/'); if (pos == -1) throw new IllegalArgumentException(); mediaType = mimeType.substring(0, pos); mediaSubtype = mimeType.substring(pos + 1); }
return getMimeType();
return getMimeType() + "; class=\"" + getRepresentationClassName() + "\"";
public String toString() { return getMimeType(); }
if (getSizeButtonsToSameWidth())
if (syncAllWidths)
public void layoutContainer(Container container) { Component[] buttonList = container.getComponents(); int x = container.getInsets().left; if (getCentersChildren()) x += (int) ((double) (container.getSize().width) / 2 - (double) (buttonRowLength(container)) / 2); for (int i = 0; i < buttonList.length; i++) { Dimension dims = buttonList[i].getPreferredSize(); if (getSizeButtonsToSameWidth()) { buttonList[i].setBounds(x, 0, widthOfWidestButton, dims.height); x += widthOfWidestButton + getPadding(); } else { buttonList[i].setBounds(x, 0, dims.width, dims.height); x += dims.width + getPadding(); } } }
optionPane.invalidate();
public void setCentersChildren(boolean newValue) { centersChildren = newValue; optionPane.invalidate(); }
optionPane.invalidate();
public void setPadding(int newPadding) { padding = newPadding; optionPane.invalidate(); }
optionPane.invalidate();
public void setSyncAllWidths(boolean newValue) { syncAllWidths = newValue; optionPane.invalidate(); }
return (Container) Box.createVerticalStrut(17);
return null;
protected Container createSeparator() { return (Container) Box.createVerticalStrut(17); }
channel = new VMChannel(); channel.initSocket(false);
protected DatagramChannelImpl (SelectorProvider provider) throws IOException { super (provider); socket = new NIODatagramSocket (new PlainDatagramSocketImpl(), this); configureBlocking(true); }
socket.connect (remote);
try { channel.connect((InetSocketAddress) remote, 0); } catch (ClassCastException cce) { throw new IOException("unsupported socked address type"); }
public DatagramChannel connect (SocketAddress remote) throws IOException { if (!isOpen()) throw new ClosedChannelException(); socket.connect (remote); return this; }
socket.disconnect ();
channel.disconnect();
public DatagramChannel disconnect () throws IOException { socket.disconnect (); return this; }
socket.close ();
channel.close();
protected void implCloseSelectableChannel () throws IOException { socket.close (); }
socket.setSoTimeout (blocking ? 0 : NIOConstants.DEFAULT_TIMEOUT);
channel.setBlocking(blocking);
protected void implConfigureBlocking (boolean blocking) throws IOException { socket.setSoTimeout (blocking ? 0 : NIOConstants.DEFAULT_TIMEOUT); }
return socket.isConnected ();
try { return channel.getPeerAddress() != null; } catch (IOException ioe) { return false; }
public boolean isConnected () { return socket.isConnected (); }
int remaining = dst.remaining(); receive (dst); return remaining - dst.remaining();
return channel.read(dst);
public int read (ByteBuffer dst) throws IOException { if (!isConnected ()) throw new NotYetConnectedException (); int remaining = dst.remaining(); receive (dst); return remaining - dst.remaining(); }
DatagramPacket packet; int len = dst.remaining(); if (dst.hasArray()) { packet = new DatagramPacket (dst.array(), dst.arrayOffset() + dst.position(), len); } else { packet = new DatagramPacket (new byte [len], len);
begin(); return channel.receive(dst); } finally { end(true); }
public SocketAddress receive (ByteBuffer dst) throws IOException { if (!isOpen()) throw new ClosedChannelException(); try { DatagramPacket packet; int len = dst.remaining(); if (dst.hasArray()) { packet = new DatagramPacket (dst.array(), dst.arrayOffset() + dst.position(), len); } else { packet = new DatagramPacket (new byte [len], len); } boolean completed = false; try { begin(); setInChannelOperation(true); socket.receive (packet); completed = true; } finally { end (completed); setInChannelOperation(false); } if (!dst.hasArray()) { dst.put (packet.getData(), packet.getOffset(), packet.getLength()); } else { dst.position (dst.position() + packet.getLength()); } return packet.getSocketAddress(); } catch (SocketTimeoutException e) { return null; } }
boolean completed = false; try { begin(); setInChannelOperation(true); socket.receive (packet); completed = true; } finally { end (completed); setInChannelOperation(false); } if (!dst.hasArray()) { dst.put (packet.getData(), packet.getOffset(), packet.getLength()); } else { dst.position (dst.position() + packet.getLength()); } return packet.getSocketAddress(); } catch (SocketTimeoutException e) { return null; } }
public SocketAddress receive (ByteBuffer dst) throws IOException { if (!isOpen()) throw new ClosedChannelException(); try { DatagramPacket packet; int len = dst.remaining(); if (dst.hasArray()) { packet = new DatagramPacket (dst.array(), dst.arrayOffset() + dst.position(), len); } else { packet = new DatagramPacket (new byte [len], len); } boolean completed = false; try { begin(); setInChannelOperation(true); socket.receive (packet); completed = true; } finally { end (completed); setInChannelOperation(false); } if (!dst.hasArray()) { dst.put (packet.getData(), packet.getOffset(), packet.getLength()); } else { dst.position (dst.position() + packet.getLength()); } return packet.getSocketAddress(); } catch (SocketTimeoutException e) { return null; } }
if (target instanceof InetSocketAddress && ((InetSocketAddress) target).isUnresolved())
if (!(target instanceof InetSocketAddress)) throw new IOException("can only send to inet socket addresses"); InetSocketAddress dst = (InetSocketAddress) target; if (dst.isUnresolved())
public int send (ByteBuffer src, SocketAddress target) throws IOException { if (!isOpen()) throw new ClosedChannelException(); if (target instanceof InetSocketAddress && ((InetSocketAddress) target).isUnresolved()) throw new IOException("Target address not resolved"); byte[] buffer; int offset = 0; int len = src.remaining(); if (src.hasArray()) { buffer = src.array(); offset = src.arrayOffset() + src.position(); } else { buffer = new byte [len]; src.get (buffer); } DatagramPacket packet = new DatagramPacket (buffer, offset, len, target); boolean completed = false; try { begin(); setInChannelOperation(true); socket.send(packet); completed = true; } finally { end (completed); setInChannelOperation(false); } if (src.hasArray()) { src.position (src.position() + len); } return len; }
byte[] buffer; int offset = 0; int len = src.remaining(); if (src.hasArray()) { buffer = src.array(); offset = src.arrayOffset() + src.position(); } else { buffer = new byte [len]; src.get (buffer);
return channel.send(src, dst);
public int send (ByteBuffer src, SocketAddress target) throws IOException { if (!isOpen()) throw new ClosedChannelException(); if (target instanceof InetSocketAddress && ((InetSocketAddress) target).isUnresolved()) throw new IOException("Target address not resolved"); byte[] buffer; int offset = 0; int len = src.remaining(); if (src.hasArray()) { buffer = src.array(); offset = src.arrayOffset() + src.position(); } else { buffer = new byte [len]; src.get (buffer); } DatagramPacket packet = new DatagramPacket (buffer, offset, len, target); boolean completed = false; try { begin(); setInChannelOperation(true); socket.send(packet); completed = true; } finally { end (completed); setInChannelOperation(false); } if (src.hasArray()) { src.position (src.position() + len); } return len; }
DatagramPacket packet = new DatagramPacket (buffer, offset, len, target); boolean completed = false; try { begin(); setInChannelOperation(true); socket.send(packet); completed = true; } finally { end (completed); setInChannelOperation(false); } if (src.hasArray()) { src.position (src.position() + len); } return len; }
public int send (ByteBuffer src, SocketAddress target) throws IOException { if (!isOpen()) throw new ClosedChannelException(); if (target instanceof InetSocketAddress && ((InetSocketAddress) target).isUnresolved()) throw new IOException("Target address not resolved"); byte[] buffer; int offset = 0; int len = src.remaining(); if (src.hasArray()) { buffer = src.array(); offset = src.arrayOffset() + src.position(); } else { buffer = new byte [len]; src.get (buffer); } DatagramPacket packet = new DatagramPacket (buffer, offset, len, target); boolean completed = false; try { begin(); setInChannelOperation(true); socket.send(packet); completed = true; } finally { end (completed); setInChannelOperation(false); } if (src.hasArray()) { src.position (src.position() + len); } return len; }
return send (src, socket.getRemoteSocketAddress());
return channel.write(src);
public int write (ByteBuffer src) throws IOException { if (!isConnected ()) throw new NotYetConnectedException (); return send (src, socket.getRemoteSocketAddress()); }
if (! expect (dateStr, pos, ch))
if (quote_start == -1 && ch == ' ') { int index = pos.getIndex(); int save = index; while (index < dateStr.length() && Character.isWhitespace(dateStr.charAt(index))) ++index; if (index > save) pos.setIndex(index); else { pos.setErrorIndex(index); return null; } } else if (! expect (dateStr, pos, ch))
public Date parse (String dateStr, ParsePosition pos) { int fmt_index = 0; int fmt_max = pattern.length(); calendar.clear(); boolean saw_timezone = false; int quote_start = -1; boolean is2DigitYear = false; try { for (; fmt_index < fmt_max; ++fmt_index) { char ch = pattern.charAt(fmt_index); if (ch == '\'') { int index = pos.getIndex(); if (fmt_index < fmt_max - 1 && pattern.charAt(fmt_index + 1) == '\'') { if (! expect (dateStr, pos, ch)) return null; ++fmt_index; } else quote_start = quote_start < 0 ? fmt_index : -1; continue; } if (quote_start != -1 || ((ch < 'a' || ch > 'z') && (ch < 'A' || ch > 'Z'))) { if (! expect (dateStr, pos, ch)) return null; continue; } // We've arrived at a potential pattern character in the // pattern. int fmt_count = 1; while (++fmt_index < fmt_max && pattern.charAt(fmt_index) == ch) { ++fmt_count; } // We might need to limit the number of digits to parse in // some cases. We look to the next pattern character to // decide. boolean limit_digits = false; if (fmt_index < fmt_max && standardChars.indexOf(pattern.charAt(fmt_index)) >= 0) limit_digits = true; --fmt_index; // We can handle most fields automatically: most either are // numeric or are looked up in a string vector. In some cases // we need an offset. When numeric, `offset' is added to the // resulting value. When doing a string lookup, offset is the // initial index into the string array. int calendar_field; boolean is_numeric = true; int offset = 0; boolean maybe2DigitYear = false; boolean oneBasedHour = false; boolean oneBasedHourOfDay = false; Integer simpleOffset; String[] set1 = null; String[] set2 = null; switch (ch) { case 'd': calendar_field = Calendar.DATE; break; case 'D': calendar_field = Calendar.DAY_OF_YEAR; break; case 'F': calendar_field = Calendar.DAY_OF_WEEK_IN_MONTH; break; case 'E': is_numeric = false; offset = 1; calendar_field = Calendar.DAY_OF_WEEK; set1 = formatData.getWeekdays(); set2 = formatData.getShortWeekdays(); break; case 'w': calendar_field = Calendar.WEEK_OF_YEAR; break; case 'W': calendar_field = Calendar.WEEK_OF_MONTH; break; case 'M': calendar_field = Calendar.MONTH; if (fmt_count <= 2) offset = -1; else { is_numeric = false; set1 = formatData.getMonths(); set2 = formatData.getShortMonths(); } break; case 'y': calendar_field = Calendar.YEAR; if (fmt_count <= 2) maybe2DigitYear = true; break; case 'K': calendar_field = Calendar.HOUR; break; case 'h': calendar_field = Calendar.HOUR; oneBasedHour = true; break; case 'H': calendar_field = Calendar.HOUR_OF_DAY; break; case 'k': calendar_field = Calendar.HOUR_OF_DAY; oneBasedHourOfDay = true; break; case 'm': calendar_field = Calendar.MINUTE; break; case 's': calendar_field = Calendar.SECOND; break; case 'S': calendar_field = Calendar.MILLISECOND; break; case 'a': is_numeric = false; calendar_field = Calendar.AM_PM; set1 = formatData.getAmPmStrings(); break; case 'z': case 'Z': // We need a special case for the timezone, because it // uses a different data structure than the other cases. is_numeric = false; calendar_field = Calendar.ZONE_OFFSET; String[][] zoneStrings = formatData.getZoneStrings(); int zoneCount = zoneStrings.length; int index = pos.getIndex(); boolean found_zone = false; simpleOffset = computeOffset(dateStr.substring(index), pos); if (simpleOffset != null) { found_zone = true; saw_timezone = true; calendar.set(Calendar.DST_OFFSET, 0); offset = simpleOffset.intValue(); } else { for (int j = 0; j < zoneCount; j++) { String[] strings = zoneStrings[j]; int k; for (k = 0; k < strings.length; ++k) { if (dateStr.startsWith(strings[k], index)) break; } if (k != strings.length) { found_zone = true; saw_timezone = true; TimeZone tz = TimeZone.getTimeZone (strings[0]); // Check if it's a DST zone or ordinary if(k == 3 || k == 4) calendar.set (Calendar.DST_OFFSET, tz.getDSTSavings()); else calendar.set (Calendar.DST_OFFSET, 0); offset = tz.getRawOffset (); pos.setIndex(index + strings[k].length()); break; } } } if (! found_zone) { pos.setErrorIndex(pos.getIndex()); return null; } break; default: pos.setErrorIndex(pos.getIndex()); return null; } // Compute the value we should assign to the field. int value; int index = -1; if (is_numeric) { numberFormat.setMinimumIntegerDigits(fmt_count); if (limit_digits) numberFormat.setMaximumIntegerDigits(fmt_count); if (maybe2DigitYear) index = pos.getIndex(); Number n = numberFormat.parse(dateStr, pos); if (pos == null || ! (n instanceof Long)) return null; value = n.intValue() + offset; } else if (set1 != null) { index = pos.getIndex(); int i; boolean found = false; for (i = offset; i < set1.length; ++i) { if (set1[i] != null) if (dateStr.toUpperCase().startsWith(set1[i].toUpperCase(), index)) { found = true; pos.setIndex(index + set1[i].length()); break; } } if (!found && set2 != null) { for (i = offset; i < set2.length; ++i) { if (set2[i] != null) if (dateStr.toUpperCase().startsWith(set2[i].toUpperCase(), index)) { found = true; pos.setIndex(index + set2[i].length()); break; } } } if (!found) { pos.setErrorIndex(index); return null; } value = i; } else value = offset; if (maybe2DigitYear) { // Parse into default century if the numeric year string has // exactly 2 digits. int digit_count = pos.getIndex() - index; if (digit_count == 2) { is2DigitYear = true; value += defaultCentury; } } // Calendar uses 0-based hours. // I.e. 00:00 AM is midnight, not 12 AM or 24:00 if (oneBasedHour && value == 12) value = 0; if (oneBasedHourOfDay && value == 24) value = 0; // Assign the value and move on. calendar.set(calendar_field, value); } if (is2DigitYear) { // Apply the 80-20 heuristic to dermine the full year based on // defaultCenturyStart. int year = calendar.get(Calendar.YEAR); if (calendar.getTime().compareTo(defaultCenturyStart) < 0) calendar.set(Calendar.YEAR, year + 100); } if (! saw_timezone) { // Use the real rules to determine whether or not this // particular time is in daylight savings. calendar.clear (Calendar.DST_OFFSET); calendar.clear (Calendar.ZONE_OFFSET); } return calendar.getTime(); } catch (IllegalArgumentException x) { pos.setErrorIndex(pos.getIndex()); return null; } }
public GregorianCalendar(Locale locale)
public GregorianCalendar()
public GregorianCalendar(Locale locale) { this(TimeZone.getDefault(), locale); }
this(TimeZone.getDefault(), locale);
this(TimeZone.getDefault(), Locale.getDefault());
public GregorianCalendar(Locale locale) { this(TimeZone.getDefault(), locale); }
return numberFormat.equals(d.numberFormat);
return false;
public boolean equals (Object obj) { if (!(obj instanceof DateFormat)) return false; DateFormat d = (DateFormat) obj; return numberFormat.equals(d.numberFormat); }
public ISO9660Entry(EntryRecord entry) { this.CDFSentry = entry; }
public ISO9660Entry(ISO9660FileSystem fs, EntryRecord entry) { this.fs = fs; this.entryRecord = entry; }
public ISO9660Entry(EntryRecord entry) { this.CDFSentry = entry; }
public EntryRecord getCDFSentry() { return CDFSentry; }
public EntryRecord getCDFSentry() { return entryRecord; }
public EntryRecord getCDFSentry() { return CDFSentry; }
public FileSystem getFileSystem() { return null; }
public FileSystem getFileSystem() { return fs; }
public FileSystem getFileSystem() { return null; }
public String getName() { return CDFSentry.getFileIdentifier(); }
public String getName() { return entryRecord.getFileIdentifier(); }
public String getName() { return CDFSentry.getFileIdentifier(); }
public boolean isDirectory() { return CDFSentry.isDirectory(); }
public boolean isDirectory() { return entryRecord.isDirectory(); }
public boolean isDirectory() { return CDFSentry.isDirectory(); }
public boolean isFile() { return !CDFSentry.isDirectory(); }
public boolean isFile() { return !entryRecord.isDirectory(); }
public boolean isFile() { return !CDFSentry.isDirectory(); }
public void setCDFSentry(EntryRecord sentry) { CDFSentry = sentry; }
public void setCDFSentry(EntryRecord sentry) { entryRecord = sentry; }
public void setCDFSentry(EntryRecord sentry) { CDFSentry = sentry; }
exceptionListener = (listener != null) ? listener : new ExceptionListener() { public void exceptionThrown(Exception e) { System.err.println("exception thrown: " + e); } };
exceptionListener = (listener != null) ? listener : DefaultExceptionListener.INSTANCE;
public void setExceptionListener(ExceptionListener listener) { exceptionListener = (listener != null) ? listener : new ExceptionListener() { public void exceptionThrown(Exception e) { System.err.println("exception thrown: " + e); } }; }
public Expression(Object target, String methodName, Object[] arguments)
public Expression(Object value, Object target, String methodName, Object[] arguments)
public Expression(Object target, String methodName, Object[] arguments) { super(target, methodName, arguments); this.value = UNSET; }
this.value = UNSET;
this.value = value;
public Expression(Object target, String methodName, Object[] arguments) { super(target, methodName, arguments); this.value = UNSET; }
insets = new Insets(0, 0, 0, 0);
top = 0; bottom = 0; left = 0; right = 0;
public CompositeView(Element element) { super(element); children = new View[0]; insets = new Insets(0, 0, 0, 0); }
return (short) insets.bottom;
return bottom;
protected short getBottomInset() { return (short) insets.bottom; }
inside.x = alloc.x + insets.left; inside.y = alloc.y + insets.top; inside.width = alloc.width - insets.left - insets.right; inside.height = alloc.height - insets.top - insets.bottom;
inside.x = alloc.x + left; inside.y = alloc.y + top; inside.width = alloc.width - left - right; inside.height = alloc.height - top - bottom;
protected Rectangle getInsideAllocation(Shape a) { if (a == null) return null; Rectangle alloc = a.getBounds(); // Initialize the inside allocation rectangle. This is done inside // a synchronized block in order to avoid multiple threads creating // this instance simultanously. Rectangle inside; synchronized(this) { inside = insideAllocation; if (inside == null) { inside = new Rectangle(); insideAllocation = inside; } } inside.x = alloc.x + insets.left; inside.y = alloc.y + insets.top; inside.width = alloc.width - insets.left - insets.right; inside.height = alloc.height - insets.top - insets.bottom; return inside; }
return (short) insets.left;
return left;
protected short getLeftInset() { return (short) insets.left; }
return (short) insets.right;
return right;
protected short getRightInset() { return (short) insets.right; }
return (short) insets.top;
return top;
protected short getTopInset() { return (short) insets.top; }
View view = children[i];
if (i >= 0 && i < getViewCount() && a != null) { view = getView(i);
protected View getViewAtPosition(int pos, Rectangle a) { int i = getViewIndexAtPosition(pos); View view = children[i]; childAllocation(i, a); return view; }
}
protected View getViewAtPosition(int pos, Rectangle a) { int i = getViewIndexAtPosition(pos); View view = children[i]; childAllocation(i, a); return view; }
if (b == Position.Bias.Backward && pos != 0)
if (b == Position.Bias.Backward)
public int getViewIndex(int pos, Position.Bias b) { if (b == Position.Bias.Backward && pos != 0) pos -= 1; return getViewIndexAtPosition(pos); }
return getViewIndexAtPosition(pos);
int i = -1; if (pos >= getStartOffset() && pos < getEndOffset()) i = getViewIndexAtPosition(pos); return i;
public int getViewIndex(int pos, Position.Bias b) { if (b == Position.Bias.Backward && pos != 0) pos -= 1; return getViewIndexAtPosition(pos); }
int index = -1; for (int i = 0; i < children.length; i++) { if (children[i].getStartOffset() <= pos && children[i].getEndOffset() > pos) { index = i; break; } } return index;
Element el = getElement(); return el.getElementIndex(pos);
protected int getViewIndexAtPosition(int pos) { int index = -1; for (int i = 0; i < children.length; i++) { if (children[i].getStartOffset() <= pos && children[i].getEndOffset() > pos) { index = i; break; } } return index; }
replace(0, getViewCount(), newChildren);
replace(0, 0, newChildren);
protected void loadChildren(ViewFactory f) { Element el = getElement(); int count = el.getElementCount(); View[] newChildren = new View[count]; for (int i = 0; i < count; ++i) { Element child = el.getElement(i); View view = f.create(child); newChildren[i] = view; } replace(0, getViewCount(), newChildren); }
int childIndex = getViewIndex(pos, bias); if (childIndex == -1) throw new BadLocationException("Position " + pos + " is not represented by view.", pos);
boolean backward = bias == Position.Bias.Backward; int testpos = backward ? Math.max(0, pos - 1) : pos;
public Shape modelToView(int pos, Shape a, Position.Bias bias) throws BadLocationException { int childIndex = getViewIndex(pos, bias); if (childIndex == -1) throw new BadLocationException("Position " + pos + " is not represented by view.", pos); Shape ret = null; View child = getView(childIndex); Shape childAlloc = getChildAllocation(childIndex, a); if (childAlloc == null) ret = createDefaultLocation(a, bias); Shape result = child.modelToView(pos, childAlloc, bias); if (result != null) ret = result; else ret = createDefaultLocation(a, bias); return ret; }
if (! backward || testpos >= getStartOffset()) { int childIndex = getViewIndexAtPosition(testpos); if (childIndex != -1 && childIndex < getViewCount()) {
public Shape modelToView(int pos, Shape a, Position.Bias bias) throws BadLocationException { int childIndex = getViewIndex(pos, bias); if (childIndex == -1) throw new BadLocationException("Position " + pos + " is not represented by view.", pos); Shape ret = null; View child = getView(childIndex); Shape childAlloc = getChildAllocation(childIndex, a); if (childAlloc == null) ret = createDefaultLocation(a, bias); Shape result = child.modelToView(pos, childAlloc, bias); if (result != null) ret = result; else ret = createDefaultLocation(a, bias); return ret; }
if (childAlloc == null) ret = createDefaultLocation(a, bias); Shape result = child.modelToView(pos, childAlloc, bias); if (result != null) ret = result;
if (childAlloc != null) { ret = child.modelToView(pos, childAlloc, bias); if (ret == null && child.getEndOffset() == pos) { childIndex++; if (childIndex < getViewCount()) { child = getView(childIndex); childAlloc = getChildAllocation(childIndex, a); ret = child.modelToView(pos, childAlloc, bias); } } } } }
public Shape modelToView(int pos, Shape a, Position.Bias bias) throws BadLocationException { int childIndex = getViewIndex(pos, bias); if (childIndex == -1) throw new BadLocationException("Position " + pos + " is not represented by view.", pos); Shape ret = null; View child = getView(childIndex); Shape childAlloc = getChildAllocation(childIndex, a); if (childAlloc == null) ret = createDefaultLocation(a, bias); Shape result = child.modelToView(pos, childAlloc, bias); if (result != null) ret = result; else ret = createDefaultLocation(a, bias); return ret; }
ret = createDefaultLocation(a, bias);
{ throw new BadLocationException("Position " + pos + " is not represented by view.", pos); } }
public Shape modelToView(int pos, Shape a, Position.Bias bias) throws BadLocationException { int childIndex = getViewIndex(pos, bias); if (childIndex == -1) throw new BadLocationException("Position " + pos + " is not represented by view.", pos); Shape ret = null; View child = getView(childIndex); Shape childAlloc = getChildAllocation(childIndex, a); if (childAlloc == null) ret = createDefaultLocation(a, bias); Shape result = child.modelToView(pos, childAlloc, bias); if (result != null) ret = result; else ret = createDefaultLocation(a, bias); return ret; }
}
public void replace(int offset, int length, View[] views) { // Check for null views to add. for (int i = 0; i < views.length; ++i) if (views[i] == null) throw new NullPointerException("Added views must not be null"); int endOffset = offset + length; // First we set the parent of the removed children to null. for (int i = offset; i < endOffset; ++i) children[i].setParent(null); View[] newChildren = new View[children.length - length + views.length]; System.arraycopy(children, 0, newChildren, 0, offset); System.arraycopy(views, 0, newChildren, offset, views.length); System.arraycopy(children, offset + length, newChildren, offset + views.length, children.length - (offset + length)); children = newChildren; // Finally we set the parent of the added children to this. for (int i = 0; i < views.length; ++i) views[i].setParent(this); }
protected void setInsets(short top, short left, short bottom, short right)
protected void setInsets(short t, short l, short b, short r)
protected void setInsets(short top, short left, short bottom, short right) { insets.top = top; insets.left = left; insets.bottom = bottom; insets.right = right; }
insets.top = top; insets.left = left; insets.bottom = bottom; insets.right = right;
top = t; left = l; bottom = b; right = r;
protected void setInsets(short top, short left, short bottom, short right) { insets.top = top; insets.left = left; insets.bottom = bottom; insets.right = right; }
Float l = (Float) attributes.getAttribute(StyleConstants.LeftIndent); short left = 0; if (l != null) left = l.shortValue(); Float r = (Float) attributes.getAttribute(StyleConstants.RightIndent); short right = 0; if (r != null) right = r.shortValue(); Float t = (Float) attributes.getAttribute(StyleConstants.SpaceAbove); short top = 0; if (t != null) top = t.shortValue(); Float b = (Float) attributes.getAttribute(StyleConstants.SpaceBelow); short bottom = 0; if (b != null) bottom = b.shortValue(); setInsets(top, left, bottom, right);
top = (short) StyleConstants.getSpaceAbove(attributes); bottom = (short) StyleConstants.getSpaceBelow(attributes); left = (short) StyleConstants.getLeftIndent(attributes); right = (short) StyleConstants.getRightIndent(attributes);
protected void setParagraphInsets(AttributeSet attributes) { Float l = (Float) attributes.getAttribute(StyleConstants.LeftIndent); short left = 0; if (l != null) left = l.shortValue(); Float r = (Float) attributes.getAttribute(StyleConstants.RightIndent); short right = 0; if (r != null) right = r.shortValue(); Float t = (Float) attributes.getAttribute(StyleConstants.SpaceAbove); short top = 0; if (t != null) top = t.shortValue(); Float b = (Float) attributes.getAttribute(StyleConstants.SpaceBelow); short bottom = 0; if (b != null) bottom = b.shortValue(); setInsets(top, left, bottom, right); }
public int getViewIndex(int pos, Position.Bias b)
public int getViewIndex(float x, float y, Shape allocation)
public int getViewIndex(int pos, Position.Bias b) { return -1; }
if (maxButton != null)
protected void setButtonIcons() { closeButton.setIcon(closeIcon); iconButton.setIcon(iconIcon); maxButton.setIcon(maxIcon); }
if (preferredSize != null) { Dimension prefSize = getPreferredSize(); prefSize.width = Math.max(prefSize.width, minimumSize.width); prefSize.height = Math.max(prefSize.height, minimumSize.height); setPreferredSize(prefSize); } if (maximumSize != null) { Dimension maxSize = getMaximumSize(); maxSize.width = Math.max(maxSize.width, minimumSize.width); maxSize.height = Math.max(maxSize.height, minimumSize.height); setMaximumSize(maxSize); }
public void setMinimumSize(Dimension min) { Dimension oldMinimumSize = minimumSize; minimumSize = min; firePropertyChange("minimumSize", oldMinimumSize, minimumSize); revalidate(); repaint(); // adjust preferred and maximum size accordingly if (preferredSize != null) { Dimension prefSize = getPreferredSize(); prefSize.width = Math.max(prefSize.width, minimumSize.width); prefSize.height = Math.max(prefSize.height, minimumSize.height); setPreferredSize(prefSize); } if (maximumSize != null) { Dimension maxSize = getMaximumSize(); maxSize.width = Math.max(maxSize.width, minimumSize.width); maxSize.height = Math.max(maxSize.height, minimumSize.height); setMaximumSize(maxSize); } }
Dimension size = this.getSize();
Dimension size = getSize(); if (size.width == 0 && size.height == 0) { size = getPreferredSize(); setSize(size); }
public void setVisible(boolean visible) { if (visible == isVisible()) return; boolean old = isVisible(); this.visible = visible; if (old != isVisible()) { firePropertyChange("visible", old, isVisible()); if (visible) { firePopupMenuWillBecomeVisible(); Container rootContainer = (Container) SwingUtilities.getRoot(invoker); Dimension screenSize = getToolkit().getScreenSize(); boolean fit = true; Dimension size = this.getSize(); if ((size.width > (rootContainer.getWidth() - popupLocation.x)) || (size.height > (rootContainer.getHeight() - popupLocation.y))) fit = false; if (lightWeightPopupEnabled && fit) popup = new LightWeightPopup(this); else { if (fit) popup = new MediumWeightPopup(this); else { popup = new HeavyWeightPopup(this); setLightWeightPopupEnabled(false); } } if (popup instanceof LightWeightPopup || popup instanceof MediumWeightPopup) { JLayeredPane layeredPane; layeredPane = SwingUtilities.getRootPane(invoker).getLayeredPane(); Point p = new Point(popupLocation.x, popupLocation.y); if (layeredPane.isShowing()) SwingUtilities.convertPointFromScreen(p, layeredPane); if (size.width + popupLocation.x > screenSize.width) popupLocation.x -= size.width; if (size.height + popupLocation.y > screenSize.height) popupLocation.y -= size.height; popup.show(p.x, p.y, size.width, size.height); } else { // Subtract insets of the top-level container if popup menu's // top-left corner is inside it. Insets insets = rootContainer.getInsets(); if (size.width + popupLocation.x > screenSize.width) popupLocation.x -= size.width; if (size.height + popupLocation.y > screenSize.height) popupLocation.y -= size.height; popup.show(popupLocation.x - insets.left, popupLocation.y - insets.top, size.width, size.height); } } else { firePopupMenuWillBecomeInvisible(); popup.hide(); } } }
bad.minor = Minor.Any;
public static BindingIterator extract(Any a) { try { return ((BindingIteratorHolder) a.extract_Streamable()).value; } catch (ClassCastException ex) { BAD_OPERATION bad = new BAD_OPERATION("Binding iterator expected"); bad.initCause(ex); throw bad; } }
bad.minor = Minor.Any;
public static InvalidValue extract(Any any) { try { EmptyExceptionHolder h = (EmptyExceptionHolder) any.extract_Streamable(); return (InvalidValue) h.value; } catch (ClassCastException cex) { BAD_OPERATION bad = new BAD_OPERATION("InvalidValue expected"); bad.initCause(cex); throw bad; } }
public boolean addAxisValueList (ValueListInterface valueListObj)
public boolean addAxisValueList (ValueList valueListObj)
public boolean addAxisValueList (ValueListInterface valueListObj) { List values = valueListObj.getValues(); // do we have any new values? if (values.size() > 0) { addValueListObj(valueListObj); // append in new values to Parameter obj Iterator iter = values.iterator(); while (iter.hasNext()) { Value thisValue = ((Value) iter.next()); internalAddAxisValue(thisValue); } return true; } else { // safety, needed? hasValueListCompactDescription = false; Log.warnln("Warning: no Values appended, ValueList empty. Parameter unchanged."); return false; } }
public void setAxisValueList (ValueListInterface valueListObj)
public void setAxisValueList (ValueList valueListObj)
public void setAxisValueList (ValueListInterface valueListObj) { resetAxisValues(); addAxisValueList(valueListObj); }
protected boolean addValueListObj (ValueListInterface valueListObj)
protected boolean addValueListObj (ValueList valueListObj)
protected boolean addValueListObj (ValueListInterface valueListObj) { if (valueListObj == null) return false; valueListObjects.add(valueListObj); hasValueListCompactDescription = true; return true; }
ex.printStackTrace();
public InvokeHandler getHandler(String operation, CookieHolder cookie, boolean forwarding_allowed ) throws gnuForwardRequest { if (servant != null) { return servantToHandler(servant); } else { // Use servant locator to locate the servant. if (poa.servant_locator != null) { try { servant = poa.servant_locator.preinvoke(Id, poa, operation, cookie); return servantToHandler(servant); } catch (org.omg.PortableServer.ForwardRequest forw_ex) { if (forwarding_allowed) { throw new gnuForwardRequest(forw_ex.forward_reference); } else { servant = ForwardedServant.create(forw_ex.forward_reference); return servantToHandler(servant); } } } else // Use servant activator to locate the servant. if (poa.applies(ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION) && poa.applies(ServantRetentionPolicyValue.RETAIN) ) { try { poa.activate_object_with_id(Id, servant, forwarding_allowed); servant = poa.id_to_servant(Id); return servantToHandler(servant); } catch (gnuForwardRequest forwarded) { throw forwarded; } catch (Exception ex) { ex.printStackTrace(); BAD_OPERATION bad = new BAD_OPERATION("Unable to activate", 0x5004, CompletionStatus.COMPLETED_NO ); bad.initCause(ex); throw bad; } } else if (poa.default_servant != null) { servant = poa.default_servant; return servantToHandler(servant); } // No servant and no servant manager - throw exception. else { throw new BAD_OPERATION("Unable to activate", 0x5002, CompletionStatus.COMPLETED_NO ); } } }