/** * 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; }
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); }
/** * 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); } } }
/** * 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(); }
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")); }
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); }
/** * 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() + // " Preferences</span>", true, cmd); MenuItem showCredentialsItem = new MenuItem( "<span>" + AbstractImagePrototype.create(newImages.credentials()).getHTML() + " Show Credentials</span>", true, userCredentialsCommand); showCredentialsItem.getElement().setId("topMenu.settingsMenu.showCredentials"); contextMenu.addItem(showCredentialsItem); add(contextMenu); // setStyleName("toolbarPopup"); }
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); } } }; }
/** * 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); } }
/** * Sets the button's icon style. The style name should match a CSS style that specifies a * background image using the following format: * * <pre> * * <code> .my-icon { background: url(images/icons/my-icon.png) no-repeat * center left !important; } </code> * * </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; }
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); }
public LoadKmlFromUrlTreeAction(TreePanel theTree) { super( theTree, AbstractImagePrototype.create(LayerResources.ICONS.loadKmlFromURL()), LayerModuleConstants.INSTANCE.LoadKmlFromUrlTreeAction_tooltipText()); this.kmlWidget = new LoadKmlFromUrlWidget(theTree); }
private static Button connectionButton() { final Button b = new Button(" Connect"); b.setIcon(AbstractImagePrototype.create(Icons.INSTANCE.email2())); b.addListener(Events.OnClick, new ConnectBaseEventListener()); return b; }
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; }
public void renameSelected(final String name) { ((CategoryItem) navTreeWidget.getSelectedItem().getUserObject()).setName(name); navTreeWidget .getSelectedItem() .setHTML( AbstractImagePrototype.create(ImageResources.INSTANCE.categorySmall()).getHTML() + h(name)); }
private Button addChartButton() { Button addChartButton = new Button(" Add Chart"); addChartButton.setIcon(AbstractImagePrototype.create(Icons.INSTANCE.lineChart())); addChartButton.setToolTip("Add another chart"); addChartButton.addListener(Events.OnClick, new AddChartBaseEventListener()); return addChartButton; }
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; }
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); }
private MenuItem newFolder() { MenuItem item = new MenuItem("New Folder"); item.setIcon(AbstractImagePrototype.create(Icons.INSTANCE.category())); item.addListener(Events.OnClick, new AddFolderBaseEventListener()); return item; }
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; }
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; }
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(); }
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; }
private MenuItem uploadFile() { MenuItem item = new MenuItem("Upload File"); item.setIcon(AbstractImagePrototype.create(Icons.INSTANCE.diagram())); item.addListener(Events.OnClick, uploadFileListener); return item; }
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; } }
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); }
/** * 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'> " + caption + "</b></td></tr></table>"; return captionHTML; }
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; }
@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); }
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); }