List of usage examples for com.google.gwt.user.client DOM getElementById
public static Element getElementById(String id)
From source file:bz.davide.dmweb.shared.view.AbstractHtmlElementView.java
License:Open Source License
@Override public Element getElement() { if (!clientSide) { throw new IllegalStateException("Element can be requested only on client not on server"); }/*from w w w . j a va 2 s .co m*/ if (this.clientSideElement__ == null && this.id != null) { this.clientSideElement__ = DOM.getElementById(this.id); } return this.clientSideElement__; }
From source file:bz.davide.dmweb.shared.view.AbstractHtmlElementView.java
License:Open Source License
boolean isAttacchedToDOM() { if (!clientSide) { throw new IllegalStateException("Only callable client side!"); }//from ww w .ja v a 2 s.c o m Element elem = DOM.getElementById(this.id); if (elem != null) // isAttached! { // Replace the current element with this new! In this case the parent node is updated // even in case was attached not using gwt this.clientSideElement__ = elem; return true; } return false; }
From source file:cc.kune.common.client.notify.UserNotifierGrowl.java
License:GNU Affero Public License
/** * Instantiates a new user notifier growl. * * @param eventBus//w w w .j a v a 2s .c o m * the event bus */ @Inject public UserNotifierGrowl(final EventBus eventBus) { eventBus.addHandler(UserNotifyEvent.getType(), new UserNotifyEvent.UserNotifyHandler() { @Override public void onUserNotify(final UserNotifyEvent event) { final GrowlOptions options = GrowlHelper.getNewOptions(); final GrowlPosition position = GrowlHelper.getNewPosition(); position.setCenter(); position.setTop(false); options.setGrowlPosition(position); String id = event.getId(); boolean hasId = TextUtils.notEmpty(id); if (hasId && DOM.getElementById(id) != null) { // this notification is already present so, don't do nothing return; } final GrowlTemplate gt = GrowlHelper.getNewTemplate(); // As a workaround, we set the id in the <br> gt.setTitleDivider(hasId ? "<br id=\"" + id + "\">" : "<br>"); options.setTemplateObject(gt); final Boolean closeable = event.getCloseable(); if (closeable) { options.setDelay(0); } options.setAllowDismiss(closeable); options.setPauseOnMouseOver(true); final String message = event.getMessage(); String icon = ""; final String iconStyleBase = Styles.FONT_AWESOME_BASE + SEPARATOR + IconSize.TIMES2.getCssName() + " growl-icon-margin "; final NotifyLevel level = event.getLevel(); switch (level) { case error: options.setDangerType(); icon = iconStyleBase + IconType.EXCLAMATION_CIRCLE.getCssName(); break; case avatar: final ClickHandler clickHandler = event.getClickHandler(); final Container container = new Container(); container.setFluid(true); final Image avatar = new Image(event.getLevel().getUrl()); avatar.setSize(AVATAR_SIZE, AVATAR_SIZE); avatar.addStyleName("k-fl"); avatar.addStyleName("growl-icon-margin"); container.add(avatar); container.add(new HTML(message)); container.addDomHandler(clickHandler, ClickEvent.getType()); Growl.growl(container.getElement().getInnerHTML(), options); return; case veryImportant: case important: options.setWarningType(); icon = iconStyleBase + IconType.WARNING.getCssName(); break; case success: options.setSuccessType(); icon = iconStyleBase + IconType.CHECK_CIRCLE.getCssName(); break; case info: options.setInfoType(); icon = iconStyleBase + IconType.INFO_CIRCLE.getCssName(); break; case log: // Do nothing with this level return; default: break; } Growl.growl(event.getTitle(), message, icon, options); } }); }
From source file:cc.kune.common.client.ui.WrappedFlowPanel.java
License:GNU Affero Public License
public static WrappedFlowPanel wrap(final String id) { final Element element = DOM.getElementById(id); if (element == null) { throw new UIException("Errow wrapping id " + id); }/*from ww w .j a v a 2 s. co m*/ return wrap(element); }
From source file:cc.kune.core.client.auth.LoginRememberManagerImpl.java
License:GNU Affero Public License
@Override public void setNickOrEmail(final String username) { DOM.getElementById(USERNAME).setAttribute(VALUE, username); }
From source file:cc.kune.core.client.auth.LoginRememberManagerImpl.java
License:GNU Affero Public License
@Override public void setPassword(final String password) { DOM.getElementById(PASSWORD).setAttribute(VALUE, password); }
From source file:cc.kune.core.client.sitebar.search.SitebarSearchPanel.java
License:GNU Affero Public License
/** * Instantiates a new sitebar search panel. * * @param gs/*from ww w . jav a 2 s.c om*/ * the gs * @param img * the img * @param session * the session * @param stateManager * the state manager * @param i18n * the i18n */ @Inject public SitebarSearchPanel(final CoreResources img, final SessionConstants session, final StateManager stateManager, final I18nTranslationService i18n, final GSpaceArmor armor) { searchButton = PaperIconButton.wrap(PolymerId.SITEBAR_SEARCH_ICON.getId()); // We remove the previous search input DOM.getElementById(INPUT_ID).removeFromParent(); ; final MultivalueSuggestBox multivalueSBox = SearchBoxFactory.create(i18n, false, true, SITE_SEARCH_TEXTBOX, new OnEntitySelectedInSearch() { @Override public void onSeleted(final String shortName) { stateManager.gotoHistoryToken(shortName); } }); suggestBox = multivalueSBox.getSuggestBox(); searchTextBox = suggestBox.getTextBox(); searchTextBox.addStyleName("sitebar_search_hide"); final WrappedFlowPanel searchDiv = armor.wrapDiv(PolymerId.SITEBAR_SEARCH_GROUP); searchDiv.add(multivalueSBox); }
From source file:cc.kune.gspace.client.armor.GSpaceArmorPolymer.java
License:GNU Affero Public License
private static Element getElementById(final String id) { return DOM.getElementById(id); }
From source file:cc.kune.polymer.client.actions.ui.PoToolbarGui.java
License:GNU Affero Public License
@Override public AbstractGuiItem create(final GuiActionDescrip descriptor) { super.descriptor = descriptor; final String id = descriptor.getId(); if ("undefined".equals(id) || TextUtils.empty(id)) { shouldBeAdded = true;/* w ww. j ava 2 s . co m*/ toolbar = new HTMLPanel(""); toolbar.getElement().setAttribute("horizontal", ""); toolbar.getElement().setAttribute("layout", ""); } else { // Already created (polymer) element shouldBeAdded = false; toolbar = HTMLPanel.wrap(DOM.getElementById(id)); } initWidget(toolbar); configureItemFromProperties(); descriptor.putValue(ParentWidget.PARENT_UI, this); return this; }
From source file:cc.kune.sandbox.client.KuneSandboxEntryPoint.java
License:GNU Affero Public License
public void onModuleLoadPolymer() { initializeInjector();//from ww w . j a v a 2 s . c o m NotifyUser.info("Started"); final WrappedFlowPanel docContent = WrappedFlowPanel.wrap("doc_content"); final CustomButton btn = new CustomButton("Sign in"); btn.setIcon(KuneIcon.KUNE); btn.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { NotifyUser.info("Tested"); } }); docContent.insert(btn, 0); final PaperFab fab = PaperFab.wrap(DOM.getElementById("edit_fab")); fab.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { NotifyUser.success("New message"); } }); final Badge inboxBadge = new Badge(); final Badge chatsBadge = new Badge(); inboxBadge.setText("99"); chatsBadge.setText("9"); // PolymerUtils.wrap(PolymerId.CHAT_SITEBAR_ICON_GROUP).add(inboxBadge); // PolymerUtils.wrapDiv("sitebar_chat_icon_group").add(chatsBadge); inboxBadge.addStyleName("btn_green"); chatsBadge.addStyleName("btn_green"); inboxBadge.addStyleName("sitebar_inbox_badge"); chatsBadge.addStyleName("sitebar_chats_badge"); NotifyUser.hideProgress(); }