public void addColorChooserPanel(final AbstractColorChooserPanel ccp) {
    final String displayName = ccp.getDisplayName();
    if (displayName == null) {
      // Return if we haven't initialized yet
      return;
    }

    if (ccp.getClass()
        .getName()
        .equals("ch.randelshofer.quaqua.colorchooser.Quaqua15ColorPicker")) {
      northPanel.add(ccp, BorderLayout.WEST);
    } else {
      Icon displayIcon = ccp.getLargeDisplayIcon();
      JToggleButton tb = new JToggleButton(null, displayIcon);
      tb.setToolTipText(displayName);
      tb.setFocusable(false);
      tb.setHorizontalTextPosition(SwingConstants.CENTER);
      tb.setVerticalTextPosition(SwingConstants.BOTTOM);
      tb.setFont(UIManager.getFont("ColorChooser.font"));
      tb.putClientProperty("Quaqua.Button.style", "toolBarTab");
      JPanel centerView = new JPanel(new BorderLayout());
      centerView.add(ccp);
      chooserPanelHolder.add(centerView, displayName);
      toolBarButtonGroup.add(tb);
      toolBar.add(tb);

      if (toolBar.getComponentCount() == 1
          || lastSelectedChooserName != null && lastSelectedChooserName.equals(displayName)) {
        tb.setSelected(true);
        CardLayout cl = (CardLayout) chooserPanelHolder.getLayout();
        cl.show(chooserPanelHolder, displayName);
      }

      tb.addItemListener(
          new ItemListener() {
            public void itemStateChanged(ItemEvent evt) {
              if (evt.getStateChange() == ItemEvent.SELECTED) {
                CardLayout cl = (CardLayout) chooserPanelHolder.getLayout();
                cl.show(chooserPanelHolder, displayName);
                lastSelectedChooserName = displayName;
              }
            }
          });
    }
  }
Exemplo n.º 2
0
  private CollapsiblePane addFilters() {

    JPanel labelPanel = new JPanel();
    labelPanel.setBackground(Color.WHITE);
    labelPanel.setLayout(new VerticalLayout(3));

    CollapsiblePane panelFilter = new CollapsiblePane(SYSTools.xx("misc.msg.Filter"));
    panelFilter.setStyle(CollapsiblePane.PLAIN_STYLE);
    panelFilter.setCollapsible(false);

    tbMedi = GUITools.getNiceToggleButton(SYSTools.xx("misc.msg.medication"));
    tbMedi.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            if (initPhase) return;
            //                SYSPropsTools.storeState(internalClassID + ":tbMedi", tbMedi);
            reloadDisplay();
          }
        });
    tbMedi.setHorizontalAlignment(SwingConstants.LEFT);
    labelPanel.add(tbMedi);
    //        SYSPropsTools.restoreState(internalClassID + ":tbMedi", tbMedi);

    tbBerichte = GUITools.getNiceToggleButton(SYSTools.xx("nursingrecords.reports"));
    tbBerichte.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            if (initPhase) return;
            //                SYSPropsTools.storeState(internalClassID + ":tbBerichte", tbBerichte);
            reloadDisplay();
          }
        });
    tbBerichte.setHorizontalAlignment(SwingConstants.LEFT);
    labelPanel.add(tbBerichte);
    //        SYSPropsTools.restoreState(internalClassID + ":tbBerichte", tbBerichte);

    tbBilanz = GUITools.getNiceToggleButton(SYSTools.xx("misc.msg.liquid.result"));
    tbBilanz.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            if (initPhase) return;
            //                SYSPropsTools.storeState(internalClassID + ":tbBilanz", tbBilanz);
            reloadDisplay();
          }
        });
    tbBilanz.setHorizontalAlignment(SwingConstants.LEFT);
    labelPanel.add(tbBilanz);
    //        SYSPropsTools.restoreState(internalClassID + ":tbBilanz", tbBilanz);

    //        tbBWInfo = GUITools.getNiceToggleButton(SYSTools.xx(PnlInfo.internalClassID));
    //        tbBWInfo.addItemListener(new ItemListener() {
    //            @Override
    //            public void itemStateChanged(ItemEvent e) {
    //                if (initPhase) return;
    //                SYSPropsTools.storeState(internalClassID + ":tbBWInfo", tbBWInfo);
    //                reloadDisplay();
    //            }
    //        });
    //        tbBilanz.setHorizontalAlignment(SwingConstants.LEFT);
    //        labelPanel.add(tbBWInfo);
    //        SYSPropsTools.restoreState(internalClassID + ":tbBWInfo", tbBWInfo);

    panelFilter.setContentPane(labelPanel);

    return panelFilter;
  }