rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
|
---|---|---|
if (! (comp instanceof AlphaComposite)) { SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkPermission(new AWTPermission("readDisplayPixels")); } | public void setComposite(Composite comp) { composite = comp; if (! (comp.equals(AlphaComposite.SrcOver))) isOptimized = false; else updateOptimization(); } |
|
public void intersect(Area a) | public void intersect(Area area) | public void intersect(Area a) { // XXX Implement. throw new Error("not implemented"); } |
throw new Error("not implemented"); | if (isEmpty() || area.isEmpty()) { reset(); return; } if (equals(area)) return; Vector pathA = new Vector(); Area B = (Area) area.clone(); pathA.addAll(solids); pathA.addAll(holes); Vector pathB = new Vector(); pathB.addAll(B.solids); pathB.addAll(B.holes); int nNodes = 0; for (int i = 0; i < pathA.size(); i++) { Segment a = (Segment) pathA.elementAt(i); for (int j = 0; j < pathB.size(); j++) { Segment b = (Segment) pathB.elementAt(j); nNodes += createNodes(a, b); } } Vector paths = new Vector(); Vector segments = new Vector(); for (int i = 0; i < pathA.size(); i++) { Segment v = (Segment) pathA.elementAt(i); Segment path = v; if (! v.isSegmentOutside(area) && v.node == null) segments.add(v); boolean node = false; do { if ((v.node != null || node)) { node = (v.node != null); if (! v.isSegmentOutside(area)) segments.add(v); } v = v.next; } while (v != path); } for (int i = 0; i < pathB.size(); i++) { Segment v = (Segment) pathB.elementAt(i); Segment path = v; if (! v.isSegmentOutside(this) && v.node == null) segments.add(v); v = v.next; boolean node = false; do { if ((v.node != null || node)) { node = (v.node != null); if (! v.isSegmentOutside(this)) segments.add(v); } v = v.next; } while (v != path); } paths = weilerAtherton(segments); deleteRedundantPaths(paths); | public void intersect(Area a) { // XXX Implement. throw new Error("not implemented"); } |
public GlyphVector createGlyphVector (FontRenderContext ctx, char[] chars) { return peer.createGlyphVector(this, ctx, new StringCharacterIterator(new String(chars))); } | public GlyphVector createGlyphVector(FontRenderContext ctx, String str) { return peer.createGlyphVector(this, ctx, new StringCharacterIterator(str)); } | public GlyphVector createGlyphVector (FontRenderContext ctx, char[] chars){ return peer.createGlyphVector(this, ctx, new StringCharacterIterator(new String(chars)));} |
public int[] getComponents(Object pixel, int[] components, int offset) | public int[] getComponents(int pixel, int[] components, int offset) | public int[] getComponents(Object pixel, int[] components, int offset) { // subclasses has to implement this method. throw new UnsupportedOperationException(); } |
{ new SecureRandom ().nextBytes(sIV); } | getDefaultPRNG().nextBytes(sIV); | private void parseO(final String o) throws AuthenticationException { this.replayDetection = false; boolean integrity = false; boolean confidentiality = false; String option; int i; final StringTokenizer st = new StringTokenizer(o.toLowerCase(), ","); while (st.hasMoreTokens()) { option = st.nextToken(); if (DEBUG && debuglevel > 6) debug(TRACE, "option: <" + option + ">"); if (option.equals(SRPRegistry.OPTION_REPLAY_DETECTION)) { replayDetection = true; } else if (option.startsWith(SRPRegistry.OPTION_INTEGRITY + "=")) { if (integrity) { throw new AuthenticationException( "Only one integrity algorithm may be chosen"); } else { option = option.substring(option.indexOf('=') + 1); if (DEBUG && debuglevel > 6) debug(TRACE, "algorithm: <" + option + ">"); for (i = 0; i < SRPRegistry.INTEGRITY_ALGORITHMS.length; i++) { if (SRPRegistry.INTEGRITY_ALGORITHMS[i].equals(option)) { chosenIntegrityAlgorithm = option; integrity = true; break; } } if (!integrity) { throw new AuthenticationException( "Unknown integrity algorithm: " + option); } } } else if (option.startsWith(SRPRegistry.OPTION_CONFIDENTIALITY + "=")) { if (confidentiality) { throw new AuthenticationException( "Only one confidentiality algorithm may be chosen"); } else { option = option.substring(option.indexOf('=') + 1); if (DEBUG && debuglevel > 6) debug(TRACE, "algorithm: <" + option + ">"); for (i = 0; i < SRPRegistry.CONFIDENTIALITY_ALGORITHMS.length; i++) { if (SRPRegistry.CONFIDENTIALITY_ALGORITHMS[i].equals(option)) { chosenConfidentialityAlgorithm = option; confidentiality = true; break; } } if (!confidentiality) { throw new AuthenticationException( "Unknown confidentiality algorithm: " + option); } } } else if (option.startsWith(SRPRegistry.OPTION_MAX_BUFFER_SIZE + "=")) { final String maxBufferSize = option.substring(option.indexOf('=') + 1); try { rawSendSize = Integer.parseInt(maxBufferSize); if (rawSendSize > Registry.SASL_BUFFER_MAX_LIMIT || rawSendSize < 1) throw new AuthenticationException( "Illegal value for 'maxbuffersize' option"); } catch (NumberFormatException x) { throw new AuthenticationException( SRPRegistry.OPTION_MAX_BUFFER_SIZE + "=" + String.valueOf(maxBufferSize), x); } } } // check if client did the right thing if (replayDetection) { if (!integrity) { throw new AuthenticationException( "Missing integrity protection algorithm " + "but replay detection is chosen"); } } if (mandatory.equals(SRPRegistry.OPTION_REPLAY_DETECTION)) { if (!replayDetection) { throw new AuthenticationException( "Replay detection is mandatory but was not chosen"); } } if (mandatory.equals(SRPRegistry.OPTION_INTEGRITY)) { if (!integrity) { throw new AuthenticationException( "Integrity protection is mandatory but was not chosen"); } } if (mandatory.equals(SRPRegistry.OPTION_CONFIDENTIALITY)) { if (!confidentiality) { throw new AuthenticationException( "Confidentiality is mandatory but was not chosen"); } } int blockSize = 0; if (chosenConfidentialityAlgorithm != null) { final IBlockCipher cipher = CipherFactory.getInstance(chosenConfidentialityAlgorithm); if (cipher != null) { blockSize = cipher.defaultBlockSize(); } else { // should not happen throw new AuthenticationException("Confidentiality algorithm (" + chosenConfidentialityAlgorithm + ") not available"); } } sIV = new byte[blockSize]; if (blockSize > 0) { new SecureRandom ().nextBytes(sIV); } } |
new SecureRandom ().nextBytes(sn); | getDefaultPRNG().nextBytes(sn); | private byte[] sendProtocolElements(final byte[] input) throws SaslException { if (DEBUG && debuglevel > 8) debug(TRACE, "==> sendProtocolElements()"); if (DEBUG && debuglevel > 6) debug(TRACE, "C: " + Util.dumpString(input)); // Client send U, I, sid, cn final InputBuffer frameIn = new InputBuffer(input); try { U = frameIn.getText(); // Extract username if (DEBUG && debuglevel > 6) debug(TRACE, "Got U (username): \"" + U + "\""); authorizationID = frameIn.getText(); // Extract authorisation ID if (DEBUG && debuglevel > 6) debug(TRACE, "Got I (userid): \"" + authorizationID + "\""); sid = frameIn.getEOS(); if (DEBUG && debuglevel > 6) debug(TRACE, "Got sid (session ID): " + new String(sid)); cn = frameIn.getOS(); if (DEBUG && debuglevel > 6) debug(TRACE, "Got cn (client nonce): " + Util.dumpString(cn)); cCB = frameIn.getEOS(); if (DEBUG && debuglevel > 6) debug(TRACE, "Got cCB (client channel binding): " + Util.dumpString(cCB)); } catch (IOException x) { if (x instanceof SaslException) { throw (SaslException) x; } throw new AuthenticationException("sendProtocolElements()", x); } // do/can we re-use? if (ServerStore.instance().isAlive(sid)) { final SecurityContext ctx = ServerStore.instance().restoreSession(sid); srp = SRP.instance(ctx.getMdName()); K = ctx.getK(); cIV = ctx.getClientIV(); sIV = ctx.getServerIV(); replayDetection = ctx.hasReplayDetection(); inCounter = ctx.getInCounter(); outCounter = ctx.getOutCounter(); inMac = ctx.getInMac(); outMac = ctx.getOutMac(); inCipher = ctx.getInCipher(); outCipher = ctx.getOutCipher(); if (sn == null || sn.length != 16) { sn = new byte[16]; } new SecureRandom ().nextBytes(sn); setupSecurityServices(false); final OutputBuffer frameOut = new OutputBuffer(); try { frameOut.setScalar(1, 0xFF); frameOut.setOS(sn); frameOut.setEOS(channelBinding); } catch (IOException x) { if (x instanceof SaslException) { throw (SaslException) x; } throw new AuthenticationException("sendProtocolElements()", x); } final byte[] result = frameOut.encode(); if (DEBUG && debuglevel > 8) debug(TRACE, "<== sendProtocolElements()"); if (DEBUG && debuglevel > 2) debug(INFO, "Old session..."); if (DEBUG && debuglevel > 2) debug(INFO, "S: " + Util.dumpString(result)); if (DEBUG && debuglevel > 2) debug(INFO, " sn = " + Util.dumpString(sn)); if (DEBUG && debuglevel > 2) debug(INFO, " sCB = " + Util.dumpString(channelBinding)); return result; } else { // new session authenticator.activate(properties); // ------------------------------------------------------------------- final HashMap mapB = new HashMap(); // mapB.put(SRP6KeyAgreement.HASH_FUNCTION, srp.newDigest()); mapB.put(SRP6KeyAgreement.HASH_FUNCTION, srp.getAlgorithm()); mapB.put(SRP6KeyAgreement.HOST_PASSWORD_DB, authenticator); try { serverHandler.init(mapB); OutgoingMessage out = new OutgoingMessage(); out.writeString(U); IncomingMessage in = new IncomingMessage(out.toByteArray()); out = serverHandler.processMessage(in); in = new IncomingMessage(out.toByteArray()); N = in.readMPI(); g = in.readMPI(); s = in.readMPI().toByteArray(); B = in.readMPI(); } catch (KeyAgreementException x) { throw new SaslException("sendProtocolElements()", x); } // ------------------------------------------------------------------- if (DEBUG && debuglevel > 6) debug(TRACE, "Encoding N (modulus): " + Util.dump(N)); if (DEBUG && debuglevel > 6) debug(TRACE, "Encoding g (generator): " + Util.dump(g)); if (DEBUG && debuglevel > 6) debug(TRACE, "Encoding s (client's salt): " + Util.dumpString(s)); if (DEBUG && debuglevel > 6) debug(TRACE, "Encoding B (server ephemeral public key): " + Util.dump(B)); // The server creates an options list (L), which consists of a // comma-separated list of option strings that specify the security // service options the server supports. L = createL(); if (DEBUG && debuglevel > 6) debug(TRACE, "Encoding L (available options): \"" + L + "\""); if (DEBUG && debuglevel > 6) debug(TRACE, "Encoding sIV (server IV): " + Util.dumpString(sIV)); final OutputBuffer frameOut = new OutputBuffer(); try { frameOut.setScalar(1, 0x00); frameOut.setMPI(N); frameOut.setMPI(g); frameOut.setOS(s); frameOut.setMPI(B); frameOut.setText(L); } catch (IOException x) { if (x instanceof SaslException) { throw (SaslException) x; } throw new AuthenticationException("sendProtocolElements()", x); } final byte[] result = frameOut.encode(); if (DEBUG && debuglevel > 8) debug(TRACE, "<== sendProtocolElements()"); if (DEBUG && debuglevel > 2) debug(INFO, "New session..."); if (DEBUG && debuglevel > 2) debug(INFO, "S: " + Util.dumpString(result)); if (DEBUG && debuglevel > 2) debug(INFO, " N = 0x" + N.toString(16)); if (DEBUG && debuglevel > 2) debug(INFO, " g = 0x" + g.toString(16)); if (DEBUG && debuglevel > 2) debug(INFO, " s = " + Util.dumpString(s)); if (DEBUG && debuglevel > 2) debug(INFO, " B = 0x" + B.toString(16)); if (DEBUG && debuglevel > 2) debug(INFO, " L = " + L); return result; } } |
AccessController.doPrivileged(new InvokeAction(method, null, args)); | Object obj = null; if(!Modifier.isStatic(method.getModifiers())) { obj = cx.newInstance(); } AccessController.doPrivileged(new InvokeAction(method, obj, args)); | public void run() { try { // System.err.println("Registering shell in new thread."); // to // ensure // access // to // the // command // shell // in // this // new // thread? try { AccessController.doPrivileged(new InvokeAction(method, null, args)); } catch (PrivilegedActionException ex) { throw ex.getException(); } if (!isBlocking()) { // somebody already hit ctrl-c. } else { finished = true; // System.err.println("Finished invocation, notifying // blockers."); // done with invoke, stop waiting for a ctrl-c unblock(); } } catch (InvocationTargetException ex) { Throwable tex = ex.getTargetException(); if (tex instanceof SyntaxErrorException) { try { Help.getInfo(cx).usage(); } catch (HelpException ex1) { // Don't care ex1.printStackTrace(); } err.println(tex.getMessage()); unblock(); } else if (tex instanceof VmExit) { err.println(tex.getMessage()); unblock(); } else { err.println("Exception in command"); tex.printStackTrace(err); unblock(); } } catch (Exception ex) { err.println("Exception in command"); ex.printStackTrace(err); unblock(); } finished = true; } |
dumpBytes = !dumpBytes; if (dumpBytes) { try { if (fw == null) { fw = new FileOutputStream("log.txt"); dw = new BufferedOutputStream(fw); } } catch (FileNotFoundException fnfe) { System.out.println(fnfe.getMessage()); } } else { try { if (dw != null) dw.close(); if (fw != null) fw.close(); dw = null; fw = null; } catch(IOException ioe) { System.out.println(ioe.getMessage()); } } System.out.println("Data Stream output is now " + dumpBytes); | producer.toggleDebug(codePage); | protected final void toggleDebug () { dumpBytes = !dumpBytes; if (dumpBytes) { try { if (fw == null) { fw = new FileOutputStream("log.txt"); dw = new BufferedOutputStream(fw); } } catch (FileNotFoundException fnfe) { System.out.println(fnfe.getMessage()); } } else { try { if (dw != null) dw.close(); if (fw != null) fw.close(); dw = null; fw = null; } catch(IOException ioe) { System.out.println(ioe.getMessage()); } } System.out.println("Data Stream output is now " + dumpBytes); } |
Color colorBg) { | Color colorBg, Session ses) { | public PrinterThread (ScreenChar[] sc, Font font, int cols, int rows, Color colorBg) { setPriority(1); screen = new ScreenChar[sc.length]; int len = sc.length; for (int x = 0; x < len; x++) { screen[x] = new ScreenChar(sc[x].s); screen[x].setCharAndAttr(sc[x].getChar(),sc[x].getCharAttr(),sc[x].isAttributePlace()); } numCols = cols; numRows = rows; this.colorBg = colorBg; this.font = font; } |
session = ses; | public PrinterThread (ScreenChar[] sc, Font font, int cols, int rows, Color colorBg) { setPriority(1); screen = new ScreenChar[sc.length]; int len = sc.length; for (int x = 0; x < len; x++) { screen[x] = new ScreenChar(sc[x].s); screen[x].setCharAndAttr(sc[x].getChar(),sc[x].getCharAttr(),sc[x].isAttributePlace()); } numCols = cols; numRows = rows; this.colorBg = colorBg; this.font = font; } |
|
g2.setColor (colorBg); | g2.setColor (Color.black); | public int print (Graphics g, PageFormat pageFormat, int page) { Graphics2D g2; //--- Validate the page number, we only print the first page if (page == 0) { //--- Create a graphic2D object and set the default parameters g2 = (Graphics2D) g; g2.setColor (colorBg); //--- Translate the origin to be (0,0) g2.translate (pageFormat.getImageableX (), pageFormat.getImageableY ()); int w = (int)pageFormat.getImageableWidth() / numCols; // proposed width int h = (int)pageFormat.getImageableHeight() / numRows; // proposed height Font k = new Font("Courier New",Font.PLAIN,8); LineMetrics l; FontRenderContext f = null; float j = 1; for (; j < 36; j++) { // derive the font and obtain the relevent information to compute // the width and height k = font.deriveFont(j); f = new FontRenderContext(k.getTransform(),true,true); l = k.getLineMetrics("Wy",f); if ( (w < (int)k.getStringBounds("W",f).getWidth() + 1) || h < (int)(k.getStringBounds("g",f).getHeight() + l.getDescent() + l.getLeading()) ) break; } // since we were looking for an overrun of the width or height we need // to adjust the font one down to get the last one that fit. k = font.deriveFont(--j); f = new FontRenderContext(k.getTransform(),true,true); l = k.getLineMetrics("Wy",f); // set the font of the print job g2.setFont(k); // get the width and height of the character bounds int w1 = (int)k.getStringBounds("W",f).getWidth() + 1; int h1 = (int)(k.getStringBounds("g",f).getHeight() + l.getDescent() + l.getLeading()); int x; int y; // loop through all the screen characters and print them out. for (int m = 0;m < numRows; m++) for (int i = 0; i < numCols; i++) { x = w1 * i; y = h1 * m; // only draw printable characters (in this case >= ' ') if (screen[getPos(m,i)].getChar() >= ' ' && !screen[getPos(m,i)].nonDisplay) { g2.drawChars(screen[getPos(m,i)].sChar, 0, 1,x , (int)(y + h1 - (l.getDescent() + l.getLeading())-2)); } // if it is underlined then underline the character if (screen[getPos(m,i)].underLine && !screen[getPos(m,i)].attributePlace) g.drawLine(x, (int)(y + (h1 - l.getLeading()-3)), (int)(x + w1), (int)(y + (h1 - l.getLeading())-3)); } return (PAGE_EXISTS); } else return (NO_SUCH_PAGE); } |
else { session.requestFocus(); } session = null; | public void run () { //--- Create a printerJob object PrinterJob printJob = PrinterJob.getPrinterJob (); printJob.setJobName("tn5250j"); //--- Set the printable class to this one since we //--- are implementing the Printable interface printJob.setPrintable (this); //--- Show a print dialog to the user. If the user //--- clicks the print button, then print, otherwise //--- cancel the print job if (printJob.printDialog()) { try { printJob.print(); } catch (Exception PrintException) { PrintException.printStackTrace(); } } int len = screen.length; for (int x = 0; x < len; x++) { screen[x] = null; } screen = null; } |
|
public AWTEvent(Object source, int id) | public AWTEvent(Event event) | public AWTEvent(Object source, int id) { super(source); this.id = id; } |
super(source); this.id = id; | this(event.target, event.id); consumed = event.consumed; | public AWTEvent(Object source, int id) { super(source); this.id = id; } |
loadSessions(); | My5250 () { splash = new TN5250jSplashScreen(createImageIcon("tn5250jSplash.jpg")); splash.setSteps(4); splash.setVisible(true); focused = createImageIcon("focused.gif"); unfocused = createImageIcon("unfocused.gif"); tnicon = createImageIcon("tnicon.jpg"); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch(Exception e) { } loadSessions(); splash.updateProgress(++step); try { Class.forName("org.tn5250j.scripting.JPythonInterpreterDriver"); } catch (java.lang.NoClassDefFoundError ncdfe) { System.out.println("Information Message: Can not find scripting support" + " files, scripting will not be available: " + "Failed to load interpreter drivers " + ncdfe); } catch (Exception ex) { System.out.println("Information Message: Can not find scripting support" + " files, scripting will not be available: " + "Failed to load interpreter drivers " + ex); } splash.updateProgress(++step); // sets the starting frame type. At this time there are tabs which is // default and Multiple Document Interface. startFrameType(); frames = new Vector(); newView(); setDefaultLocale(); manager = new SessionManager(); manager.setController(this); splash.updateProgress(++step); } |
|
loadSessions(); | loadDefaultSession(); | private String getConnectSession () { Connect sc = new Connect(frame1,LangTool.getString("ss.title"),sessions); // load the new session information from the session property file loadSessions(); return sc.getConnectKey(); } |
if (isSpecified("-MDI",args)) { | initConfig(args); if (sesProps.getProperty(GUI_MDI_TYPE) != null) { | static public void main(String[] args) { if (isSpecified("-MDI",args)) { useMDIFrames = true; } if (!isSpecified("-nc",args)) { if (!checkBootStrapper(args)) { // if we did not find a running instance and the -d options is // specified start up the bootstrap deamon to allow checking // for running instances if (isSpecified("-d",args)) { strapper = new BootStrapper(); strapper.start(); } } else { System.exit(0); } } My5250 m = new My5250(); if (strapper != null) strapper.addBootListener(m); if (args.length > 0) { if (isSpecified("-width",args) || isSpecified("-height",args)) { int width = m.frame1.getWidth(); int height = m.frame1.getHeight(); if (isSpecified("-width",args)) { width = Integer.parseInt(m.getParm("-width",args)); } if (isSpecified("-height",args)) { height = Integer.parseInt(m.getParm("-height",args)); } m.frame1.setSize(width,height); m.frame1.centerFrame(); } /** * @todo this crap needs to be rewritten it is a mess */ if (args[0].startsWith("-")) { // check if a session parameter is specified on the command line if (isSpecified("-s",args)) { String sd = getParm("-s",args); if (sessions.containsKey(sd)) { sessions.setProperty("emul.default",sd); } else { args = null; } } // check if a locale parameter is specified on the command line if (isSpecified("-L",args)) { Locale.setDefault(parseLocal(getParm("-L",args))); LangTool.init(); if (args[0].startsWith("-")) { m.sessionArgs = null; } else { m.splash.updateProgress(++m.step); m.frame1.setVisible(true); m.splash.setVisible(false); m.frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); LangTool.init(); m.sessionArgs = args; } } else { LangTool.init(); if (isSpecified("-s",args)) m.sessionArgs = args; else m.sessionArgs = null; } } else { LangTool.init(); m.sessionArgs = args; } } else { LangTool.init(); m.sessionArgs = null; } if (m.sessionArgs != null) { // BEGIN // 2001/09/19 natural computing MR Vector os400_sessions = new Vector(); Vector session_params = new Vector(); for (int x = 0; x < args.length; x++) { if (args[x].equals("-s")) { x++; if (args[x] != null && sessions.containsKey(args[x])) { os400_sessions.addElement(args[x]); }else{ x--; session_params.addElement(args[x]); } }else{ session_params.addElement(args[x]); } } for (int x = 0; x < session_params.size(); x++) m.sessionArgs[x] = session_params.elementAt(x).toString(); m.startNewSession(); for (int x = 1; x < os400_sessions.size(); x++ ) { String sel = os400_sessions.elementAt(x).toString(); if (!m.frame1.isVisible()) { m.splash.updateProgress(++m.step); m.frame1.setVisible(true); m.splash.setVisible(false); m.frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } m.sessionArgs = new String[NUM_PARMS]; m.parseArgs(sessions.getProperty(sel),m.sessionArgs); m.newSession(sel,m.sessionArgs); } // 2001/09/19 natural computing MR // END } else { m.startNewSession(); } } |
if (!isSpecified("-nc",args)) { | if (sesProps.getProperty(NO_CHECK_RUNNING) != null) { | static public void main(String[] args) { if (isSpecified("-MDI",args)) { useMDIFrames = true; } if (!isSpecified("-nc",args)) { if (!checkBootStrapper(args)) { // if we did not find a running instance and the -d options is // specified start up the bootstrap deamon to allow checking // for running instances if (isSpecified("-d",args)) { strapper = new BootStrapper(); strapper.start(); } } else { System.exit(0); } } My5250 m = new My5250(); if (strapper != null) strapper.addBootListener(m); if (args.length > 0) { if (isSpecified("-width",args) || isSpecified("-height",args)) { int width = m.frame1.getWidth(); int height = m.frame1.getHeight(); if (isSpecified("-width",args)) { width = Integer.parseInt(m.getParm("-width",args)); } if (isSpecified("-height",args)) { height = Integer.parseInt(m.getParm("-height",args)); } m.frame1.setSize(width,height); m.frame1.centerFrame(); } /** * @todo this crap needs to be rewritten it is a mess */ if (args[0].startsWith("-")) { // check if a session parameter is specified on the command line if (isSpecified("-s",args)) { String sd = getParm("-s",args); if (sessions.containsKey(sd)) { sessions.setProperty("emul.default",sd); } else { args = null; } } // check if a locale parameter is specified on the command line if (isSpecified("-L",args)) { Locale.setDefault(parseLocal(getParm("-L",args))); LangTool.init(); if (args[0].startsWith("-")) { m.sessionArgs = null; } else { m.splash.updateProgress(++m.step); m.frame1.setVisible(true); m.splash.setVisible(false); m.frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); LangTool.init(); m.sessionArgs = args; } } else { LangTool.init(); if (isSpecified("-s",args)) m.sessionArgs = args; else m.sessionArgs = null; } } else { LangTool.init(); m.sessionArgs = args; } } else { LangTool.init(); m.sessionArgs = null; } if (m.sessionArgs != null) { // BEGIN // 2001/09/19 natural computing MR Vector os400_sessions = new Vector(); Vector session_params = new Vector(); for (int x = 0; x < args.length; x++) { if (args[x].equals("-s")) { x++; if (args[x] != null && sessions.containsKey(args[x])) { os400_sessions.addElement(args[x]); }else{ x--; session_params.addElement(args[x]); } }else{ session_params.addElement(args[x]); } } for (int x = 0; x < session_params.size(); x++) m.sessionArgs[x] = session_params.elementAt(x).toString(); m.startNewSession(); for (int x = 1; x < os400_sessions.size(); x++ ) { String sel = os400_sessions.elementAt(x).toString(); if (!m.frame1.isVisible()) { m.splash.updateProgress(++m.step); m.frame1.setVisible(true); m.splash.setVisible(false); m.frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } m.sessionArgs = new String[NUM_PARMS]; m.parseArgs(sessions.getProperty(sel),m.sessionArgs); m.newSession(sel,m.sessionArgs); } // 2001/09/19 natural computing MR // END } else { m.startNewSession(); } } |
if (isSpecified("-d",args)) { | if (sesProps.getProperty(START_MONITOR_THREAD) != null) { | static public void main(String[] args) { if (isSpecified("-MDI",args)) { useMDIFrames = true; } if (!isSpecified("-nc",args)) { if (!checkBootStrapper(args)) { // if we did not find a running instance and the -d options is // specified start up the bootstrap deamon to allow checking // for running instances if (isSpecified("-d",args)) { strapper = new BootStrapper(); strapper.start(); } } else { System.exit(0); } } My5250 m = new My5250(); if (strapper != null) strapper.addBootListener(m); if (args.length > 0) { if (isSpecified("-width",args) || isSpecified("-height",args)) { int width = m.frame1.getWidth(); int height = m.frame1.getHeight(); if (isSpecified("-width",args)) { width = Integer.parseInt(m.getParm("-width",args)); } if (isSpecified("-height",args)) { height = Integer.parseInt(m.getParm("-height",args)); } m.frame1.setSize(width,height); m.frame1.centerFrame(); } /** * @todo this crap needs to be rewritten it is a mess */ if (args[0].startsWith("-")) { // check if a session parameter is specified on the command line if (isSpecified("-s",args)) { String sd = getParm("-s",args); if (sessions.containsKey(sd)) { sessions.setProperty("emul.default",sd); } else { args = null; } } // check if a locale parameter is specified on the command line if (isSpecified("-L",args)) { Locale.setDefault(parseLocal(getParm("-L",args))); LangTool.init(); if (args[0].startsWith("-")) { m.sessionArgs = null; } else { m.splash.updateProgress(++m.step); m.frame1.setVisible(true); m.splash.setVisible(false); m.frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); LangTool.init(); m.sessionArgs = args; } } else { LangTool.init(); if (isSpecified("-s",args)) m.sessionArgs = args; else m.sessionArgs = null; } } else { LangTool.init(); m.sessionArgs = args; } } else { LangTool.init(); m.sessionArgs = null; } if (m.sessionArgs != null) { // BEGIN // 2001/09/19 natural computing MR Vector os400_sessions = new Vector(); Vector session_params = new Vector(); for (int x = 0; x < args.length; x++) { if (args[x].equals("-s")) { x++; if (args[x] != null && sessions.containsKey(args[x])) { os400_sessions.addElement(args[x]); }else{ x--; session_params.addElement(args[x]); } }else{ session_params.addElement(args[x]); } } for (int x = 0; x < session_params.size(); x++) m.sessionArgs[x] = session_params.elementAt(x).toString(); m.startNewSession(); for (int x = 1; x < os400_sessions.size(); x++ ) { String sel = os400_sessions.elementAt(x).toString(); if (!m.frame1.isVisible()) { m.splash.updateProgress(++m.step); m.frame1.setVisible(true); m.splash.setVisible(false); m.frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } m.sessionArgs = new String[NUM_PARMS]; m.parseArgs(sessions.getProperty(sel),m.sessionArgs); m.newSession(sel,m.sessionArgs); } // 2001/09/19 natural computing MR // END } else { m.startNewSession(); } } |
if (args.length > 0) { | int width = m.frame1.getWidth(); int height = m.frame1.getHeight(); | static public void main(String[] args) { if (isSpecified("-MDI",args)) { useMDIFrames = true; } if (!isSpecified("-nc",args)) { if (!checkBootStrapper(args)) { // if we did not find a running instance and the -d options is // specified start up the bootstrap deamon to allow checking // for running instances if (isSpecified("-d",args)) { strapper = new BootStrapper(); strapper.start(); } } else { System.exit(0); } } My5250 m = new My5250(); if (strapper != null) strapper.addBootListener(m); if (args.length > 0) { if (isSpecified("-width",args) || isSpecified("-height",args)) { int width = m.frame1.getWidth(); int height = m.frame1.getHeight(); if (isSpecified("-width",args)) { width = Integer.parseInt(m.getParm("-width",args)); } if (isSpecified("-height",args)) { height = Integer.parseInt(m.getParm("-height",args)); } m.frame1.setSize(width,height); m.frame1.centerFrame(); } /** * @todo this crap needs to be rewritten it is a mess */ if (args[0].startsWith("-")) { // check if a session parameter is specified on the command line if (isSpecified("-s",args)) { String sd = getParm("-s",args); if (sessions.containsKey(sd)) { sessions.setProperty("emul.default",sd); } else { args = null; } } // check if a locale parameter is specified on the command line if (isSpecified("-L",args)) { Locale.setDefault(parseLocal(getParm("-L",args))); LangTool.init(); if (args[0].startsWith("-")) { m.sessionArgs = null; } else { m.splash.updateProgress(++m.step); m.frame1.setVisible(true); m.splash.setVisible(false); m.frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); LangTool.init(); m.sessionArgs = args; } } else { LangTool.init(); if (isSpecified("-s",args)) m.sessionArgs = args; else m.sessionArgs = null; } } else { LangTool.init(); m.sessionArgs = args; } } else { LangTool.init(); m.sessionArgs = null; } if (m.sessionArgs != null) { // BEGIN // 2001/09/19 natural computing MR Vector os400_sessions = new Vector(); Vector session_params = new Vector(); for (int x = 0; x < args.length; x++) { if (args[x].equals("-s")) { x++; if (args[x] != null && sessions.containsKey(args[x])) { os400_sessions.addElement(args[x]); }else{ x--; session_params.addElement(args[x]); } }else{ session_params.addElement(args[x]); } } for (int x = 0; x < session_params.size(); x++) m.sessionArgs[x] = session_params.elementAt(x).toString(); m.startNewSession(); for (int x = 1; x < os400_sessions.size(); x++ ) { String sel = os400_sessions.elementAt(x).toString(); if (!m.frame1.isVisible()) { m.splash.updateProgress(++m.step); m.frame1.setVisible(true); m.splash.setVisible(false); m.frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } m.sessionArgs = new String[NUM_PARMS]; m.parseArgs(sessions.getProperty(sel),m.sessionArgs); m.newSession(sel,m.sessionArgs); } // 2001/09/19 natural computing MR // END } else { m.startNewSession(); } } |
if (isSpecified("-width",args) || isSpecified("-height",args)) { int width = m.frame1.getWidth(); int height = m.frame1.getHeight(); if (isSpecified("-width",args)) { width = Integer.parseInt(m.getParm("-width",args)); } if (isSpecified("-height",args)) { height = Integer.parseInt(m.getParm("-height",args)); } m.frame1.setSize(width,height); m.frame1.centerFrame(); } if (args[0].startsWith("-")) { if (isSpecified("-s",args)) { String sd = getParm("-s",args); if (sessions.containsKey(sd)) { sessions.setProperty("emul.default",sd); } else { args = null; } } if (isSpecified("-L",args)) { Locale.setDefault(parseLocal(getParm("-L",args))); LangTool.init(); if (args[0].startsWith("-")) { m.sessionArgs = null; } else { m.splash.updateProgress(++m.step); m.frame1.setVisible(true); m.splash.setVisible(false); m.frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); LangTool.init(); m.sessionArgs = args; } } else { LangTool.init(); if (isSpecified("-s",args)) m.sessionArgs = args; else m.sessionArgs = null; } } else { LangTool.init(); m.sessionArgs = args; } | if (sesProps.getProperty(GUI_FRAME_WIDTH) != null) { width = Integer.parseInt(sesProps.getProperty(GUI_FRAME_WIDTH)); | static public void main(String[] args) { if (isSpecified("-MDI",args)) { useMDIFrames = true; } if (!isSpecified("-nc",args)) { if (!checkBootStrapper(args)) { // if we did not find a running instance and the -d options is // specified start up the bootstrap deamon to allow checking // for running instances if (isSpecified("-d",args)) { strapper = new BootStrapper(); strapper.start(); } } else { System.exit(0); } } My5250 m = new My5250(); if (strapper != null) strapper.addBootListener(m); if (args.length > 0) { if (isSpecified("-width",args) || isSpecified("-height",args)) { int width = m.frame1.getWidth(); int height = m.frame1.getHeight(); if (isSpecified("-width",args)) { width = Integer.parseInt(m.getParm("-width",args)); } if (isSpecified("-height",args)) { height = Integer.parseInt(m.getParm("-height",args)); } m.frame1.setSize(width,height); m.frame1.centerFrame(); } /** * @todo this crap needs to be rewritten it is a mess */ if (args[0].startsWith("-")) { // check if a session parameter is specified on the command line if (isSpecified("-s",args)) { String sd = getParm("-s",args); if (sessions.containsKey(sd)) { sessions.setProperty("emul.default",sd); } else { args = null; } } // check if a locale parameter is specified on the command line if (isSpecified("-L",args)) { Locale.setDefault(parseLocal(getParm("-L",args))); LangTool.init(); if (args[0].startsWith("-")) { m.sessionArgs = null; } else { m.splash.updateProgress(++m.step); m.frame1.setVisible(true); m.splash.setVisible(false); m.frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); LangTool.init(); m.sessionArgs = args; } } else { LangTool.init(); if (isSpecified("-s",args)) m.sessionArgs = args; else m.sessionArgs = null; } } else { LangTool.init(); m.sessionArgs = args; } } else { LangTool.init(); m.sessionArgs = null; } if (m.sessionArgs != null) { // BEGIN // 2001/09/19 natural computing MR Vector os400_sessions = new Vector(); Vector session_params = new Vector(); for (int x = 0; x < args.length; x++) { if (args[x].equals("-s")) { x++; if (args[x] != null && sessions.containsKey(args[x])) { os400_sessions.addElement(args[x]); }else{ x--; session_params.addElement(args[x]); } }else{ session_params.addElement(args[x]); } } for (int x = 0; x < session_params.size(); x++) m.sessionArgs[x] = session_params.elementAt(x).toString(); m.startNewSession(); for (int x = 1; x < os400_sessions.size(); x++ ) { String sel = os400_sessions.elementAt(x).toString(); if (!m.frame1.isVisible()) { m.splash.updateProgress(++m.step); m.frame1.setVisible(true); m.splash.setVisible(false); m.frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } m.sessionArgs = new String[NUM_PARMS]; m.parseArgs(sessions.getProperty(sel),m.sessionArgs); m.newSession(sel,m.sessionArgs); } // 2001/09/19 natural computing MR // END } else { m.startNewSession(); } } |
else { LangTool.init(); m.sessionArgs = null; | if (sesProps.getProperty(GUI_FRAME_HEIGHT) != null) { height = Integer.parseInt(sesProps.getProperty(GUI_FRAME_HEIGHT)); | static public void main(String[] args) { if (isSpecified("-MDI",args)) { useMDIFrames = true; } if (!isSpecified("-nc",args)) { if (!checkBootStrapper(args)) { // if we did not find a running instance and the -d options is // specified start up the bootstrap deamon to allow checking // for running instances if (isSpecified("-d",args)) { strapper = new BootStrapper(); strapper.start(); } } else { System.exit(0); } } My5250 m = new My5250(); if (strapper != null) strapper.addBootListener(m); if (args.length > 0) { if (isSpecified("-width",args) || isSpecified("-height",args)) { int width = m.frame1.getWidth(); int height = m.frame1.getHeight(); if (isSpecified("-width",args)) { width = Integer.parseInt(m.getParm("-width",args)); } if (isSpecified("-height",args)) { height = Integer.parseInt(m.getParm("-height",args)); } m.frame1.setSize(width,height); m.frame1.centerFrame(); } /** * @todo this crap needs to be rewritten it is a mess */ if (args[0].startsWith("-")) { // check if a session parameter is specified on the command line if (isSpecified("-s",args)) { String sd = getParm("-s",args); if (sessions.containsKey(sd)) { sessions.setProperty("emul.default",sd); } else { args = null; } } // check if a locale parameter is specified on the command line if (isSpecified("-L",args)) { Locale.setDefault(parseLocal(getParm("-L",args))); LangTool.init(); if (args[0].startsWith("-")) { m.sessionArgs = null; } else { m.splash.updateProgress(++m.step); m.frame1.setVisible(true); m.splash.setVisible(false); m.frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); LangTool.init(); m.sessionArgs = args; } } else { LangTool.init(); if (isSpecified("-s",args)) m.sessionArgs = args; else m.sessionArgs = null; } } else { LangTool.init(); m.sessionArgs = args; } } else { LangTool.init(); m.sessionArgs = null; } if (m.sessionArgs != null) { // BEGIN // 2001/09/19 natural computing MR Vector os400_sessions = new Vector(); Vector session_params = new Vector(); for (int x = 0; x < args.length; x++) { if (args[x].equals("-s")) { x++; if (args[x] != null && sessions.containsKey(args[x])) { os400_sessions.addElement(args[x]); }else{ x--; session_params.addElement(args[x]); } }else{ session_params.addElement(args[x]); } } for (int x = 0; x < session_params.size(); x++) m.sessionArgs[x] = session_params.elementAt(x).toString(); m.startNewSession(); for (int x = 1; x < os400_sessions.size(); x++ ) { String sel = os400_sessions.elementAt(x).toString(); if (!m.frame1.isVisible()) { m.splash.updateProgress(++m.step); m.frame1.setVisible(true); m.splash.setVisible(false); m.frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } m.sessionArgs = new String[NUM_PARMS]; m.parseArgs(sessions.getProperty(sel),m.sessionArgs); m.newSession(sel,m.sessionArgs); } // 2001/09/19 natural computing MR // END } else { m.startNewSession(); } } |
if (m.sessionArgs != null) { | m.frame1.setSize(width,height); m.frame1.centerFrame(); | static public void main(String[] args) { if (isSpecified("-MDI",args)) { useMDIFrames = true; } if (!isSpecified("-nc",args)) { if (!checkBootStrapper(args)) { // if we did not find a running instance and the -d options is // specified start up the bootstrap deamon to allow checking // for running instances if (isSpecified("-d",args)) { strapper = new BootStrapper(); strapper.start(); } } else { System.exit(0); } } My5250 m = new My5250(); if (strapper != null) strapper.addBootListener(m); if (args.length > 0) { if (isSpecified("-width",args) || isSpecified("-height",args)) { int width = m.frame1.getWidth(); int height = m.frame1.getHeight(); if (isSpecified("-width",args)) { width = Integer.parseInt(m.getParm("-width",args)); } if (isSpecified("-height",args)) { height = Integer.parseInt(m.getParm("-height",args)); } m.frame1.setSize(width,height); m.frame1.centerFrame(); } /** * @todo this crap needs to be rewritten it is a mess */ if (args[0].startsWith("-")) { // check if a session parameter is specified on the command line if (isSpecified("-s",args)) { String sd = getParm("-s",args); if (sessions.containsKey(sd)) { sessions.setProperty("emul.default",sd); } else { args = null; } } // check if a locale parameter is specified on the command line if (isSpecified("-L",args)) { Locale.setDefault(parseLocal(getParm("-L",args))); LangTool.init(); if (args[0].startsWith("-")) { m.sessionArgs = null; } else { m.splash.updateProgress(++m.step); m.frame1.setVisible(true); m.splash.setVisible(false); m.frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); LangTool.init(); m.sessionArgs = args; } } else { LangTool.init(); if (isSpecified("-s",args)) m.sessionArgs = args; else m.sessionArgs = null; } } else { LangTool.init(); m.sessionArgs = args; } } else { LangTool.init(); m.sessionArgs = null; } if (m.sessionArgs != null) { // BEGIN // 2001/09/19 natural computing MR Vector os400_sessions = new Vector(); Vector session_params = new Vector(); for (int x = 0; x < args.length; x++) { if (args[x].equals("-s")) { x++; if (args[x] != null && sessions.containsKey(args[x])) { os400_sessions.addElement(args[x]); }else{ x--; session_params.addElement(args[x]); } }else{ session_params.addElement(args[x]); } } for (int x = 0; x < session_params.size(); x++) m.sessionArgs[x] = session_params.elementAt(x).toString(); m.startNewSession(); for (int x = 1; x < os400_sessions.size(); x++ ) { String sel = os400_sessions.elementAt(x).toString(); if (!m.frame1.isVisible()) { m.splash.updateProgress(++m.step); m.frame1.setVisible(true); m.splash.setVisible(false); m.frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } m.sessionArgs = new String[NUM_PARMS]; m.parseArgs(sessions.getProperty(sel),m.sessionArgs); m.newSession(sel,m.sessionArgs); } // 2001/09/19 natural computing MR // END } else { m.startNewSession(); } } |
if (sesProps.getProperty(SESSION_LOCALE) != null) Locale.setDefault(parseLocal(sesProps.getProperty(SESSION_LOCALE))); m.splash.updateProgress(++m.step); m.frame1.setVisible(true); m.splash.setVisible(false); m.frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); LangTool.init(); if (sesProps.getProperty(SESSION_NAMES_REFS) != null) { | static public void main(String[] args) { if (isSpecified("-MDI",args)) { useMDIFrames = true; } if (!isSpecified("-nc",args)) { if (!checkBootStrapper(args)) { // if we did not find a running instance and the -d options is // specified start up the bootstrap deamon to allow checking // for running instances if (isSpecified("-d",args)) { strapper = new BootStrapper(); strapper.start(); } } else { System.exit(0); } } My5250 m = new My5250(); if (strapper != null) strapper.addBootListener(m); if (args.length > 0) { if (isSpecified("-width",args) || isSpecified("-height",args)) { int width = m.frame1.getWidth(); int height = m.frame1.getHeight(); if (isSpecified("-width",args)) { width = Integer.parseInt(m.getParm("-width",args)); } if (isSpecified("-height",args)) { height = Integer.parseInt(m.getParm("-height",args)); } m.frame1.setSize(width,height); m.frame1.centerFrame(); } /** * @todo this crap needs to be rewritten it is a mess */ if (args[0].startsWith("-")) { // check if a session parameter is specified on the command line if (isSpecified("-s",args)) { String sd = getParm("-s",args); if (sessions.containsKey(sd)) { sessions.setProperty("emul.default",sd); } else { args = null; } } // check if a locale parameter is specified on the command line if (isSpecified("-L",args)) { Locale.setDefault(parseLocal(getParm("-L",args))); LangTool.init(); if (args[0].startsWith("-")) { m.sessionArgs = null; } else { m.splash.updateProgress(++m.step); m.frame1.setVisible(true); m.splash.setVisible(false); m.frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); LangTool.init(); m.sessionArgs = args; } } else { LangTool.init(); if (isSpecified("-s",args)) m.sessionArgs = args; else m.sessionArgs = null; } } else { LangTool.init(); m.sessionArgs = args; } } else { LangTool.init(); m.sessionArgs = null; } if (m.sessionArgs != null) { // BEGIN // 2001/09/19 natural computing MR Vector os400_sessions = new Vector(); Vector session_params = new Vector(); for (int x = 0; x < args.length; x++) { if (args[x].equals("-s")) { x++; if (args[x] != null && sessions.containsKey(args[x])) { os400_sessions.addElement(args[x]); }else{ x--; session_params.addElement(args[x]); } }else{ session_params.addElement(args[x]); } } for (int x = 0; x < session_params.size(); x++) m.sessionArgs[x] = session_params.elementAt(x).toString(); m.startNewSession(); for (int x = 1; x < os400_sessions.size(); x++ ) { String sel = os400_sessions.elementAt(x).toString(); if (!m.frame1.isVisible()) { m.splash.updateProgress(++m.step); m.frame1.setVisible(true); m.splash.setVisible(false); m.frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } m.sessionArgs = new String[NUM_PARMS]; m.parseArgs(sessions.getProperty(sel),m.sessionArgs); m.newSession(sel,m.sessionArgs); } // 2001/09/19 natural computing MR // END } else { m.startNewSession(); } } |
|
Properties sesProps = new Properties(); | synchronized void newSession(String sel,String[] args) { Properties sesProps = new Properties(); String propFileName = null; String session = args[0]; // Start loading properties sesProps.put(SESSION_HOST,session); if (isSpecified("-e",args)) sesProps.put(SESSION_TN_ENHANCED,"1"); if (isSpecified("-p",args)) { sesProps.put(SESSION_HOST_PORT,getParm("-p",args)); } if (isSpecified("-f",args)) propFileName = getParm("-f",args); if (isSpecified("-cp",args)) sesProps.put(SESSION_CODE_PAGE ,getParm("-cp",args)); if (isSpecified("-gui",args)) sesProps.put(SESSION_USE_GUI,"1"); if (isSpecified("-132",args)) sesProps.put(SESSION_SCREEN_SIZE,SCREEN_SIZE_27X132_STR); else sesProps.put(SESSION_SCREEN_SIZE,SCREEN_SIZE_24X80_STR); // are we to use a socks proxy if (isSpecified("-usp",args)) { // socks proxy host argument if (isSpecified("-sph",args)) { sesProps.put(SESSION_PROXY_HOST ,getParm("-sph",args)); } // socks proxy port argument if (isSpecified("-spp",args)) sesProps.put(SESSION_PROXY_PORT ,getParm("-spp",args)); } // check if device name is specified if (isSpecified("-dn",args)) sesProps.put(SESSION_DEVICE_NAME ,getParm("-dn",args)); Session s = manager.openSession(sesProps,propFileName,sel); if (!frame1.isVisible()) { splash.updateProgress(++step); frame1.setVisible(true); splash.setVisible(false); frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } else { if (isSpecified("-noembed",args)) { splash.updateProgress(++step); newView(); frame1.setVisible(true); splash.setVisible(false); frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } if (isSpecified("-t",args)) frame1.addSessionView(sel,s); else frame1.addSessionView(session,s); s.connect(); } |
|
String propFileName = null; String session = args[0]; sesProps.put(SESSION_HOST,session); if (isSpecified("-e",args)) sesProps.put(SESSION_TN_ENHANCED,"1"); if (isSpecified("-p",args)) { sesProps.put(SESSION_HOST_PORT,getParm("-p",args)); } if (isSpecified("-f",args)) propFileName = getParm("-f",args); if (isSpecified("-cp",args)) sesProps.put(SESSION_CODE_PAGE ,getParm("-cp",args)); if (isSpecified("-gui",args)) sesProps.put(SESSION_USE_GUI,"1"); if (isSpecified("-132",args)) sesProps.put(SESSION_SCREEN_SIZE,SCREEN_SIZE_27X132_STR); else sesProps.put(SESSION_SCREEN_SIZE,SCREEN_SIZE_24X80_STR); if (isSpecified("-usp",args)) { if (isSpecified("-sph",args)) { sesProps.put(SESSION_PROXY_HOST ,getParm("-sph",args)); } if (isSpecified("-spp",args)) sesProps.put(SESSION_PROXY_PORT ,getParm("-spp",args)); } if (isSpecified("-dn",args)) sesProps.put(SESSION_DEVICE_NAME ,getParm("-dn",args)); Session s = manager.openSession(sesProps,propFileName,sel); | Session s = manager.openSession(sesProps, sesProps.getProperty(SESSION_CONFIG_FILE), sesProps.getProperty(SESSION_TERM_NAME)); | synchronized void newSession(String sel,String[] args) { Properties sesProps = new Properties(); String propFileName = null; String session = args[0]; // Start loading properties sesProps.put(SESSION_HOST,session); if (isSpecified("-e",args)) sesProps.put(SESSION_TN_ENHANCED,"1"); if (isSpecified("-p",args)) { sesProps.put(SESSION_HOST_PORT,getParm("-p",args)); } if (isSpecified("-f",args)) propFileName = getParm("-f",args); if (isSpecified("-cp",args)) sesProps.put(SESSION_CODE_PAGE ,getParm("-cp",args)); if (isSpecified("-gui",args)) sesProps.put(SESSION_USE_GUI,"1"); if (isSpecified("-132",args)) sesProps.put(SESSION_SCREEN_SIZE,SCREEN_SIZE_27X132_STR); else sesProps.put(SESSION_SCREEN_SIZE,SCREEN_SIZE_24X80_STR); // are we to use a socks proxy if (isSpecified("-usp",args)) { // socks proxy host argument if (isSpecified("-sph",args)) { sesProps.put(SESSION_PROXY_HOST ,getParm("-sph",args)); } // socks proxy port argument if (isSpecified("-spp",args)) sesProps.put(SESSION_PROXY_PORT ,getParm("-spp",args)); } // check if device name is specified if (isSpecified("-dn",args)) sesProps.put(SESSION_DEVICE_NAME ,getParm("-dn",args)); Session s = manager.openSession(sesProps,propFileName,sel); if (!frame1.isVisible()) { splash.updateProgress(++step); frame1.setVisible(true); splash.setVisible(false); frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } else { if (isSpecified("-noembed",args)) { splash.updateProgress(++step); newView(); frame1.setVisible(true); splash.setVisible(false); frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } if (isSpecified("-t",args)) frame1.addSessionView(sel,s); else frame1.addSessionView(session,s); s.connect(); } |
if (isSpecified("-noembed",args)) { | if (sesProps.getProperty(GUI_NO_TAB) != null) { | synchronized void newSession(String sel,String[] args) { Properties sesProps = new Properties(); String propFileName = null; String session = args[0]; // Start loading properties sesProps.put(SESSION_HOST,session); if (isSpecified("-e",args)) sesProps.put(SESSION_TN_ENHANCED,"1"); if (isSpecified("-p",args)) { sesProps.put(SESSION_HOST_PORT,getParm("-p",args)); } if (isSpecified("-f",args)) propFileName = getParm("-f",args); if (isSpecified("-cp",args)) sesProps.put(SESSION_CODE_PAGE ,getParm("-cp",args)); if (isSpecified("-gui",args)) sesProps.put(SESSION_USE_GUI,"1"); if (isSpecified("-132",args)) sesProps.put(SESSION_SCREEN_SIZE,SCREEN_SIZE_27X132_STR); else sesProps.put(SESSION_SCREEN_SIZE,SCREEN_SIZE_24X80_STR); // are we to use a socks proxy if (isSpecified("-usp",args)) { // socks proxy host argument if (isSpecified("-sph",args)) { sesProps.put(SESSION_PROXY_HOST ,getParm("-sph",args)); } // socks proxy port argument if (isSpecified("-spp",args)) sesProps.put(SESSION_PROXY_PORT ,getParm("-spp",args)); } // check if device name is specified if (isSpecified("-dn",args)) sesProps.put(SESSION_DEVICE_NAME ,getParm("-dn",args)); Session s = manager.openSession(sesProps,propFileName,sel); if (!frame1.isVisible()) { splash.updateProgress(++step); frame1.setVisible(true); splash.setVisible(false); frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } else { if (isSpecified("-noembed",args)) { splash.updateProgress(++step); newView(); frame1.setVisible(true); splash.setVisible(false); frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } if (isSpecified("-t",args)) frame1.addSessionView(sel,s); else frame1.addSessionView(session,s); s.connect(); } |
if (isSpecified("-t",args)) frame1.addSessionView(sel,s); else frame1.addSessionView(session,s); | frame1.addSessionView(sesProps.getProperty(SESSION_TERM_NAME),s); | synchronized void newSession(String sel,String[] args) { Properties sesProps = new Properties(); String propFileName = null; String session = args[0]; // Start loading properties sesProps.put(SESSION_HOST,session); if (isSpecified("-e",args)) sesProps.put(SESSION_TN_ENHANCED,"1"); if (isSpecified("-p",args)) { sesProps.put(SESSION_HOST_PORT,getParm("-p",args)); } if (isSpecified("-f",args)) propFileName = getParm("-f",args); if (isSpecified("-cp",args)) sesProps.put(SESSION_CODE_PAGE ,getParm("-cp",args)); if (isSpecified("-gui",args)) sesProps.put(SESSION_USE_GUI,"1"); if (isSpecified("-132",args)) sesProps.put(SESSION_SCREEN_SIZE,SCREEN_SIZE_27X132_STR); else sesProps.put(SESSION_SCREEN_SIZE,SCREEN_SIZE_24X80_STR); // are we to use a socks proxy if (isSpecified("-usp",args)) { // socks proxy host argument if (isSpecified("-sph",args)) { sesProps.put(SESSION_PROXY_HOST ,getParm("-sph",args)); } // socks proxy port argument if (isSpecified("-spp",args)) sesProps.put(SESSION_PROXY_PORT ,getParm("-spp",args)); } // check if device name is specified if (isSpecified("-dn",args)) sesProps.put(SESSION_DEVICE_NAME ,getParm("-dn",args)); Session s = manager.openSession(sesProps,propFileName,sel); if (!frame1.isVisible()) { splash.updateProgress(++step); frame1.setVisible(true); splash.setVisible(false); frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } else { if (isSpecified("-noembed",args)) { splash.updateProgress(++step); newView(); frame1.setVisible(true); splash.setVisible(false); frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } if (isSpecified("-t",args)) frame1.addSessionView(sel,s); else frame1.addSessionView(session,s); s.connect(); } |
protected void parseArgs(String theStringList, String[] s) { | static protected void parseArgs(String theStringList, String[] s) { | protected void parseArgs(String theStringList, String[] s) { int x = 0; StringTokenizer tokenizer = new StringTokenizer(theStringList, " "); while (tokenizer.hasMoreTokens()) { s[x++] = tokenizer.nextToken(); } } |
if (sessionArgs != null && !sessionArgs[0].startsWith("-")) sel = sessionArgs[0]; else { sel = getDefaultSession(); } | void startNewSession() { int result = 2; String sel = ""; if (sessionArgs != null && !sessionArgs[0].startsWith("-")) sel = sessionArgs[0]; else { sel = getDefaultSession(); } Sessions sess = manager.getSessions(); if (sel != null && sess.getCount() == 0 && sessions.containsKey(sel)){ sessionArgs = new String[NUM_PARMS]; parseArgs((String)sessions.getProperty(sel), sessionArgs); } if (sessionArgs == null || sess.getCount() > 0 || sessions.containsKey("emul.showConnectDialog")) { sel = getConnectSession(); if (sel != null) { String selArgs = sessions.getProperty(sel); sessionArgs = new String[NUM_PARMS]; parseArgs(selArgs, sessionArgs); newSession(sel,sessionArgs); } else { if (sess.getCount() == 0) System.exit(0); } } else { newSession(sel,sessionArgs); } } |
|
if (sel != null && sess.getCount() == 0 && sessions.containsKey(sel)){ sessionArgs = new String[NUM_PARMS]; parseArgs((String)sessions.getProperty(sel), sessionArgs); } if (sessionArgs == null || sess.getCount() > 0 || sessions.containsKey("emul.showConnectDialog")) { | if (sess.getCount() > 0 || sessions.containsKey("emul.showConnectDialog")) { | void startNewSession() { int result = 2; String sel = ""; if (sessionArgs != null && !sessionArgs[0].startsWith("-")) sel = sessionArgs[0]; else { sel = getDefaultSession(); } Sessions sess = manager.getSessions(); if (sel != null && sess.getCount() == 0 && sessions.containsKey(sel)){ sessionArgs = new String[NUM_PARMS]; parseArgs((String)sessions.getProperty(sel), sessionArgs); } if (sessionArgs == null || sess.getCount() > 0 || sessions.containsKey("emul.showConnectDialog")) { sel = getConnectSession(); if (sel != null) { String selArgs = sessions.getProperty(sel); sessionArgs = new String[NUM_PARMS]; parseArgs(selArgs, sessionArgs); newSession(sel,sessionArgs); } else { if (sess.getCount() == 0) System.exit(0); } } else { newSession(sel,sessionArgs); } } |
newSession(sel,sessionArgs); | newSession(sesProps.getProperty(SESSION_HOST), null); | void startNewSession() { int result = 2; String sel = ""; if (sessionArgs != null && !sessionArgs[0].startsWith("-")) sel = sessionArgs[0]; else { sel = getDefaultSession(); } Sessions sess = manager.getSessions(); if (sel != null && sess.getCount() == 0 && sessions.containsKey(sel)){ sessionArgs = new String[NUM_PARMS]; parseArgs((String)sessions.getProperty(sel), sessionArgs); } if (sessionArgs == null || sess.getCount() > 0 || sessions.containsKey("emul.showConnectDialog")) { sel = getConnectSession(); if (sel != null) { String selArgs = sessions.getProperty(sel); sessionArgs = new String[NUM_PARMS]; parseArgs(selArgs, sessionArgs); newSession(sel,sessionArgs); } else { if (sess.getCount() == 0) System.exit(0); } } else { newSession(sel,sessionArgs); } } |
stateMask = stateMask & (~ENABLED); | stateMask = stateMask & (~ENABLED) & (~ARMED) & (~PRESSED); | public void setEnabled(boolean e) { // if this call does not represent a CHANGE in state, then return if ((e && isEnabled()) || (!e && !isEnabled())) return; // make the change if (e) stateMask = stateMask | ENABLED; else stateMask = stateMask & (~ENABLED); // notify interested ChangeListeners fireStateChanged(); } |
if (group != g) { | public void setGroup(ButtonGroup g) { if (group != g) { group = g; fireStateChanged(); } } |
|
fireStateChanged(); } | public void setGroup(ButtonGroup g) { if (group != g) { group = g; fireStateChanged(); } } |
|
public void setRxMode(int rxMode) { this.rxMode = rxMode; | final void setRxMode() { EEPRO100TxFD lastCmd0; byte newRxMode = 0; int flags; int entry; byte[] configData = new byte[22]; if (curTx - dirtyTx >= TX_RING_SIZE - 1) { rxMode = -1; return; } entry = curTx & TX_RING_SIZE - 1; lastCmd0 = lastCmd; lastCmd = txRing[entry]; txRing[entry].setStatus(CmdSuspend | CmdConfigure); curTx++; txRing[entry].setLink(txRing[(entry + 1) & TX_RING_SIZE - 1].getBufferAddress()); System.arraycopy(i82558ConfigCmd, 0, configData, 0, configData.length); for (int i = 0; i < configData.length; i++) { log.debug(i + ':' + Integer.toHexString(configData[i]) + ' '); } txRing[entry].setParams(configData); EEPRO100Utils.waitForCmdDone(this.core.getRegs()); this.core.getRegs().setReg8(SCBCmd, CUResume); lastCmdTime = jiffies; rxMode = newRxMode; lastCmdTime = jiffies; | public void setRxMode(int rxMode) { this.rxMode = rxMode; } |
MyFileChooser pcFileChooser = new MyFileChooser(workingDir); | TN5250jFileChooser pcFileChooser = new TN5250jFileChooser(workingDir); | private void getPCFile() { String workingDir = System.getProperty("user.dir"); MyFileChooser pcFileChooser = new MyFileChooser(workingDir); int ret = pcFileChooser.showSaveDialog(new JFrame()); // check to see if something was actually chosen if (ret == JFileChooser.APPROVE_OPTION) { File file = pcFileChooser.getSelectedFile(); StringBuffer sb = new StringBuffer(); char[] s = screen.getScreenAsChars(); int c = screen.getCols(); int l = screen.getRows() * c; int col = 0; for (int x = 0; x < l; x++,col++) { sb.append(s[x]); if (col == c) { sb.append('\n'); col = 0; } } writeToFile(sb.toString(),file); } } |
return AccessibleRole.POPUP_MENU; | return AccessibleRole.COMBO_BOX; | public AccessibleRole getAccessibleRole() { return AccessibleRole.POPUP_MENU; } |
thumbRect.y = contentRect.y; | thumbRect.y = trackRect.y; | protected void calculateThumbLocation() { int value = slider.getValue(); if (slider.getOrientation() == JSlider.HORIZONTAL) { thumbRect.x = xPositionForValue(value) - thumbRect.width / 2; thumbRect.y = contentRect.y; } else { thumbRect.x = contentRect.x; thumbRect.y = yPositionForValue(value) - thumbRect.height / 2; } } |
thumbRect.x = contentRect.x; | thumbRect.x = trackRect.x; | protected void calculateThumbLocation() { int value = slider.getValue(); if (slider.getOrientation() == JSlider.HORIZONTAL) { thumbRect.x = xPositionForValue(value) - thumbRect.width / 2; thumbRect.y = contentRect.y; } else { thumbRect.x = contentRect.x; thumbRect.y = yPositionForValue(value) - thumbRect.height / 2; } } |
{ if (thumbWidth > contentRect.width) thumbRect.width = contentRect.width / 4; else thumbRect.width = thumbWidth; if (thumbHeight > contentRect.height) thumbRect.height = contentRect.height; else thumbRect.height = thumbHeight; } | thumbRect.y = trackRect.y; | protected void calculateThumbSize() { if (slider.getOrientation() == JSlider.HORIZONTAL) { if (thumbWidth > contentRect.width) thumbRect.width = contentRect.width / 4; else thumbRect.width = thumbWidth; if (thumbHeight > contentRect.height) thumbRect.height = contentRect.height; else thumbRect.height = thumbHeight; } else { // The thumb gets flipped when inverted, so thumbWidth // actually is the height and vice versa. if (thumbWidth > contentRect.height) thumbRect.height = contentRect.height / 4; else thumbRect.height = thumbWidth; if (thumbHeight > contentRect.width) thumbRect.width = contentRect.width; else thumbRect.width = thumbHeight; } } |
{ if (thumbWidth > contentRect.height) thumbRect.height = contentRect.height / 4; else thumbRect.height = thumbWidth; if (thumbHeight > contentRect.width) thumbRect.width = contentRect.width; else thumbRect.width = thumbHeight; } | thumbRect.x = trackRect.x; | protected void calculateThumbSize() { if (slider.getOrientation() == JSlider.HORIZONTAL) { if (thumbWidth > contentRect.width) thumbRect.width = contentRect.width / 4; else thumbRect.width = thumbWidth; if (thumbHeight > contentRect.height) thumbRect.height = contentRect.height; else thumbRect.height = thumbHeight; } else { // The thumb gets flipped when inverted, so thumbWidth // actually is the height and vice versa. if (thumbWidth > contentRect.height) thumbRect.height = contentRect.height / 4; else thumbRect.height = thumbWidth; if (thumbHeight > contentRect.width) thumbRect.width = contentRect.width; else thumbRect.width = thumbHeight; } } |
trackBuffer = thumbRect.width; | trackBuffer = thumbRect.width / 2; | protected void calculateTrackBuffer() { if (slider.getOrientation() == JSlider.HORIZONTAL) trackBuffer = thumbRect.width; else trackBuffer = thumbRect.height; } |
trackBuffer = thumbRect.height; | trackBuffer = thumbRect.height / 2; | protected void calculateTrackBuffer() { if (slider.getOrientation() == JSlider.HORIZONTAL) trackBuffer = thumbRect.width; else trackBuffer = thumbRect.height; } |
trackRect.y = contentRect.y; | int h = getThumbSize().height; if (slider.getPaintTicks() && (slider.getMajorTickSpacing() > 0 || slider.getMinorTickSpacing() > 0)) h += getTickLength(); trackRect.y = contentRect.y + (contentRect.height - h) / 2 - 1; | protected void calculateTrackRect() { if (slider.getOrientation() == JSlider.HORIZONTAL) { trackRect.x = contentRect.x + trackBuffer; trackRect.y = contentRect.y; trackRect.width = contentRect.width - 2 * trackBuffer; trackRect.height = thumbRect.height; } else { trackRect.x = contentRect.x; trackRect.y = contentRect.y + trackBuffer; trackRect.width = thumbRect.width; trackRect.height = contentRect.height - 2 * trackBuffer; } } |
trackRect.x = contentRect.x; | int w = getThumbSize().width; if (slider.getPaintTicks() && (slider.getMajorTickSpacing() > 0 || slider.getMinorTickSpacing() > 0)) w += getTickLength(); trackRect.x = contentRect.x + (contentRect.width - w) / 2 - 1; | protected void calculateTrackRect() { if (slider.getOrientation() == JSlider.HORIZONTAL) { trackRect.x = contentRect.x + trackBuffer; trackRect.y = contentRect.y; trackRect.width = contentRect.width - 2 * trackBuffer; trackRect.height = thumbRect.height; } else { trackRect.x = contentRect.x; trackRect.y = contentRect.y + trackBuffer; trackRect.width = thumbRect.width; trackRect.height = contentRect.height - 2 * trackBuffer; } } |
return getPreferredHorizontalSize(); | { int height = getThumbSize().height; if (slider.getPaintTicks() && slider.getMajorTickSpacing() > 0 || slider.getMinorTickSpacing() > 0) height += getTickLength(); if (slider.getPaintLabels()) height += getHeightOfTallestLabel(); height += insets.top + insets.bottom + focusInsets.top + focusInsets.bottom; return new Dimension(32767, height); } | public Dimension getMaximumSize(JComponent c) { if (slider.getOrientation() == JSlider.HORIZONTAL) return getPreferredHorizontalSize(); else return getPreferredVerticalSize(); } |
return getPreferredVerticalSize(); | { int width = getThumbSize().width; if (slider.getPaintTicks() && slider.getMajorTickSpacing() > 0 || slider.getMinorTickSpacing() > 0) width += getTickLength(); if (slider.getPaintLabels()) width += getWidthOfWidestLabel(); width += insets.left + insets.right + focusInsets.left + focusInsets.right; return new Dimension(width, 32767); } | public Dimension getMaximumSize(JComponent c) { if (slider.getOrientation() == JSlider.HORIZONTAL) return getPreferredHorizontalSize(); else return getPreferredVerticalSize(); } |
return getPreferredHorizontalSize(); | Insets insets = slider.getInsets(); int height = getThumbSize().height; if (slider.getPaintTicks() && slider.getMajorTickSpacing() > 0 || slider.getMinorTickSpacing() > 0) height += getTickLength(); if (slider.getPaintLabels()) height += getHeightOfTallestLabel(); height += insets.top + insets.bottom + focusInsets.top + focusInsets.bottom; return new Dimension(36, height); | public Dimension getMinimumHorizontalSize() { return getPreferredHorizontalSize(); } |
return getPreferredHorizontalSize(); | return getMinimumHorizontalSize(); | public Dimension getMinimumSize(JComponent c) { if (slider.getOrientation() == JSlider.HORIZONTAL) return getPreferredHorizontalSize(); else return getPreferredVerticalSize(); } |
return getPreferredVerticalSize(); | return getMinimumVerticalSize(); | public Dimension getMinimumSize(JComponent c) { if (slider.getOrientation() == JSlider.HORIZONTAL) return getPreferredHorizontalSize(); else return getPreferredVerticalSize(); } |
return getPreferredVerticalSize(); | Insets insets = slider.getInsets(); int width = getThumbSize().width; if (slider.getPaintTicks() && slider.getMajorTickSpacing() > 0 || slider.getMinorTickSpacing() > 0) width += getTickLength(); if (slider.getPaintLabels()) width += getWidthOfWidestLabel(); width += insets.left + insets.right + focusInsets.left + focusInsets.right; return new Dimension(width, 36); | public Dimension getMinimumVerticalSize() { return getPreferredVerticalSize(); } |
int height = thumbHeight; | int height = getThumbSize().height; | public Dimension getPreferredHorizontalSize() { Insets insets = slider.getInsets(); // The width should cover all the labels (which are usually the // deciding factor of the width) int width = getWidthOfWidestLabel() * (slider.getLabelTable() == null ? 0 : slider.getLabelTable() .size()); // If there are not enough labels. // This number is pretty much arbitrary, but it looks nice. if (width < 200) width = 200; // We can only draw inside of the focusRectangle, so we have to // pad it with insets. width += insets.left + insets.right + focusInsets.left + focusInsets.right; // Height is determined by the thumb, the ticks and the labels. int height = thumbHeight; if (slider.getPaintTicks() && slider.getMajorTickSpacing() > 0 || slider.getMinorTickSpacing() > 0) height += tickHeight; if (slider.getPaintLabels()) height += getHeightOfTallestLabel(); height += insets.top + insets.bottom + focusInsets.top + focusInsets.bottom; return new Dimension(width, height); } |
height += tickHeight; | height += getTickLength(); | public Dimension getPreferredHorizontalSize() { Insets insets = slider.getInsets(); // The width should cover all the labels (which are usually the // deciding factor of the width) int width = getWidthOfWidestLabel() * (slider.getLabelTable() == null ? 0 : slider.getLabelTable() .size()); // If there are not enough labels. // This number is pretty much arbitrary, but it looks nice. if (width < 200) width = 200; // We can only draw inside of the focusRectangle, so we have to // pad it with insets. width += insets.left + insets.right + focusInsets.left + focusInsets.right; // Height is determined by the thumb, the ticks and the labels. int height = thumbHeight; if (slider.getPaintTicks() && slider.getMajorTickSpacing() > 0 || slider.getMinorTickSpacing() > 0) height += tickHeight; if (slider.getPaintLabels()) height += getHeightOfTallestLabel(); height += insets.top + insets.bottom + focusInsets.top + focusInsets.bottom; return new Dimension(width, height); } |
int width = thumbHeight; | int width = getThumbSize().width; | public Dimension getPreferredVerticalSize() { Insets insets = slider.getInsets(); int height = getHeightOfTallestLabel() * (slider.getLabelTable() == null ? 0 : slider.getLabelTable() .size()); if (height < 200) height = 200; height += insets.top + insets.bottom + focusInsets.top + focusInsets.bottom; int width = thumbHeight; if (slider.getPaintTicks() && slider.getMajorTickSpacing() > 0 || slider.getMinorTickSpacing() > 0) width += tickHeight; if (slider.getPaintLabels()) width += getWidthOfWidestLabel(); width += insets.left + insets.right + focusInsets.left + focusInsets.right; return new Dimension(width, height); } |
width += tickHeight; | width += getTickLength(); | public Dimension getPreferredVerticalSize() { Insets insets = slider.getInsets(); int height = getHeightOfTallestLabel() * (slider.getLabelTable() == null ? 0 : slider.getLabelTable() .size()); if (height < 200) height = 200; height += insets.top + insets.bottom + focusInsets.top + focusInsets.bottom; int width = thumbHeight; if (slider.getPaintTicks() && slider.getMajorTickSpacing() > 0 || slider.getMinorTickSpacing() > 0) width += tickHeight; if (slider.getPaintLabels()) width += getWidthOfWidestLabel(); width += insets.left + insets.right + focusInsets.left + focusInsets.right; return new Dimension(width, height); } |
return thumbRect.getSize(); | if (slider.getOrientation() == JSlider.HORIZONTAL) return new Dimension(11, 20); else return new Dimension(20, 11); | protected Dimension getThumbSize() { // This is really just the bounds box for the thumb. // The thumb will actually be pointed (like a rectangle + triangle at bottom) return thumbRect.getSize(); } |
return tickHeight; | return 8; | protected int getTickLength() { return tickHeight; } |
thumbHeight = defaults.getInt("Slider.thumbHeight"); thumbWidth = defaults.getInt("Slider.thumbWidth"); tickHeight = defaults.getInt("Slider.tickHeight"); | protected void installDefaults(JSlider slider) { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); slider.setForeground(defaults.getColor("Slider.foreground")); slider.setBackground(defaults.getColor("Slider.background")); shadowColor = defaults.getColor("Slider.shadow"); highlightColor = defaults.getColor("Slider.highlight"); focusColor = defaults.getColor("Slider.focus"); slider.setBorder(defaults.getBorder("Slider.border")); slider.setOpaque(true); thumbHeight = defaults.getInt("Slider.thumbHeight"); thumbWidth = defaults.getInt("Slider.thumbWidth"); tickHeight = defaults.getInt("Slider.tickHeight"); focusInsets = defaults.getInsets("Slider.focusInsets"); } |
|
int y = tickRect.y + tickRect.height / 4; | int y = tickRect.height / 4; | protected void paintMajorTickForHorizSlider(Graphics g, Rectangle tickBounds, int x) { int y = tickRect.y + tickRect.height / 4; Color saved = g.getColor(); g.setColor(Color.BLACK); g.drawLine(x, y, x, y + tickRect.height / 2); g.setColor(saved); } |
int x = tickRect.x + tickRect.width / 4; | int x = tickRect.width / 4; | protected void paintMajorTickForVertSlider(Graphics g, Rectangle tickBounds, int y) { int x = tickRect.x + tickRect.width / 4; Color saved = g.getColor(); g.setColor(Color.BLACK); g.drawLine(x, y, x + tickRect.width / 2, y); g.setColor(saved); } |
int y = tickRect.y + tickRect.height / 4; | int y = tickRect.height / 4; | protected void paintMinorTickForHorizSlider(Graphics g, Rectangle tickBounds, int x) { int y = tickRect.y + tickRect.height / 4; Color saved = g.getColor(); g.setColor(Color.BLACK); g.drawLine(x, y, x, y + tickRect.height / 4); g.setColor(saved); } |
int x = tickRect.x + tickRect.width / 4; | int x = tickRect.width / 4; | protected void paintMinorTickForVertSlider(Graphics g, Rectangle tickBounds, int y) { int x = tickRect.x + tickRect.width / 4; Color saved = g.getColor(); g.setColor(Color.BLACK); g.drawLine(x, y, x + tickRect.width / 4, y); g.setColor(saved); } |
Polygon thumb = new Polygon(); | public void paintThumb(Graphics g) { Color saved_color = g.getColor(); Polygon thumb = new Polygon(); Point a = new Point(thumbRect.x, thumbRect.y); Point b = new Point(a); Point c = new Point(a); Point d = new Point(a); Point e = new Point(a); Polygon bright; Polygon dark; Polygon all; // This will be in X-dimension if the slider is inverted and y if it isn't. int turnPoint; if (slider.getOrientation() == JSlider.HORIZONTAL) { turnPoint = thumbRect.height * 3 / 4; b.translate(thumbRect.width, 0); c.translate(thumbRect.width, turnPoint); d.translate(thumbRect.width / 2, thumbRect.height); e.translate(0, turnPoint); bright = new Polygon(new int[] { b.x, a.x, e.x, d.x }, new int[] { b.y, a.y, e.y, d.y }, 4); dark = new Polygon(new int[] { b.x, c.x, d.x }, new int[] { b.y, c.y, d.y }, 3); all = new Polygon(new int[] { a.x + 1, b.x, c.x, d.x, e.x + 1 }, new int[] { a.y + 1, b.y + 1, c.y, d.y + 1, e.y }, 5); } else { turnPoint = thumbRect.width * 3 / 4; b.translate(turnPoint, 0); c.translate(thumbRect.width, thumbRect.height / 2); d.translate(turnPoint, thumbRect.height); e.translate(0, thumbRect.height); bright = new Polygon(new int[] { c.x, b.x, a.x, e.x }, new int[] { c.y, b.y, a.y, e.y }, 4); dark = new Polygon(new int[] { c.x, d.x, e.x + 1 }, new int[] { c.y, d.y, e.y }, 3); all = new Polygon(new int[] { a.x + 1, b.x, c.x - 1, d.x, e.x + 1 }, new int[] { a.y + 1, b.y + 1, c.y, d.y, e.y }, 5); } g.setColor(Color.WHITE); g.drawPolyline(bright.xpoints, bright.ypoints, bright.npoints); g.setColor(Color.BLACK); g.drawPolyline(dark.xpoints, dark.ypoints, dark.npoints); g.setColor(Color.GRAY); g.fillPolygon(all); g.setColor(saved_color); } |
|
Polygon dark; | Polygon light; Polygon dark; | public void paintThumb(Graphics g) { Color saved_color = g.getColor(); Polygon thumb = new Polygon(); Point a = new Point(thumbRect.x, thumbRect.y); Point b = new Point(a); Point c = new Point(a); Point d = new Point(a); Point e = new Point(a); Polygon bright; Polygon dark; Polygon all; // This will be in X-dimension if the slider is inverted and y if it isn't. int turnPoint; if (slider.getOrientation() == JSlider.HORIZONTAL) { turnPoint = thumbRect.height * 3 / 4; b.translate(thumbRect.width, 0); c.translate(thumbRect.width, turnPoint); d.translate(thumbRect.width / 2, thumbRect.height); e.translate(0, turnPoint); bright = new Polygon(new int[] { b.x, a.x, e.x, d.x }, new int[] { b.y, a.y, e.y, d.y }, 4); dark = new Polygon(new int[] { b.x, c.x, d.x }, new int[] { b.y, c.y, d.y }, 3); all = new Polygon(new int[] { a.x + 1, b.x, c.x, d.x, e.x + 1 }, new int[] { a.y + 1, b.y + 1, c.y, d.y + 1, e.y }, 5); } else { turnPoint = thumbRect.width * 3 / 4; b.translate(turnPoint, 0); c.translate(thumbRect.width, thumbRect.height / 2); d.translate(turnPoint, thumbRect.height); e.translate(0, thumbRect.height); bright = new Polygon(new int[] { c.x, b.x, a.x, e.x }, new int[] { c.y, b.y, a.y, e.y }, 4); dark = new Polygon(new int[] { c.x, d.x, e.x + 1 }, new int[] { c.y, d.y, e.y }, 3); all = new Polygon(new int[] { a.x + 1, b.x, c.x - 1, d.x, e.x + 1 }, new int[] { a.y + 1, b.y + 1, c.y, d.y, e.y }, 5); } g.setColor(Color.WHITE); g.drawPolyline(bright.xpoints, bright.ypoints, bright.npoints); g.setColor(Color.BLACK); g.drawPolyline(dark.xpoints, dark.ypoints, dark.npoints); g.setColor(Color.GRAY); g.fillPolygon(all); g.setColor(saved_color); } |
b.translate(thumbRect.width, 0); c.translate(thumbRect.width, turnPoint); d.translate(thumbRect.width / 2, thumbRect.height); | b.translate(thumbRect.width - 1, 0); c.translate(thumbRect.width - 1, turnPoint); d.translate(thumbRect.width / 2 - 1, thumbRect.height - 1); | public void paintThumb(Graphics g) { Color saved_color = g.getColor(); Polygon thumb = new Polygon(); Point a = new Point(thumbRect.x, thumbRect.y); Point b = new Point(a); Point c = new Point(a); Point d = new Point(a); Point e = new Point(a); Polygon bright; Polygon dark; Polygon all; // This will be in X-dimension if the slider is inverted and y if it isn't. int turnPoint; if (slider.getOrientation() == JSlider.HORIZONTAL) { turnPoint = thumbRect.height * 3 / 4; b.translate(thumbRect.width, 0); c.translate(thumbRect.width, turnPoint); d.translate(thumbRect.width / 2, thumbRect.height); e.translate(0, turnPoint); bright = new Polygon(new int[] { b.x, a.x, e.x, d.x }, new int[] { b.y, a.y, e.y, d.y }, 4); dark = new Polygon(new int[] { b.x, c.x, d.x }, new int[] { b.y, c.y, d.y }, 3); all = new Polygon(new int[] { a.x + 1, b.x, c.x, d.x, e.x + 1 }, new int[] { a.y + 1, b.y + 1, c.y, d.y + 1, e.y }, 5); } else { turnPoint = thumbRect.width * 3 / 4; b.translate(turnPoint, 0); c.translate(thumbRect.width, thumbRect.height / 2); d.translate(turnPoint, thumbRect.height); e.translate(0, thumbRect.height); bright = new Polygon(new int[] { c.x, b.x, a.x, e.x }, new int[] { c.y, b.y, a.y, e.y }, 4); dark = new Polygon(new int[] { c.x, d.x, e.x + 1 }, new int[] { c.y, d.y, e.y }, 3); all = new Polygon(new int[] { a.x + 1, b.x, c.x - 1, d.x, e.x + 1 }, new int[] { a.y + 1, b.y + 1, c.y, d.y, e.y }, 5); } g.setColor(Color.WHITE); g.drawPolyline(bright.xpoints, bright.ypoints, bright.npoints); g.setColor(Color.BLACK); g.drawPolyline(dark.xpoints, dark.ypoints, dark.npoints); g.setColor(Color.GRAY); g.fillPolygon(all); g.setColor(saved_color); } |
bright = new Polygon(new int[] { b.x, a.x, e.x, d.x }, | bright = new Polygon(new int[] { b.x - 1, a.x, e.x, d.x }, | public void paintThumb(Graphics g) { Color saved_color = g.getColor(); Polygon thumb = new Polygon(); Point a = new Point(thumbRect.x, thumbRect.y); Point b = new Point(a); Point c = new Point(a); Point d = new Point(a); Point e = new Point(a); Polygon bright; Polygon dark; Polygon all; // This will be in X-dimension if the slider is inverted and y if it isn't. int turnPoint; if (slider.getOrientation() == JSlider.HORIZONTAL) { turnPoint = thumbRect.height * 3 / 4; b.translate(thumbRect.width, 0); c.translate(thumbRect.width, turnPoint); d.translate(thumbRect.width / 2, thumbRect.height); e.translate(0, turnPoint); bright = new Polygon(new int[] { b.x, a.x, e.x, d.x }, new int[] { b.y, a.y, e.y, d.y }, 4); dark = new Polygon(new int[] { b.x, c.x, d.x }, new int[] { b.y, c.y, d.y }, 3); all = new Polygon(new int[] { a.x + 1, b.x, c.x, d.x, e.x + 1 }, new int[] { a.y + 1, b.y + 1, c.y, d.y + 1, e.y }, 5); } else { turnPoint = thumbRect.width * 3 / 4; b.translate(turnPoint, 0); c.translate(thumbRect.width, thumbRect.height / 2); d.translate(turnPoint, thumbRect.height); e.translate(0, thumbRect.height); bright = new Polygon(new int[] { c.x, b.x, a.x, e.x }, new int[] { c.y, b.y, a.y, e.y }, 4); dark = new Polygon(new int[] { c.x, d.x, e.x + 1 }, new int[] { c.y, d.y, e.y }, 3); all = new Polygon(new int[] { a.x + 1, b.x, c.x - 1, d.x, e.x + 1 }, new int[] { a.y + 1, b.y + 1, c.y, d.y, e.y }, 5); } g.setColor(Color.WHITE); g.drawPolyline(bright.xpoints, bright.ypoints, bright.npoints); g.setColor(Color.BLACK); g.drawPolyline(dark.xpoints, dark.ypoints, dark.npoints); g.setColor(Color.GRAY); g.fillPolygon(all); g.setColor(saved_color); } |
dark = new Polygon(new int[] { b.x, c.x, d.x }, new int[] { b.y, c.y, d.y }, 3); all = new Polygon(new int[] { a.x + 1, b.x, c.x, d.x, e.x + 1 }, new int[] { a.y + 1, b.y + 1, c.y, d.y + 1, e.y }, 5); | dark = new Polygon(new int[] { b.x, c.x, d.x + 1 }, new int[] { b.y, c.y - 1, d.y }, 3); light = new Polygon(new int[] { b.x - 1, c.x - 1, d.x + 1 }, new int[] { b.y + 1, c.y - 1, d.y - 1 }, 3); all = new Polygon(new int[] { a.x + 1, b.x - 2, c.x - 2, d.x, e.x + 1 }, new int[] { a.y + 1, b.y + 1, c.y - 1, d.y - 1, e.y }, 5); | public void paintThumb(Graphics g) { Color saved_color = g.getColor(); Polygon thumb = new Polygon(); Point a = new Point(thumbRect.x, thumbRect.y); Point b = new Point(a); Point c = new Point(a); Point d = new Point(a); Point e = new Point(a); Polygon bright; Polygon dark; Polygon all; // This will be in X-dimension if the slider is inverted and y if it isn't. int turnPoint; if (slider.getOrientation() == JSlider.HORIZONTAL) { turnPoint = thumbRect.height * 3 / 4; b.translate(thumbRect.width, 0); c.translate(thumbRect.width, turnPoint); d.translate(thumbRect.width / 2, thumbRect.height); e.translate(0, turnPoint); bright = new Polygon(new int[] { b.x, a.x, e.x, d.x }, new int[] { b.y, a.y, e.y, d.y }, 4); dark = new Polygon(new int[] { b.x, c.x, d.x }, new int[] { b.y, c.y, d.y }, 3); all = new Polygon(new int[] { a.x + 1, b.x, c.x, d.x, e.x + 1 }, new int[] { a.y + 1, b.y + 1, c.y, d.y + 1, e.y }, 5); } else { turnPoint = thumbRect.width * 3 / 4; b.translate(turnPoint, 0); c.translate(thumbRect.width, thumbRect.height / 2); d.translate(turnPoint, thumbRect.height); e.translate(0, thumbRect.height); bright = new Polygon(new int[] { c.x, b.x, a.x, e.x }, new int[] { c.y, b.y, a.y, e.y }, 4); dark = new Polygon(new int[] { c.x, d.x, e.x + 1 }, new int[] { c.y, d.y, e.y }, 3); all = new Polygon(new int[] { a.x + 1, b.x, c.x - 1, d.x, e.x + 1 }, new int[] { a.y + 1, b.y + 1, c.y, d.y, e.y }, 5); } g.setColor(Color.WHITE); g.drawPolyline(bright.xpoints, bright.ypoints, bright.npoints); g.setColor(Color.BLACK); g.drawPolyline(dark.xpoints, dark.ypoints, dark.npoints); g.setColor(Color.GRAY); g.fillPolygon(all); g.setColor(saved_color); } |
turnPoint = thumbRect.width * 3 / 4; | turnPoint = thumbRect.width * 3 / 4 - 1; | public void paintThumb(Graphics g) { Color saved_color = g.getColor(); Polygon thumb = new Polygon(); Point a = new Point(thumbRect.x, thumbRect.y); Point b = new Point(a); Point c = new Point(a); Point d = new Point(a); Point e = new Point(a); Polygon bright; Polygon dark; Polygon all; // This will be in X-dimension if the slider is inverted and y if it isn't. int turnPoint; if (slider.getOrientation() == JSlider.HORIZONTAL) { turnPoint = thumbRect.height * 3 / 4; b.translate(thumbRect.width, 0); c.translate(thumbRect.width, turnPoint); d.translate(thumbRect.width / 2, thumbRect.height); e.translate(0, turnPoint); bright = new Polygon(new int[] { b.x, a.x, e.x, d.x }, new int[] { b.y, a.y, e.y, d.y }, 4); dark = new Polygon(new int[] { b.x, c.x, d.x }, new int[] { b.y, c.y, d.y }, 3); all = new Polygon(new int[] { a.x + 1, b.x, c.x, d.x, e.x + 1 }, new int[] { a.y + 1, b.y + 1, c.y, d.y + 1, e.y }, 5); } else { turnPoint = thumbRect.width * 3 / 4; b.translate(turnPoint, 0); c.translate(thumbRect.width, thumbRect.height / 2); d.translate(turnPoint, thumbRect.height); e.translate(0, thumbRect.height); bright = new Polygon(new int[] { c.x, b.x, a.x, e.x }, new int[] { c.y, b.y, a.y, e.y }, 4); dark = new Polygon(new int[] { c.x, d.x, e.x + 1 }, new int[] { c.y, d.y, e.y }, 3); all = new Polygon(new int[] { a.x + 1, b.x, c.x - 1, d.x, e.x + 1 }, new int[] { a.y + 1, b.y + 1, c.y, d.y, e.y }, 5); } g.setColor(Color.WHITE); g.drawPolyline(bright.xpoints, bright.ypoints, bright.npoints); g.setColor(Color.BLACK); g.drawPolyline(dark.xpoints, dark.ypoints, dark.npoints); g.setColor(Color.GRAY); g.fillPolygon(all); g.setColor(saved_color); } |
c.translate(thumbRect.width, thumbRect.height / 2); d.translate(turnPoint, thumbRect.height); e.translate(0, thumbRect.height); | c.translate(thumbRect.width - 1, thumbRect.height / 2); d.translate(turnPoint, thumbRect.height - 1); e.translate(0, thumbRect.height - 1); | public void paintThumb(Graphics g) { Color saved_color = g.getColor(); Polygon thumb = new Polygon(); Point a = new Point(thumbRect.x, thumbRect.y); Point b = new Point(a); Point c = new Point(a); Point d = new Point(a); Point e = new Point(a); Polygon bright; Polygon dark; Polygon all; // This will be in X-dimension if the slider is inverted and y if it isn't. int turnPoint; if (slider.getOrientation() == JSlider.HORIZONTAL) { turnPoint = thumbRect.height * 3 / 4; b.translate(thumbRect.width, 0); c.translate(thumbRect.width, turnPoint); d.translate(thumbRect.width / 2, thumbRect.height); e.translate(0, turnPoint); bright = new Polygon(new int[] { b.x, a.x, e.x, d.x }, new int[] { b.y, a.y, e.y, d.y }, 4); dark = new Polygon(new int[] { b.x, c.x, d.x }, new int[] { b.y, c.y, d.y }, 3); all = new Polygon(new int[] { a.x + 1, b.x, c.x, d.x, e.x + 1 }, new int[] { a.y + 1, b.y + 1, c.y, d.y + 1, e.y }, 5); } else { turnPoint = thumbRect.width * 3 / 4; b.translate(turnPoint, 0); c.translate(thumbRect.width, thumbRect.height / 2); d.translate(turnPoint, thumbRect.height); e.translate(0, thumbRect.height); bright = new Polygon(new int[] { c.x, b.x, a.x, e.x }, new int[] { c.y, b.y, a.y, e.y }, 4); dark = new Polygon(new int[] { c.x, d.x, e.x + 1 }, new int[] { c.y, d.y, e.y }, 3); all = new Polygon(new int[] { a.x + 1, b.x, c.x - 1, d.x, e.x + 1 }, new int[] { a.y + 1, b.y + 1, c.y, d.y, e.y }, 5); } g.setColor(Color.WHITE); g.drawPolyline(bright.xpoints, bright.ypoints, bright.npoints); g.setColor(Color.BLACK); g.drawPolyline(dark.xpoints, dark.ypoints, dark.npoints); g.setColor(Color.GRAY); g.fillPolygon(all); g.setColor(saved_color); } |
bright = new Polygon(new int[] { c.x, b.x, a.x, e.x }, new int[] { c.y, b.y, a.y, e.y }, 4); | bright = new Polygon(new int[] { c.x - 1, b.x, a.x, e.x }, new int[] { c.y - 1, b.y, a.y, e.y - 1 }, 4); | public void paintThumb(Graphics g) { Color saved_color = g.getColor(); Polygon thumb = new Polygon(); Point a = new Point(thumbRect.x, thumbRect.y); Point b = new Point(a); Point c = new Point(a); Point d = new Point(a); Point e = new Point(a); Polygon bright; Polygon dark; Polygon all; // This will be in X-dimension if the slider is inverted and y if it isn't. int turnPoint; if (slider.getOrientation() == JSlider.HORIZONTAL) { turnPoint = thumbRect.height * 3 / 4; b.translate(thumbRect.width, 0); c.translate(thumbRect.width, turnPoint); d.translate(thumbRect.width / 2, thumbRect.height); e.translate(0, turnPoint); bright = new Polygon(new int[] { b.x, a.x, e.x, d.x }, new int[] { b.y, a.y, e.y, d.y }, 4); dark = new Polygon(new int[] { b.x, c.x, d.x }, new int[] { b.y, c.y, d.y }, 3); all = new Polygon(new int[] { a.x + 1, b.x, c.x, d.x, e.x + 1 }, new int[] { a.y + 1, b.y + 1, c.y, d.y + 1, e.y }, 5); } else { turnPoint = thumbRect.width * 3 / 4; b.translate(turnPoint, 0); c.translate(thumbRect.width, thumbRect.height / 2); d.translate(turnPoint, thumbRect.height); e.translate(0, thumbRect.height); bright = new Polygon(new int[] { c.x, b.x, a.x, e.x }, new int[] { c.y, b.y, a.y, e.y }, 4); dark = new Polygon(new int[] { c.x, d.x, e.x + 1 }, new int[] { c.y, d.y, e.y }, 3); all = new Polygon(new int[] { a.x + 1, b.x, c.x - 1, d.x, e.x + 1 }, new int[] { a.y + 1, b.y + 1, c.y, d.y, e.y }, 5); } g.setColor(Color.WHITE); g.drawPolyline(bright.xpoints, bright.ypoints, bright.npoints); g.setColor(Color.BLACK); g.drawPolyline(dark.xpoints, dark.ypoints, dark.npoints); g.setColor(Color.GRAY); g.fillPolygon(all); g.setColor(saved_color); } |
dark = new Polygon(new int[] { c.x, d.x, e.x + 1 }, | dark = new Polygon(new int[] { c.x, d.x, e.x }, | public void paintThumb(Graphics g) { Color saved_color = g.getColor(); Polygon thumb = new Polygon(); Point a = new Point(thumbRect.x, thumbRect.y); Point b = new Point(a); Point c = new Point(a); Point d = new Point(a); Point e = new Point(a); Polygon bright; Polygon dark; Polygon all; // This will be in X-dimension if the slider is inverted and y if it isn't. int turnPoint; if (slider.getOrientation() == JSlider.HORIZONTAL) { turnPoint = thumbRect.height * 3 / 4; b.translate(thumbRect.width, 0); c.translate(thumbRect.width, turnPoint); d.translate(thumbRect.width / 2, thumbRect.height); e.translate(0, turnPoint); bright = new Polygon(new int[] { b.x, a.x, e.x, d.x }, new int[] { b.y, a.y, e.y, d.y }, 4); dark = new Polygon(new int[] { b.x, c.x, d.x }, new int[] { b.y, c.y, d.y }, 3); all = new Polygon(new int[] { a.x + 1, b.x, c.x, d.x, e.x + 1 }, new int[] { a.y + 1, b.y + 1, c.y, d.y + 1, e.y }, 5); } else { turnPoint = thumbRect.width * 3 / 4; b.translate(turnPoint, 0); c.translate(thumbRect.width, thumbRect.height / 2); d.translate(turnPoint, thumbRect.height); e.translate(0, thumbRect.height); bright = new Polygon(new int[] { c.x, b.x, a.x, e.x }, new int[] { c.y, b.y, a.y, e.y }, 4); dark = new Polygon(new int[] { c.x, d.x, e.x + 1 }, new int[] { c.y, d.y, e.y }, 3); all = new Polygon(new int[] { a.x + 1, b.x, c.x - 1, d.x, e.x + 1 }, new int[] { a.y + 1, b.y + 1, c.y, d.y, e.y }, 5); } g.setColor(Color.WHITE); g.drawPolyline(bright.xpoints, bright.ypoints, bright.npoints); g.setColor(Color.BLACK); g.drawPolyline(dark.xpoints, dark.ypoints, dark.npoints); g.setColor(Color.GRAY); g.fillPolygon(all); g.setColor(saved_color); } |
all = new Polygon(new int[] { a.x + 1, b.x, c.x - 1, d.x, e.x + 1 }, new int[] { a.y + 1, b.y + 1, c.y, d.y, e.y }, 5); | light = new Polygon(new int[] { c.x - 1, d.x, e.x + 1}, new int[] { c.y, d.y - 1, e.y - 1}, 3); all = new Polygon(new int[] { a.x + 1, b.x, c.x - 2, c.x - 2, d.x, e.x + 1 }, new int[] { a.y + 1, b.y + 1, c.y - 1, c.y, d.y - 2, e.y - 2 }, 6); | public void paintThumb(Graphics g) { Color saved_color = g.getColor(); Polygon thumb = new Polygon(); Point a = new Point(thumbRect.x, thumbRect.y); Point b = new Point(a); Point c = new Point(a); Point d = new Point(a); Point e = new Point(a); Polygon bright; Polygon dark; Polygon all; // This will be in X-dimension if the slider is inverted and y if it isn't. int turnPoint; if (slider.getOrientation() == JSlider.HORIZONTAL) { turnPoint = thumbRect.height * 3 / 4; b.translate(thumbRect.width, 0); c.translate(thumbRect.width, turnPoint); d.translate(thumbRect.width / 2, thumbRect.height); e.translate(0, turnPoint); bright = new Polygon(new int[] { b.x, a.x, e.x, d.x }, new int[] { b.y, a.y, e.y, d.y }, 4); dark = new Polygon(new int[] { b.x, c.x, d.x }, new int[] { b.y, c.y, d.y }, 3); all = new Polygon(new int[] { a.x + 1, b.x, c.x, d.x, e.x + 1 }, new int[] { a.y + 1, b.y + 1, c.y, d.y + 1, e.y }, 5); } else { turnPoint = thumbRect.width * 3 / 4; b.translate(turnPoint, 0); c.translate(thumbRect.width, thumbRect.height / 2); d.translate(turnPoint, thumbRect.height); e.translate(0, thumbRect.height); bright = new Polygon(new int[] { c.x, b.x, a.x, e.x }, new int[] { c.y, b.y, a.y, e.y }, 4); dark = new Polygon(new int[] { c.x, d.x, e.x + 1 }, new int[] { c.y, d.y, e.y }, 3); all = new Polygon(new int[] { a.x + 1, b.x, c.x - 1, d.x, e.x + 1 }, new int[] { a.y + 1, b.y + 1, c.y, d.y, e.y }, 5); } g.setColor(Color.WHITE); g.drawPolyline(bright.xpoints, bright.ypoints, bright.npoints); g.setColor(Color.BLACK); g.drawPolyline(dark.xpoints, dark.ypoints, dark.npoints); g.setColor(Color.GRAY); g.fillPolygon(all); g.setColor(saved_color); } |
g.drawPolyline(light.xpoints, light.ypoints, light.npoints); g.setColor(Color.LIGHT_GRAY); g.drawPolyline(all.xpoints, all.ypoints, all.npoints); | public void paintThumb(Graphics g) { Color saved_color = g.getColor(); Polygon thumb = new Polygon(); Point a = new Point(thumbRect.x, thumbRect.y); Point b = new Point(a); Point c = new Point(a); Point d = new Point(a); Point e = new Point(a); Polygon bright; Polygon dark; Polygon all; // This will be in X-dimension if the slider is inverted and y if it isn't. int turnPoint; if (slider.getOrientation() == JSlider.HORIZONTAL) { turnPoint = thumbRect.height * 3 / 4; b.translate(thumbRect.width, 0); c.translate(thumbRect.width, turnPoint); d.translate(thumbRect.width / 2, thumbRect.height); e.translate(0, turnPoint); bright = new Polygon(new int[] { b.x, a.x, e.x, d.x }, new int[] { b.y, a.y, e.y, d.y }, 4); dark = new Polygon(new int[] { b.x, c.x, d.x }, new int[] { b.y, c.y, d.y }, 3); all = new Polygon(new int[] { a.x + 1, b.x, c.x, d.x, e.x + 1 }, new int[] { a.y + 1, b.y + 1, c.y, d.y + 1, e.y }, 5); } else { turnPoint = thumbRect.width * 3 / 4; b.translate(turnPoint, 0); c.translate(thumbRect.width, thumbRect.height / 2); d.translate(turnPoint, thumbRect.height); e.translate(0, thumbRect.height); bright = new Polygon(new int[] { c.x, b.x, a.x, e.x }, new int[] { c.y, b.y, a.y, e.y }, 4); dark = new Polygon(new int[] { c.x, d.x, e.x + 1 }, new int[] { c.y, d.y, e.y }, 3); all = new Polygon(new int[] { a.x + 1, b.x, c.x - 1, d.x, e.x + 1 }, new int[] { a.y + 1, b.y + 1, c.y, d.y, e.y }, 5); } g.setColor(Color.WHITE); g.drawPolyline(bright.xpoints, bright.ypoints, bright.npoints); g.setColor(Color.BLACK); g.drawPolyline(dark.xpoints, dark.ypoints, dark.npoints); g.setColor(Color.GRAY); g.fillPolygon(all); g.setColor(saved_color); } |
|
double loc = tickRect.x; | double loc = tickRect.x + 0.5; | public void paintTicks(Graphics g) { int max = slider.getMaximum(); int min = slider.getMinimum(); int majorSpace = slider.getMajorTickSpacing(); int minorSpace = slider.getMinorTickSpacing(); if (majorSpace > 0) { if (slider.getOrientation() == JSlider.HORIZONTAL) { double loc = tickRect.x; double increment = (max == min) ? 0 : majorSpace * (double) tickRect.width / (max - min); if (drawInverted()) { loc += tickRect.width; increment *= -1; } for (int i = min; i <= max; i += majorSpace) { paintMajorTickForHorizSlider(g, tickRect, (int) loc); loc += increment; } } else { double loc = tickRect.height + tickRect.y; double increment = (max == min) ? 0 : -majorSpace * (double) tickRect.height / (max - min); if (drawInverted()) { loc = tickRect.y; increment *= -1; } for (int i = min; i <= max; i += majorSpace) { paintMajorTickForVertSlider(g, tickRect, (int) loc); loc += increment; } } } if (minorSpace > 0) { if (slider.getOrientation() == JSlider.HORIZONTAL) { double loc = tickRect.x; double increment = (max == min) ? 0 : minorSpace * (double) tickRect.width / (max - min); if (drawInverted()) { loc += tickRect.width; increment *= -1; } for (int i = min; i <= max; i += minorSpace) { paintMinorTickForHorizSlider(g, tickRect, (int) loc); loc += increment; } } else { double loc = tickRect.height + tickRect.y; double increment = (max == min) ? 0 : -minorSpace * (double) tickRect.height / (max - min); if (drawInverted()) { loc = tickRect.y; increment *= -1; } for (int i = min; i <= max; i += minorSpace) { paintMinorTickForVertSlider(g, tickRect, (int) loc); loc += increment; } } } } |
: majorSpace * (double) tickRect.width / (max - min); | : majorSpace * (double) (tickRect.width - 1) / (max - min); | public void paintTicks(Graphics g) { int max = slider.getMaximum(); int min = slider.getMinimum(); int majorSpace = slider.getMajorTickSpacing(); int minorSpace = slider.getMinorTickSpacing(); if (majorSpace > 0) { if (slider.getOrientation() == JSlider.HORIZONTAL) { double loc = tickRect.x; double increment = (max == min) ? 0 : majorSpace * (double) tickRect.width / (max - min); if (drawInverted()) { loc += tickRect.width; increment *= -1; } for (int i = min; i <= max; i += majorSpace) { paintMajorTickForHorizSlider(g, tickRect, (int) loc); loc += increment; } } else { double loc = tickRect.height + tickRect.y; double increment = (max == min) ? 0 : -majorSpace * (double) tickRect.height / (max - min); if (drawInverted()) { loc = tickRect.y; increment *= -1; } for (int i = min; i <= max; i += majorSpace) { paintMajorTickForVertSlider(g, tickRect, (int) loc); loc += increment; } } } if (minorSpace > 0) { if (slider.getOrientation() == JSlider.HORIZONTAL) { double loc = tickRect.x; double increment = (max == min) ? 0 : minorSpace * (double) tickRect.width / (max - min); if (drawInverted()) { loc += tickRect.width; increment *= -1; } for (int i = min; i <= max; i += minorSpace) { paintMinorTickForHorizSlider(g, tickRect, (int) loc); loc += increment; } } else { double loc = tickRect.height + tickRect.y; double increment = (max == min) ? 0 : -minorSpace * (double) tickRect.height / (max - min); if (drawInverted()) { loc = tickRect.y; increment *= -1; } for (int i = min; i <= max; i += minorSpace) { paintMinorTickForVertSlider(g, tickRect, (int) loc); loc += increment; } } } } |
double loc = tickRect.height + tickRect.y; | double loc = tickRect.height + tickRect.y + 0.5; | public void paintTicks(Graphics g) { int max = slider.getMaximum(); int min = slider.getMinimum(); int majorSpace = slider.getMajorTickSpacing(); int minorSpace = slider.getMinorTickSpacing(); if (majorSpace > 0) { if (slider.getOrientation() == JSlider.HORIZONTAL) { double loc = tickRect.x; double increment = (max == min) ? 0 : majorSpace * (double) tickRect.width / (max - min); if (drawInverted()) { loc += tickRect.width; increment *= -1; } for (int i = min; i <= max; i += majorSpace) { paintMajorTickForHorizSlider(g, tickRect, (int) loc); loc += increment; } } else { double loc = tickRect.height + tickRect.y; double increment = (max == min) ? 0 : -majorSpace * (double) tickRect.height / (max - min); if (drawInverted()) { loc = tickRect.y; increment *= -1; } for (int i = min; i <= max; i += majorSpace) { paintMajorTickForVertSlider(g, tickRect, (int) loc); loc += increment; } } } if (minorSpace > 0) { if (slider.getOrientation() == JSlider.HORIZONTAL) { double loc = tickRect.x; double increment = (max == min) ? 0 : minorSpace * (double) tickRect.width / (max - min); if (drawInverted()) { loc += tickRect.width; increment *= -1; } for (int i = min; i <= max; i += minorSpace) { paintMinorTickForHorizSlider(g, tickRect, (int) loc); loc += increment; } } else { double loc = tickRect.height + tickRect.y; double increment = (max == min) ? 0 : -minorSpace * (double) tickRect.height / (max - min); if (drawInverted()) { loc = tickRect.y; increment *= -1; } for (int i = min; i <= max; i += minorSpace) { paintMinorTickForVertSlider(g, tickRect, (int) loc); loc += increment; } } } } |
: -majorSpace * (double) tickRect.height / (max - min); | : -majorSpace * (double) (tickRect.height - 1) / (max - min); | public void paintTicks(Graphics g) { int max = slider.getMaximum(); int min = slider.getMinimum(); int majorSpace = slider.getMajorTickSpacing(); int minorSpace = slider.getMinorTickSpacing(); if (majorSpace > 0) { if (slider.getOrientation() == JSlider.HORIZONTAL) { double loc = tickRect.x; double increment = (max == min) ? 0 : majorSpace * (double) tickRect.width / (max - min); if (drawInverted()) { loc += tickRect.width; increment *= -1; } for (int i = min; i <= max; i += majorSpace) { paintMajorTickForHorizSlider(g, tickRect, (int) loc); loc += increment; } } else { double loc = tickRect.height + tickRect.y; double increment = (max == min) ? 0 : -majorSpace * (double) tickRect.height / (max - min); if (drawInverted()) { loc = tickRect.y; increment *= -1; } for (int i = min; i <= max; i += majorSpace) { paintMajorTickForVertSlider(g, tickRect, (int) loc); loc += increment; } } } if (minorSpace > 0) { if (slider.getOrientation() == JSlider.HORIZONTAL) { double loc = tickRect.x; double increment = (max == min) ? 0 : minorSpace * (double) tickRect.width / (max - min); if (drawInverted()) { loc += tickRect.width; increment *= -1; } for (int i = min; i <= max; i += minorSpace) { paintMinorTickForHorizSlider(g, tickRect, (int) loc); loc += increment; } } else { double loc = tickRect.height + tickRect.y; double increment = (max == min) ? 0 : -minorSpace * (double) tickRect.height / (max - min); if (drawInverted()) { loc = tickRect.y; increment *= -1; } for (int i = min; i <= max; i += minorSpace) { paintMinorTickForVertSlider(g, tickRect, (int) loc); loc += increment; } } } } |
loc = tickRect.y; | loc = tickRect.y + 0.5; | public void paintTicks(Graphics g) { int max = slider.getMaximum(); int min = slider.getMinimum(); int majorSpace = slider.getMajorTickSpacing(); int minorSpace = slider.getMinorTickSpacing(); if (majorSpace > 0) { if (slider.getOrientation() == JSlider.HORIZONTAL) { double loc = tickRect.x; double increment = (max == min) ? 0 : majorSpace * (double) tickRect.width / (max - min); if (drawInverted()) { loc += tickRect.width; increment *= -1; } for (int i = min; i <= max; i += majorSpace) { paintMajorTickForHorizSlider(g, tickRect, (int) loc); loc += increment; } } else { double loc = tickRect.height + tickRect.y; double increment = (max == min) ? 0 : -majorSpace * (double) tickRect.height / (max - min); if (drawInverted()) { loc = tickRect.y; increment *= -1; } for (int i = min; i <= max; i += majorSpace) { paintMajorTickForVertSlider(g, tickRect, (int) loc); loc += increment; } } } if (minorSpace > 0) { if (slider.getOrientation() == JSlider.HORIZONTAL) { double loc = tickRect.x; double increment = (max == min) ? 0 : minorSpace * (double) tickRect.width / (max - min); if (drawInverted()) { loc += tickRect.width; increment *= -1; } for (int i = min; i <= max; i += minorSpace) { paintMinorTickForHorizSlider(g, tickRect, (int) loc); loc += increment; } } else { double loc = tickRect.height + tickRect.y; double increment = (max == min) ? 0 : -minorSpace * (double) tickRect.height / (max - min); if (drawInverted()) { loc = tickRect.y; increment *= -1; } for (int i = min; i <= max; i += minorSpace) { paintMinorTickForVertSlider(g, tickRect, (int) loc); loc += increment; } } } } |
: minorSpace * (double) tickRect.width / (max - min); | : minorSpace * (double) (tickRect.width - 1) / (max - min); | public void paintTicks(Graphics g) { int max = slider.getMaximum(); int min = slider.getMinimum(); int majorSpace = slider.getMajorTickSpacing(); int minorSpace = slider.getMinorTickSpacing(); if (majorSpace > 0) { if (slider.getOrientation() == JSlider.HORIZONTAL) { double loc = tickRect.x; double increment = (max == min) ? 0 : majorSpace * (double) tickRect.width / (max - min); if (drawInverted()) { loc += tickRect.width; increment *= -1; } for (int i = min; i <= max; i += majorSpace) { paintMajorTickForHorizSlider(g, tickRect, (int) loc); loc += increment; } } else { double loc = tickRect.height + tickRect.y; double increment = (max == min) ? 0 : -majorSpace * (double) tickRect.height / (max - min); if (drawInverted()) { loc = tickRect.y; increment *= -1; } for (int i = min; i <= max; i += majorSpace) { paintMajorTickForVertSlider(g, tickRect, (int) loc); loc += increment; } } } if (minorSpace > 0) { if (slider.getOrientation() == JSlider.HORIZONTAL) { double loc = tickRect.x; double increment = (max == min) ? 0 : minorSpace * (double) tickRect.width / (max - min); if (drawInverted()) { loc += tickRect.width; increment *= -1; } for (int i = min; i <= max; i += minorSpace) { paintMinorTickForHorizSlider(g, tickRect, (int) loc); loc += increment; } } else { double loc = tickRect.height + tickRect.y; double increment = (max == min) ? 0 : -minorSpace * (double) tickRect.height / (max - min); if (drawInverted()) { loc = tickRect.y; increment *= -1; } for (int i = min; i <= max; i += minorSpace) { paintMinorTickForVertSlider(g, tickRect, (int) loc); loc += increment; } } } } |
: -minorSpace * (double) tickRect.height / (max - min); | : -minorSpace * (double) (tickRect.height - 1) / (max - min); | public void paintTicks(Graphics g) { int max = slider.getMaximum(); int min = slider.getMinimum(); int majorSpace = slider.getMajorTickSpacing(); int minorSpace = slider.getMinorTickSpacing(); if (majorSpace > 0) { if (slider.getOrientation() == JSlider.HORIZONTAL) { double loc = tickRect.x; double increment = (max == min) ? 0 : majorSpace * (double) tickRect.width / (max - min); if (drawInverted()) { loc += tickRect.width; increment *= -1; } for (int i = min; i <= max; i += majorSpace) { paintMajorTickForHorizSlider(g, tickRect, (int) loc); loc += increment; } } else { double loc = tickRect.height + tickRect.y; double increment = (max == min) ? 0 : -majorSpace * (double) tickRect.height / (max - min); if (drawInverted()) { loc = tickRect.y; increment *= -1; } for (int i = min; i <= max; i += majorSpace) { paintMajorTickForVertSlider(g, tickRect, (int) loc); loc += increment; } } } if (minorSpace > 0) { if (slider.getOrientation() == JSlider.HORIZONTAL) { double loc = tickRect.x; double increment = (max == min) ? 0 : minorSpace * (double) tickRect.width / (max - min); if (drawInverted()) { loc += tickRect.width; increment *= -1; } for (int i = min; i <= max; i += minorSpace) { paintMinorTickForHorizSlider(g, tickRect, (int) loc); loc += increment; } } else { double loc = tickRect.height + tickRect.y; double increment = (max == min) ? 0 : -minorSpace * (double) tickRect.height / (max - min); if (drawInverted()) { loc = tickRect.y; increment *= -1; } for (int i = min; i <= max; i += minorSpace) { paintMinorTickForVertSlider(g, tickRect, (int) loc); loc += increment; } } } } |
g.translate(-tickRect.x, 0); | public void paintTicks(Graphics g) { int max = slider.getMaximum(); int min = slider.getMinimum(); int majorSpace = slider.getMajorTickSpacing(); int minorSpace = slider.getMinorTickSpacing(); if (majorSpace > 0) { if (slider.getOrientation() == JSlider.HORIZONTAL) { double loc = tickRect.x; double increment = (max == min) ? 0 : majorSpace * (double) tickRect.width / (max - min); if (drawInverted()) { loc += tickRect.width; increment *= -1; } for (int i = min; i <= max; i += majorSpace) { paintMajorTickForHorizSlider(g, tickRect, (int) loc); loc += increment; } } else { double loc = tickRect.height + tickRect.y; double increment = (max == min) ? 0 : -majorSpace * (double) tickRect.height / (max - min); if (drawInverted()) { loc = tickRect.y; increment *= -1; } for (int i = min; i <= max; i += majorSpace) { paintMajorTickForVertSlider(g, tickRect, (int) loc); loc += increment; } } } if (minorSpace > 0) { if (slider.getOrientation() == JSlider.HORIZONTAL) { double loc = tickRect.x; double increment = (max == min) ? 0 : minorSpace * (double) tickRect.width / (max - min); if (drawInverted()) { loc += tickRect.width; increment *= -1; } for (int i = min; i <= max; i += minorSpace) { paintMinorTickForHorizSlider(g, tickRect, (int) loc); loc += increment; } } else { double loc = tickRect.height + tickRect.y; double increment = (max == min) ? 0 : -minorSpace * (double) tickRect.height / (max - min); if (drawInverted()) { loc = tickRect.y; increment *= -1; } for (int i = min; i <= max; i += minorSpace) { paintMinorTickForVertSlider(g, tickRect, (int) loc); loc += increment; } } } } |
|
Polygon high; Polygon shadow; | public void paintTrack(Graphics g) { Color saved_color = g.getColor(); int width; int height; Point a = new Point(trackRect.x, trackRect.y); Point b = new Point(a); Point c = new Point(a); Point d = new Point(a); Polygon high; Polygon shadow; if (slider.getOrientation() == JSlider.HORIZONTAL) { width = trackRect.width; height = (thumbRect.height / 4 == 0) ? 1 : thumbRect.height / 4; a.translate(0, (trackRect.height / 2) - (height / 2)); b.translate(0, (trackRect.height / 2) + (height / 2)); c.translate(trackRect.width, (trackRect.height / 2) + (height / 2)); d.translate(trackRect.width, (trackRect.height / 2) - (height / 2)); } else { width = (thumbRect.width / 4 == 0) ? 1 : thumbRect.width / 4; height = trackRect.height; a.translate((trackRect.width / 2) - (width / 2), 0); b.translate((trackRect.width / 2) - (width / 2), trackRect.height); c.translate((trackRect.width / 2) + (width / 2), trackRect.height); d.translate((trackRect.width / 2) + (width / 2), 0); } g.setColor(Color.GRAY); g.fillRect(a.x, a.y, width, height); g.setColor(getHighlightColor()); g.drawLine(b.x, b.y, c.x, c.y); g.drawLine(c.x, c.y, d.x, d.y); g.setColor(getShadowColor()); g.drawLine(b.x, b.y, a.x, a.y); g.drawLine(a.x, a.y, d.x, d.y); g.setColor(saved_color); } |
|
int extent = slider.getExtent(); int len = trackRect.width; | int len = trackRect.width - 1; | protected int xPositionForValue(int value) { int min = slider.getMinimum(); int max = slider.getMaximum(); int extent = slider.getExtent(); int len = trackRect.width; int xPos = (max == min) ? 0 : (value - min) * len / (max - min); if (! drawInverted()) xPos += trackRect.x; else { xPos = trackRect.width - xPos; xPos += trackRect.x; } return xPos; } |
xPos = trackRect.width - xPos; | xPos = len - xPos; | protected int xPositionForValue(int value) { int min = slider.getMinimum(); int max = slider.getMaximum(); int extent = slider.getExtent(); int len = trackRect.width; int xPos = (max == min) ? 0 : (value - min) * len / (max - min); if (! drawInverted()) xPos += trackRect.x; else { xPos = trackRect.width - xPos; xPos += trackRect.x; } return xPos; } |
int extent = slider.getExtent(); int len = trackRect.height; | int len = trackRect.height - 1; | protected int yPositionForValue(int value) { int min = slider.getMinimum(); int max = slider.getMaximum(); int extent = slider.getExtent(); int len = trackRect.height; int yPos = (max == min) ? 0 : (value - min) * len / (max - min); if (! drawInverted()) { yPos = trackRect.height - yPos; yPos += trackRect.y; } else yPos += trackRect.y; return yPos; } |
yPos = trackRect.height - yPos; | yPos = len - yPos; | protected int yPositionForValue(int value) { int min = slider.getMinimum(); int max = slider.getMaximum(); int extent = slider.getExtent(); int len = trackRect.height; int yPos = (max == min) ? 0 : (value - min) * len / (max - min); if (! drawInverted()) { yPos = trackRect.height - yPos; yPos += trackRect.y; } else yPos += trackRect.y; return yPos; } |
groupObject.removeMemberObj(this); | groupObject.removeMemberObject((Object) this); | public Group removeFromGroup (Group groupObject) { if (groupObject != null) { if (groupMemberHash.contains(groupObject)) { //this object does belong to the indicated Group object groupObject.removeMemberObj(this); groupMemberHash.remove(groupObject); return groupObject; } else { Log.error("Can't delete from group. not a member of the group" + groupObject.getName()); return null; } } else { Log.error("Error: The group to add to is null"); return null; } } |
Log.error("Weird error: unknown XML attribute type for item:"+item); | Log.errorln("Weird error: unknown XML attribute type for item:"+item); | public void toXDFOutputStream ( OutputStream outputstream, Hashtable XMLDeclAttribs, String indent, boolean dontCloseNode, String newNodeNameString, String noChildObjectNodeName ) { String nodeNameString = this.classXDFNodeName; // Setup. Sometimes the name of the node we are opening is different from // that specified in the classXDFNodeName (*sigh*) if (newNodeNameString != null) nodeNameString = newNodeNameString; // 0. To be valid XML, we always start an XML block with an // XML declaration (e.g. somehting like "<?xml standalone="no"?>"). // Here we deal with printing out XML Declaration && its attributes if (!XMLDeclAttribs.isEmpty()) { indent = ""; writeXMLDeclToOutputStream(outputstream, XMLDeclAttribs); } // 1. open this node, print its simple XML attributes if (nodeNameString != null) { if (sPrettyXDFOutput) writeOut(outputstream, indent); // indent node if desired // For printing the opening statement we need to invoke a little // Voodoo to keep the DTD happy: the first structure node is always // called by the root node name instead of the usual nodeNameString // We can tell this by checking if this object is derived from class // Structure and if XMLDeclAttrib defined/populated with information // NOTE: This isnt really the way to do this. We need to check if 'this' is // is or has as a superclass xdf.Structure instead of the 'string check' below. // check is class Strucuture & XMLDeclAttribs populated? if ( nodeNameString.equals(sXDFStructureNodeName) && !XMLDeclAttribs.isEmpty() ) { writeOut(outputstream,"<" + sXDFRootNodeName); // print opening root node statement } else { writeOut(outputstream,"<" + nodeNameString); // print opening statement } } // gather info about XMLAttributes in this object/node Hashtable xmlInfo = getXMLInfo(); // 2. Print out string object XML attributes EXCEPT for the one that // matches PCDATAAttribute. ArrayList attribs = (ArrayList) xmlInfo.get("attribList"); // is synchronized here correct? synchronized(attribs) { for (int i = 0; i < attribs.size(); i++) { Hashtable item = (Hashtable) attribs.get(i); writeOut(outputstream, " "+ item.get("name") + "=\"" + item.get("value") + "\""); } } // 3. Print out Node PCData or Child Nodes as specified by object ref // XML attributes. The way this stuff occurs will also affect how we // close the node. ArrayList childObjs = (ArrayList) xmlInfo.get("childObjList"); String pcdata = (String) xmlInfo.get("PCDATA"); if ( childObjs.size() > 0 || pcdata != null || noChildObjectNodeName != null) { // close the opening tag if (nodeNameString != null) { writeOut(outputstream, ">"); if (sPrettyXDFOutput && pcdata == null) writeOut(outputstream, Constants.NEW_LINE); } // deal with object/list XML attributes, if any in our list for (int i = 0; i < childObjs.size(); i++) { Hashtable item = (Hashtable) childObjs.get(i); if (item.get("type") == Constants.LIST_TYPE) { List objectList = (List) item.get("value"); // Im not sure this synchronized wrapper is needed, we are // only accessing stuff here.. Also, should synchronzied wrapper // occur back in the getXMLInfo method instead where the orig // access occured?!? synchronized(objectList) { Iterator iter = objectList.iterator(); // Must be in synchronized block while (iter.hasNext()) { BaseObject containedObj = (BaseObject) iter.next(); if (containedObj != null) { // can happen from pre-allocation of axis values, etc (?) String newindent = indent + sPrettyXDFOutputIndentation; dealWithOpeningGroupNodes(containedObj, outputstream, indent); dealWithClosingGroupNodes(containedObj, outputstream, indent); containedObj.toXDFOutputStream(outputstream, new Hashtable(), newindent); } } } } else if (item.get("type") == Constants.OBJECT_TYPE) { BaseObject containedObj = (BaseObject) item.get("value"); if (containedObj != null) { // can happen from pre-allocation of axis values, etc (?) // shouldnt this be synchronized too?? synchronized(containedObj) { String newindent = indent + sPrettyXDFOutputIndentation; dealWithOpeningGroupNodes(containedObj, outputstream, indent); dealWithClosingGroupNodes(containedObj, outputstream, indent); containedObj.toXDFOutputStream(outputstream, new Hashtable(), newindent); } } } else { // error: weird type, actually shouldnt occur. Is this needed?? Log.error("Weird error: unknown XML attribute type for item:"+item); } } // print out PCDATA, if any if(pcdata != null) { writeOut(outputstream, pcdata); //write out closing node after PCDATA, leaving no space between them. //k.z. 10/18/2000 if (!dontCloseNode) if ( nodeNameString.equals(sXDFStructureNodeName) && !XMLDeclAttribs.isEmpty() ) { writeOut(outputstream, "</"+sXDFRootNodeName+">"); } else { writeOut(outputstream, "</"+nodeNameString+">"); } if (sPrettyXDFOutput) writeOut(outputstream, Constants.NEW_LINE); return ; //now we are done, return! //k.z. 10/18/2000 }; // if there are no PCDATA or child objects/nodes then // we print out noChildObjectNodeName if ( childObjs.size() == 0 && pcdata == null && noChildObjectNodeName != null) { if (sPrettyXDFOutput) writeOut(outputstream, indent); writeOut(outputstream, "<" + noChildObjectNodeName + "/>"); if (sPrettyXDFOutput) writeOut(outputstream, Constants.NEW_LINE); } // ok, now deal with closing the node if (nodeNameString != null) { // Needed?? //dealWithClosingGroupNodes(containedObj, outputstream, indent); //Brian: we have to fix this, no whitespace should be allowed between //PCDATA and closing node if (sPrettyXDFOutput) writeOut(outputstream, indent); if (!dontCloseNode) if ( nodeNameString.equals(sXDFStructureNodeName) && !XMLDeclAttribs.isEmpty() ) { writeOut(outputstream, "</"+sXDFRootNodeName+">"); } else { writeOut(outputstream, "</"+nodeNameString+">"); } } } else { if(dontCloseNode) { // it may not have sub-objects, but we dont want to close it // (happens for group objects) } else { // no sub-objects, just close this node writeOut(outputstream, "/>"); } } if (sPrettyXDFOutput) writeOut(outputstream, Constants.NEW_LINE); } |
if (!extendedMode) vk = keys.getKey(scancode).getLowerVirtuelKey(); | if (!extendedMode){ if((flags & InputEvent.ALT_GRAPH_DOWN_MASK) != 0){ vk = keys.getKey(scancode).getAltGrVirtuelKey(); }else if((flags & InputEvent.SHIFT_DOWN_MASK) != 0){ vk = keys.getKey(scancode).getUpperVirtuelKey(); }else{ vk = keys.getKey(scancode).getLowerVirtuelKey(); } } | public final KeyboardEvent interpretScancode(int scancode) { final boolean extendedMode = this.extendedMode; if (scancode == XT_EXTENDED) { this.extendedMode = true; return null; } else { this.extendedMode = false; } final boolean released = ((scancode & XT_RELEASE) != 0); final long time = System.currentTimeMillis(); scancode &= 0x7f; int vk = deriveKeyCode(scancode, extendedMode); // debug output to find new keycodes// System.out.println("[" + (extendedMode ? "E" : "N") + scancode + "," + vk + "] " /*+ KeyEvent.getKeyText(vk)*/); if (!extendedMode) vk = keys.getKey(scancode).getLowerVirtuelKey(); adjustFlags(vk, released); // debug output to find new keycodes// System.out.println("[" + (extendedMode ? "E" : "N") + scancode + "," + vk + "] " /*+ KeyEvent.getKeyText(vk)*/); try { final char ch; ch = interpretExtendedScanCode(scancode, vk, released, extendedMode); return new KeyboardEvent(released ? KeyEvent.KEY_RELEASED : KeyEvent.KEY_PRESSED, time, flags, vk, ch); } catch (UnsupportedKeyException e) { final char ch; if ((flags & InputEvent.SHIFT_DOWN_MASK) != 0) { ch = keys.getKey(scancode).getUpperChar(); if (!extendedMode) vk = keys.getKey(scancode).getUpperVirtuelKey(); } else if ((flags & InputEvent.ALT_GRAPH_DOWN_MASK) != 0) { ch = keys.getKey(scancode).getAltGrChar(); if (!extendedMode) vk = keys.getKey(scancode).getAltGrVirtuelKey(); } else { ch = keys.getKey(scancode).getLowerChar(); } return new KeyboardEvent(released ? KeyEvent.KEY_RELEASED : KeyEvent.KEY_PRESSED, time, flags, vk, ch); } catch (DeadKeyException e) { return null; } } |
tabs = t; | if (t != null) tabs = (TabStop[]) t.clone(); else tabs = new TabStop[0]; | public TabSet(TabStop[] t) { tabs = t; } |
if (i < 0 || i >= tabs.length) throw new IllegalArgumentException("Index out of bounds."); | public TabStop getTab(int i) { return tabs[i]; } |
|
int idx = -1; for (int i = 0; i < tabs.length; ++i) | for (int i = 0; i < tabs.length; i++) | public int getTabIndexAfter(float location) { int idx = -1; for (int i = 0; i < tabs.length; ++i) { if (location < tabs[i].getPosition()) idx = i; } return idx; } |
if (location < tabs[i].getPosition()) idx = i; | if (location <= tabs[i].getPosition()) return i; | public int getTabIndexAfter(float location) { int idx = -1; for (int i = 0; i < tabs.length; ++i) { if (location < tabs[i].getPosition()) idx = i; } return idx; } |
return idx; | return -1; | public int getTabIndexAfter(float location) { int idx = -1; for (int i = 0; i < tabs.length; ++i) { if (location < tabs[i].getPosition()) idx = i; } return idx; } |
return result; | protected PrivateKey engineGeneratePrivate(KeySpec keySpec) throws InvalidKeySpecException { if (keySpec instanceof DHPrivateKeySpec) { DHPrivateKeySpec spec = (DHPrivateKeySpec) keySpec; BigInteger p = spec.getP(); BigInteger g = spec.getG(); BigInteger x = spec.getX(); return new GnuDHPrivateKey(Registry.PKCS8_ENCODING_ID, null, p, g, x); } if (keySpec instanceof PKCS8EncodedKeySpec) { PKCS8EncodedKeySpec spec = (PKCS8EncodedKeySpec) keySpec; byte[] encoded = spec.getEncoded(); PrivateKey result; try { result = new DHKeyPairPKCS8Codec().decodePrivateKey(encoded); } catch (RuntimeException x) { InvalidKeySpecException y = new InvalidKeySpecException(); y.initCause(x); throw y; } } throw new InvalidKeySpecException("Unsupported (private) key specification"); } |
|
return result; | protected PublicKey engineGeneratePublic(KeySpec keySpec) throws InvalidKeySpecException { if (keySpec instanceof DHPublicKeySpec) { DHPublicKeySpec spec = (DHPublicKeySpec) keySpec; BigInteger p = spec.getP(); BigInteger g = spec.getG(); BigInteger y = spec.getY(); return new GnuDHPublicKey(Registry.X509_ENCODING_ID, null, p, g, y); } if (keySpec instanceof X509EncodedKeySpec) { X509EncodedKeySpec spec = (X509EncodedKeySpec) keySpec; byte[] encoded = spec.getEncoded(); PublicKey result; try { result = new DHKeyPairX509Codec().decodePublicKey(encoded); } catch (RuntimeException x) { InvalidKeySpecException y = new InvalidKeySpecException(); y.initCause(x); throw y; } } throw new InvalidKeySpecException("Unsupported (public) key specification"); } |
|
checkIsConstructed(derPKI, "Wrong PrivateKeyInfo field"); | DerUtil.checkIsConstructed(derPKI, "Wrong PrivateKeyInfo field"); | public PrivateKey decodePrivateKey(byte[] input) { if (input == null) throw new InvalidParameterException("Input bytes MUST NOT be null"); BigInteger version, p, q, g, x; DERReader der = new DERReader(input); try { DERValue derPKI = der.read(); checkIsConstructed(derPKI, "Wrong PrivateKeyInfo field"); DERValue derVersion = der.read(); if (! (derVersion.getValue() instanceof BigInteger)) throw new InvalidParameterException("Wrong Version field"); version = (BigInteger) derVersion.getValue(); if (version.compareTo(BigInteger.ZERO) != 0) throw new InvalidParameterException("Unexpected Version: " + version); DERValue derAlgoritmID = der.read(); checkIsConstructed(derAlgoritmID, "Wrong AlgorithmIdentifier field"); DERValue derOID = der.read(); OID algOID = (OID) derOID.getValue(); if (! algOID.equals(DH_ALG_OID)) throw new InvalidParameterException("Unexpected OID: " + algOID); DERValue derParams = der.read(); checkIsConstructed(derParams, "Wrong DSS Parameters field"); DERValue val = der.read(); checkIsBigInteger(val, "Wrong P field"); p = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong G field"); g = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong Q field"); q = (BigInteger) val.getValue(); val = der.read(); byte[] xBytes = (byte[]) val.getValue(); x = new BigInteger(1, xBytes); } catch (IOException e) { InvalidParameterException y = new InvalidParameterException(); y.initCause(e); throw y; } return new GnuDHPrivateKey(Registry.PKCS8_ENCODING_ID, q, p, g, x); } |
checkIsConstructed(derAlgoritmID, "Wrong AlgorithmIdentifier field"); | DerUtil.checkIsConstructed(derAlgoritmID, "Wrong AlgorithmIdentifier field"); | public PrivateKey decodePrivateKey(byte[] input) { if (input == null) throw new InvalidParameterException("Input bytes MUST NOT be null"); BigInteger version, p, q, g, x; DERReader der = new DERReader(input); try { DERValue derPKI = der.read(); checkIsConstructed(derPKI, "Wrong PrivateKeyInfo field"); DERValue derVersion = der.read(); if (! (derVersion.getValue() instanceof BigInteger)) throw new InvalidParameterException("Wrong Version field"); version = (BigInteger) derVersion.getValue(); if (version.compareTo(BigInteger.ZERO) != 0) throw new InvalidParameterException("Unexpected Version: " + version); DERValue derAlgoritmID = der.read(); checkIsConstructed(derAlgoritmID, "Wrong AlgorithmIdentifier field"); DERValue derOID = der.read(); OID algOID = (OID) derOID.getValue(); if (! algOID.equals(DH_ALG_OID)) throw new InvalidParameterException("Unexpected OID: " + algOID); DERValue derParams = der.read(); checkIsConstructed(derParams, "Wrong DSS Parameters field"); DERValue val = der.read(); checkIsBigInteger(val, "Wrong P field"); p = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong G field"); g = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong Q field"); q = (BigInteger) val.getValue(); val = der.read(); byte[] xBytes = (byte[]) val.getValue(); x = new BigInteger(1, xBytes); } catch (IOException e) { InvalidParameterException y = new InvalidParameterException(); y.initCause(e); throw y; } return new GnuDHPrivateKey(Registry.PKCS8_ENCODING_ID, q, p, g, x); } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.