コード例 #1
0
  /**
   * Sets the state icon.
   *
   * <p>The state icon indicates if a resource is exported, secure, etc.
   *
   * <p>
   *
   * @param icon the state icon
   */
  public void setStateIcon(StateIcon icon) {

    if (m_stateIcon == null) {
      m_stateIcon = new HTML();
      m_stateIcon.addClickHandler(m_iconSuperClickHandler);
      m_contentPanel.add(m_stateIcon);
    }
    String iconTitle = null;
    switch (icon) {
      case export:
        m_stateIcon.setStyleName(
            I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().stateIcon()
                + " "
                + I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().export());
        iconTitle = Messages.get().key(Messages.GUI_ICON_TITLE_EXPORT_0);
        break;
      case secure:
        m_stateIcon.setStyleName(
            I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().stateIcon()
                + " "
                + I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().secure());
        iconTitle = Messages.get().key(Messages.GUI_ICON_TITLE_SECURE_0);
        break;
      default:
        m_stateIcon.setStyleName(I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().stateIcon());
        break;
    }
    m_stateIcon.setTitle(concatIconTitles(m_iconTitle, iconTitle));
    m_stateIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER);
  }
コード例 #2
0
ファイル: LocationEntry.java プロジェクト: aik1king/waggle-ui
  private VerticalPanel buildExtras() {

    HorizontalPanel extsBaseRow = new HorizontalPanel();

    ToggleButton bShowOnly = new ToggleButton(new Image("images/button_eye.gif"), this);
    bShowOnly.setTitle("Click to hide all route segments except this one! Click again to restore.");
    extsBaseRow.add(bShowOnly);

    soClick = new HTML("<div class=\"togglelink\">詳細內容</div>");
    soClick.setTitle("顯示詳細內容.");
    soClick.addClickListener(this);
    extsBaseRow.add(soClick);

    VerticalPanel exts = new VerticalPanel();
    exts.add(extsBaseRow);

    detailPanel = buildStopOvers();
    exts.add(detailPanel);

    exts.setStyleName("extras");
    extsBaseRow.setStyleName("base_row");
    bShowOnly.setStyleName("eye");
    detailPanel.setStyleName("stopovers");
    return exts;
  }
コード例 #3
0
ファイル: Toolbar.java プロジェクト: ltly/firefly
    public CmdButton(String name, Widget icon, Command cmd, String label, String desc) {
      this.name = name;
      this.command = cmd;
      this.name = name;
      String htmlstr = label == null ? name : label;
      html = new HTML(htmlstr);
      if (desc != null) {
        html.setTitle(desc);
      }
      this.command = cmd;
      html.setWordWrap(false);
      if (command instanceof GeneralCommand) {
        addListeners();
        setButtonEnabled(((GeneralCommand) command).isEnabled());
      }

      GwtUtil.setStyles(iconHolderLeft, "padding", "none", "marginRight", "3px");
      GwtUtil.setStyle(html, "padding", "6px 0");
      container = GwtUtil.makeHoriPanel(null, null, iconHolderLeft, html, iconHolderRight);
      container.setCellVerticalAlignment(iconHolderLeft, VerticalPanel.ALIGN_MIDDLE);
      container.setCellVerticalAlignment(iconHolderRight, VerticalPanel.ALIGN_MIDDLE);
      setIconLeft(icon);
      setIconRight(null);
      GwtUtil.setStyle(container, "margin", "0px auto");
      initWidget(new SimplePanel(container));
    }
コード例 #4
0
  NodePresenter(VGraphExplorer parent, NodeProxy model) {
    this.parent = parent;
    this.model = model;
    graph = parent.getGraph();

    view.setTitle(model.getId());
    Style style = view.getElement().getStyle();
    style.setLeft(model.getX(), Unit.PX);
    style.setTop(model.getY(), Unit.PX);

    view.addDomHandler(this, MouseDownEvent.getType());
    view.addDomHandler(this, MouseMoveEvent.getType());
    view.addDomHandler(this, MouseUpEvent.getType());

    parent.add(view);
  }
コード例 #5
0
  /**
   * Sets the lock icon.
   *
   * <p>
   *
   * @param icon the icon to use
   * @param iconTitle the icon title
   */
  public void setLockIcon(LockIcon icon, String iconTitle) {

    if (m_lockIcon == null) {
      m_lockIcon = new HTML();
      m_lockIcon.addClickHandler(m_iconSuperClickHandler);
      m_contentPanel.add(m_lockIcon);
    }
    switch (icon) {
      case CLOSED:
        m_lockIcon.setStyleName(
            I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().lockIcon()
                + " "
                + I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().lockClosed());
        break;
      case OPEN:
        m_lockIcon.setStyleName(
            I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().lockIcon()
                + " "
                + I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().lockOpen());
        break;
      case SHARED_CLOSED:
        m_lockIcon.setStyleName(
            I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().lockIcon()
                + " "
                + I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().lockSharedClosed());
        break;
      case SHARED_OPEN:
        m_lockIcon.setStyleName(
            I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().lockIcon()
                + " "
                + I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().lockSharedOpen());
        break;
      case NONE:
      default:
        m_lockIcon.setStyleName(I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().lockIcon());
    }

    m_lockIcon.setTitle(concatIconTitles(m_iconTitle, iconTitle));
    m_lockIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER);
  }
コード例 #6
0
  public void init(final KieImageType imageType, final int containersRunningCount) {
    if (imageType == null) return;

    final SafeUri imageUri = ClientUtils.getImageUri(imageType);
    typeNameText.setText(imageType.getName());
    if (containersRunningCount < 0) {
      countText.setVisible(false);
    } else if (containersRunningCount == 0
        && showCreateButton
        && !KieImageCategory.OTHERS.equals(imageType.getCategory())) {
      countText.setText(Constants.INSTANCE.createNew());
      countText.setTitle(Constants.INSTANCE.createNewForThisType());
      countText.addStyleName(style.createNewButton());
      countText.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent clickEvent) {
              KieImageTypeView.this.fireEvent(new CreateContainerEvent(imageType));
            }
          });
      countText.setVisible(true);
    } else {
      countText.setText(Integer.toString(containersRunningCount));
      countText.removeStyleName(style.createNewButton());
      countText.setVisible(true);
    }

    typeImage.setUrl(imageUri);
    typeImage.setSize(size, size);
    typeImage.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent clickEvent) {
            KieImageTypeView.this.fireEvent(new ImageTypeSelectedEvent(imageType));
          }
        });
    mainPanel.setVisible(true);
  }
コード例 #7
0
ファイル: AlarmView.java プロジェクト: garylai578/opennms
  /** {@inheritDoc} */
  protected void setRow(FlexTable table, int row, int elementIndex) {
    Alarm alarm = m_alarms[elementIndex];
    if (alarm.getIsDashboardRole()) {
      table.setText(row, 0, alarm.getNodeLabel());
    } else {
      table.setHTML(
          row,
          0,
          "<a href=\"element/node.jsp?node="
              + alarm.getNodeId()
              + "\">"
              + alarm.getNodeLabel()
              + "</a>");
    }

    HTML label = new HTML();
    label.setTitle(stripHtmlTags(alarm.getDescrption()));
    label.setHTML(SafeHtmlUtils.fromTrustedString(alarm.getLogMsg()));
    table.setWidget(row, 1, label);
    table.setText(row, 2, "" + alarm.getCount());
    table.setText(row, 3, alarm.getFirstEventTime().toString());
    table.setText(row, 4, alarm.getLastEventTime().toString());
    table.getRowFormatter().setStyleName(row, alarm.getSeverity());
  }
コード例 #8
0
  /**
   * @see com.alkacon.acacia.client.widgets.I_FormEditWidget#setWidgetInfo(java.lang.String,
   *     java.lang.String)
   */
  public void setWidgetInfo(String label, String help) {

    m_label.setHTML(label);
    m_label.setTitle(DomUtil.stripHtml(help));
  }
コード例 #9
0
ファイル: SearchSummaryPanel.java プロジェクト: ltly/firefly
  public void layout() {

    // clear any backgrounded processes.
    for (Timer t : bgList) {
      t.cancel();
    }

    table = new FlexTable();
    mainPanel.clear();
    if (!StringUtils.isEmpty(name) || !StringUtils.isEmpty(helpId)) {

      String n = StringUtils.isEmpty(name) ? "" : name.trim();
      HorizontalPanel h = new HorizontalPanel();
      h.setWidth("100%");
      HTML lname = new HTML("<b>" + n + "</b>");
      if (shortDesc != null) {
        lname.setTitle(shortDesc);
      }
      GwtUtil.setStyles(lname, "textAlign", "center");
      h.add(lname);
      h.setCellWidth(lname, "100%");

      if (!StringUtils.isEmpty(helpId)) {
        final Widget helpIcon = HelpManager.makeHelpIcon(helpId);
        h.add(helpIcon);
        GwtUtil.setStyles(helpIcon, "marginRight", "11px");
      }
      mainPanel.addNorth(h, 20);
    }

    // setup group by selection
    if (groupByCols != null && groupByCols.size() > 1) {
      EnumFieldDef gb = new EnumFieldDef("groupBy");
      gb.setLabel("Group By");
      gb.setDesc("Select a group by column to update the data table");
      gb.setPreferWidth(200);
      gb.setDefaultValue(curGroupByName);
      for (TableDataView.Column item : headers) {
        if (groupByCols.contains(item.getName())) {
          gb.addItem(item.getName(), item.getTitle());
        }
      }
      final SimpleInputField sif = SimpleInputField.createByDef(gb);
      mainPanel.addNorth(sif, 28);
      sif.getField()
          .addValueChangeHandler(
              new ValueChangeHandler() {
                public void onValueChange(ValueChangeEvent ve) {
                  curGroupByName = sif.getValue();
                  layout();
                }
              });
    }

    ScrollPanel sp = new ScrollPanel();
    sp.add(table);

    mainPanel.add(sp);

    table.setStyleName("firefly-summary-table");
    table.setSize("100%", "100%");
    iconColIdx = headers.size();
    String titleCol = null;

    // render headers
    int colIdx = 0;
    for (int i = 0; i < headers.size(); i++) {
      TableDataView.Column col = headers.get(i);
      if (curGroupByName == null || !curGroupByName.equals(col.getName())) {
        table.setText(0, colIdx, col.getTitle());
        table.getCellFormatter().setStyleName(0, colIdx, "title-bar");
        colIdx++;
        if (titleCol == null) {
          titleCol = col.getName();
        }
      }
    }
    table.setText(0, headers.size(), "");
    table.getCellFormatter().setWidth(0, headers.size(), "100%");

    ArrayList<SearchSummaryItem> itemList = searchItems;

    if (!StringUtils.isEmpty(curGroupByName)) {
      itemList = new ArrayList<SearchSummaryItem>();

      GroupFinder finder = new GroupFinder("");
      List<GroupedSummaryItem> groupList = new ArrayList<GroupedSummaryItem>();
      for (int i = 0; i < searchItems.size(); i++) {
        SearchSummaryItem dsi = searchItems.get(i);
        String cGroupValue = dsi.getValue(curGroupByName);
        GroupedSummaryItem cGroup =
            CollectionUtil.findFirst(groupList, finder.setName(cGroupValue));
        if (cGroup == null) {
          cGroup = new GroupedSummaryItem(cGroupValue);
          groupList.add(cGroup);
          itemList.add(cGroup);
        }
        cGroup.addChild(dsi);
      }
    }

    for (SearchSummaryItem ssi : itemList) {
      ssi.setTitleCol(titleCol);
      layout(ssi, 0);
    }
  }