Beispiel #1
0
  @Override
  public Object getSelection() {
    iActionComponent b = panel.getSelectedButton();

    return (b == null)
           ? null
           : b.getText();
  }
Beispiel #2
0
  @Override
  public void setValue(Object value) {
    iActionComponent b = panel.getSelectedButton();
    String           s = null;

    if (value instanceof String) {
      s = (String) value;
    } else if (value != null) {
      s = value.toString();
    }

    if ((s != null) && (b != null)) {
      b.setText(s);
    }
  }
Beispiel #3
0
  /**
   * Configures the navigator
   *
   * @param cfg
   *          the navigator's configuration
   */
  protected void configureEx(Navigator cfg) {
    final aNavigatorPanel np = createNavigatorPanel();

    panel = np;

    iNavigatorPanel.PanelType pt;

    switch(cfg.type.intValue()) {
      case Navigator.CType.toggle :
        pt = iNavigatorPanel.PanelType.TOGGLE;

        break;

      case Navigator.CType.option :
        pt = iNavigatorPanel.PanelType.OPTION;

        break;

      default :
        pt = iNavigatorPanel.PanelType.HIERARCHICAL;

        break;
    }

    np.setPanelType(pt);
    formComponent = dataComponent = np;

    if (cfg.showBackButton.booleanValue() && (np.isHiearchical())) {
      BorderPanelEx p = new BorderPanelEx(createBorderLayoutView(), np);

      p.setPadding(new UIInsets(0, 0, 0, ScreenUtils.PLATFORM_PIXELS_4));
      p.add(np.getBackButton(), Location.LEFT);
      p.add(np, Location.CENTER);
      formComponent = p;
    }

    configure(cfg, true, false, false, true);

    UIColor sc = UIColorHelper.getColor(cfg.separatorLineColor.getValue());

    if (sc != null) {
      np.setSeparatorLineColor(sc);
    }

    np.setShowIconsOnly(cfg.showIconsOnly.booleanValue());

    if (cfg.iconPosition.spot_valueWasSet()) {
      np.setIconPosition(IconPosition.valueOf(cfg.iconPosition.stringValue().toUpperCase(Locale.US)));
    }

    PaintBucket               pb;
    iPlatformComponentPainter cp;
    UIFont                    font = null;
    UIColor                   fg   = null;

    pb = UIColorHelper.getPaintBucket(this, cfg.getSelectionPainter());
    cp = (pb == null)
         ? null
         : pb.getComponentPainter(true);

    if (cp != null) {
      np.setSelectedPainter(cp);
    }

    if (pb != null) {
      font = pb.getFont();
      fg   = pb.getForegroundColor();
    }

    pb = UIColorHelper.getPaintBucket(this, cfg.getPressedPainter());
    cp = (pb == null)
         ? null
         : pb.getComponentPainter(true);

    if (cp != null) {
      np.setPressedPainter(cp);
    }

    if (pb != null) {
      if (fg == null) {
        fg = pb.getForegroundColor();
      }

      if (font == null) {
        font = pb.getFont();
      }
    }

    np.setSelectedFont(font);
    np.setSelectedForeground(fg);

    if (cfg.buttonsSameSize.booleanValue()) {
      np.setButtonsSameSize(true);
    }

    Margin m = cfg.getContentPadding();

    if (m != null) {
      np.setInsets(m.getInsets());
    }

    SPOTSet    set = cfg.actions;
    int        len = set.getCount();
    ActionItem item;

    for (int i = 0; i < len; i++) {
      item = (ActionItem) set.get(i);

      iActionComponent b = np.addButton(UIAction.createAction(this, item));

      if ("false".equals(item.spot_getAttribute("visible"))) {
        b.setVisible(false);
      }
    }

    int n = cfg.selectedIndex.intValue();

    if (n > -1) {
      np.setSelectedIndex(n);
    }
  }