List of usage examples for com.google.gwt.gwtpages.client Pages get
public static Pages get()
From source file:hudson.gwtmarketplace.client.GWT_Marketplace.java
License:Open Source License
/** * This is the entry point method./*from www . ja v a 2 s .c om*/ */ public void onModuleLoad() { Pages.init((PageLoader) GWT.create(PageLoader.class), this.layoutPage = new LayoutPage(), new HandlerManager(null), true).addDefaultEventHandlers().add(new AuthenticationPageEventHandler()); // load the current logged in user new LoginCommand() { @Override public void onSuccess(UserInfo result) { clearContent(); RootPanel.get("content").add(layoutPage); Pages.get().showStartPage(true); } public void onFailure(Throwable e) { clearContent(); RootPanel.get("content").add(layoutPage); Pages.get().showStartPage(false); }; }.execute(); }
From source file:hudson.gwtmarketplace.client.pages.layout.Header.java
License:Open Source License
private void onSearch() { Pages.get().goTo(PageLoader.PAGE_SEARCH, searchBox.getValue()).execute(); searchBox.setValue(null); }
From source file:hudson.gwtmarketplace.client.pages.layout.LeftNav.java
License:Open Source License
public LeftNav() { initWidget(uiBinder.createAndBindUi(this)); reloadCategories(); Pages.get().getEventBus().addHandler(CategoriesUpdatedEvent.TYPE, this); }
From source file:hudson.gwtmarketplace.client.pages.layout.LeftNav.java
License:Open Source License
private void reloadCategories(ArrayList<Category> categories) { LeftNav.this.categories.clear(); for (Category c : categories) { FlowPanel fp = new FlowPanel(); fp.getElement().getStyle().setPaddingTop(4, Unit.PX); String link = Pages.get().createHistoryToken(PageLoader.PAGE_SEARCH, "category:" + c.getAlias()); fp.add(new Hyperlink(c.getName() + " (" + c.getNumProducts() + ")", link)); LeftNav.this.categories.add(fp); }// w ww .j av a 2 s . c o m }
From source file:hudson.gwtmarketplace.client.pages.product.ProductDetailsPanel.java
License:Open Source License
public ProductDetailsPanel() { HorizontalPanel container = uiBinder.createAndBindUi(this); initWidget(container);//from w w w . jav a2 s .co m container.setCellWidth(container.getWidget(0), "132px"); container.getWidget(0).getElement().getStyle().setPaddingRight(12, Unit.PX); rateIt.addClickHandler(this); Pages.get().getEventBus().addHandler(ProductUpdatedEvent.TYPE, this); }
From source file:hudson.gwtmarketplace.client.pages.product.ProductDetailsPanel.java
License:Open Source License
public void show(Product product) { Product _previous = this.product; this.product = product; links.clear();/* ww w . ja va 2 s . c om*/ if (null == product) { newsfeedContainer.setVisible(false); newsfeed.clear(); description.setInnerText(""); tags.setInnerHTML(""); category.setInnerText(""); versionNumber.setInnerText(""); views.setInnerText(""); organization.setInnerText(""); createdDate.setInnerText(""); lastUpdatedDate.setInnerText(""); icon.getStyle().setDisplay(Display.NONE); ratingContainer.getElement().setInnerText(""); } else { if (!isNull(product.getWebsiteUrl())) { links.add(new Anchor("Website", product.getWebsiteUrl(), "_blank")); } if (!isNull(product.getDemoUrl())) { links.add(new Anchor("Showcase", product.getDemoUrl(), "_blank")); } if (!isNull(product.getDownloadUrl())) { links.add(new Anchor("Download", product.getDownloadUrl(), "_blank")); } if (!isNull(product.getWikiUrl())) { links.add(new Anchor("Wiki", product.getWikiUrl(), "_blank")); } if (!isNull(product.getForumUrl())) { links.add(new Anchor("Forum", product.getForumUrl(), "_blank")); } if (!isNull(product.getIssueTrackerUrl())) { links.add(new Anchor("Issue Tracker", product.getIssueTrackerUrl(), "_blank")); } UserInfo userInfo = Session.get().getLoggedInUser(); if (null != userInfo && userInfo.getId().equals(product.getUserId())) { links.add(new HTML("<br/>")); links.add(new Hyperlink("Edit settings", Pages.get().createHistoryToken(PageLoader.PAGE_EDIT_PRODUCT, product.getAlias()))); } description.setInnerHTML(product.getDescription()); tags.setInnerHTML(createTagHtml(product.getTags())); category.setInnerText(product.getCategoryName()); versionNumber.setInnerText(product.getVersionNumber()); organization.setInnerText(product.getOrganizationName()); createdDate.setInnerText(dateFormat.format(product.getCreatedDate())); lastUpdatedDate.setInnerText(dateFormat.format(product.getUpdatedDate())); if (null == product.getIconKey()) { icon.setSrc("images/noicon.gif"); icon.getStyle().setDisplay(Display.NONE); } else { icon.setSrc("gwt_marketplace/productImage?key=" + product.getId() + "&ik=" + product.getIconKey()); icon.getStyle().setDisplay(Display.BLOCK); } if (null != product.getRating()) { ratingContainer.getElement().setInnerText(ratingFormat.format(product.getRating()) + " of 5"); } else { ratingContainer.getElement().setInnerText(""); } developmentStatus.setInnerText(Status.getDisplayValue(product.getStatus())); license.setInnerHTML(License.getDisplayValue(product.getLicense())); views.setInnerText(product.getNumDailyViews() + " / " + product.getNumMonthlyViews()); if (null == _previous || !_previous.equals(product)) { newsfeed.clear(); if (null != product.getNewsUrl() && product.getNewsUrl().length() > 0) { newsfeedContainer.setVisible(true); Feed f = new Feed(); f.getFeed(product.getNewsUrl(), this); } else { newsfeedContainer.setVisible(false); } } } }
From source file:hudson.gwtmarketplace.client.pages.product.ProductSectionEntry.java
License:Open Source License
public ProductSectionEntry(Product product, int type, int index) { HorizontalPanel panel = uiBinder.createAndBindUi(this); if (index % 2 == 0) panel.addStyleName("feed feed-even"); else/*from w w w.ja v a2 s . c om*/ panel.addStyleName("feed feed-odd"); initWidget(panel); panel.setCellHorizontalAlignment(panel.getWidget(1), HorizontalPanel.ALIGN_RIGHT); productLink.setText(product.getName()); productLink.setTargetHistoryToken(Pages.get().createHistoryToken(product.getAlias())); if (type == TYPE_UPDATE_AGE) custom.add(new Label(dateFormat.format(product.getUpdatedDate()))); else if (type == TYPE_RATING) custom.add( new Label(numberFormat.format(product.getRating()) + " (" + product.getTotalRatings() + ")")); else if (type == TYPE_ACTIVE_VIEWS) custom.add(new Label(Integer.toString(product.getNumDailyViews()))); }
From source file:hudson.gwtmarketplace.client.pages.product.ViewProductPage.java
License:Open Source License
@Override protected void onConstruct(FlowPanel view) { tabs.add(this.productDetails = new ProductDetailsPanel() { protected void onRateIt() { tabs.selectTab(1);/*w w w .j av a 2 s . c o m*/ }; }, "Details", false); tabs.add(this.productComments = new ProductCommentsPanel(), "Comments", false); tabs.addSelectionHandler(this); tabs.selectTab(0); Pages.get().getEventBus().addHandler(ProductCommentEvent.TYPE, this); }