/** * Main for testing. */ public static void main(String[] args) { JFrame f = new JFrame(); StatusBar sb = new StatusBar(); f.add("South", sb); f.setSize(200, 200); f.setVisible(true); sb.setText("hallo"); Component b = new Button("b"); sb.addStatusComponent("a", new Button("a")); sb.addStatusComponent("b", b); sb.addStatusComponent("c", new Button("c")); sb.removeStatusComponent("b"); } }
/** * Get a component from the status bar. * @param id Id used for adding a component. * @return The component to display. */ public JComponent getStatusComponent(Object id) { return (JComponent)controlcenter.getWindow().getStatusBar().getStatusComponent(id); }
/** * Relayout components after components have been added or removed. */ protected void layoutComponents() { // Remove and re-add all components in inverse insertion order (adding from right-to-left). this.removeAll(); this.add(textl, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2,4,4,2), 0, 0)); int pos = components.size(); for(Iterator it=components.values().iterator(); it.hasNext(); ) { this.add((Component)it.next(), new GridBagConstraints(pos--, 0, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.VERTICAL, new Insets(0,0,0,0), 0, 0)); } this.invalidate(); this.doLayout(); this.repaint(); }
/** * Set a text to be displayed in the status bar. The text will be removed * automatically after some delay (or replaced by some other text). */ public void setStatusText(String text) { controlcenter.getWindow().getStatusBar().setText(text); }
statusbar = new StatusBar(); getContentPane().add("South", statusbar);
/** * Remove a previously added component from the status bar. * * @param id The id used for adding the component. */ public void removeStatusComponent(Object id) { controlcenter.getWindow().getStatusBar().removeStatusComponent(id); }
/** * Add a component to the status bar. * * @param id An id for later reference. * @param comp An id for later reference. */ public void addStatusComponent(Object id, JComponent comp) { controlcenter.getWindow().getStatusBar().addStatusComponent(id, comp); }
/** * Set a text to be displayed in the status bar. The text will be removed * automatically after some delay (or replaced by some other text). */ public void setStatusText(String text) { controlcenter.getWindow().getStatusBar().setText(text); }
statusbar = new StatusBar(); getContentPane().add("South", statusbar);
/** * Remove a previously added component from the status bar. * * @param id The id used for adding the component. */ public void removeStatusComponent(Object id) { controlcenter.getWindow().getStatusBar().removeStatusComponent(id); }
/** * Add a component to the status bar. * * @param id An id for later reference. * @param comp An id for later reference. */ public void addStatusComponent(Object id, JComponent comp) { controlcenter.getWindow().getStatusBar().addStatusComponent(id, comp); }
public void customExceptionOccurred(Exception exception) { // Continue anyways. window.getStatusBar().setText("Could not save platform settings: "+exception); pcc.dispose(); } });
this.sb = new StatusBar();
/** * Get a component from the status bar. * @param id Id used for adding a component. * @return The component to display. */ public JComponent getStatusComponent(Object id) { return (JComponent)controlcenter.getWindow().getStatusBar().getStatusComponent(id); }
public void customExceptionOccurred(Exception exception) { // Continue anyways. window.getStatusBar().setText("Could not save platform settings: "+exception); pcc.dispose(); } });
public void customResultAvailable(Object result) { window.getStatusBar().setText("Saved platform settings for: "+pcc.getPlatformAccess().getComponentIdentifier().getPlatformName()); pcc.dispose(); } public void customExceptionOccurred(Exception exception)
public void customResultAvailable(Object result) { window.getStatusBar().setText("Saved platform settings for: "+pcc.getPlatformAccess().getComponentIdentifier().getPlatformName()); pcc.dispose(); } public void customExceptionOccurred(Exception exception)
/** * Close a platform control center. */ public void closePlatform(final PlatformControlCenter pcc) { pccs.remove(pcc.getPlatformAccess().getComponentIdentifier()); window.getStatusBar().setText("Saving platform settings for: "+pcc.getPlatformAccess().getComponentIdentifier().getPlatformName()); window.closePlatformPanel(pcc); // Do not save settings when closing remote platform window boolean allowed = pcc.getPlatformAccess().getComponentIdentifier().getRoot().equals(jccaccess.getComponentIdentifier().getRoot()); // System.out.println("allowed: "+allowed); IFuture saved = isSaveOnExit() && allowed? pcc.savePlatformProperties() : IFuture.DONE; saved.addResultListener(new SwingDefaultResultListener() { public void customResultAvailable(Object result) { window.getStatusBar().setText("Saved platform settings for: "+pcc.getPlatformAccess().getComponentIdentifier().getPlatformName()); pcc.dispose(); } public void customExceptionOccurred(Exception exception) { // Continue anyways. window.getStatusBar().setText("Could not save platform settings: "+exception); pcc.dispose(); } }); }
/** * Close a platform control center. */ public void closePlatform(final PlatformControlCenter pcc) { pccs.remove(pcc.getPlatformAccess().getComponentIdentifier()); window.getStatusBar().setText("Saving platform settings for: "+pcc.getPlatformAccess().getComponentIdentifier().getPlatformName()); window.closePlatformPanel(pcc); // Do not save settings when closing remote platform window boolean allowed = pcc.getPlatformAccess().getComponentIdentifier().getRoot().equals(jccaccess.getComponentIdentifier().getRoot()); // System.out.println("allowed: "+allowed); IFuture saved = isSaveOnExit() && allowed? pcc.savePlatformProperties() : IFuture.DONE; saved.addResultListener(new SwingDefaultResultListener() { public void customResultAvailable(Object result) { window.getStatusBar().setText("Saved platform settings for: "+pcc.getPlatformAccess().getComponentIdentifier().getPlatformName()); pcc.dispose(); } public void customExceptionOccurred(Exception exception) { // Continue anyways. window.getStatusBar().setText("Could not save platform settings: "+exception); pcc.dispose(); } }); }