Example #1
0
  /**
   * Gets the name of the selected action
   *
   * @return the name of the selected action
   */
  public String getSelectedName() {
    UIAction a = panel.getSelectedAction();

    return (a == null)
           ? null
           : a.getActionName();
  }
Example #2
0
  /**
   * Adds a action to the navigation panel
   *
   * @param text
   *          the text for the button
   * @param code
   *          the code to execute when the button is pressed
   *
   * @return the newly created button
   */
  public iActionComponent addAction(String text, String code) {
    UIAction a = new UIAction(text);

    a.setActionScript(code);
    a.setContext(this);

    return addAction(a);
  }
Example #3
0
  /**
   * Adds a action to the navigation panel
   *
   * @param text
   *          the text for the button
   * @param link
   *          the link to activate when the button is pressed
   *
   * @return the newly created button
   */
  public iActionComponent addAction(String text, ActionLink link) {
    UIAction a = new UIAction(text);

    a.setActionListener(link);
    a.setContext(this);

    return addAction(a);
  }
Example #4
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);
    }
  }