コード例 #1
0
ファイル: SurveyWidget.java プロジェクト: awaazde/avaajotalo
 /**
  * Generates HTML for a tree item with an attached icon.
  *
  * @param imageProto the image prototype to use
  * @param title the title of the item
  * @return the resultant HTML
  */
 private HTML imageItemHTML(ImageResource res, String title) {
   AbstractImagePrototype imageProto = AbstractImagePrototype.create(res);
   HTML label = new HTML(imageProto.getHTML() + " " + title);
   label.addClickHandler(this);
   label.addClickHandler((ClickHandler) parent);
   return label;
 }
コード例 #2
0
  private void addActionMenu() {
    Button button = new Button("Action");
    Menu menu = new Menu();

    if (settings.containsKey(SettingType.twitterClientId)
        && !Utils.isEmptyString(settings.get(SettingType.twitterClientId))
        && user != null) {
      menu.add(
          actionMenuItem(
              "Enable Facebook",
              AbstractImagePrototype.create(Icons.INSTANCE.connection()),
              Action.facebook));
    }
    if (settings.containsKey(SettingType.facebookAPIKey)
        && !Utils.isEmptyString(settings.get(SettingType.facebookAPIKey))) {
      menu.add(
          actionMenuItem(
              "Enable Twitter",
              AbstractImagePrototype.create(Icons.INSTANCE.connection()),
              Action.twitter));
    }
    menu.add(
        actionMenuItem(
            "Enable Instant Message (XMPP)",
            AbstractImagePrototype.create(Icons.INSTANCE.list_items()),
            Action.xmpp));

    button.setMenu(menu);
    add(button);
  }
コード例 #3
0
/**
 * abstract cell class for rendering recommendation icon
 *
 * @author Lucas Reeh
 */
public class RecommendedChartCell extends AbstractCell<Boolean> {

  final AbstractImagePrototype imageRes =
      AbstractImagePrototype.create(COModuleRecommenderResources.IMAGES.star_16());

  final Image image = imageRes.createImage();

  /** @param consumedEvents */
  public RecommendedChartCell(Set<String> consumedEvents) {
    super(consumedEvents);
    image.setTitle(COModuleRecommenderResources.TEXT.recommendationFromStudentsLong());
  }

  /** @param consumedEvents */
  public RecommendedChartCell(String... consumedEvents) {
    super(consumedEvents);
    image.setTitle(COModuleRecommenderResources.TEXT.recommendationFromStudentsLong());
  }

  @Override
  public void render(Context context, Boolean value, SafeHtmlBuilder sb) {
    if (value) {
      SafeHtml html = SafeHtmlUtils.fromTrustedString(image.toString());
      sb.append(html);
    }
  }
}
コード例 #4
0
  /**
   * Make icons available as SafeHtml
   *
   * @param resource
   * @return
   */
  private static SafeHtml makeImage(ImageResource resource) {
    AbstractImagePrototype proto = AbstractImagePrototype.create(resource);

    // String html = proto.getHTML().replace("style='",
    // "style='left:0px;top:0px;"); // position:absolute;
    //
    // return SafeHtmlUtils.fromTrustedString(html);

    return proto.getSafeHtml();
  }
コード例 #5
0
ファイル: LoginPanel.java プロジェクト: hegerchr/SoPeCo-WebUI
  private void createLanguagePanel() {
    selectLanguagePanel = new FlowPanel();
    selectLanguagePanel.addStyleName("selectLanguage");

    selectLanguagePanel.add(new HTML(R.lang.selectLanguage()));
    selectLanguagePanel.add(
        new Anchor(AbstractImagePrototype.create(R.img.flagEn()).getSafeHtml(), "frontend.jsp"));
    selectLanguagePanel.add(
        new Anchor(
            AbstractImagePrototype.create(R.img.flagDe()).getSafeHtml(), "frontend.jsp?locale=de"));
  }
コード例 #6
0
  public TeachersUI() {
    setScrollMode(Scroll.AUTO);
    setId("centerPanelBackground");
    addStyleName("uiContainer");
    setHeaderVisible(false);

    image = Resources.ICONS.image();
    add(image.createImage());

    String text = "<br><center><font color='orange' size='5px'>Teachers</font></center>";
    text += "<h2>Teachers directions here </h2> ";
    label = new Label();
    label.setText(text);
    add(label);

    videoPanel = new ContentPanel();
    videoPanel.setId("jwplayer");
    videoPanel.setHeaderVisible(false);
    videoPanel.setBodyBorder(false);
    add(videoPanel);

    Timer timer =
        new Timer() {

          @Override
          public void run() {
            loadVideoPlayer();
          }
        };

    timer.schedule(50);
  }
コード例 #7
0
ファイル: SettingsMenu.java プロジェクト: davideuler/gss
  /**
   * The widget's constructor.
   *
   * @param newImages the image bundle passed on by the parent object
   */
  public SettingsMenu(final Images newImages) {
    // The popup's constructor's argument is a boolean specifying that it
    // auto-close itself when the user clicks outside of it.
    super(true);
    setAnimationEnabled(true);
    images = newImages;

    Command userCredentialsCommand =
        new Command() {
          @Override
          public void execute() {
            CredentialsDialog dlg = new CredentialsDialog(newImages);
            dlg.center();
          }
        };
    contextMenu = new MenuBar(true);
    //		contextMenu.addItem("<span>" + newImages.preferences().getHTML() +
    // "&nbsp;Preferences</span>", true, cmd);
    MenuItem showCredentialsItem =
        new MenuItem(
            "<span>"
                + AbstractImagePrototype.create(newImages.credentials()).getHTML()
                + "&nbsp;Show Credentials</span>",
            true,
            userCredentialsCommand);
    showCredentialsItem.getElement().setId("topMenu.settingsMenu.showCredentials");
    contextMenu.addItem(showCredentialsItem);

    add(contextMenu);
    // setStyleName("toolbarPopup");
  }
コード例 #8
0
 public CreateFolderViewportAction(final TreePanel treePanel) {
   super("CreateViewport", AbstractImagePrototype.create(BasicWidgetResources.ICONS.viewport()));
   this.treePanel = treePanel;
   this.executor =
       new Listener() {
         @Override
         public void handleEvent(BaseEvent be) {
           execute(selectedElement.getChildren(), selectedElement.getLabel());
           treePanel.removeListener(GeoPlatformEvents.GP_NODE_EXPANDED, this);
         }
       };
   this.message =
       new Listener<MessageBoxEvent>() {
         @Override
         public void handleEvent(MessageBoxEvent be) {
           if (be.getButtonClicked().getItemId().equalsIgnoreCase(Dialog.YES)) {
             treePanel.addListener(GeoPlatformEvents.GP_NODE_EXPANDED, executor);
             treePanel.setExpanded(selectedElement, true);
             System.out.println("Selected element: " + selectedElement);
           } else {
             treePanel.removeListener(GeoPlatformEvents.GP_NODE_EXPANDED, executor);
           }
         }
       };
 }
コード例 #9
0
ファイル: SplitButton.java プロジェクト: sajeeshnl/sigmah
  /**
   * Replaces the button icon <b>but</b> does not save icon reference into parent {@code icon}
   * attribute.
   *
   * @param icon The button icon to display.
   */
  private void replaceIcon(final AbstractImagePrototype icon) {

    if (rendered) {
      El oldIcon = buttonEl.selectNode("." + baseStyle + "-image");
      if (oldIcon != null) {
        oldIcon.remove();
        el().removeStyleName(baseStyle + "-text-icon", baseStyle + "-icon", baseStyle + "-noicon");
      }
      el().addStyleName(
              (icon != null
                  ? (!Util.isEmptyString(html)
                      ? " " + baseStyle + "-text-icon"
                      : " " + baseStyle + "-icon")
                  : " " + baseStyle + "-noicon"));
      Element e = null;

      if (icon != null) {
        e = (Element) icon.createElement().cast();

        Accessibility.setRole(e, "presentation");
        fly(e).addStyleName(baseStyle + "-image");

        buttonEl.insertFirst(e);
        El.fly(e).makePositionable(true);
      }
      autoWidth();
      alignIcon(e);
    }
  }
コード例 #10
0
ファイル: Button.java プロジェクト: FURCAS-dev/FURCAS
  /**
   * Sets the button's icon style. The style name should match a CSS style that specifies a
   * background image using the following format:
   *
   * <pre>
   *
   * &lt;code&gt; .my-icon { background: url(images/icons/my-icon.png) no-repeat
   * center left !important; } &lt;/code&gt;
   *
   * </pre>
   *
   * @param icon the icon
   */
  public void setIcon(AbstractImagePrototype icon) {
    if (rendered) {
      if (buttonEl.selectNode("img") != null) {
        buttonEl.selectNode("img").remove();
        el().removeStyleName("x-btn-text-icon", "x-btn-icon", "x-btn-noicon");
      }
      el().addStyleName(
              (icon != null
                  ? ((text != null && text.length() > 0) ? " x-btn-text-icon" : " x-btn-icon")
                  : " x-btn-noicon"));
      if (icon != null) {

        Element e = (Element) icon.createElement().cast();
        buttonEl.insertFirst(e);
        El.fly(e).makePositionable(true);
        String align = "b-b";
        if (iconAlign == IconAlign.BOTTOM) {
          align = "b-b";
        } else if (iconAlign == IconAlign.TOP) {
          align = "t-t";
        } else if (iconAlign == IconAlign.LEFT) {
          align = "tl-tl";
        } else if (iconAlign == IconAlign.RIGHT) {
          align = "tr-tr";
        }
        El.fly(e).alignTo(buttonEl.dom, align, null);
      }
    }
    this.icon = icon;
  }
コード例 #11
0
  protected void onRender(Element parent, int index) {
    super.onRender(parent, index);

    setId("settings-tabs-wrapper");
    setLayout(new FitLayout());

    m_tabsPanel = new TabPanel();
    m_tabsPanel.setPlain(true);
    m_tabsPanel.setBorders(false);
    m_tabsPanel.setBodyBorder(false);
    m_tabsPanel.setStyleAttribute("padding-top", "5px");

    m_snapshotsConfig = new TabItem(MSGS.settingsSnapshots());
    m_snapshotsConfig.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.snapshots()));
    m_snapshotsConfig.setBorders(true);
    m_snapshotsConfig.setLayout(new FitLayout());
    m_snapshotsConfig.add(m_snapshotsTab);
    m_tabsPanel.add(m_snapshotsConfig);

    m_certificatesConfig = new TabItem(MSGS.settingsAddSSLCertificates());
    m_certificatesConfig.setBorders(true);
    m_certificatesConfig.setLayout(new FitLayout());
    m_certificatesConfig.add(m_certificatesTab);
    m_tabsPanel.add(m_certificatesConfig);

    m_permissionsConfig = new TabItem(MSGS.permissions());
    m_permissionsConfig.setBorders(true);
    m_permissionsConfig.setLayout(new FitLayout());
    m_permissionsConfig.add(m_permissionsTab);
    m_tabsPanel.add(m_permissionsConfig);

    add(m_tabsPanel);
  }
コード例 #12
0
 public LoadKmlFromUrlTreeAction(TreePanel theTree) {
   super(
       theTree,
       AbstractImagePrototype.create(LayerResources.ICONS.loadKmlFromURL()),
       LayerModuleConstants.INSTANCE.LoadKmlFromUrlTreeAction_tooltipText());
   this.kmlWidget = new LoadKmlFromUrlWidget(theTree);
 }
コード例 #13
0
  private static Button connectionButton() {
    final Button b = new Button("&nbsp;Connect");
    b.setIcon(AbstractImagePrototype.create(Icons.INSTANCE.email2()));

    b.addListener(Events.OnClick, new ConnectBaseEventListener());
    return b;
  }
コード例 #14
0
  private ContentPanel buildConfigBloc(ConfigGroup configGroup, ImageResource icon) {
    final ContentPanel cPanel = new ContentPanel(new ColumnLayout());
    cPanel.setHeading(
        "<div class='config-title'>" + I18nUtils.getString(configGroup.key) + "</div>");
    cPanel.getHeader().addStyleName("config-header");
    cPanel.setCollapsible(true);
    cPanel.setAnimCollapse(false);
    cPanel.collapse();
    cPanel.setIcon(AbstractImagePrototype.create(icon));
    cPanel.addListener(
        Events.Expand,
        new Listener<ComponentEvent>() {

          @Override
          public void handleEvent(ComponentEvent be) {
            cPanel.layout(true);
          }
        });

    cPanel.getHeader().addDomHandler(this, ClickEvent.getType());
    mapConfigGroupPanel.put(configGroup, cPanel);
    mapHeaderGroup.put(cPanel.getHeader(), cPanel);

    return cPanel;
  }
コード例 #15
0
 public void renameSelected(final String name) {
   ((CategoryItem) navTreeWidget.getSelectedItem().getUserObject()).setName(name);
   navTreeWidget
       .getSelectedItem()
       .setHTML(
           AbstractImagePrototype.create(ImageResources.INSTANCE.categorySmall()).getHTML()
               + h(name));
 }
コード例 #16
0
  private Button addChartButton() {
    Button addChartButton = new Button("&nbsp;Add Chart");
    addChartButton.setIcon(AbstractImagePrototype.create(Icons.INSTANCE.lineChart()));
    addChartButton.setToolTip("Add another chart");

    addChartButton.addListener(Events.OnClick, new AddChartBaseEventListener());
    return addChartButton;
  }
コード例 #17
0
  private Button pendingConnectionsButton() throws NimbitsException {
    final Button connectionRequest = new Button("Connection Requests(" + connectionCount + ')');

    connectionRequest.setIcon(AbstractImagePrototype.create(Icons.INSTANCE.add16()));
    service.getPendingConnectionRequests(
        user.getEmail(), new GetPendingRequestListAsyncCallback(connectionRequest));
    return connectionRequest;
  }
コード例 #18
0
  private void addHelpMenu() {
    Button button = new Button("Help");
    Menu menu = new Menu();

    menu.add(
        urlMenuItem(
            "Forum",
            AbstractImagePrototype.create(Icons.INSTANCE.Help()),
            "http://groups.google.com/group/nimbits"));
    menu.add(
        urlMenuItem(
            "nimbits.com",
            AbstractImagePrototype.create(Icons.INSTANCE.Home()),
            "http://www.nimbits.com"));

    button.setMenu(menu);
    add(button);
  }
コード例 #19
0
  private MenuItem newFolder() {
    MenuItem item = new MenuItem("New Folder");

    item.setIcon(AbstractImagePrototype.create(Icons.INSTANCE.category()));

    item.addListener(Events.OnClick, new AddFolderBaseEventListener());

    return item;
  }
コード例 #20
0
  private MenuItem newDataPoint() {
    final MenuItem item = new MenuItem("Data Point");

    item.setIcon(AbstractImagePrototype.create(Icons.INSTANCE.addNew()));
    item.setToolTip(UserMessages.MESSAGE_NEW_POINT);
    item.addListener(Events.OnClick, new NewPointBaseEventListener());

    return item;
  }
コード例 #21
0
 private MenuItem acceptConnectionMenuItem(final Menu scrollMenu, final ConnectionRequest r)
     throws NimbitsException {
   final MenuItem m = new MenuItem(r.getRequestorEmail().getValue());
   m.setIcon(AbstractImagePrototype.create(Icons.INSTANCE.connection()));
   m.addListener(
       Events.Select,
       new AcceptConnectionBaseEventListener(r, scrollMenu, m, connectionRequest));
   return m;
 }
コード例 #22
0
 public EditWFSAction(TreePanel<GPBeanTreeModel> treePanel) {
   super(
       WFSTWidgetConstants.INSTANCE.EditWFSAction_titleText(),
       AbstractImagePrototype.create(BasicWidgetResources.ICONS.vector()));
   this.treePanel = treePanel;
   this.bus = FeatureInjector.MainInjector.getInstance().getEventBus();
   this.layerTypeHandlerManager =
       FeatureInjector.MainInjector.getInstance().getLayerTypeHandlerManager();
 }
コード例 #23
0
  public TreeItem buildTreeItem(final CategoryItem category) {
    final TreeItem it = new TreeItem();
    it.setHTML(
        AbstractImagePrototype.create(ImageResources.INSTANCE.categorySmall()).getHTML()
            + h(category.getName()));
    it.setUserObject(category);

    return it;
  }
コード例 #24
0
  private MenuItem uploadFile() {
    MenuItem item = new MenuItem("Upload File");

    item.setIcon(AbstractImagePrototype.create(Icons.INSTANCE.diagram()));

    item.addListener(Events.OnClick, uploadFileListener);

    return item;
  }
コード例 #25
0
ファイル: GroupingView.java プロジェクト: Elisabitao/gxt-rtl
  public class GroupingViewImages extends GridViewImages {
    private AbstractImagePrototype groupBy =
        AbstractImagePrototype.create(GXT.IMAGES.grid_groupBy());

    public AbstractImagePrototype getGroupBy() {
      return groupBy;
    }

    public void setGroupBy(AbstractImagePrototype groupBy) {
      this.groupBy = groupBy;
    }
  }
コード例 #26
0
  private void addNavigateMenu() {
    Button button = new Button("Navigate");
    Menu menu = new Menu();
    menu.add(
        actionMenuItem(
            "Toggle Expansion",
            AbstractImagePrototype.create(Icons.INSTANCE.expand()),
            Action.expand));

    button.setMenu(menu);
    add(button);
  }
コード例 #27
0
ファイル: GSS.java プロジェクト: davideuler/gss
 /**
  * Creates an HTML fragment that places an image & caption together, for use in a group header.
  *
  * @param imageProto an image prototype for an image
  * @param caption the group caption
  * @return the header HTML fragment
  */
 private String createHeaderHTML(AbstractImagePrototype imageProto, String caption) {
   String captionHTML =
       "<table class='caption' cellpadding='0' "
           + "cellspacing='0'>"
           + "<tr><td class='lcaption'>"
           + imageProto.getHTML()
           + "</td><td id ="
           + caption
           + " class='rcaption'><b style='white-space:nowrap'>&nbsp;"
           + caption
           + "</b></td></tr></table>";
   return captionHTML;
 }
コード例 #28
0
 private Button buildNewToolRequestMenuItem() {
   Button newToolBtn = new Button(org.iplantc.core.tito.client.I18N.DISPLAY.requestNewTool());
   newToolBtn.setIcon(AbstractImagePrototype.create(Resources.ICONS.add()));
   newToolBtn.addSelectionListener(
       new SelectionListener<ButtonEvent>() {
         @Override
         public void componentSelected(ButtonEvent ce) {
           new NewToolRequestWindow().show();
         }
       });
   newToolBtn.setId(ID_BTN_NEW_TOOL_BTN);
   return newToolBtn;
 }
コード例 #29
0
 @Override
 public void finalizeInitOperations() {
   super.finalizeInitOperations();
   super.selectButton.setText(
       LayerModuleConstants.INSTANCE.GPProjectSearchPanel_selectButtonText());
   super.search.setFieldLabel(
       LayerModuleConstants.INSTANCE.GPProjectSearchPanel_searchlabelText());
   GPProjectAction action = new GPProjectAction(GPTrustedLevel.HIGH, this);
   GPSecureButton addProjectButton =
       new GPSecureButton(
           ButtonsConstants.INSTANCE.addText(),
           AbstractImagePrototype.create(LayerResources.ICONS.projectAdd()),
           action);
   super.addButton(1, addProjectButton);
   addProjectButton.disable();
   this.editButton =
       new GPSecureButton(
           ButtonsConstants.INSTANCE.editText(),
           AbstractImagePrototype.create(BasicWidgetResources.ICONS.edit()),
           action);
   this.editButton.disable();
   super.addButton(2, this.editButton);
   this.deleteButton =
       new GPSecureButton(
           ButtonsConstants.INSTANCE.deleteText(),
           AbstractImagePrototype.create(LayerResources.ICONS.projectDelete()),
           new DeleteProjectAction(GPTrustedLevel.FULL, this));
   this.deleteButton.disable();
   super.addButton(3, this.deleteButton);
   ShareProjectAction shareProjectAction = new ShareProjectAction(GPTrustedLevel.HIGH, this);
   this.shareButton =
       new GPSecureButton(
           ButtonsConstants.INSTANCE.shareText(),
           AbstractImagePrototype.create(LayerResources.ICONS.arrowRefresh()),
           shareProjectAction);
   this.shareButton.disable();
   super.addButton(4, this.shareButton);
 }
コード例 #30
0
ファイル: GcodeView.java プロジェクト: dalinhuang/gwtbusi
  public void init() {
    toolBar = new PagingToolBar(5, true);
    getStore();
    // initwidget();
    store.addBaseStoreListener(BaseStoreEvent.EventType.LOAD_COMPLETE, this);

    printer = new Button("打印");
    // printer.setStyleName("printer");
    // printer.setIconStyle("printer");
    // printer.setId("printer");
    printer.setIcon(AbstractImagePrototype.create(BaseResource.INSTANCE.print_16()));

    printer.addListener(Events.Select, this);
  }