public void createView() { table = new VerticalPanel(); createButton = new Hyperlink( "Create Company", "" ); goToProduct = new Hyperlink( "Go To Products", "" ); filter = new CheckBox( "Filter Company EventBus events" ); moduleHistory = new CheckBox( "Disable Company Module History" ); applicationHistory = new CheckBox( "Disable Application History" ); VerticalPanel mainPanel = new VerticalPanel(); mainPanel.add( table ); mainPanel.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_RIGHT ); mainPanel.add( createButton ); mainPanel.add( goToProduct ); mainPanel.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_LEFT ); mainPanel.add( moduleHistory ); mainPanel.add( applicationHistory ); mainPanel.add( filter ); initWidget( mainPanel ); }
private static CellRenderer<DataContainerGVO, String> createLinkRenderer(final DataGridGVO source, final DataGridColumnGVO column, final String uuid, final String parent, final String targetHistoryToken, final HasDataGridMethods uiParent) { CellRenderer<DataContainerGVO, String> cellRenderer; cellRenderer = new CellRenderer<DataContainerGVO, String>() { public void renderRowValue(DataContainerGVO rowValue, ColumnDefinition<DataContainerGVO, String> columnDef, AbstractCellView<DataContainerGVO> view) { boolean alreadyRendered = false; String value = simpleObjectToText(columnDef.getCellValue(rowValue)); int rowIndex = view.getRowIndex(); String generatedId = generateIdBasedOnIndex(column, rowIndex); Hyperlink renderedComponent = (Hyperlink)getRenderedComponent(column, generatedId, uuid, parent); if (renderedComponent != null) { renderedComponent.setText(value); alreadyRendered = true; } else { renderedComponent = new Hyperlink(value, targetHistoryToken); } view.setWidget(renderedComponent); CellRendererHelper.addBasicInfoToUIObject(renderedComponent, uuid, parent, source, column, rowValue, rowIndex, null, alreadyRendered); handleCellSet(uiParent, columnDef, renderedComponent, rowValue); } }; return cellRenderer; }
public ResponseItem(final MethodNode method, final TreeItem methodTreeItem) { HorizontalPanel containerPanel = new HorizontalPanel(); HTML response = new HTML(SyntaxHighlighter.highlight("<" + WadlXml.responseNode + ">")); containerPanel.add(response); // remove response hyperlink Hyperlink removeResponseLink = new Hyperlink(GuiFactory.strings.remove(), true, ""); removeResponseLink.addClickListener(new ClickListener() { public void onClick(Widget sender) { method.removeResponse(method.getResponse()); listResponse(method, methodTreeItem); } }); containerPanel.add(removeResponseLink); initWidget(containerPanel); }
public RequestItem(final MethodNode method, final TreeItem methodTreeItem) { HorizontalPanel containerPanel = new HorizontalPanel(); HTML request = new HTML(SyntaxHighlighter.highlight("<" + WadlXml.requestNode + ">")); containerPanel.add(request); // remove request hyperlink Hyperlink removeRequestLink = new Hyperlink(GuiFactory.strings.remove(), true, ""); removeRequestLink.addClickListener(new ClickListener() { public void onClick(Widget sender) { method.removeRequest(method.getRequest()); listRequest(method, methodTreeItem); } }); containerPanel.add(removeRequestLink); initWidget(containerPanel); }
/** * */ private static void listUsedClassNames() { Iterator classNameIterator = CodeGenerator.usedClassNames.iterator(); requestClassesPanel.clear(); while(classNameIterator.hasNext()) { final String className = (String) classNameIterator.next(); Hyperlink hyperlink = new Hyperlink("<nobr><img align=\"absmiddle\" src=\"./images/details.png\" />" + className + "</nobr>", true, ""); hyperlink.addClickListener(new ClickListener() { public void onClick(Widget sender) { int pos = codeTextArea.getText().indexOf(className); codeTextArea.setCursorPos(pos); codeTextArea.setSelectionRange(pos, className.length()); } }); requestClassesPanel.add(hyperlink); } }
public NavigationLink(String text, long projectId, String targetHistoryToken, Function<Void, TaPagePresenter> createPresenterFunction) { this.targetHistoryToken = targetHistoryToken; this.projectId = projectId; this.createPresenterFunction = createPresenterFunction; panel = new DeckPanel(); SimplePanel fakeLinkPanel = new SimplePanel(); fakeLink = new Label(text); fakeLinkPanel.add(fakeLink); realLink = new Hyperlink(text, getHyperlinkTarget()); panel.add(realLink); panel.add(fakeLinkPanel); enable(); super.initWidget(panel); }
public DndLink(String text, String link, DomainObject representedDomainObject, Widget parent) { myLink = new Hyperlink(text, link); this.setWidget(myLink); //workaround default blue link text styling myLink.getElement().getFirstChildElement().getStyle().setColor("#475765"); representedObjects = new ArrayList<DomainObject>(1); representedObjects.add(representedDomainObject); // this.parent = parent; // this.representedDomainObject = representedDomainObject; if(!draggable()) { this.getElement().getStyle().setCursor(Cursor.POINTER); } }
private void appendToBreadcrumb(String text, String history, boolean isLast) { Element li = DOM.createElement("li"); breadcrumb.appendChild(li); if (isLast) { // last element in breadcrumb li.setAttribute("class", "active"); li.setInnerText(text); } else { // elements still coming li.appendChild(new Hyperlink(text, history).getElement()); Element divider = DOM.createElement("span"); divider.setAttribute("class", "divider"); divider.setInnerText("/"); li.appendChild(divider); } }
public DemoWidget(Mediator mediator) { mediator.setDemoWidget(this); final DemoSubjectsController demoSubjectsController = new DemoSubjectsController(mediator); final DemoSubjectsWidget demoSubjectsWidget = new DemoSubjectsWidget(mediator, demoSubjectsController); add(demoSubjectsWidget); final Label introLabel = new HTML(StringConstants.StringConstantsSingleton.getInstance().intro()); final Hyperlink registerHyperlink = new Hyperlink( StringConstants.StringConstantsSingleton.getInstance().registerRightNow(), HistoryToken.registration.toString() ); registerHyperlink.setStylePrimaryName("registerHyperlink"); final VerticalPanel introPanel = new VerticalPanel(); introPanel.add(introLabel); introPanel.add(registerHyperlink); introPanel.setStylePrimaryName("borderedIntro"); introPanel.setSpacing(10); add(demoSubjectsWidget); add(introPanel); }
public Widget render(Row row, Column column, Object value) { if(value == null || !(value instanceof String)) { return null; } else { Hyperlink hyperlink = new Hyperlink((String)value, _asHTML, _targetHistoryToken); if(_title != null) hyperlink.setTitle(_title); return hyperlink; } }
private void addAttributeRow(HoverGridWidget widget, int row, final GWT_AttributeBean aBean) { widget.setText(row, NAME_COL, aBean.getDisplayName()); widget.setText(row, ALIAS_COL, aBean.getAlias()); widget.setWidget(row, TYPE_COL, new Hyperlink(aBean.getType(), null)); widget.setText(row, REF_TYPE_COL, aBean.getRefType()); widget.setText(row, DERIVED_COL, aBean.isDerived() ? "*" : " "); widget.setText(row, MIN_COL, aBean.getMinOccurs()); widget.setText(row, MAX_COL, aBean.getMaxOccurs()); List values = currentTemplate.fetchAttributeValueBeans(aBean.getAlias()); if (values != null && values.size() > 0) { GWT_ValueBean value = (GWT_ValueBean) values.get(0); widget.setText(row, DEFAULT_VALUE_COL, value.getValue()); } else { widget.setText(row, DEFAULT_VALUE_COL, ""); } if (!aBean.isDerived()) { Image delete = new Image("images/trashcan16.gif"); delete.setTitle("Delete attribute " + aBean.getDisplayName()); delete.addClickListener(new ClickListener() { public void onClick(Widget sender) { delete(aBean); } }); widget.setWidget(row, DEFAULT_VALUE_COL+1, delete); } rowMap.put(new Integer(row), aBean); }
/** * Create a new ClickableTextItem. * * @param name the name of the bean member. * @param title the label text. * @param valueAdapter the adapter for the field value. */ public ClickableTextItem(String name, String title, ValueAdapter<T> valueAdapter) { super(name, title); _link = new Hyperlink(); _valueAdapter = valueAdapter; resetMetaData(); }
public GrammarsItem(final GrammarsNode grammars, final TreeItem applicationTreeItem) { HorizontalPanel grammarsPanel = new HorizontalPanel(); grammarsPanel.add(new HTML(SyntaxHighlighter.highlight("<" + WadlXml.grammarsNode + ">"))); // remove resources hyperlink Hyperlink removeGrammarsLink = new Hyperlink(GuiFactory.strings.remove(), true, ""); removeGrammarsLink.addClickListener(new ClickListener() { public void onClick(Widget sender) { grammars.getApplication().removeGrammars(); listGrammars(grammars.getApplication(), applicationTreeItem); } }); grammarsPanel.add(removeGrammarsLink); initWidget(grammarsPanel); }
private Widget prepareLink(Hyperlink link) { HorizontalPanel horizontalPanel = new HorizontalPanel(); horizontalPanel.setStyleName(panelStyle.padding()); horizontalPanel.add(new Image(AtomClientBundle.INSTANCE.linkArrow())); link.setStyleName(panelStyle.link()); horizontalPanel.add(link); return horizontalPanel; }
/** * Get a {@link Hyperlink} to a section based on the name of the * {@link ContentWidget} example. * * @param cwClass the {@link ContentWidget} class * @param name the name to display for the link * @return a {@link Hyperlink} */ @ShowcaseSource private <C extends ContentWidget> Hyperlink getHyperlink( Class<C> cwClass, String name) { Hyperlink link = new Hyperlink( name, Showcase.getContentWidgetToken(cwClass)); link.ensureDebugId("cwHyperlink-" + cwClass.getName()); return link; }
private static Widget createSidebarHyperlink(String name, String token) { if (History.getToken().startsWith(token)) { Label l = new Label(name); l.addStyleName("SidebarSelected"); return l; } else { return new Hyperlink(name, token); } }
@Override public void onModuleLoad() { RootPanel.get("location").add(location); RootPanel.get("links").add(links); RootPanel.get("events").add(events); History.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { showLocationData(event.getValue()); events.insertItem("["+new Date()+"] ValueChangeEvent: value="+event.getValue(), 0); } }); showLocationData(""); String hash = "#"+token; String uri = Document.get().getBody().getAttribute("data-file")+hash; links.setText(0, 0, "GWT Hyperlink"); links.setWidget(0, 1, new Hyperlink(SafeHtmlUtils.fromString(token), token)); links.setText(1, 0, "HTML Hash"); links.setHTML(1, 1, "<a href=\""+SafeHtmlUtils.htmlEscape(hash)+"\">"+SafeHtmlUtils.htmlEscape(hash)+"</a>"); links.setText(2, 0, "GWT Anchor"); links.setWidget(2, 1, new Anchor(SafeHtmlUtils.fromString(uri), uri)); links.setText(3, 0, "HTML Relative URI"); links.setHTML(3, 1, "<a href=\""+SafeHtmlUtils.htmlEscape(uri)+"\">"+SafeHtmlUtils.htmlEscape(uri)+"</a>"); events.setVisibleItemCount(20); events.setWidth("800px"); }
public void refresh() { System.out.println("---------refresh Success"); table.clear(); int i=0; table.setText(i++, 0, getCurState().getMessage()); table.setText(i++, 0, "如果您不作出选择,将在3秒后跳到第一个链接"); for(String[] choice:getCurState().getChoices()) { table.setWidget(i++, 0, new Hyperlink("返回"+choice[0], choice[1])); } }
public void render(Context context, Hyperlink h, SafeHtmlBuilder sb) { sb.append(SafeHtmlUtils.fromTrustedString(h.toString())); }
public MenuItemComponent(final String menuItemName, String history, String styleName, final String url) { setSpacing(2); Hyperlink hyperlink = new Hyperlink(menuItemName, "history"); hyperlink.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { MainFactory.createWindowWithUrl(menuItemName, url); postRender(); } }); add(hyperlink); setStyleName(styleName); }
/** * Creates the wadl panel */ public WadlPanel() { wadlPanel.setStyleName("restDescribe-wadlPanel"); wadlPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); wadlHeader = new HTML("<h2>" + GuiFactory.strings.wadlFile() + "</h2>"); wadlPanel.add(wadlHeader); VerticalPanel buttonPanel = new VerticalPanel(); containerPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); wadlArea.setStyleName("restDescribe-wadlArea"); containerPanel.add(wadlArea); wadlSaveButton = new Button(GuiFactory.strings.dumpXml()); wadlSaveButton.setWidth("8em"); wadlSaveButton.addClickListener(this); wadlSaveButton.setEnabled(false); buttonPanel.add(wadlSaveButton); wadlPreviewButton = new Button(GuiFactory.strings.prettyPrintXml()); wadlPreviewButton.setWidth("8em"); wadlPreviewButton.addClickListener(this); wadlPreviewButton.setEnabled(false); buttonPanel.add(wadlPreviewButton); fullscreenButton = new Button(GuiFactory.strings.fullscreen()); fullscreenButton.setWidth("8em"); fullscreenButton.addClickListener(this); fullscreenButton.setEnabled(false); buttonPanel.add(fullscreenButton); generateCodeButton = new Button(GuiFactory.strings.generateCode()); generateCodeButton.setWidth("8em"); generateCodeButton.addClickListener(this); generateCodeButton.setEnabled(false); buttonPanel.add(generateCodeButton); resetButton = new Button(GuiFactory.strings.resetWadl()); resetButton.setWidth("8em"); resetButton.addClickListener(this); resetButton.setEnabled(false); buttonPanel.add(resetButton); Hyperlink resetLink = new Hyperlink(GuiFactory.strings.resetLink(), true, ""); resetLink.addClickListener(new ClickListener() { public void onClick(Widget sender) { if (Window.confirm(GuiFactory.strings.reallyCompletelyReset())) { GuiFactory.resetApplication(GuiFactory.strings.newRequestUri()); } } }); buttonPanel.add(new HTML(" ")); buttonPanel.add(resetLink); containerPanel.add(buttonPanel); wadlPanel.add(containerPanel); initWidget(wadlPanel); }
public Hyperlink getHyperlink() { return realLink; }
protected Hyperlink createHyperlink(String name, Place place) { Hyperlink link = new Hyperlink(name, placeHistoryMapper.getToken(place)); link.setStyleName(WebConsoleResourceBundle.INSTANCE.css().menuLink()); return link; }
public Hyperlink getLink() { return myLink; }
private Hyperlink getLocationLink() { return locationLink; }
private Hyperlink getApplicationLink() { return applicationLink; }
private void displaySearchResults(Panel panel, String tokenqueryprefix, SearchResult result) { int numpages = result.total / MAX_SEARCH_RESULTS; if (result.total % MAX_SEARCH_RESULTS != 0) { numpages++; } int page = result.offset / MAX_SEARCH_RESULTS; Panel nav = createSearchResultsNav(page, numpages, tokenqueryprefix); panel.add(nav); Grid grid = new Grid((result.matches.length / 2) + (result.matches.length % 2), 4); for (int i = 0; i < result.matches.length; i++) { SearchMatch m = result.matches[i]; int resultrow = i / 2; int resultcol = (i % 2) * 2; String thumbhtml; String imagename; String bookid; if (m.loc.contains(".")) { bookid = Book.bookIDFromImage(m.loc); thumbhtml = FSIService.embedStaticImage(PIZAN_FSI_SHARE, m.loc + ".tif", 64, 64); imagename = m.loc.substring(m.loc.indexOf('.') + 1); } else { bookid = m.loc; imagename = null; thumbhtml = FSIService.embedStaticImage(PIZAN_FSI_SHARE, m.loc + ".binding.frontcover.tif", 64, 64); } grid.setWidget(resultrow, resultcol, new Hyperlink(thumbhtml, true, Action.READ_BOOK.toToken(m.loc))); FlowPanel desc = new FlowPanel(); grid.setWidget(resultrow, resultcol + 1, desc); String resultname = (imagename == null ? "" : imagename + ": ") + col.fullBookName(col.findBookByID(bookid)); desc.add(new Anchor(resultname, "#" + Action.READ_BOOK.toToken(m.loc))); StringBuilder context = new StringBuilder(); for (int j = 0; j < m.snippets.size();) { String field = m.snippets.get(j++); String snippet = m.snippets.get(j++); Searcher.UserField uf = Searcher.UserField.findByLuceneField(field); field = uf == null ? field : uf.display; context.append("<span class='ResultField'>" + field + ":</span>"); context.append("<span class='ResultSnippet'> " + snippet); if (j != m.snippets.size()) { context.append(", "); } context.append("</span>"); } desc.add(new HTML(context.toString())); } panel.add(grid); panel.add(createSearchResultsNav(page, numpages, tokenqueryprefix)); }
private void displaySearchResults(Panel panel, String tokenqueryprefix, SearchResult result) { int numpages = result.total / MAX_SEARCH_RESULTS; if (result.total % MAX_SEARCH_RESULTS != 0) { numpages++; } int page = result.offset / MAX_SEARCH_RESULTS; Panel nav = createSearchResultsNav(page, numpages, tokenqueryprefix); panel.add(nav); Grid grid = new Grid((result.matches.length / 2) + (result.matches.length % 2), 4); for (int i = 0; i < result.matches.length; i++) { SearchMatch m = result.matches[i]; int resultrow = i / 2; int resultcol = (i % 2) * 2; String thumbhtml; String imagename; String bookid; if (m.loc.contains(".")) { bookid = Book.bookIDFromImage(m.loc); thumbhtml = FSIService.embedStaticImage(ROSE_FSI_SHARE, m.loc + ".tif", 64, 64); imagename = m.loc.substring(m.loc.indexOf('.') + 1); } else { bookid = m.loc; imagename = null; thumbhtml = FSIService.embedStaticImage(ROSE_FSI_SHARE, m.loc + ".binding.frontcover.tif", 64, 64); } grid.setWidget(resultrow, resultcol, new Hyperlink(thumbhtml, true, Action.READ_BOOK.toToken(m.loc))); FlowPanel desc = new FlowPanel(); grid.setWidget(resultrow, resultcol + 1, desc); String resultname = (imagename == null ? "" : imagename + ": ") + col.fullBookName(col.findBookByID(bookid)); desc.add(new Anchor(resultname, "#" + Action.READ_BOOK.toToken(m.loc))); StringBuilder context = new StringBuilder(); for (int j = 0; j < m.snippets.size();) { String field = m.snippets.get(j++); String snippet = m.snippets.get(j++); Searcher.UserField uf = Searcher.UserField .findByLuceneField(field); field = uf == null ? field : uf.display; context.append("<span class='ResultField'>" + field + ":</span>"); context.append("<span class='ResultSnippet'> " + snippet); if (j != m.snippets.size()) { context.append(", "); } context.append("</span>"); } desc.add(new HTML(context.toString())); } panel.add(grid); panel.add(createSearchResultsNav(page, numpages, tokenqueryprefix)); }