public PreloaderCallback getPreloaderCallback () { final Panel preloaderPanel = new VerticalPanel(); preloaderPanel.setStyleName("gdx-preloader"); final Image logo = new Image(GWT.getModuleBaseURL() + "logo.png"); logo.setStyleName("logo"); preloaderPanel.add(logo); final Panel meterPanel = new SimplePanel(); meterPanel.setStyleName("gdx-meter"); meterPanel.addStyleName("red"); final InlineHTML meter = new InlineHTML(); final Style meterStyle = meter.getElement().getStyle(); meterStyle.setWidth(0, Unit.PCT); meterPanel.add(meter); preloaderPanel.add(meterPanel); getRootPanel().add(preloaderPanel); return new PreloaderCallback() { @Override public void error (String file) { System.out.println("error: " + file); } @Override public void update (PreloaderState state) { meterStyle.setWidth(100f * state.getProgress(), Unit.PCT); } }; }
/** * Creates an empty HTML widget. */ public InlineHTML() { super(Document.get().createSpanElement()); setStyleName("gwt-InlineHTML"); }
/** * Creates an InlineHTML widget that wraps an existing <div> or * <span> element. * * This element must already be attached to the document. If the element is * removed from the document, you must call * {@link RootPanel#detachNow(Widget)}. * * @param element the element to be wrapped */ public static InlineHTML wrap(Element element) { // Assert that the element is attached. assert Document.get().getBody().isOrHasChild(element); InlineHTML html = new InlineHTML(element); // Mark it attached and remember it for cleanup. html.onAttach(); RootPanel.detachOnWindowClose(html); return html; }
/** * Creates an HTML widget with the specified HTML contents and with a default * direction estimator. * * @param html the new widget's SafeHtml contents * @param directionEstimator A DirectionEstimator object used for automatic * direction adjustment. For convenience, * {@link Label#DEFAULT_DIRECTION_ESTIMATOR} can be used. */ public InlineHTML(SafeHtml html, DirectionEstimator directionEstimator) { this(); setDirectionEstimator(directionEstimator); setHTML(html); }
@AssistedInject public MessageDialogPresenter( @NotNull MessageDialogView view, @NotNull @Assisted String title, @NotNull @Assisted IsWidget content, @Nullable @Assisted ConfirmCallback confirmCallback) { this(view, title, content, confirmCallback, null); }
public SystemMenu(AppCache appCache) { MenuItem versionItem = new MenuItem(); versionItem.setText(I18N.CONSTANTS.appVersion() + " " + appCache.getCurrentVersion()); versionItem.setHideOnClick(false); appCacheStatusItem = new MenuItem(); appCacheStatusItem.addSelectionHandler(this::loadUpdatedAppCache); MenuItem logoutItem = new MenuItem(); logoutItem.setText(I18N.CONSTANTS.logout()); logoutItem.addSelectionHandler(this::logout); Menu menu = new Menu(); menu.add(versionItem); menu.add(appCacheStatusItem); menu.add(new SeparatorMenuItem()); menu.add(logoutItem); icon = new InlineHTML(ChromeBundle.BUNDLE.settingsIcon().getText()); icon.addStyleName(ChromeBundle.BUNDLE.style().appBarButton()); icon.addClickHandler(event -> menu.show(icon.getElement(), new Style.AnchorAlignment(Style.Anchor.TOP, Style.Anchor.BOTTOM))); icon.addClickHandler(event -> appCache.checkForUpdates()); appCache.getStatus().subscribe(this::updateAppCacheView); }
public OfflineMenu(HttpBus bus, OfflineStore offlineStore) { this.offlineStore = offlineStore; pendingChangesItem = new MenuItem(); pendingChangesItem.setHideOnClick(false); syncNowItem = new MenuItem(I18N.CONSTANTS.syncNow()); syncNowItem.addSelectionHandler(event -> offlineStore.syncChanges()); clearMenuItem = new MenuItem(I18N.CONSTANTS.clearOfflineMode()); clearMenuItem.addSelectionHandler(this::confirmOfflineDelete); Menu menu = new Menu(); menu.add(pendingChangesItem); menu.add(new SeparatorMenuItem()); menu.add(syncNowItem); menu.add(new SeparatorMenuItem()); menu.add(clearMenuItem); icon = new InlineHTML(ChromeBundle.BUNDLE.offlineIcon().getText()); icon.addStyleName(ChromeBundle.BUNDLE.style().appBarButton()); icon.setVisible(false); icon.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { menu.show(icon.getElement(), new Style.AnchorAlignment(Style.Anchor.TOP, Style.Anchor.BOTTOM)); } }); offlineStore.getOfflineForms().subscribe(this::onOfflineFormSetChanged); offlineStore.getStatus().subscribe(this::onStatusChanged); }
@Override public InlineHTML createWidget() { InlineHTML inlineHTML = GWT.create(InlineHTML.class); inlineHTML.addClickHandler(this); inlineHTML.setStyleName("v-link"); return inlineHTML; }
/** * Creates an HTML widget with the specified HTML contents and with the * specified direction. * * @param html the new widget's HTML contents * @param dir the content's direction. Note: {@code Direction.DEFAULT} means * direction should be inherited from the widget's parent element. */ public InlineHTML(@IsSafeHtml String html, Direction dir) { this(); setHTML(html, dir); }
private void toggleClass(String className, boolean add) { if(add) { icon.getElement().addClassName(className); } else { icon.getElement().removeClassName(className); } }
@AssistedInject public ChoiceDialogPresenter( final @NotNull ChoiceDialogView view, final @NotNull @Assisted("title") String title, final @NotNull @Assisted("message") String message, final @NotNull @Assisted("firstChoice") String firstChoiceLabel, final @NotNull @Assisted("secondChoice") String secondChoiceLabel, final @Nullable @Assisted("firstCallback") ConfirmCallback firstChoiceCallback, final @Nullable @Assisted("secondCallback") ConfirmCallback secondChoiceCallback) { this( view, title, new InlineHTML(sanitizeHtml(message)), firstChoiceLabel, secondChoiceLabel, "", firstChoiceCallback, secondChoiceCallback, null); }
/** * Creates an HTML widget with the specified HTML contents and with a default * direction estimator. * * @param html the new widget's SafeHtml contents * @param directionEstimator A DirectionEstimator object used for automatic * direction adjustment. For convenience, * {@link Label#DEFAULT_DIRECTION_ESTIMATOR} can be used. */ public InlineHTML(SafeHtml html, DirectionEstimator directionEstimator) { this(); setDirectionEstimator(directionEstimator); setHTML(html); }
/** * Creates an HTML widget with the specified HTML contents. * * @param html the new widget's HTML contents */ public InlineHTML(@IsSafeHtml String html) { this(); setHTML(html); }
@Override public void onClick(ClickEvent event) { menu.show(icon.getElement(), new Style.AnchorAlignment(Style.Anchor.TOP, Style.Anchor.BOTTOM)); } });
@AssistedInject public ConfirmDialogPresenter( final @NotNull ConfirmDialogView view, final @NotNull @Assisted("title") String title, final @NotNull @Assisted("message") String message, final @Nullable @Assisted("okButtonLabel") String okButtonLabel, final @Nullable @Assisted("cancelButtonLabel") String cancelButtonLabel, final @Nullable @Assisted ConfirmCallback confirmCallback, final @Nullable @Assisted CancelCallback cancelCallback) { this(view, title, new InlineHTML(sanitizeHtml(message)), confirmCallback, cancelCallback); view.setOkButtonLabel(okButtonLabel); view.setCancelButtonLabel(cancelButtonLabel); }
public PreloaderCallback getPreloaderCallback () { final Panel preloaderPanel = new VerticalPanel(); preloaderPanel.setStyleName("gdx-preloader"); final Image logo = new Image(GWT.getModuleBaseURL() + "logo.png"); logo.setStyleName("logo"); preloaderPanel.add(logo); final Panel meterPanel = new SimplePanel(); meterPanel.setStyleName("gdx-meter"); meterPanel.addStyleName("red"); final InlineHTML meter = new InlineHTML(); final Style meterStyle = meter.getElement().getStyle(); meterStyle.setWidth(0, Unit.PCT); meterPanel.add(meter); preloaderPanel.add(meterPanel); getRootPanel().add(preloaderPanel); return new PreloaderCallback() { @Override public void error (String file) { System.out.println("error: " + file); } @Override public void update (PreloaderState state) { meterStyle.setWidth(100f * state.getProgress(), Unit.PCT); } }; }
/** * Creates an InlineHTML widget that wraps an existing <div> or * <span> element. * * This element must already be attached to the document. If the element is * removed from the document, you must call * {@link RootPanel#detachNow(Widget)}. * * @param element the element to be wrapped */ public static InlineHTML wrap(Element element) { // Assert that the element is attached. assert Document.get().getBody().isOrHasChild(element); InlineHTML html = new InlineHTML(element); // Mark it attached and remember it for cleanup. html.onAttach(); RootPanel.detachOnWindowClose(html); return html; }
/** * Creates an HTML widget with the specified HTML contents and with a default * direction estimator. * * @param html the new widget's SafeHtml contents * @param directionEstimator A DirectionEstimator object used for automatic * direction adjustment. For convenience, * {@link Label#DEFAULT_DIRECTION_ESTIMATOR} can be used. */ public InlineHTML(SafeHtml html, DirectionEstimator directionEstimator) { this(); setDirectionEstimator(directionEstimator); setHTML(html); }
/** * Creates an HTML widget with the specified HTML contents. * * @param html the new widget's HTML contents */ public InlineHTML(String html) { this(); setHTML(html); }
/** * Creates an empty HTML widget. */ public InlineHTML() { super(Document.get().createSpanElement()); setStyleName("gwt-InlineHTML"); }