public void actionPerformed(ActionEvent event) { if (Debug.isActive()) Debug.println("Action for Collapse Tree button"); tree_view.collapseLevel(); toolbar.getYaxisTreeCommitButton().doClick(); // Set toolbar buttons to reflect status toolbar.resetYaxisTreeButtons(); }
public void actionPerformed(ActionEvent event) { Window window; String msg; if (model.isZoomUndoStackEmpty()) { window = SwingUtilities.windowForComponent((JToolBar) toolbar); msg = "Zoom Undo Stack is empty"; Dialogs.warn(window, msg); } else model.zoomUndo(); // Set toolbar buttons to reflect status if (toolbar != null) toolbar.resetZoomButtons(); if (Debug.isActive()) Debug.println("Action for Zoom Undo button."); }
private void showDeclaration(BeanTableSorted from, boolean isNcml) { Variable v = getCurrentVariable(from); if (v == null) return; infoTA.clear(); if (isNcml) { Formatter out = new Formatter(); try { NCdumpW.writeNcMLVariable(v, out); } catch (IOException e) { e.printStackTrace(); } infoTA.appendLine(out.toString()); } else { infoTA.appendLine(v.toString()); } if (Debug.isSet("Xdeveloper")) { infoTA.appendLine("\n"); infoTA.appendLine("FULL NAME = " + v.getFullName()); infoTA.appendLine("\n"); infoTA.appendLine(v.toStringDebug()); } infoTA.gotoTop(); infoWindow.setTitle("Variable Info"); infoWindow.show(); }
public void run() { try { Thread drawthread = new HackThread(drawfun, "Render thread"); drawthread.start(); synchronized (drawfun) { while (state == null) drawfun.wait(); } try { long now, then; long frames[] = new long[128]; int framep = 0, waited[] = new int[128]; while (true) { int fwaited = 0; Debug.cycle(); UI ui = this.ui; then = System.currentTimeMillis(); CPUProfile.Frame curf = null; if (Config.profile) curf = uprof.new Frame(); synchronized (ui) { if (ui.sess != null) ui.sess.glob.ctick(); dispatch(); ui.tick(); if ((ui.root.sz.x != w) || (ui.root.sz.y != h)) ui.root.resize(new Coord(w, h)); } if (curf != null) curf.tick("dsp"); BGL buf = new BGL(); GLState.Applier state = this.state; rootdraw(state, ui, buf); if (curf != null) curf.tick("draw"); synchronized (drawfun) { now = System.currentTimeMillis(); while (bufdraw != null) drawfun.wait(); bufdraw = new Frame(buf, state.cgl); drawfun.notifyAll(); fwaited += System.currentTimeMillis() - now; } ui.audio.cycle(); if (curf != null) curf.tick("aux"); now = System.currentTimeMillis(); long fd = bgmode ? this.bgfd : this.fd; if (now - then < fd) { synchronized (events) { events.wait(fd - (now - then)); } fwaited += System.currentTimeMillis() - now; } frames[framep] = now; waited[framep] = fwaited; for (int i = 0, ckf = framep, twait = 0; i < frames.length; i++) { ckf = (ckf - 1 + frames.length) % frames.length; twait += waited[ckf]; if (now - frames[ckf] > 1000) { fps = i; uidle = ((double) twait) / ((double) (now - frames[ckf])); break; } } framep = (framep + 1) % frames.length; if (curf != null) curf.tick("wait"); if (curf != null) curf.fin(); if (Thread.interrupted()) throw (new InterruptedException()); } } finally { drawthread.interrupt(); drawthread.join(); } } catch (InterruptedException e) { } finally { ui.destroy(); } }
/** Actual Instantiation of the UI components */ public void init() { Debug.println("AuditLogPanel: init()"); super.init(); refresh(); }
public void actionPerformed(ActionEvent event) { canvas_vport.searchBackward(); if (Debug.isActive()) Debug.println("Action for Search Backward button. "); }
public pmLogin(JFrame f, String title, String msg, pmTop t, String h) { super(f, title, true); // modal theTop = t; theTag = h; theFrame = f; JLabel l; JPanel p; // initialize constraints GridBagConstraints c = new GridBagConstraints(); c.gridx = 0; c.gridy = GridBagConstraints.RELATIVE; c.gridwidth = 1; c.gridheight = 1; c.insets = new Insets(10, 10, 10, 10); c.anchor = GridBagConstraints.EAST; // top panel contains the desired message p = new JPanel(); p.setLayout(new GridBagLayout()); l = new JLabel(msg, SwingConstants.CENTER); p.add(l, c); this.getContentPane().add(p, "North"); // NIS middle panel // contains username and password if (t.ns.getNameService().equals("nis")) { p = new JPanel(); p.setLayout(new GridBagLayout()); l = new JLabel(pmUtility.getResource("Hostname:"), SwingConstants.RIGHT); p.add(l, c); l = new JLabel(pmUtility.getResource("Username:"******"Password:"******"Password.mnemonic")); c.gridx = 1; c.weightx = 1.0; String nisMaster; try { nisMaster = theTop.host.getNisMaster(); } catch (Exception e) { nisMaster = new String("Unknown"); Debug.warning("pmLogin: getNisMaster() returns exception: " + e); } c.anchor = GridBagConstraints.WEST; l = new JLabel(nisMaster, SwingConstants.LEFT); p.add(l, c); l = new JLabel(("root"), SwingConstants.LEFT); p.add(l, c); c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.CENTER; c.gridy = GridBagConstraints.RELATIVE; p.add(passwordField, c); passwordField.setEchoChar('*'); this.getContentPane().add(p, "Center"); } else if (t.ns.getNameService().equals("ldap")) { // middle panel contains LDAP server name, distinguished name, // and password p = new JPanel(); p.setLayout(new GridBagLayout()); // LDAP Server Name l = new JLabel(pmUtility.getResource("LDAP.Server:"), SwingConstants.RIGHT); p.add(l, c); serverField = new pmTextField(25); serverField.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { okPressed(); } }); String ldapMaster; try { ldapMaster = theTop.host.getLDAPMaster(); } catch (Exception e) { ldapMaster = new String(""); Debug.warning("pmLdap: getLDAPMaster() returns exception: " + e); } serverField.setText(ldapMaster); c.gridx = 1; p.add(serverField, c); // Distinguished Name c.gridx = 0; l = new JLabel(pmUtility.getResource("Distinguished.Name:"), SwingConstants.RIGHT); p.add(l, c); dnField = new pmTextField(25); dnField.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { okPressed(); } }); String defaultDN; try { defaultDN = theTop.host.getDefaultAdminDN(); } catch (Exception e) { defaultDN = new String(""); Debug.warning("pmLdap: getDefaultAdminDN() returns exception: " + e); } dnField.setText(defaultDN); c.gridx = 1; p.add(dnField, c); // Password c.gridx = 0; l = new JLabel(pmUtility.getResource("Password:"******"Password.mnemonic")); c.gridx = 1; c.weightx = 1.0; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.CENTER; c.gridy = GridBagConstraints.RELATIVE; p.add(passwordField, c); passwordField.setEchoChar('*'); this.getContentPane().add(p, "Center"); } // bottom panel contains buttons c.gridx = 0; c.weightx = 1.0; c.weighty = 0.0; c.gridwidth = GridBagConstraints.REMAINDER; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.CENTER; JPanel thePanel = new JPanel(); okButton = new pmButton(pmUtility.getResource("OK")); okButton.setMnemonic(pmUtility.getIntResource("OK.mnemonic")); okButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { okPressed(); } }); thePanel.add(okButton, c); cancelButton = new pmButton(pmUtility.getResource("Cancel")); cancelButton.setMnemonic(pmUtility.getIntResource("Cancel.mnemonic")); cancelButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { cancelPressed(); } }); thePanel.add(cancelButton, c); if (theTag != null && theTop != null) { helpButton = new pmButton(pmUtility.getResource("Help")); helpButton.setMnemonic(pmUtility.getIntResource("Help.mnemonic")); p.add(helpButton); helpButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { helpPressed(); } }); thePanel.add(helpButton, c); } this.getContentPane().add(thePanel, "South"); addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { returnValue = JOptionPane.CLOSED_OPTION; pmLogin.this.setVisible(false); } }); // handle Esc as cancel in any case this.getRootPane() .registerKeyboardAction( new ActionListener() { public void actionPerformed(ActionEvent e) { Debug.message("CLNT: default cancel action"); cancelPressed(); } }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false), JComponent.WHEN_IN_FOCUSED_WINDOW); // lay out the dialog this.pack(); // set focus and defaults after packing... // this.getRootPane().setDefaultButton(okButton); okButton.setAsDefaultButton(); passwordField.requestFocus(); }