コード例 #1
0
    /**
     * Updates the <code>Toolbar</code> represented by this folder.
     *
     * @param cookies array of instance cookies for the folder
     * @return the updated <code>ToolbarPool</code> representee
     */
    protected Object createInstance(InstanceCookie[] cookies)
        throws java.io.IOException, ClassNotFoundException {
      // refresh the toolbar's content
      getToolbar().removeAll();
      for (int i = 0; i < cookies.length; i++) {
        try {
          Object obj = cookies[i].instanceCreate();
          if (obj instanceof Presenter.Toolbar) {
            obj = ((Presenter.Toolbar) obj).getToolbarPresenter();
          }
          if (obj instanceof Component) {
            Component comp = (Component) obj;
            getToolbar().add(comp);
          }
        } catch (java.io.IOException ex) {
        } catch (ClassNotFoundException ex) {
        }
      }

      // invalidate the toolbar and its parent
      toolbar.invalidate();
      java.awt.Container parent = toolbar.getParent();
      if (parent != null) {
        parent.validate();
        parent.repaint();
      }
      return toolbar;
    }
コード例 #2
0
 public void removeAll() {
   super.removeAll();
   addGrip();
 }