com.google.gwt.user.client.ui.HTMLPanel Java Examples

The following examples show how to use com.google.gwt.user.client.ui.HTMLPanel. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Console.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
public void onFailure(BootstrapContext context) {
    LoadingPanel.get().off();

    String cause = "";
    int status = 500;
    if (context.getLastError() != null) {
        cause = context.getLastError().getMessage();
        if (context.getLastError() instanceof DispatchError) {
            status = ((DispatchError) context.getLastError()).getStatusCode();
        }
    }
    if (403 == status) {
        // authorisation error (lack of privileges)
        new InsufficientPrivileges(context.isSsoEnabled()).execute();
    } else {
        // unknown error
        HTMLPanel explanation = new HTMLPanel("<div style='padding-top:150px;padding-left:120px;'><h2>" + CONSTANTS
                .unableToLoadConsole() + "</h2><pre>" + cause + "</pre></div>");
        RootLayoutPanel.get().add(explanation);
    }
}
 
Example #2
Source File: ContentBox.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public ContentBox(final String id, final String title, final SafeHtml body, Widget widget) {

        dp = new DisclosurePanel();
        dp.setHeader(new HTML(TEMPLATES.header(IdHelper.asId(id + "_", getClass(), "_" + "header"), title)));
        dp.addOpenHandler(this);
        dp.addCloseHandler(this);
        dp.setOpen(true);

        String linkId = HTMLPanel.createUniqueId();
        HTMLPanel panel = new HTMLPanel(TEMPLATES.body(body, linkId));
        panel.addStyleName("homepage-content-box-body");
        panel.add(widget, linkId);
        dp.add(panel);

        initWidget(dp);
        setStyleName("homepage-content-box");
    }
 
Example #3
Source File: ContentBox.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public ContentBox(final String id, final String title, final SafeHtml body, final String linkTitle,
                  final String linkTarget) {

    dp = new DisclosurePanel();
    dp.setHeader(new HTML(TEMPLATES.header(IdHelper.asId(id + "_", getClass(), "_" + "header"), title)));
    dp.addOpenHandler(this);
    dp.addCloseHandler(this);
    dp.setOpen(true);

    String linkId = IdHelper.asId(id + "_", getClass(), "_" + "link");
    HTMLPanel panel = new HTMLPanel(TEMPLATES.body(body, linkId));
    panel.addStyleName("homepage-content-box-body");
    InlineHyperlink hyperlink = new InlineHyperlink(linkTitle, linkTarget);
    hyperlink.addStyleName("homepage-link");
    panel.add(hyperlink, linkId);
    dp.add(panel);

    initWidget(dp);
    setStyleName("homepage-content-box");
}
 
Example #4
Source File: GwtMockitoWidgetBaseClassesTest.java    From gwtmockito with Apache License 2.0 6 votes vote down vote up
@Test
public void testPanels() throws Exception {
  invokeAllAccessibleMethods(new AbsolutePanel() {});
  invokeAllAccessibleMethods(new CellPanel() {});
  invokeAllAccessibleMethods(new ComplexPanel() {});
  invokeAllAccessibleMethods(new DeckLayoutPanel() {});
  invokeAllAccessibleMethods(new DeckPanel() {});
  invokeAllAccessibleMethods(new DecoratorPanel() {});
  invokeAllAccessibleMethods(new DockLayoutPanel(Unit.PX) {});
  invokeAllAccessibleMethods(new DockPanel() {});
  invokeAllAccessibleMethods(new FlowPanel() {});
  invokeAllAccessibleMethods(new FocusPanel() {});
  invokeAllAccessibleMethods(new HorizontalPanel() {});
  invokeAllAccessibleMethods(new HTMLPanel("") {});
  invokeAllAccessibleMethods(new LayoutPanel() {});
  invokeAllAccessibleMethods(new PopupPanel() {});
  invokeAllAccessibleMethods(new RenderablePanel("") {});
  invokeAllAccessibleMethods(new ResizeLayoutPanel() {});
  invokeAllAccessibleMethods(new SimpleLayoutPanel() {});
  invokeAllAccessibleMethods(new SimplePanel() {});
  invokeAllAccessibleMethods(new SplitLayoutPanel() {});
  invokeAllAccessibleMethods(new StackPanel() {});
  invokeAllAccessibleMethods(new VerticalPanel() {});
}
 
Example #5
Source File: Header.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private Widget getLinksSection() {
    linksPane = new HTMLPanel(createLinks());
    linksPane.getElement().setId("header-links-section");
    linksPane.getElement().setAttribute("role", "menubar");
    linksPane.getElement().setAttribute("aria-controls", "main-content-area");

    for (final ToplevelTabs.Config tlt : toplevelTabs) {
        final String id = "header-" + tlt.getToken();

        SafeHtmlBuilder html = new SafeHtmlBuilder();
        html.appendHtmlConstant("<div class='header-link-label'>");
        html.appendHtmlConstant("<span role='menuitem'>");
        html.appendHtmlConstant(tlt.getTitle());
        html.appendHtmlConstant("</span>");
        html.appendHtmlConstant("</div>");
        HTML widget = new HTML(html.toSafeHtml());
        widget.setStyleName("fill-layout");

        widget.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                // navigate either child directly or parent if revealed the first time
                /*boolean hasChild = perspectiveStore.hasChild(tlt.getToken());
                String token = hasChild ?
                        perspectiveStore.getChild(tlt.getToken()) : tlt.getToken();
                boolean updateToken = hasChild ? true : tlt.isUpdateToken();*/

                String token = tlt.getToken();
                placeManager.revealPlace(
                        new PlaceRequest.Builder().nameToken(token).build(), tlt.isUpdateToken()
                );
            }
        });
        linksPane.add(widget, id);

    }

    return linksPane;
}
 
Example #6
Source File: TwoStepWizard.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public TwoStepWizard(LoggerPresenter presenter, AddressTemplate address, SecurityContext securityContext, ResourceDescription resourceDescription) {

        super(HTMLPanel.createUniqueId(), new HandlerContext());
        this.presenter = presenter;
        this.address = address;
        this.securityContext = securityContext;
        this.resourceDescription = resourceDescription;

        addStep(HandlerSteps.ATTRIBUTES, new CommonAttributesStep(this, "Common Attributes"));
        addStep(HandlerSteps.FILE, new FileAttributeStep(this, "File Attribute"));
    }
 
Example #7
Source File: MaterialInfo.java    From gwt-material with Apache License 2.0 5 votes vote down vote up
public void showInfo(HTMLPanel panel, ImageResource resource, String message) {
    panel.clear();

    HTMLPanel container = new HTMLPanel("");
    container.addStyleName(CssName.MATERIAL_INFO);
    container.add(new Image(resource));
    container.add(new Label(message));
    panel.add(container);
}
 
Example #8
Source File: LayerLegend.java    From geomajas-gwt2-quickstart-application with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Init the layer legend panel.
 */
private void initLayerLegend() {

		HTMLPanel layerPopupPanelWrapper = new HTMLPanel("");

		closeLayerPopupPanelButton.addStyleName(ApplicationResource.INSTANCE.css().closePopupPanelButton());
		closeLayerPopupPanelButton.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				layerLegendPanel.hide();
				ApplicationService.getInstance().setTooltipShowingAllowed(true);
			}
		});

		HTMLPanel closeLayerButtonContainer = new HTMLPanel("");
		closeLayerButtonContainer.addStyleName(ApplicationResource.INSTANCE.css().popupPanelHeader());
		Label layerTitle = new Label(msg.layerLegendPanelTitle());
		closeLayerButtonContainer.add(layerTitle);
		closeLayerButtonContainer.add(closeLayerPopupPanelButton);
		layerPopupPanelWrapper.add(closeLayerButtonContainer);

		HTMLPanel layerPopupPanelContent = new HTMLPanel("");
		layerPopupPanelContent.addStyleName(ApplicationResource.INSTANCE.css().layerPopupPanelContent());

		// Add a generated layers legend.
		layerPopupPanelWrapper.add(
				getLayersLegend(layerPopupPanelContent, mapPresenter.getLayersModel())
		);

		layerLegendPanel.add(layerPopupPanelWrapper);

}
 
Example #9
Source File: InfoPanel.java    From geomajas-gwt2-quickstart-application with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Init the info panel.
 */
private void initInfoPanel() {

	infoPopupPanel.addStyleName(ApplicationResource.INSTANCE.css().infoPopupPanel());

	HTMLPanel infoPopupPanelWrapper = new HTMLPanel("");

	closeInfoPopupPanelButton.addStyleName(ApplicationResource.INSTANCE.css().closePopupPanelButton());
	closeInfoPopupPanelButton.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			infoPopupPanel.hide();
			ApplicationService.getInstance().setTooltipShowingAllowed(true);
		}
	});

	HTMLPanel closeInfoButtonContainer = new HTMLPanel("");
	closeInfoButtonContainer.addStyleName(ApplicationResource.INSTANCE.css().popupPanelHeader());
	Label infoTitle = new Label(msg.infoPanelTitle());
	closeInfoButtonContainer.add(infoTitle);
	closeInfoButtonContainer.add(closeInfoPopupPanelButton);
	infoPopupPanelWrapper.add(closeInfoButtonContainer);

	infoPopupPanelContent = new HTMLPanel("");
	infoPopupPanelContent.addStyleName(ApplicationResource.INSTANCE.css().infoPopupPanelContent());

	ScrollPanel infoPopupPanelScroll = new ScrollPanel();
	infoPopupPanelScroll.addStyleName(ApplicationResource.INSTANCE.css().infoPopupPanelScroll());
	infoPopupPanelScroll.add(infoPopupPanelContent);

	infoPopupPanelWrapper.add(infoPopupPanelScroll);

	infoPopupPanel.add(infoPopupPanelWrapper);

	infoPopupPanel.hide();
}
 
Example #10
Source File: LoadingPanel.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public LoadingPanel() {
    html = new HTMLPanel(TEMPLATE.panel(PANEL_STYLE, IMAGE_STYLE));
}
 
Example #11
Source File: HeaderView.java    From EasyML with Apache License 2.0 4 votes vote down vote up
public HTMLPanel getNavMenu(){
	return navMenu;
}
 
Example #12
Source File: HtmlGenerator.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
HTMLPanel createPanel() {
    return new HTMLPanel(this.toSafeHtml().asString());
}
 
Example #13
Source File: StackedBar.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public Widget asWidget() {

        SafeHtmlBuilder builder = new SafeHtmlBuilder();

        builder.appendHtmlConstant("<div id='"+ outerId +"'><div id='"+innerId+"'/></div>");

        panel = new HTMLPanel(builder.toSafeHtml());

        Element outerElement = panel.getElementById(outerId);
        outerElement.addClassName("stacked-bar-total");
        outerElement.setAttribute("style", "width:100%");
        outerElement.setAttribute("cssText", "width:100%!important");


        Element innerElement = panel.getElementById(innerId);
        innerElement.addClassName("stacked-bar-actual");
        innerElement.setInnerText(label);

        return panel;
    }
 
Example #14
Source File: GwtMockitoTestRunner.java    From gwtmockito with Apache License 2.0 4 votes vote down vote up
/**
 * Returns a collection of classes whose non-abstract methods should always be replaced with
 * no-ops. By default, this list includes {@link Composite}, {@link DOM} {@link UIObject},
 * {@link Widget}, {@link Image}, and most subclasses of {@link Panel}. It will also include any
 * classes specified via the {@link WithClassesToStub} annotation on the test class. This makes
 * it much safer to test code that uses or extends these types.
 * <p>
 * This list can be customized via {@link WithClassesToStub} or by defining a new test runner
 * extending {@link GwtMockitoTestRunner} and overriding this method. This allows users to
 * explicitly stub out particular classes that are causing problems in tests. If you override this
 * method, you will probably want to retain the classes that are stubbed here by doing something
 * like this:
 *
 * <pre>
 * &#064;Override
 * protected Collection&lt;Class&lt;?&gt;&gt; getClassesToStub() {
 *   Collection&lt;Class&lt;?&gt;&gt; classes = super.getClassesToStub();
 *   classes.add(MyBaseWidget.class);
 *   return classes;
 * }
 * </pre>
 *
 * @return a collection of classes whose methods should be stubbed with no-ops while running tests
 */
protected Collection<Class<?>> getClassesToStub() {
  Collection<Class<?>> classes = new LinkedList<Class<?>>();
  classes.add(Composite.class);
  classes.add(DOM.class);
  classes.add(UIObject.class);
  classes.add(Widget.class);

  classes.add(DataGrid.class);
  classes.add(HTMLTable.class);
  classes.add(Image.class);

  classes.add(AbsolutePanel.class);
  classes.add(CellList.class);
  classes.add(CellPanel.class);
  classes.add(CellTable.class);
  classes.add(ComplexPanel.class);
  classes.add(DeckLayoutPanel.class);
  classes.add(DeckPanel.class);
  classes.add(DecoratorPanel.class);
  classes.add(DockLayoutPanel.class);
  classes.add(DockPanel.class);
  classes.add(FlowPanel.class);
  classes.add(FocusPanel.class);
  classes.add(HorizontalPanel.class);
  classes.add(HTMLPanel.class);
  classes.add(LayoutPanel.class);
  classes.add(Panel.class);
  classes.add(PopupPanel.class);
  classes.add(RenderablePanel.class);
  classes.add(ResizeLayoutPanel.class);
  classes.add(SimpleLayoutPanel.class);
  classes.add(SimplePanel.class);
  classes.add(SplitLayoutPanel.class);
  classes.add(StackPanel.class);
  classes.add(VerticalPanel.class);
  classes.add(ValueListBox.class);

  WithClassesToStub annotation = unitTestClass.getAnnotation(WithClassesToStub.class);
  if (annotation != null) {
    classes.addAll(Arrays.asList(annotation.value()));
  }

  return classes;
}
 
Example #15
Source File: StatDialog.java    From incubator-retired-wave with Apache License 2.0 4 votes vote down vote up
public StatDialog() {
  PopupChrome chrome = PopupChromeFactory.createPopupChrome();
  popup = PopupFactory.createPopup(
      Document.get().getElementById("app"), new CenterPopupPositioner(), chrome, true);
  htmlPanel = new HTMLPanel("");
  htmlPanel.addDomHandler(new ClickHandler(){

    @Override
    public void onClick(ClickEvent event) {
      Element e = event.getNativeEvent().getEventTarget().cast();
      if (e.getTagName().toLowerCase().equals("a")) {
        event.preventDefault();
        if (isClient) {
          if (ID_ENABLE.equals(e.getId()) || ID_DISABLE.equals(e.getId())) {
            Timing.setEnabled(!Timing.isEnabled());
            showClientStatistic();
          } else if (ID_CLEAR.equals(e.getId())) {
            Timing.clearStatistics();
            showClientStatistic();
          }
        } else {
          String href = e.getPropertyString("href");
          int index = href.lastIndexOf('/');
          if (index != -1) {
            showUrl(StatService.STAT_URL + href.substring(index+1));
          }
        }
      }
    }
  }, ClickEvent.getType());

  ScrollPanel scroll = new ScrollPanel(htmlPanel);
  scroll.setSize(RootPanel.get().getOffsetWidth()-100 + "px",
          RootPanel.get().getOffsetHeight()-200 + "px");
  targetButton = new DialogBox.DialogButton("", new Command() {

    @Override
    public void execute() {
      if (isClient) {
        showServerStatistic();
      } else {
        showClientStatistic();
      }
    }
  });
  exitButton = new DialogBox.DialogButton("Exit", new Command() {

    @Override
    public void execute() {
      popup.hide();
    }
  });
  DialogBox.create(popup, "", scroll,
      new DialogBox.DialogButton[] { targetButton, exitButton });
}
 
Example #16
Source File: MetricView.java    From dashbuilder with Apache License 2.0 4 votes vote down vote up
@Override
public void setHtml(String html) {
    htmlPanel = new HTMLPanel(html);
    container.clear();
    container.add(htmlPanel);
}
 
Example #17
Source File: StatDialog.java    From swellrt with Apache License 2.0 4 votes vote down vote up
public StatDialog() {
  PopupChrome chrome = PopupChromeFactory.createPopupChrome();
  popup = PopupFactory.createPopup(
      Document.get().getElementById("app"), new CenterPopupPositioner(), chrome, true);
  htmlPanel = new HTMLPanel("");
  htmlPanel.addDomHandler(new ClickHandler(){

    @Override
    public void onClick(ClickEvent event) {
      Element e = event.getNativeEvent().getEventTarget().cast();
      if (e.getTagName().toLowerCase().equals("a")) {
        event.preventDefault();
        if (isClient) {
          if (ID_ENABLE.equals(e.getId()) || ID_DISABLE.equals(e.getId())) {
            Timing.setEnabled(!Timing.isEnabled());
            showClientStatistic();
          } else if (ID_CLEAR.equals(e.getId())) {
            Timing.clearStatistics();
            showClientStatistic();
          }
        } else {
          String href = e.getPropertyString("href");
          int index = href.lastIndexOf('/');
          if (index != -1) {
            showUrl(StatService.STAT_URL + href.substring(index+1));
          }
        }
      }
    }
  }, ClickEvent.getType());

  ScrollPanel scroll = new ScrollPanel(htmlPanel);
  scroll.setSize(RootPanel.get().getOffsetWidth()-100 + "px",
          RootPanel.get().getOffsetHeight()-200 + "px");
  targetButton = new DialogBox.DialogButton("", new Command() {

    @Override
    public void execute() {
      if (isClient) {
        showServerStatistic();
      } else {
        showClientStatistic();
      }
    }
  });
  exitButton = new DialogBox.DialogButton("Exit", new Command() {

    @Override
    public void execute() {
      popup.hide();
    }
  });
  DialogBox.create(popup, "", scroll,
      new DialogBox.DialogButton[] { targetButton, exitButton });
}
 
Example #18
Source File: AdminView.java    From EasyML with Apache License 2.0 4 votes vote down vote up
public HTMLPanel getAdminPanel(){
	return content;
}
 
Example #19
Source File: AdminView.java    From EasyML with Apache License 2.0 4 votes vote down vote up
public HTMLPanel getCatePage(){
	return catePage;
}
 
Example #20
Source File: AdminView.java    From EasyML with Apache License 2.0 4 votes vote down vote up
public HTMLPanel getCateContent(){
	return cateContent;
}
 
Example #21
Source File: AdminView.java    From EasyML with Apache License 2.0 4 votes vote down vote up
public HTMLPanel getUserPage(){
	return userPage;
}
 
Example #22
Source File: AdminView.java    From EasyML with Apache License 2.0 4 votes vote down vote up
public HTMLPanel getUserContent(){
	return userContent;
}
 
Example #23
Source File: AdminView.java    From EasyML with Apache License 2.0 4 votes vote down vote up
public HTMLPanel getDataPage(){
	return dataPage;
}
 
Example #24
Source File: AdminView.java    From EasyML with Apache License 2.0 4 votes vote down vote up
public HTMLPanel getDataContent(){
	return dataContent;
}
 
Example #25
Source File: AdminView.java    From EasyML with Apache License 2.0 4 votes vote down vote up
public HTMLPanel getProgPage(){
	return progPage;
}
 
Example #26
Source File: AdminView.java    From EasyML with Apache License 2.0 4 votes vote down vote up
public HTMLPanel getProgContent(){
	return progContent;
}
 
Example #27
Source File: LayerLegend.java    From geomajas-gwt2-quickstart-application with GNU Affero General Public License v3.0 2 votes vote down vote up
/**
 * Add the content tp the popup panel.
 * @param wrapper HTMLPanel
 */
public void add(HTMLPanel wrapper) {
	layerLegendPanel.add(wrapper);
}
 
Example #28
Source File: InfoPanel.java    From geomajas-gwt2-quickstart-application with GNU Affero General Public License v3.0 2 votes vote down vote up
/**
 * Add the content tp the popup panel.
 * @param wrapper HTMLPanel
 */
public void add(HTMLPanel wrapper) {
	infoPopupPanel.add(wrapper);
}