rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
&& style != WARNING_DIALOG)
&& style != WARNING_DIALOG && style != PLAIN_DIALOG)
public void setWindowDecorationStyle(int style) { if (style != NONE && style != FRAME && style != INFORMATION_DIALOG && style != ERROR_DIALOG && style != COLOR_CHOOSER_DIALOG && style != FILE_CHOOSER_DIALOG && style != QUESTION_DIALOG && style != WARNING_DIALOG) throw new IllegalArgumentException("invalid style"); int oldStyle = windowDecorationStyle; windowDecorationStyle = style; firePropertyChange("windowDecorationStyle", oldStyle, style); }
if (n == null) { Log.warn("in Parameter.addNote(), the Note passed in is null"); return null; }
public Note addNote(Note n) { if (n == null) { Log.warn("in Parameter.addNote(), the Note passed in is null"); return null; } getNoteList().add(n); return n; }
if (v == null) { Log.warn("in Parameter.addValue(), the Value passed in is null"); return null; }
public Value addValue(Value v) { if (v == null) { Log.warn("in Parameter.addValue(), the Value passed in is null"); return null; } getValueList().add(v); return v; }
if (group !=null) {
public ValueGroup addValueGroup (ValueGroup group) { if (group !=null) { //add the group to the groupOwnedHash valueGroupOwnedHash.add(group); return group; } else { Log.warn("in Parameter,addValueGroup(). ValueGroup passed in is null"); return null; } }
} else { Log.warn("in Parameter,addValueGroup(). ValueGroup passed in is null"); return null; }
public ValueGroup addValueGroup (ValueGroup group) { if (group !=null) { //add the group to the groupOwnedHash valueGroupOwnedHash.add(group); return group; } else { Log.warn("in Parameter,addValueGroup(). ValueGroup passed in is null"); return null; } }
cloneObj.valueGroupOwnedHash.add(iter.next());
cloneObj.valueGroupOwnedHash.add(((Group)iter.next()).clone());
public Object clone() throws CloneNotSupportedException { Parameter cloneObj = (Parameter) super.clone(); //deep copy of the valueGroupOwnedHash synchronized (this.valueGroupOwnedHash) { synchronized(cloneObj.valueGroupOwnedHash) { cloneObj.valueGroupOwnedHash = Collections.synchronizedSet(new HashSet(this.valueGroupOwnedHash.size())); Iterator iter = this.valueGroupOwnedHash.iterator(); while (iter.hasNext()) { cloneObj.valueGroupOwnedHash.add(iter.next()); } } } return cloneObj; }
if (group == null) { Log.warn("in Axis,removeValueGroup(). ValueGroup passed in is null"); return false; }
public boolean removeValueGroup(ValueGroup group) { if (group == null) { Log.warn("in Axis,removeValueGroup(). ValueGroup passed in is null"); return false; } return valueGroupOwnedHash.remove(group); }
if (member < 1) throw new IllegalArgumentException("member may not be less than 1");
public CopiesSupported(int member) { super(member); }
return (this.getClass() + "[" + getName() + "]");
return (this.getClass() + "[type=" + getType() + ",name=" + getName() + "]");
public String toString() { return (this.getClass() + "[" + getName() + "]"); }
SwingToolkit.add(sb, this); SwingToolkit.copyAwtProperties(sb, this); setOrientation(sb.getOrientation()); setBlockIncrement(sb.getBlockIncrement()); setUnitIncrement(sb.getUnitIncrement()); setValues(sb.getValue(), sb.getVisibleAmount(), sb.getMinimum(), sb.getMaximum()); }
this.scrollbar = sb; SwingToolkit.add(sb, this); SwingToolkit.copyAwtProperties(sb, this); setOrientation(sb.getOrientation()); setBlockIncrement(sb.getBlockIncrement()); setUnitIncrement(sb.getUnitIncrement()); setValues(sb.getValue(), sb.getVisibleAmount(), sb.getMinimum(), sb .getMaximum()); }
public SwingScrollbarPeer(Scrollbar sb) { SwingToolkit.add(sb, this); SwingToolkit.copyAwtProperties(sb, this); setOrientation(sb.getOrientation()); setBlockIncrement(sb.getBlockIncrement()); setUnitIncrement(sb.getUnitIncrement()); setValues(sb.getValue(), sb.getVisibleAmount(), sb.getMinimum(), sb.getMaximum()); }
Ext2Debugger.debug("INode.getIMode(): "+Ext2Debugger.hexFormat(iMode), 3);
log.debug("INode.getIMode(): "+NumberUtils.hex(iMode));
public int getMode() { int iMode=Ext2Utils.get16(data, 0); Ext2Debugger.debug("INode.getIMode(): "+Ext2Debugger.hexFormat(iMode), 3); return iMode; }
specificDataFormatName = "exponent";
specificDataFormatName = "exponential";
private void init() { specificDataFormatName = "exponent"; //add attributes attribOrder.add(0,"exponent"); attribOrder.add(0,"precision"); attribOrder.add(0, "width"); attribHash.put("exponent", new XMLAttribute( new Integer(0), Constants.INTEGER_TYPE)); attribHash.put("precision", new XMLAttribute(new Integer(0), Constants.INTEGER_TYPE)); attribHash.put("width", new XMLAttribute( new Integer(0), Constants.INTEGER_TYPE)); generateFormatPattern(); }
new Random ().nextBytes(M);
PRNG.getInstance().nextBytes(M);
public boolean selfTest() { final int[] mLen = new int[] { 16, 20, 32, 48, 64 }; final byte[] M = new byte[mLen[mLen.length - 1]]; new Random ().nextBytes(M); final byte[] EM = new byte[1024]; byte[] p; int bs, i, j; for (bs = 256; bs < 1025; bs += 256) { init(bs); for (i = 0; i < mLen.length; i++) { j = mLen[i]; p = pad(M, 0, j); if (j + p.length != blockSize) { new RuntimeException(name()).printStackTrace(System.err); return false; } System.arraycopy(p, 0, EM, 0, p.length); System.arraycopy(M, 0, EM, p.length, j); try { if (p.length != unpad(EM, 0, blockSize)) { new RuntimeException(name()).printStackTrace(System.err); return false; } } catch (WrongPaddingException x) { x.printStackTrace(System.err); return false; } } reset(); } return true; }
Rectangle vr = new Rectangle(); Rectangle ir = new Rectangle(); Rectangle tr = new Rectangle(); FontMetrics fm = getToolkit().getFontMetrics(getFont()); SwingUtilities.layoutCompoundLabel((JLabel) this, fm, getText(), getIcon(), getVerticalAlignment(), getHorizontalAlignment(), getVerticalTextPosition(), getHorizontalTextPosition(), vr, ir, tr, getIconTextGap()); Rectangle cr = ir.union(tr); return new Dimension(cr.width, cr.height);
Dimension size = super.getPreferredSize(); size.width += 3; return size;
public Dimension getPreferredSize() { Rectangle vr = new Rectangle(); Rectangle ir = new Rectangle(); Rectangle tr = new Rectangle(); FontMetrics fm = getToolkit().getFontMetrics(getFont()); SwingUtilities.layoutCompoundLabel((JLabel) this, fm, getText(), getIcon(), getVerticalAlignment(), getHorizontalAlignment(), getVerticalTextPosition(), getHorizontalTextPosition(), vr, ir, tr, getIconTextGap()); Rectangle cr = ir.union(tr); return new Dimension(cr.width, cr.height); }
this.p = p;
this.p = (1. - (p / 100.)) / 3.;
public GrayFilter(boolean b, int p) { this.b = b; //FIXME - HANDLE THIS this.p = p; }
return (int) (p * (0.299 * ((0xff0000 & rgb) >> 16) + 0.587 * ((0xff00 & rgb) >> 8) + 0.114 * (0xff & rgb)));
int alpha = 0xff000000 & rgb; int red = (0xff0000 & rgb) >> 16; int green = (0xff00 & rgb) >> 8; int blue = (0xff & rgb); int gray = (int) ((0.299 * red + 0.587 * green + 0.114 * blue) * p); if (b) gray = Math.min(gray + 128, 255); return gray | gray << 8 | gray << 16 | alpha ;
public int filterRGB(int x, int y, int rgb) { return (int) (p * (0.299 * ((0xff0000 & rgb) >> 16) + 0.587 * ((0xff00 & rgb) >> 8) + 0.114 * (0xff & rgb))); }
Font font) {
Font font,int botOffset) {
public void drawCursor(Screen5250 s,int row, int col, int fmWidth, int fmHeight, boolean insertMode, int crossHair, int cursorSize, Color colorCursor, Color colorBg,Color colorWhite, Font font) {// synchronized (lock) { Graphics2D g2 = getDrawingArea();// if (g2 == null)// return; switch (cursorSize) { case 0: cursor.setRect( fmWidth * (col), (fmHeight * (row + 1)), fmWidth, 1 ); break; case 1: cursor.setRect( fmWidth * (col), (fmHeight * (row + 1) - fmHeight / 2), fmWidth, fmHeight / 2 ); break; case 2: cursor.setRect( fmWidth * (col), (fmHeight * row), fmWidth, fmHeight ); break; } if (insertMode && cursorSize != 1) { cursor.setRect( fmWidth * (col), (fmHeight * (row + 1) - fmHeight / 2), fmWidth, fmHeight / 2 ); } Rectangle r = cursor.getBounds(); r.setSize(r.width,r.height); g2.setColor(colorCursor); g2.setXORMode(colorBg); g2.fill(cursor);// cursorActive = true; s.updateImage(r); switch (crossHair) { case 1: // horizontal g2.drawLine(0,fmHeight * (row + 1),bi.getWidth(null),fmHeight * (row + 1)); s.updateImage(0,fmHeight * (row + 1),bi.getWidth(null),1); break; case 2: // vertical g2.drawLine(r.x,0,r.x,bi.getHeight(null) - fmHeight - fmHeight); s.updateImage(r.x,0,1,bi.getHeight(null) - fmHeight - fmHeight); break; case 3: // horizontal & vertical g2.drawLine(0,fmHeight * (row + 1),bi.getWidth(null),fmHeight * (row + 1)); g2.drawLine(r.x,0,r.x,bi.getHeight(null) - fmHeight - fmHeight); s.updateImage(0,fmHeight * (row + 1),bi.getWidth(null),1); s.updateImage(r.x,0,1,bi.getHeight(null) - fmHeight - fmHeight); break; } g2.dispose(); g2 = getWritingArea(font); g2.setPaint(colorBg); g2.fill(pArea); g2.setColor(colorWhite);// g2.drawString((getRow(lastPos) + 1) + "/" + (getCol(lastPos) + 1)// ,(float)pArea.getX(),// (float)pArea.getY() + fmHeight); g2.drawString((row + 1) + "/" + (col + 1) ,(float)pArea.getX(), (float)pArea.getY() + fmHeight); s.updateImage(pArea.getBounds()); g2.dispose(); // tell waiting threads to wake up// lock.notify();// } }
(fmHeight * (row + 1)),
(fmHeight * (row + 1)) - botOffset,
public void drawCursor(Screen5250 s,int row, int col, int fmWidth, int fmHeight, boolean insertMode, int crossHair, int cursorSize, Color colorCursor, Color colorBg,Color colorWhite, Font font) {// synchronized (lock) { Graphics2D g2 = getDrawingArea();// if (g2 == null)// return; switch (cursorSize) { case 0: cursor.setRect( fmWidth * (col), (fmHeight * (row + 1)), fmWidth, 1 ); break; case 1: cursor.setRect( fmWidth * (col), (fmHeight * (row + 1) - fmHeight / 2), fmWidth, fmHeight / 2 ); break; case 2: cursor.setRect( fmWidth * (col), (fmHeight * row), fmWidth, fmHeight ); break; } if (insertMode && cursorSize != 1) { cursor.setRect( fmWidth * (col), (fmHeight * (row + 1) - fmHeight / 2), fmWidth, fmHeight / 2 ); } Rectangle r = cursor.getBounds(); r.setSize(r.width,r.height); g2.setColor(colorCursor); g2.setXORMode(colorBg); g2.fill(cursor);// cursorActive = true; s.updateImage(r); switch (crossHair) { case 1: // horizontal g2.drawLine(0,fmHeight * (row + 1),bi.getWidth(null),fmHeight * (row + 1)); s.updateImage(0,fmHeight * (row + 1),bi.getWidth(null),1); break; case 2: // vertical g2.drawLine(r.x,0,r.x,bi.getHeight(null) - fmHeight - fmHeight); s.updateImage(r.x,0,1,bi.getHeight(null) - fmHeight - fmHeight); break; case 3: // horizontal & vertical g2.drawLine(0,fmHeight * (row + 1),bi.getWidth(null),fmHeight * (row + 1)); g2.drawLine(r.x,0,r.x,bi.getHeight(null) - fmHeight - fmHeight); s.updateImage(0,fmHeight * (row + 1),bi.getWidth(null),1); s.updateImage(r.x,0,1,bi.getHeight(null) - fmHeight - fmHeight); break; } g2.dispose(); g2 = getWritingArea(font); g2.setPaint(colorBg); g2.fill(pArea); g2.setColor(colorWhite);// g2.drawString((getRow(lastPos) + 1) + "/" + (getCol(lastPos) + 1)// ,(float)pArea.getX(),// (float)pArea.getY() + fmHeight); g2.drawString((row + 1) + "/" + (col + 1) ,(float)pArea.getX(), (float)pArea.getY() + fmHeight); s.updateImage(pArea.getBounds()); g2.dispose(); // tell waiting threads to wake up// lock.notify();// } }
fmHeight / 2
(fmHeight / 2) - botOffset
public void drawCursor(Screen5250 s,int row, int col, int fmWidth, int fmHeight, boolean insertMode, int crossHair, int cursorSize, Color colorCursor, Color colorBg,Color colorWhite, Font font) {// synchronized (lock) { Graphics2D g2 = getDrawingArea();// if (g2 == null)// return; switch (cursorSize) { case 0: cursor.setRect( fmWidth * (col), (fmHeight * (row + 1)), fmWidth, 1 ); break; case 1: cursor.setRect( fmWidth * (col), (fmHeight * (row + 1) - fmHeight / 2), fmWidth, fmHeight / 2 ); break; case 2: cursor.setRect( fmWidth * (col), (fmHeight * row), fmWidth, fmHeight ); break; } if (insertMode && cursorSize != 1) { cursor.setRect( fmWidth * (col), (fmHeight * (row + 1) - fmHeight / 2), fmWidth, fmHeight / 2 ); } Rectangle r = cursor.getBounds(); r.setSize(r.width,r.height); g2.setColor(colorCursor); g2.setXORMode(colorBg); g2.fill(cursor);// cursorActive = true; s.updateImage(r); switch (crossHair) { case 1: // horizontal g2.drawLine(0,fmHeight * (row + 1),bi.getWidth(null),fmHeight * (row + 1)); s.updateImage(0,fmHeight * (row + 1),bi.getWidth(null),1); break; case 2: // vertical g2.drawLine(r.x,0,r.x,bi.getHeight(null) - fmHeight - fmHeight); s.updateImage(r.x,0,1,bi.getHeight(null) - fmHeight - fmHeight); break; case 3: // horizontal & vertical g2.drawLine(0,fmHeight * (row + 1),bi.getWidth(null),fmHeight * (row + 1)); g2.drawLine(r.x,0,r.x,bi.getHeight(null) - fmHeight - fmHeight); s.updateImage(0,fmHeight * (row + 1),bi.getWidth(null),1); s.updateImage(r.x,0,1,bi.getHeight(null) - fmHeight - fmHeight); break; } g2.dispose(); g2 = getWritingArea(font); g2.setPaint(colorBg); g2.fill(pArea); g2.setColor(colorWhite);// g2.drawString((getRow(lastPos) + 1) + "/" + (getCol(lastPos) + 1)// ,(float)pArea.getX(),// (float)pArea.getY() + fmHeight); g2.drawString((row + 1) + "/" + (col + 1) ,(float)pArea.getX(), (float)pArea.getY() + fmHeight); s.updateImage(pArea.getBounds()); g2.dispose(); // tell waiting threads to wake up// lock.notify();// } }
fmHeight
fmHeight - botOffset
public void drawCursor(Screen5250 s,int row, int col, int fmWidth, int fmHeight, boolean insertMode, int crossHair, int cursorSize, Color colorCursor, Color colorBg,Color colorWhite, Font font) {// synchronized (lock) { Graphics2D g2 = getDrawingArea();// if (g2 == null)// return; switch (cursorSize) { case 0: cursor.setRect( fmWidth * (col), (fmHeight * (row + 1)), fmWidth, 1 ); break; case 1: cursor.setRect( fmWidth * (col), (fmHeight * (row + 1) - fmHeight / 2), fmWidth, fmHeight / 2 ); break; case 2: cursor.setRect( fmWidth * (col), (fmHeight * row), fmWidth, fmHeight ); break; } if (insertMode && cursorSize != 1) { cursor.setRect( fmWidth * (col), (fmHeight * (row + 1) - fmHeight / 2), fmWidth, fmHeight / 2 ); } Rectangle r = cursor.getBounds(); r.setSize(r.width,r.height); g2.setColor(colorCursor); g2.setXORMode(colorBg); g2.fill(cursor);// cursorActive = true; s.updateImage(r); switch (crossHair) { case 1: // horizontal g2.drawLine(0,fmHeight * (row + 1),bi.getWidth(null),fmHeight * (row + 1)); s.updateImage(0,fmHeight * (row + 1),bi.getWidth(null),1); break; case 2: // vertical g2.drawLine(r.x,0,r.x,bi.getHeight(null) - fmHeight - fmHeight); s.updateImage(r.x,0,1,bi.getHeight(null) - fmHeight - fmHeight); break; case 3: // horizontal & vertical g2.drawLine(0,fmHeight * (row + 1),bi.getWidth(null),fmHeight * (row + 1)); g2.drawLine(r.x,0,r.x,bi.getHeight(null) - fmHeight - fmHeight); s.updateImage(0,fmHeight * (row + 1),bi.getWidth(null),1); s.updateImage(r.x,0,1,bi.getHeight(null) - fmHeight - fmHeight); break; } g2.dispose(); g2 = getWritingArea(font); g2.setPaint(colorBg); g2.fill(pArea); g2.setColor(colorWhite);// g2.drawString((getRow(lastPos) + 1) + "/" + (getCol(lastPos) + 1)// ,(float)pArea.getX(),// (float)pArea.getY() + fmHeight); g2.drawString((row + 1) + "/" + (col + 1) ,(float)pArea.getX(), (float)pArea.getY() + fmHeight); s.updateImage(pArea.getBounds()); g2.dispose(); // tell waiting threads to wake up// lock.notify();// } }
g2.drawLine(0,fmHeight * (row + 1),bi.getWidth(null),fmHeight * (row + 1)); s.updateImage(0,fmHeight * (row + 1),bi.getWidth(null),1);
g2.drawLine(0,(fmHeight * (row + 1))- botOffset,bi.getWidth(null),(fmHeight * (row + 1))- botOffset); s.updateImage(0,fmHeight * (row + 1)- botOffset,bi.getWidth(null),1);
public void drawCursor(Screen5250 s,int row, int col, int fmWidth, int fmHeight, boolean insertMode, int crossHair, int cursorSize, Color colorCursor, Color colorBg,Color colorWhite, Font font) {// synchronized (lock) { Graphics2D g2 = getDrawingArea();// if (g2 == null)// return; switch (cursorSize) { case 0: cursor.setRect( fmWidth * (col), (fmHeight * (row + 1)), fmWidth, 1 ); break; case 1: cursor.setRect( fmWidth * (col), (fmHeight * (row + 1) - fmHeight / 2), fmWidth, fmHeight / 2 ); break; case 2: cursor.setRect( fmWidth * (col), (fmHeight * row), fmWidth, fmHeight ); break; } if (insertMode && cursorSize != 1) { cursor.setRect( fmWidth * (col), (fmHeight * (row + 1) - fmHeight / 2), fmWidth, fmHeight / 2 ); } Rectangle r = cursor.getBounds(); r.setSize(r.width,r.height); g2.setColor(colorCursor); g2.setXORMode(colorBg); g2.fill(cursor);// cursorActive = true; s.updateImage(r); switch (crossHair) { case 1: // horizontal g2.drawLine(0,fmHeight * (row + 1),bi.getWidth(null),fmHeight * (row + 1)); s.updateImage(0,fmHeight * (row + 1),bi.getWidth(null),1); break; case 2: // vertical g2.drawLine(r.x,0,r.x,bi.getHeight(null) - fmHeight - fmHeight); s.updateImage(r.x,0,1,bi.getHeight(null) - fmHeight - fmHeight); break; case 3: // horizontal & vertical g2.drawLine(0,fmHeight * (row + 1),bi.getWidth(null),fmHeight * (row + 1)); g2.drawLine(r.x,0,r.x,bi.getHeight(null) - fmHeight - fmHeight); s.updateImage(0,fmHeight * (row + 1),bi.getWidth(null),1); s.updateImage(r.x,0,1,bi.getHeight(null) - fmHeight - fmHeight); break; } g2.dispose(); g2 = getWritingArea(font); g2.setPaint(colorBg); g2.fill(pArea); g2.setColor(colorWhite);// g2.drawString((getRow(lastPos) + 1) + "/" + (getCol(lastPos) + 1)// ,(float)pArea.getX(),// (float)pArea.getY() + fmHeight); g2.drawString((row + 1) + "/" + (col + 1) ,(float)pArea.getX(), (float)pArea.getY() + fmHeight); s.updateImage(pArea.getBounds()); g2.dispose(); // tell waiting threads to wake up// lock.notify();// } }
g2.drawLine(0,fmHeight * (row + 1),bi.getWidth(null),fmHeight * (row + 1));
g2.drawLine(0,(fmHeight * (row + 1))- botOffset,bi.getWidth(null),(fmHeight * (row + 1))- botOffset);
public void drawCursor(Screen5250 s,int row, int col, int fmWidth, int fmHeight, boolean insertMode, int crossHair, int cursorSize, Color colorCursor, Color colorBg,Color colorWhite, Font font) {// synchronized (lock) { Graphics2D g2 = getDrawingArea();// if (g2 == null)// return; switch (cursorSize) { case 0: cursor.setRect( fmWidth * (col), (fmHeight * (row + 1)), fmWidth, 1 ); break; case 1: cursor.setRect( fmWidth * (col), (fmHeight * (row + 1) - fmHeight / 2), fmWidth, fmHeight / 2 ); break; case 2: cursor.setRect( fmWidth * (col), (fmHeight * row), fmWidth, fmHeight ); break; } if (insertMode && cursorSize != 1) { cursor.setRect( fmWidth * (col), (fmHeight * (row + 1) - fmHeight / 2), fmWidth, fmHeight / 2 ); } Rectangle r = cursor.getBounds(); r.setSize(r.width,r.height); g2.setColor(colorCursor); g2.setXORMode(colorBg); g2.fill(cursor);// cursorActive = true; s.updateImage(r); switch (crossHair) { case 1: // horizontal g2.drawLine(0,fmHeight * (row + 1),bi.getWidth(null),fmHeight * (row + 1)); s.updateImage(0,fmHeight * (row + 1),bi.getWidth(null),1); break; case 2: // vertical g2.drawLine(r.x,0,r.x,bi.getHeight(null) - fmHeight - fmHeight); s.updateImage(r.x,0,1,bi.getHeight(null) - fmHeight - fmHeight); break; case 3: // horizontal & vertical g2.drawLine(0,fmHeight * (row + 1),bi.getWidth(null),fmHeight * (row + 1)); g2.drawLine(r.x,0,r.x,bi.getHeight(null) - fmHeight - fmHeight); s.updateImage(0,fmHeight * (row + 1),bi.getWidth(null),1); s.updateImage(r.x,0,1,bi.getHeight(null) - fmHeight - fmHeight); break; } g2.dispose(); g2 = getWritingArea(font); g2.setPaint(colorBg); g2.fill(pArea); g2.setColor(colorWhite);// g2.drawString((getRow(lastPos) + 1) + "/" + (getCol(lastPos) + 1)// ,(float)pArea.getX(),// (float)pArea.getY() + fmHeight); g2.drawString((row + 1) + "/" + (col + 1) ,(float)pArea.getX(), (float)pArea.getY() + fmHeight); s.updateImage(pArea.getBounds()); g2.dispose(); // tell waiting threads to wake up// lock.notify();// } }
s.updateImage(0,fmHeight * (row + 1),bi.getWidth(null),1);
s.updateImage(0,(fmHeight * (row + 1)) - botOffset,bi.getWidth(null),1);
public void drawCursor(Screen5250 s,int row, int col, int fmWidth, int fmHeight, boolean insertMode, int crossHair, int cursorSize, Color colorCursor, Color colorBg,Color colorWhite, Font font) {// synchronized (lock) { Graphics2D g2 = getDrawingArea();// if (g2 == null)// return; switch (cursorSize) { case 0: cursor.setRect( fmWidth * (col), (fmHeight * (row + 1)), fmWidth, 1 ); break; case 1: cursor.setRect( fmWidth * (col), (fmHeight * (row + 1) - fmHeight / 2), fmWidth, fmHeight / 2 ); break; case 2: cursor.setRect( fmWidth * (col), (fmHeight * row), fmWidth, fmHeight ); break; } if (insertMode && cursorSize != 1) { cursor.setRect( fmWidth * (col), (fmHeight * (row + 1) - fmHeight / 2), fmWidth, fmHeight / 2 ); } Rectangle r = cursor.getBounds(); r.setSize(r.width,r.height); g2.setColor(colorCursor); g2.setXORMode(colorBg); g2.fill(cursor);// cursorActive = true; s.updateImage(r); switch (crossHair) { case 1: // horizontal g2.drawLine(0,fmHeight * (row + 1),bi.getWidth(null),fmHeight * (row + 1)); s.updateImage(0,fmHeight * (row + 1),bi.getWidth(null),1); break; case 2: // vertical g2.drawLine(r.x,0,r.x,bi.getHeight(null) - fmHeight - fmHeight); s.updateImage(r.x,0,1,bi.getHeight(null) - fmHeight - fmHeight); break; case 3: // horizontal & vertical g2.drawLine(0,fmHeight * (row + 1),bi.getWidth(null),fmHeight * (row + 1)); g2.drawLine(r.x,0,r.x,bi.getHeight(null) - fmHeight - fmHeight); s.updateImage(0,fmHeight * (row + 1),bi.getWidth(null),1); s.updateImage(r.x,0,1,bi.getHeight(null) - fmHeight - fmHeight); break; } g2.dispose(); g2 = getWritingArea(font); g2.setPaint(colorBg); g2.fill(pArea); g2.setColor(colorWhite);// g2.drawString((getRow(lastPos) + 1) + "/" + (getCol(lastPos) + 1)// ,(float)pArea.getX(),// (float)pArea.getY() + fmHeight); g2.drawString((row + 1) + "/" + (col + 1) ,(float)pArea.getX(), (float)pArea.getY() + fmHeight); s.updateImage(pArea.getBounds()); g2.dispose(); // tell waiting threads to wake up// lock.notify();// } }
else
else if (span > 1)
private void distributeSizeAndWeight (int size, double weight, int start, int span, int[] sizes, double[] weights) { if (span == 1) { sizes[start] = Math.max(sizes[start], size); weights[start] = Math.max(weights[start], weight); } else { int numOccupied = span; int lastOccupied = -1; for(int i = start; i < start + span; i++) { if (sizes[i] == 0.0) numOccupied--; else { size -= sizes[i]; lastOccupied = i; } } // A component needs to occupy at least one row. if(numOccupied == 0) sizes[start + span - 1] = size; else if (size > 0) sizes[lastOccupied] += size; calcCellWeights(weight, weights, start, span); } }
else if (clone.gridwidth < 0 && clone.gridwidth != GridBagConstraints.REMAINDER && clone.gridwidth != GridBagConstraints.RELATIVE)
else if (clone.gridwidth < 0)
public void setConstraints (Component component, GridBagConstraints constraints) { GridBagConstraints clone = (GridBagConstraints) constraints.clone(); if (clone.gridx < 0) clone.gridx = GridBagConstraints.RELATIVE; if (clone.gridy < 0) clone.gridy = GridBagConstraints.RELATIVE; if (clone.gridwidth == 0) clone.gridwidth = GridBagConstraints.REMAINDER; else if (clone.gridwidth < 0 && clone.gridwidth != GridBagConstraints.REMAINDER && clone.gridwidth != GridBagConstraints.RELATIVE) clone.gridwidth = 1; if (clone.gridheight == 0) clone.gridheight = GridBagConstraints.REMAINDER; else if (clone.gridheight < 0 && clone.gridheight != GridBagConstraints.REMAINDER && clone.gridheight != GridBagConstraints.RELATIVE) clone.gridheight = 1; comptable.put (component, clone); }
else if (clone.gridheight < 0 && clone.gridheight != GridBagConstraints.REMAINDER && clone.gridheight != GridBagConstraints.RELATIVE)
else if (clone.gridheight < 0)
public void setConstraints (Component component, GridBagConstraints constraints) { GridBagConstraints clone = (GridBagConstraints) constraints.clone(); if (clone.gridx < 0) clone.gridx = GridBagConstraints.RELATIVE; if (clone.gridy < 0) clone.gridy = GridBagConstraints.RELATIVE; if (clone.gridwidth == 0) clone.gridwidth = GridBagConstraints.REMAINDER; else if (clone.gridwidth < 0 && clone.gridwidth != GridBagConstraints.REMAINDER && clone.gridwidth != GridBagConstraints.RELATIVE) clone.gridwidth = 1; if (clone.gridheight == 0) clone.gridheight = GridBagConstraints.REMAINDER; else if (clone.gridheight < 0 && clone.gridheight != GridBagConstraints.REMAINDER && clone.gridheight != GridBagConstraints.RELATIVE) clone.gridheight = 1; comptable.put (component, clone); }
public CommandShell(TextConsole cons) throws ShellException { try { this.console = cons; this.out = this.console.getOut(); this.err = this.console.getErr(); this.currentLine = new Line(console, this, out); this.console.addKeyboardListener(this); defaultCommandInvoker = new DefaultCommandInvoker(this); threadCommandInvoker = new ThreadCommandInvoker(this); this.commandInvoker = threadCommandInvoker; aliasMgr = ((AliasManager) InitialNaming.lookup(AliasManager.NAME)) .createAliasManager(); AccessController.doPrivileged(new SetPropertyAction( PROMPT_PROPERTY_NAME, DEFAULT_PROMPT)); } catch (NameNotFoundException ex) { throw new ShellException("Cannot find required resource", ex); }
public CommandShell() throws NameNotFoundException, ShellException { this((TextConsole) ((ConsoleManager) InitialNaming .lookup(ConsoleManager.NAME)).getFocus());
public CommandShell(TextConsole cons) throws ShellException { try { this.console = cons; this.out = this.console.getOut(); this.err = this.console.getErr(); this.currentLine = new Line(console, this, out); // listen to the keyboard this.console.addKeyboardListener(this); defaultCommandInvoker = new DefaultCommandInvoker(this); threadCommandInvoker = new ThreadCommandInvoker(this); this.commandInvoker = threadCommandInvoker; // default to separate // threads for commands. aliasMgr = ((AliasManager) InitialNaming.lookup(AliasManager.NAME)) .createAliasManager(); AccessController.doPrivileged(new SetPropertyAction( PROMPT_PROPERTY_NAME, DEFAULT_PROMPT)); // ShellUtils.getShellManager().registerShell(this); } catch (NameNotFoundException ex) { throw new ShellException("Cannot find required resource", ex); } }
exitted = true;
exit0();
public void exit(){ exitted = true; console.close(); }
String prompt = System.getProperty(PROMPT_PROPERTY_NAME);
String prompt = (String) AccessController.doPrivileged( new GetPropertyAction(PROMPT_PROPERTY_NAME));
protected String prompt() { String prompt = System.getProperty(PROMPT_PROPERTY_NAME); final StringBuffer result = new StringBuffer(); boolean commandMode = false; try { StringReader reader = new StringReader(prompt); int i; while ((i = reader.read()) != -1) { char c = (char) i; if (commandMode) { switch (c) { case 'P': result.append(new File( (String) AccessController .doPrivileged(new GetPropertyAction( "user.dir")))); break; case 'G': result.append("> "); break; case 'D': final Date now = new Date(); DateFormat.getDateTimeInstance().format(now, result, null); break; default: result.append(c); } commandMode = false; } else { switch (c) { case '$': commandMode = true; break; default: result.append(c); } } } } catch (Exception ioex) { // This should never occur log.error("Error in prompt()", ioex); } return result.toString(); }
ownThread = Thread.currentThread();
public void run() { // Here, we are running in the CommandShell (main) Thread // so, we can register ourself as the current shell // (it will also be the current shell for all children Thread) try { ShellUtils.getShellManager().registerShell(this); } catch (NameNotFoundException e1) { e1.printStackTrace(); } // Run commands from the JNode commandline first final String cmdLine = (String) AccessController .doPrivileged(new GetPropertyAction("jnode.cmdline", "")); final StringTokenizer tok = new StringTokenizer(cmdLine); while (tok.hasMoreTokens()) { final String e = tok.nextToken(); try { if (e.startsWith(command)) { final String cmd = e.substring(command.length()); currentPrompt = prompt(); out.println(currentPrompt + cmd); processCommand(cmd); } } catch (Throwable ex) { ex.printStackTrace(err); } } final String user_home = (String) AccessController.doPrivileged(new GetPropertyAction("user.home", "")); AccessController.doPrivileged(new PrivilegedAction() { public Object run() { try { final File shell_ini = new File(user_home + "/shell.ini"); if(shell_ini.exists()) executeFile(shell_ini); } catch(IOException ioe){ ioe.printStackTrace(); } return null; } }); // Now become interactive while (!isExitted()) { try { synchronized (this) { // Catch keyboard events isActive = true; currentPrompt = prompt(); out.print(currentPrompt); currentLine.start(); // wait until enter is hit threadSuspended = true; while (threadSuspended) { wait(); } String line = currentLine.getContent().trim(); if (line.length() > 0) { processCommand(line); } // if (currentLine.trim().equals("halt")) halt = true; historyIndex = -1; if (VmSystem.isShuttingDown()) { exitted = true; } } } catch (Throwable ex) { ex.printStackTrace(err); } } }
public void start(boolean keepContent) { if (keepContent) { consoleY = console.getCursorY(); } else { consoleX = console.getCursorX(); consoleY = console.getCursorY(); setContent(""); console.setCursor( consoleX,consoleY); }
public void start() { start(false);
public void start(boolean keepContent) { if (keepContent) { // we stay at the same position in X coordinate // only Y may have changed consoleY = console.getCursorY(); } else { consoleX = console.getCursorX(); consoleY = console.getCursorY(); setContent(""); console.setCursor( consoleX,consoleY);//move the cursor to the start of the line. } }
UNKNOWN(String reason, int minor, CompletionStatus completed)
public UNKNOWN(String message)
UNKNOWN(String reason, int minor, CompletionStatus completed) { super(reason, minor, completed); }
super(reason, minor, completed);
super(message, 0, CompletionStatus.COMPLETED_NO);
UNKNOWN(String reason, int minor, CompletionStatus completed) { super(reason, minor, completed); }
AddressPcEntry p = list; int count = 0; while (p != null) { count++; p = p.next; } final int[] table = new int[count*2]; p = list; int i = 0; while (p != null) { table[i+0] = p.pc; table[i+1] = p.offset; i += 2; p = p.next; } this.table = table; this.list = null; }
AddressPcEntry p = list; int count = 0; while (p != null) { count++; p = p.next; } final int[] table = new int[ count * 2]; p = list; int i = 0; int lastOffset = -1; while (p != null) { table[ i + 0] = p.pc; table[ i + 1] = p.offset; if (p.offset < lastOffset) { throw new VirtualMachineError( "unordered offset found"); } lastOffset = p.offset; i += 2; p = p.next; } this.table = table; this.list = null; }
final void lock() { AddressPcEntry p = list; int count = 0; while (p != null) { count++; p = p.next; } final int[] table = new int[count*2]; p = list; int i = 0; while (p != null) { table[i+0] = p.pc; table[i+1] = p.offset; i += 2; p = p.next; } this.table = table; this.list = null; }
Border outer = new MetalButtonBorder();
Border outer = new ButtonBorder();
public static Border getButtonBorder() { if (buttonBorder == null) { Border outer = new MetalButtonBorder(); Border inner = getMarginBorder(); buttonBorder = new BorderUIResource.CompoundBorderUIResource (outer, inner); } return buttonBorder; }
Border outer = new MetalButtonBorder();
Border outer = new ButtonBorder();
static Border getToolbarButtonBorder() { if (toolbarButtonBorder == null) { Border outer = new MetalButtonBorder(); Border inner = new RolloverMarginBorder(); toolbarButtonBorder = new BorderUIResource.CompoundBorderUIResource (outer, inner); } return toolbarButtonBorder; }
Color foreground = view.getForeground(); g.setColor(foreground); Utilities.drawTabbedText(txt, bounds.x, bounds.y, g, tabEx, txt.offset);
Color background = view.getBackground(); g.setColor(background); int width = Utilities.getTabbedTextWidth(txt, g.getFontMetrics(), bounds.x, tabEx, txt.offset); g.fillRect(bounds.x, bounds.y, width, height); g.setColor(view.getForeground()); g.setFont(view.getFont()); if (view.isSuperscript()) Utilities.drawTabbedText(txt, bounds.x, bounds.y - height / 2, g, tabEx, txt.offset); else if (view.isSubscript()) Utilities.drawTabbedText(txt, bounds.x, bounds.y + height / 2, g, tabEx, txt.offset); else Utilities.drawTabbedText(txt, bounds.x, bounds.y, g, tabEx, txt.offset); if (view.isStikeThrough()) { int strikeHeight = (int) (getAscent(view) / 2); g.drawLine(bounds.x, bounds.y + strikeHeight, bounds.height + width, bounds.y + strikeHeight); } if (view.isUnderline()) { int lineHeight = (int) getAscent(view); g.drawLine(bounds.x, bounds.y + lineHeight, bounds.height + width, bounds.y + lineHeight); }
public void paint(GlyphView view, Graphics g, Shape a, int p0, int p1) { int height = (int) getHeight(view); Segment txt = view.getText(p0, p1); Rectangle bounds = a.getBounds(); TabExpander tabEx = null; View parent = view.getParent(); if (parent instanceof TabExpander) tabEx = (TabExpander) parent; // FIXME: Set character attributes like font-family, font-size, colors. Color foreground = view.getForeground(); g.setColor(foreground); Utilities.drawTabbedText(txt, bounds.x, bounds.y, g, tabEx, txt.offset); }
startOffset = element.getStartOffset(); endOffset = element.getEndOffset();
public GlyphView(Element element) { super(element); }
Element el = getElement();
float span = 0;
public float getPreferredSpan(int axis) { Element el = getElement(); checkPainter(); GlyphPainter painter = getGlyphPainter(); TabExpander tabEx = null; View parent = getParent(); if (parent instanceof TabExpander) tabEx = (TabExpander) parent; // FIXME: Figure out how to determine the x parameter. float span = painter.getSpan(this, el.getStartOffset(), el.getEndOffset(), tabEx, 0.F); return span; }
TabExpander tabEx = null; View parent = getParent(); if (parent instanceof TabExpander) tabEx = (TabExpander) parent; float span = painter.getSpan(this, el.getStartOffset(), el.getEndOffset(), tabEx, 0.F);
if (axis == X_AXIS) { Element el = getElement(); TabExpander tabEx = null; View parent = getParent(); if (parent instanceof TabExpander) tabEx = (TabExpander) parent; span = painter.getSpan(this, getStartOffset(), getEndOffset(), tabEx, 0.F); } else span = painter.getHeight(this);
public float getPreferredSpan(int axis) { Element el = getElement(); checkPainter(); GlyphPainter painter = getGlyphPainter(); TabExpander tabEx = null; View parent = getParent(); if (parent instanceof TabExpander) tabEx = (TabExpander) parent; // FIXME: Figure out how to determine the x parameter. float span = painter.getSpan(this, el.getStartOffset(), el.getEndOffset(), tabEx, 0.F); return span; }
if (parent instanceof ParagraphView) te = (ParagraphView) parent;
if (parent instanceof TabExpander) te = (TabExpander) parent;
public TabExpander getTabExpander() { // TODO: Figure out if this is correct. TabExpander te = null; View parent = getParent(); if (parent instanceof ParagraphView) te = (ParagraphView) parent; return te; }
return 0;
checkPainter(); GlyphPainter painter = getGlyphPainter(); return painter.viewToModel(this, x, y, a, b);
public int viewToModel(float x, float y, Shape a, Position.Bias[] b) { // FIXME: not implemented return 0; }
if (orientation == SwingConstants.VERTICAL) return visibleRect.height * direction;
int block; if (orientation == SwingConstants.HORIZONTAL) { block = visibleRect.width; }
public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) { if (orientation == SwingConstants.VERTICAL) return visibleRect.height * direction; else return visibleRect.width * direction; }
return visibleRect.width * direction;
{ int rowHeight = getRowHeight(); if (rowHeight > 0) block = Math.max(rowHeight, (visibleRect.height / rowHeight) * rowHeight); else block = visibleRect.height; } return block;
public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) { if (orientation == SwingConstants.VERTICAL) return visibleRect.height * direction; else return visibleRect.width * direction; }
int h = (rowHeight + rowMargin); int delta = h * direction; if (orientation == SwingConstants.VERTICAL)
int unit; if (orientation == SwingConstants.HORIZONTAL) unit = 100; else
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { int h = (rowHeight + rowMargin); int delta = h * direction; // Round so that the top would start from the row boundary if (orientation == SwingConstants.VERTICAL) { // Completely expose the top row int near = ((visibleRect.y + delta + h / 2) / h) * h; int diff = visibleRect.y + delta - near; delta -= diff; } return delta; // TODO when scrollng horizontally, scroll into the column boundary. }
int near = ((visibleRect.y + delta + h / 2) / h) * h; int diff = visibleRect.y + delta - near; delta -= diff;
unit = getRowHeight(); if (rowHeights == null) { if (direction > 0) { int exposed = (visibleRect.y + visibleRect.height) % unit; if (exposed > 0 && exposed < unit - 1) unit = unit - exposed - 1; } else { int exposed = visibleRect.y % unit; if (exposed > 0 && exposed < unit) unit = exposed; }
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { int h = (rowHeight + rowMargin); int delta = h * direction; // Round so that the top would start from the row boundary if (orientation == SwingConstants.VERTICAL) { // Completely expose the top row int near = ((visibleRect.y + delta + h / 2) / h) * h; int diff = visibleRect.y + delta - near; delta -= diff; } return delta; // TODO when scrollng horizontally, scroll into the column boundary. }
return delta;
} return unit;
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { int h = (rowHeight + rowMargin); int delta = h * direction; // Round so that the top would start from the row boundary if (orientation == SwingConstants.VERTICAL) { // Completely expose the top row int near = ((visibleRect.y + delta + h / 2) / h) * h; int diff = visibleRect.y + delta - near; delta -= diff; } return delta; // TODO when scrollng horizontally, scroll into the column boundary. }
getColumnModel().setColumnSelectionAllowed(c);
if (columnModel.getColumnSelectionAllowed() != c) { columnModel.setColumnSelectionAllowed(c); firePropertyChange("columnSelectionAllowed", !c, c);
public void setColumnSelectionAllowed(boolean c) { getColumnModel().setColumnSelectionAllowed(c); repaint(); }
}
public void setColumnSelectionAllowed(boolean c) { getColumnModel().setColumnSelectionAllowed(c); repaint(); }
}
public void setRowSelectionAllowed(boolean r) { rowSelectionAllowed = r; repaint(); }
checkSelection();
public void setSelectionModel(ListSelectionModel s) { if (s == null) throw new IllegalArgumentException(); ListSelectionModel tmp = selectionModel; if (tmp != null) tmp.removeListSelectionListener(this); if (s != null) s.addListSelectionListener(this); selectionModel = s; }
if ((event == null || (event.getFirstRow() == TableModelEvent.HEADER_ROW)) && autoCreateColumnsFromModel) { rowHeights = null; if (getAutoCreateColumnsFromModel()) createDefaultColumnsFromModel(); resizeAndRepaint(); return; } if (event == null || event.getType() == TableModelEvent.INSERT) { if (event != null) { int first = event.getFirstRow(); if (first < 0) first = 0; int last = event.getLastRow(); if (last < 0) last = getRowCount() - 1; selectionModel.insertIndexInterval(first, last - first + 1, true); if (rowHeights != null) rowHeights.insertEntries(first, last - first + 1, rowHeight); } revalidate(); } if (event == null || event.getType() == TableModelEvent.DELETE) { if (event != null) { int first = event.getFirstRow(); if (first < 0) first = 0; int last = event.getLastRow(); if (last < 0) last = getRowCount() - 1; selectionModel.removeIndexInterval(first, last); if (rowHeights != null) rowHeights.removeEntries(first, last - first + 1); } if (dataModel.getRowCount() == 0) clearSelection(); revalidate(); } repaint();
if (event == null || (event.getFirstRow() == TableModelEvent.HEADER_ROW)) handleCompleteChange(event); else if (event.getType() == TableModelEvent.INSERT) handleInsert(event); else if (event.getType() == TableModelEvent.DELETE) handleDelete(event); else handleUpdate(event);
public void tableChanged (TableModelEvent event) { // update the column model from the table model if the structure has // changed and the flag autoCreateColumnsFromModel is set if ((event == null || (event.getFirstRow() == TableModelEvent.HEADER_ROW)) && autoCreateColumnsFromModel) { rowHeights = null; if (getAutoCreateColumnsFromModel()) createDefaultColumnsFromModel(); resizeAndRepaint(); return; } // If the structure changes, we need to revalidate, since that might // affect the size parameters of the JTable. Otherwise we only need // to perform a repaint to update the view. if (event == null || event.getType() == TableModelEvent.INSERT) { // Sync selection model with data model. if (event != null) { int first = event.getFirstRow(); if (first < 0) first = 0; int last = event.getLastRow(); if (last < 0) last = getRowCount() - 1; selectionModel.insertIndexInterval(first, last - first + 1, true); if (rowHeights != null) rowHeights.insertEntries(first, last - first + 1, rowHeight); } revalidate(); } if (event == null || event.getType() == TableModelEvent.DELETE) { // Sync selection model with data model. if (event != null) { int first = event.getFirstRow(); if (first < 0) first = 0; int last = event.getLastRow(); if (last < 0) last = getRowCount() - 1; selectionModel.removeIndexInterval(first, last); if (rowHeights != null) rowHeights.removeEntries(first, last - first + 1); } if (dataModel.getRowCount() == 0) clearSelection(); revalidate(); } repaint(); }
public static final DateFormat getDateInstance (int style)
public static final DateFormat getDateInstance ()
public static final DateFormat getDateInstance (int style) { return getDateInstance (style, Locale.getDefault()); }
return getDateInstance (style, Locale.getDefault());
return getDateInstance (DEFAULT, Locale.getDefault());
public static final DateFormat getDateInstance (int style) { return getDateInstance (style, Locale.getDefault()); }
public TableColumn(int modelIndex)
public TableColumn()
public TableColumn(int modelIndex) { this(modelIndex, 75, null, null); }
this(modelIndex, 75, null, null);
this(0, 75, null, null);
public TableColumn(int modelIndex) { this(modelIndex, 75, null, null); }
public JTableHeader(TableColumnModel cm)
public JTableHeader()
public JTableHeader(TableColumnModel cm) { accessibleContext = new AccessibleJTableHeader(); columnModel = cm == null ? createDefaultColumnModel() : cm; draggedColumn = null; draggedDistance = 0; opaque = true; reorderingAllowed = true; resizingAllowed = true; resizingColumn = null; table = null; updateTableInRealTime = true; cellRenderer = createDefaultRenderer(); updateUI(); }
accessibleContext = new AccessibleJTableHeader(); columnModel = cm == null ? createDefaultColumnModel() : cm; draggedColumn = null; draggedDistance = 0; opaque = true; reorderingAllowed = true; resizingAllowed = true; resizingColumn = null; table = null; updateTableInRealTime = true; cellRenderer = createDefaultRenderer(); updateUI();
this(null);
public JTableHeader(TableColumnModel cm) { accessibleContext = new AccessibleJTableHeader(); columnModel = cm == null ? createDefaultColumnModel() : cm; draggedColumn = null; draggedDistance = 0; opaque = true; reorderingAllowed = true; resizingAllowed = true; resizingColumn = null; table = null; updateTableInRealTime = true; cellRenderer = createDefaultRenderer(); updateUI(); }
firePropertyChange(COLUMN_WIDTH_PROPERTY, oldWidth, width);
firePropertyChange("width", oldWidth, width);
public void setWidth(int newWidth) { int oldWidth = width; if (newWidth < minWidth) width = minWidth; else if (newWidth > maxWidth) width = maxWidth; else width = newWidth; if (width == oldWidth) return; firePropertyChange(COLUMN_WIDTH_PROPERTY, oldWidth, width); }
public int getPosition(int index) { int position; int loop; position = 0; for (loop = 0; loop < index; loop++) { position += sizes[loop]; }
public int getPosition(int index) { int position; int loop;
public int getPosition(int index) { // Variables int position; int loop; // Process Sizes position = 0; for (loop = 0; loop < index; loop++) { position += sizes[loop]; } // for // Return Position return position; } // getPosition()
return position;
position = 0; for (loop = 0; loop < index; loop++) position += sizes[loop];
public int getPosition(int index) { // Variables int position; int loop; // Process Sizes position = 0; for (loop = 0; loop < index; loop++) { position += sizes[loop]; } // for // Return Position return position; } // getPosition()
}
return position; }
public int getPosition(int index) { // Variables int position; int loop; // Process Sizes position = 0; for (loop = 0; loop < index; loop++) { position += sizes[loop]; } // for // Return Position return position; } // getPosition()
int getColumnIndex(Object columnIdentifier);
int getColumnIndex(Object identifier);
int getColumnIndex(Object columnIdentifier);
public void removeEntries(int start, int length) {
public void removeEntries(int start, int length) { int[] array; int index; int arrayIndex;
public void removeEntries(int start, int length) { // Variables int[] array; int index; int arrayIndex; // Sanity Check if ((start + length) > sizes.length) { throw new IllegalArgumentException("Specified start/length that " + "is greater than available sizes"); } // if // Create New Array array = new int[sizes.length - length]; arrayIndex = 0; for (index = 0; index < sizes.length; index++) { if (index == start) { index += length - 1; } else { array[arrayIndex] = sizes[index]; arrayIndex++; } // if } // for } // removeEntries()
int[] array; int index; int arrayIndex;
if ((start + length) > sizes.length) throw new IllegalArgumentException("Specified start/length that " + "is greater than available sizes");
public void removeEntries(int start, int length) { // Variables int[] array; int index; int arrayIndex; // Sanity Check if ((start + length) > sizes.length) { throw new IllegalArgumentException("Specified start/length that " + "is greater than available sizes"); } // if // Create New Array array = new int[sizes.length - length]; arrayIndex = 0; for (index = 0; index < sizes.length; index++) { if (index == start) { index += length - 1; } else { array[arrayIndex] = sizes[index]; arrayIndex++; } // if } // for } // removeEntries()
if ((start + length) > sizes.length) { throw new IllegalArgumentException("Specified start/length that " + "is greater than available sizes"); } array = new int[sizes.length - length]; arrayIndex = 0; for (index = 0; index < sizes.length; index++) { if (index == start) { index += length - 1; } else { array[arrayIndex] = sizes[index]; arrayIndex++; } } }
array = new int[sizes.length - length]; arrayIndex = 0; for (index = 0; index < sizes.length; index++) { if (index == start) index += length - 1; else { array[arrayIndex] = sizes[index]; arrayIndex++; } } }
public void removeEntries(int start, int length) { // Variables int[] array; int index; int arrayIndex; // Sanity Check if ((start + length) > sizes.length) { throw new IllegalArgumentException("Specified start/length that " + "is greater than available sizes"); } // if // Create New Array array = new int[sizes.length - length]; arrayIndex = 0; for (index = 0; index < sizes.length; index++) { if (index == start) { index += length - 1; } else { array[arrayIndex] = sizes[index]; arrayIndex++; } // if } // for } // removeEntries()
public void insertEntries(int start, int length, int value) {
public void insertEntries(int start, int length, int value) { int[] array; int index; int arrayIndex; int loop;
public void insertEntries(int start, int length, int value) { // Variables int[] array; int index; int arrayIndex; int loop; // Create New Array array = new int[sizes.length + length]; arrayIndex = 0; for (index = 0; index < sizes.length; index++) { if (index == start) { for (loop = 0; loop < length; loop++) { array[arrayIndex] = value; arrayIndex++; } // for } else { array[arrayIndex] = sizes[index]; arrayIndex++; } // if } // for } // insertEntries()
int[] array; int index; int arrayIndex; int loop;
array = new int[sizes.length + length]; arrayIndex = 0; for (index = 0; index < sizes.length; index++) { if (index == start) { for (loop = 0; loop < length; loop++) { array[arrayIndex] = value; arrayIndex++; } } else { array[arrayIndex] = sizes[index]; arrayIndex++; } }
public void insertEntries(int start, int length, int value) { // Variables int[] array; int index; int arrayIndex; int loop; // Create New Array array = new int[sizes.length + length]; arrayIndex = 0; for (index = 0; index < sizes.length; index++) { if (index == start) { for (loop = 0; loop < length; loop++) { array[arrayIndex] = value; arrayIndex++; } // for } else { array[arrayIndex] = sizes[index]; arrayIndex++; } // if } // for } // insertEntries()
array = new int[sizes.length + length]; arrayIndex = 0; for (index = 0; index < sizes.length; index++) { if (index == start) { for (loop = 0; loop < length; loop++) { array[arrayIndex] = value; arrayIndex++; } } else { array[arrayIndex] = sizes[index]; arrayIndex++; } } }
}
public void insertEntries(int start, int length, int value) { // Variables int[] array; int index; int arrayIndex; int loop; // Create New Array array = new int[sizes.length + length]; arrayIndex = 0; for (index = 0; index < sizes.length; index++) { if (index == start) { for (loop = 0; loop < length; loop++) { array[arrayIndex] = value; arrayIndex++; } // for } else { array[arrayIndex] = sizes[index]; arrayIndex++; } // if } // for } // insertEntries()
public SizeSequence(int numEntries, int value) { insertEntries(0, numEntries, value); }
public SizeSequence() { sizes = new int[0]; }
public SizeSequence(int numEntries, int value) { insertEntries(0, numEntries, value); } // SizeSequence()
public OptionGroup(String name)
OptionGroup()
public OptionGroup(String name) { this.name = name; }
this.name = name;
public OptionGroup(String name) { this.name = name; }
String sourceMethod, Object result)
String sourceMethod)
public synchronized void exiting(String sourceClass, String sourceMethod, Object result) { if (isLoggable(Level.FINER)) logp(Level.FINER, sourceClass, sourceMethod, "RETURN {0}", result); }
logp(Level.FINER, sourceClass, sourceMethod, "RETURN {0}", result);
logp(Level.FINER, sourceClass, sourceMethod, "RETURN");
public synchronized void exiting(String sourceClass, String sourceMethod, Object result) { if (isLoggable(Level.FINER)) logp(Level.FINER, sourceClass, sourceMethod, "RETURN {0}", result); }
empty = other.empty;
void assignFrom(REMatch other) { start = other.start; end = other.end; index = other.index; // need to deep clone? next = other.next; empty = other.empty; }
Locale.setDefault( new Locale( "jp" ) );
protected void setUp() throws Exception { super.setUp(); i18n = (I18N) lookup( I18N.ROLE ); }
public VerifyError(String s) { super(s);
public VerifyError() {
public VerifyError(String s) { super(s); }
Authenticator() { }
public Authenticator() { }
Authenticator(){}
getPasswordAuthentication() { return(null); }
protected PasswordAuthentication getPasswordAuthentication() { return null; }
getPasswordAuthentication(){ return(null);}
{ return(host); }
{ return host; }
protected final String getRequestingHost(){ return(host);}
getRequestingPort() { return(port); }
protected final int getRequestingPort() { return port; }
getRequestingPort(){ return(port);}
getRequestingPrompt() { return(prompt); }
protected final String getRequestingPrompt() { return prompt; }
getRequestingPrompt(){ return(prompt);}
getRequestingProtocol() { return(protocol); }
protected final String getRequestingProtocol() { return protocol; }
getRequestingProtocol(){ return(protocol);}
getRequestingScheme() { return(scheme); }
protected final String getRequestingScheme() { return scheme; }
getRequestingScheme(){ return(scheme);}
getRequestingSite() { return(addr); }
protected final InetAddress getRequestingSite() { return addr; }
getRequestingSite(){ return(addr);}
requestPasswordAuthentication(InetAddress addr, int port, String protocol, String prompt, String scheme)
public static PasswordAuthentication requestPasswordAuthentication(InetAddress addr, int port, String protocol, String prompt, String scheme)
requestPasswordAuthentication(InetAddress addr, int port, String protocol, String prompt, String scheme) throws SecurityException{ return(requestPasswordAuthentication (null, addr, port, protocol, prompt, scheme));}
{ return(requestPasswordAuthentication (null, addr, port, protocol, prompt, scheme)); }
{ return requestPasswordAuthentication(null, addr, port, protocol, prompt, scheme); }
requestPasswordAuthentication(InetAddress addr, int port, String protocol, String prompt, String scheme) throws SecurityException{ return(requestPasswordAuthentication (null, addr, port, protocol, prompt, scheme));}
setDefault(Authenticator def_auth) {
public static void setDefault(Authenticator defAuth) {
setDefault(Authenticator def_auth){ SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkPermission(new NetPermission("setDefaultAuthenticator")); default_authenticator = def_auth;}
default_authenticator = def_auth; }
defaultAuthenticator = defAuth; }
setDefault(Authenticator def_auth){ SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkPermission(new NetPermission("setDefaultAuthenticator")); default_authenticator = def_auth;}
if (object instanceof UnboxedObject) { return ((UnboxedObject) object).toInt(); }
public int addressOf32(Object object) { final NativeStream.ObjectRef ref = os.getObjectRef(object); try { if (!ref.isResolved()) { throw new RuntimeException("Unresolved object " + object); //builder.emitObject(os, object); } final int offset = (int) os.getBaseAddr() + ref.getOffset(); return offset; //} catch (ClassNotFoundException ex) { //throw new RuntimeException("Unresolved object ref", ex); } catch (UnresolvedObjectRefException ex) { throw new RuntimeException("Unresolved object ref", ex); } }
if (object instanceof UnboxedObject) { return ((UnboxedObject) object).toLong(); }
public long addressOf64(Object object) { final NativeStream.ObjectRef ref = os.getObjectRef(object); try { if (!ref.isResolved()) { throw new RuntimeException("Unresolved object " + object); //builder.emitObject(os, object); } final long offset = os.getBaseAddr() + ref.getOffset(); return offset; //} catch (ClassNotFoundException ex) { //throw new RuntimeException("Unresolved object ref", ex); } catch (UnresolvedObjectRefException ex) { throw new RuntimeException("Unresolved object ref", ex); } }
public ClassNameArgument(String name, String description) { super(name, description);
public ClassNameArgument(String name, String description, boolean multi) { super(name, description, multi);
public ClassNameArgument(String name, String description) { super(name, description); }
dialog.show();
dialog.setVisible(true);
public void actionPerformed(ActionEvent e) { // process the save transfer information button if (e.getActionCommand().equals("SAVE")) { saveXTFRInfo(); } // process the save transfer information button if (e.getActionCommand().equals("LOAD")) { loadXTFRInfo(); } if (e.getActionCommand().equals("XTFR") || e.getActionCommand().equals("EMAIL")) { saveXTFRFields(); if (e.getActionCommand().equals("EMAIL")) emailIt = true; else emailIt = false; initializeMonitor(); dialog.show(); if (useQuery.isSelected()) { axtfr.login(user.getText(), new String(password.getPassword())); // this will execute in it's own thread and will send a // fileInfoReceived(FTPStatusEvent statusevent) event when // finished without an error. axtfr.setDecimalChar(getDecimalChar()); axtfr.connect(systemName.getText()); } else { if (ftpProtocol.connect(systemName.getText(), 21)) { if (ftpProtocol .login( user.getText(), new String(password.getPassword()))) { // this will execute in it's own thread and will send a // fileInfoReceived(FTPStatusEvent statusevent) event when // finished without an error. ftpProtocol.setDecimalChar(getDecimalChar()); ftpProtocol.getFileInfo( hostFile.getText(), intDesc.isSelected()); } } else { disconnect(); } } } if (e.getActionCommand().equals("BROWSEPC")) { getPCFile(); } if (e.getActionCommand().equals("CUSTOMIZE")) { filter.getOutputFilterInstance().setCustomProperties(); } }
show();
setVisible(true);
private void initXTFRInfo(Properties XTFRProps) { // create some reusable borders and layouts BorderLayout borderLayout = new BorderLayout(); Border emptyBorder = BorderFactory.createEmptyBorder(10, 10, 0, 10); // main panel JPanel mp = new JPanel(); mp.setLayout(borderLayout); // system panel JPanel sp = new JPanel(); sp.setLayout(new BorderLayout()); sp.setBorder(emptyBorder); // host panel for as400 as400p = new JPanel(); as400p.setBorder( BorderFactory.createTitledBorder( LangTool.getString("xtfr.labelAS400"))); as400p.setLayout(new GridBagLayout()); JLabel snpLabel = new JLabel(LangTool.getString("xtfr.labelSystemName")); systemName = new JTextField(vt.getHostName()); systemName.setColumns(30); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy =0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(snpLabel, gbc); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; gbc.gridwidth = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 10); as400p.add(systemName,gbc); JLabel hfnpLabel = new JLabel(LangTool.getString("xtfr.labelHostFile")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(hfnpLabel, gbc); hostFile = new JTextField(); hostFile.setColumns(30); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 1; gbc.gridwidth = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 10); as400p.add(hostFile, gbc); JLabel idpLabel = new JLabel(LangTool.getString("xtfr.labelUserId")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(idpLabel, gbc); user = new JTextField(); user.setColumns(15); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 5); as400p.add(user, gbc); // password panel JLabel pwpLabel = new JLabel(LangTool.getString("xtfr.labelPassword")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 3; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(pwpLabel, gbc); password = new JPasswordField(); password.setColumns(15); password.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { txtONKeyPressed(evt); } }); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 3; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 5); as400p.add(password, gbc); // Query Wizard useQuery = new JCheckBox(LangTool.getString("xtfr.labelUseQuery")); useQuery.addItemListener(this); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 4; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(useQuery, gbc); //query button queryWizard = new JButton(LangTool.getString("xtfr.labelQueryWizard")); queryWizard.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { startWizard(); } }); queryWizard.setEnabled(false); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 4; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 0, 5); as400p.add(queryWizard, gbc); // Field Selection panel fieldsLabel = new JLabel(LangTool.getString("xtfr.labelFields")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 5; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(fieldsLabel, gbc); allFields = new JRadioButton(LangTool.getString("xtfr.labelAllFields")); allFields.setSelected(true); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 5; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 0, 5); as400p.add(allFields, gbc); selectedFields = new JRadioButton(LangTool.getString("xtfr.labelSelectedFields")); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 5; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 0, 10); as400p.add(selectedFields, gbc); ButtonGroup fieldGroup = new ButtonGroup(); fieldGroup.add(allFields); fieldGroup.add(selectedFields); // Field Text Description panel textDescLabel = new JLabel(LangTool.getString("xtfr.labelTxtDesc")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 6; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); as400p.add(textDescLabel, gbc); txtDesc = new JRadioButton(LangTool.getString("xtfr.labelTxtDescFull")); txtDesc.setSelected(true); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 6; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 5, 5); as400p.add(txtDesc, gbc); intDesc = new JRadioButton(LangTool.getString("xtfr.labelTxtDescInt")); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 6; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 5, 10); as400p.add(intDesc, gbc); ButtonGroup txtDescGroup = new ButtonGroup(); txtDescGroup.add(txtDesc); txtDescGroup.add(intDesc); // pc panel for pc information JPanel pcp = new JPanel(new GridBagLayout()); pcp.setBorder( BorderFactory.createTitledBorder( LangTool.getString("xtfr.labelpc"))); JLabel pffLabel = new JLabel(LangTool.getString("xtfr.labelFileFormat")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); pcp.add(pffLabel, gbc); fileFormat = new JComboBox(); fileFormat.setPreferredSize(new Dimension(220, 25)); fileFormat.addItem(htmlFilter.getDescription()); fileFormat.addItem(OOFilter.getDescription()); fileFormat.addItem(ExcelFilter.getDescription()); fileFormat.addItem(KSpreadFilter.getDescription()); fileFormat.addItem(DelimitedFilter.getDescription()); fileFormat.addItem(FixedWidthFilter.getDescription()); fileFormat.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JComboBox cb = (JComboBox) e.getSource(); filter = getFilterByDescription(); if (filter.getOutputFilterInstance().isCustomizable()) customize.setEnabled(true); else customize.setEnabled(false); } }); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(0, 5, 0, 5); pcp.add(fileFormat, gbc); customize = new JButton(LangTool.getString("xtfr.labelCustomize")); customize.setPreferredSize(new Dimension(110, 25)); customize.setActionCommand("CUSTOMIZE"); customize.addActionListener(this); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(0, 5, 0, 10); pcp.add(customize, gbc); // now make sure we set the customizable button enabled or not // depending on the filter. fileFormat.setSelectedIndex(0); JLabel pcpLabel = new JLabel(LangTool.getString("xtfr.labelPCFile")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); pcp.add(pcpLabel, gbc); localFile = new JTextField(); localFile.setColumns(15); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 0, 5); pcp.add(localFile, gbc); JButton browsePC = new JButton(LangTool.getString("xtfr.labelPCBrowse")); browsePC.setActionCommand("BROWSEPC"); browsePC.addActionListener(this); browsePC.setPreferredSize(new Dimension(110, 25)); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 0, 10); pcp.add(browsePC, gbc); decimalSeparator = new JComboBox(); decimalSeparator.setPreferredSize(new Dimension(220, 25)); decimalSeparator.addItem(LangTool.getString("xtfr.period")); decimalSeparator.addItem(LangTool.getString("xtfr.comma")); // obtain the decimal separator for the machine locale DecimalFormat formatter = (DecimalFormat) NumberFormat.getInstance(Locale.getDefault()); if (formatter.getDecimalFormatSymbols().getDecimalSeparator() == '.') decimalSeparator.setSelectedIndex(0); else decimalSeparator.setSelectedIndex(1); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 10, 5); pcp.add(new JLabel(LangTool.getString("xtfr.labelDecimal")), gbc); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 5, 5); pcp.add(decimalSeparator, gbc); sp.add(as400p, BorderLayout.NORTH); sp.add(pcp, BorderLayout.SOUTH); // options panel JPanel op = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 10)); xtfrButton = new JButton(LangTool.getString("xtfr.labelXTFR")); xtfrButton.addActionListener(this); xtfrButton.setActionCommand("XTFR"); op.add(xtfrButton); JButton emailButton = new JButton(LangTool.getString("xtfr.labelXTFREmail")); emailButton.addActionListener(this); emailButton.setActionCommand("EMAIL"); op.add(emailButton); // add transfer save information button JButton saveButton = new JButton(LangTool.getString("xtfr.labelXTFRSave")); saveButton.addActionListener(this); saveButton.setActionCommand("SAVE"); op.add(saveButton); // add transfer load information button JButton loadButton = new JButton(LangTool.getString("xtfr.labelXTFRLoad")); loadButton.addActionListener(this); loadButton.setActionCommand("LOAD"); op.add(loadButton); mp.add(sp, BorderLayout.CENTER); mp.add(op, BorderLayout.SOUTH); this.getContentPane().add(mp, BorderLayout.CENTER); // this.setModal(false); // this.setModal(true); this.setTitle(LangTool.getString("xtfr.title")); //QueryPanel when Use Query selected as400QueryP = new JPanel(); as400QueryP.setLayout(new BorderLayout()); queryStatement = new JTextArea(2, 40); JScrollPane scrollPane = new JScrollPane(queryStatement); queryStatement.setLineWrap(true); as400QueryP.add(scrollPane, BorderLayout.CENTER); initXTFRFields(XTFRProps); // pack it and center it on the screen pack(); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = getSize(); if (frameSize.height > screenSize.height) frameSize.height = screenSize.height; if (frameSize.width > screenSize.width) frameSize.width = screenSize.width; setLocation( (screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); // now show the world what we can do show(); }
if (evt.getKeyCode() == evt.VK_ENTER) {
if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
private void txtONKeyPressed(java.awt.event.KeyEvent evt) { if (evt.getKeyCode() == evt.VK_ENTER) { xtfrButton.doClick(); } }
";decimal separator=" + decChar );
";decimal separator=" + decChar + ";extended metadata=true;translate binary=true");
public boolean connect(String host) { connection = null; hostName = host.toUpperCase(); try { printFTPInfo("Connecting to " + hostName); Driver driver2 = (Driver)Class.forName("com.ibm.as400.access.AS400JDBCDriver").newInstance(); DriverManager.registerDriver(driver2); // Get a connection to the database. Since we do not // provide a user id or password, a prompt will appear. // modified the connection string to add the translate binary = true // as suggested from Luca connection = DriverManager.getConnection ("jdbc:as400://" + hostName + ";decimal separator=" + decChar + ";extended metadata=true;translate binary=true", user,pass); printFTPInfo("jdbc:as400://" + hostName + ";decimal separator=" + decChar ); fireInfoEvent(); printFTPInfo("Connected to " + hostName); return true; } catch (NoClassDefFoundError ncdf) { printFTPInfo("Error: JDBC Driver not found. Please check classpath." ); } catch (Exception e) {// JOptionPane.showMessageDialog(this,// "Error: " + e.getMessage() + "\n\n" +// "There was an error connecting to host "// + system.toUpperCase() +// "\n\nPlease make sure that you run " +// "the command STRHOSTSVR",// "Host connection error",// JOptionPane.ERROR_MESSAGE); printFTPInfo("Error: " + e.getMessage() + "\n\n" + "There was an error connecting to host " + host.toUpperCase() + "\n\nPlease make sure that you run " + "the command STRHOSTSVR"); System.out.println ( "Exception while retrieving data : " + e.getMessage()); } return false; }
public JProgressBar(int minimum, int maximum)
public JProgressBar()
public JProgressBar(int minimum, int maximum) { this(HORIZONTAL, minimum, maximum); }
this(HORIZONTAL, minimum, maximum);
this(HORIZONTAL, 0, 100);
public JProgressBar(int minimum, int maximum) { this(HORIZONTAL, minimum, maximum); }
this.rows = rows;
if (rows != this.rows) { this.rows = rows; revalidate(); }
public void setRows(int rows) { if (rows < 0) throw new IllegalArgumentException(); this.rows = rows; }
getThread.yield();
Thread.yield();
protected boolean getFile(String remoteFile, String localFile) { boolean flag = true; if(ftpOutputStream == null) { printFTPInfo("Not connected to any server!"); return false; } if(!loggedIn) { printFTPInfo("Login was not successful! Aborting!"); return false; } final String localFileF = localFile; final String remoteFileF = remoteFile; Runnable getRun = new Runnable () { // set the thread to run. public void run() { Socket socket = null; DataInputStream datainputstream = null; String localFileFull = localFileF; executeCommand("TYPE","I"); try { socket = createPassiveSocket("RETR " + remoteFileF); if(socket != null) { datainputstream = new DataInputStream(socket.getInputStream()); writeHeader(localFileFull); byte abyte0[] = new byte[recordLength]; StringBuffer rb = new StringBuffer(recordOutLength); int c = 0; int kj = 0; int len = 0; for(int j = 0; j != -1 && !aborted;) { j = datainputstream.read(); if(j == -1) break; c ++; abyte0[len++] = (byte)j; if (len == recordLength) { rb.setLength(0); parseFFD(abyte0,rb); len =0; status.setCurrentRecord(c / recordLength); fireStatusEvent(); } getThread.yield(); // if ((c / recordLength) == 200) // aborted = true; } System.out.println(c); if (c == 0) { status.setCurrentRecord(c); fireStatusEvent(); } else { if (!aborted) parseResponse(); } writeFooter();// parseResponse(); printFTPInfo("Transfer complete!"); } } catch(InterruptedIOException iioe) { printFTPInfo("Interrupted! " + iioe.getMessage()); } catch(Exception _ex) { printFTPInfo("Error! " + _ex); } finally { try { socket.close(); } catch(Exception _ex) { } try { datainputstream.close(); } catch(Exception _ex) { } try { writeFooter(); } catch(Exception _ex) { } disconnect(); } } }; getThread = new Thread(getRun); getThread.setPriority(2); getThread.start(); return flag; }