Example usage for com.google.gwt.user.client.ui HTMLPanel HTMLPanel

List of usage examples for com.google.gwt.user.client.ui HTMLPanel HTMLPanel

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui HTMLPanel HTMLPanel.

Prototype

private HTMLPanel(Element elem) 

Source Link

Document

Construct a new HTMLPanel with the specified element.

Usage

From source file:org.gems.ajax.client.figures.TemplatePanel.java

License:Open Source License

protected void createHTMLPanel() {
    body_ = new HTMLPanel(template_.getHtml());
    ((AbsolutePanel) getBodyPanel()).add(body_);
}

From source file:org.geomajas.codemirror.client.ExampleEntryPoint.java

License:Open Source License

public void onModuleLoad() {
    // -- show some background
    String contents = "<div style='margin-left: 5px; font-size: 100pt; font-weight: bold; color:#DDFFDD'>GEOMAJAS</div>"
            + "<div style='margin-left: 10px; margin-top:-70px; font-size: 50pt; color:#CCCCCC'>Codemirror</div>"
            + "<div style='margin-left: 10px; margin-top:-15px; font-size: 28pt; color:#DDDDDD'>GWT wrapper</div>";
    HTMLPanel html = new HTMLPanel(contents);
    html.setSize("100%", "100%");

    RootLayoutPanel.get().add(html);//  w  ww  . j  a v  a  2s .c  o m

    // -- show a codemirror panel
    String initialContent = "<html>\n\t<head>\n\t\t<title>Geomajas GWT Codemirror wrapper sample</title>\n\t</head>\n"
            + "\n\t<body>\n\t\tRead more here: <a href=\"http://www.geomajas.org/documentation/main\">"
            + "Geomajas</a><br />\n\t\tand here: <a href=\"http://codemirror.net/\">CodeMirror</a><br />\n\t"
            + "</body>\n</html>";

    final PopupPanel popup = new PopupPanel(false);
    popup.setSize("800px", "450px");
    popup.setWidget(new CodeMirrorPanel(initialContent));
    popup.center();
}

From source file:org.geomajas.javascript.gwt2.impl.client.map.JsMarkerImpl.java

License:Open Source License

/**
 * Create a new transformable marker widget.
 *
 * @param element dom element object./* w  w  w . j a v a 2 s. com*/
 * @param anchorX The x-coordinate of the anchor of the marker.
 * @param anchorY The y-coordinate of the anchor of the marker.
 * @return A new marker widget.
 */
@ExportConstructor
public static JsMarkerImpl constructor(Element element, int anchorX, int anchorY) {
    JsMarkerImpl marker = new JsMarkerImpl(new HTMLPanel(element.getString()), anchorX, anchorY);
    return marker;
}

From source file:org.geomajas.plugin.printing.client.widget.PrintPreferencesCanvas.java

License:Open Source License

protected void print() {
    startProgress();// w  w  w.j a va  2 s.  c  o m
    PrintGetTemplateRequest request = new PrintGetTemplateRequest();
    imageUrlService.makeRasterizable(mapWidget);
    DefaultTemplateBuilder builder = new DefaultTemplateBuilder();
    builder.setApplicationId(mapWidget.getApplicationId());
    builder.setMapModel(mapWidget.getMapModel());
    builder.setMarginX((int) PrintingLayout.templateMarginX);
    builder.setMarginY((int) PrintingLayout.templateMarginY);
    PageSize size = PageSize.getByName((String) sizeItem.getValue());
    if (LANDSCAPE.equals(orientationGroup.getValue())) {
        builder.setPageHeight(size.getWidth());
        builder.setPageWidth(size.getHeight());
    } else {
        builder.setPageHeight(size.getHeight());
        builder.setPageWidth(size.getWidth());
    }
    builder.setTitleText((String) titleItem.getValue());
    builder.setWithArrow((Boolean) arrowCheckbox.getValue());
    builder.setWithScaleBar((Boolean) scaleBarCheckbox.getValue());
    builder.setRasterDpi((Integer) rasterDpiSlider.getValue());
    PrintTemplateInfo template = builder.buildTemplate();
    request.setTemplate(template);
    final GwtCommand command = new GwtCommand(PrintGetTemplateRequest.COMMAND);
    command.setCommandRequest(request);
    GwtCommandDispatcher.getInstance().execute(command,
            new AbstractCommandCallback<PrintGetTemplateResponse>() {

                public void execute(PrintGetTemplateResponse response) {
                    stopProgress();
                    UrlBuilder url = new UrlBuilder(GWT.getHostPageBaseURL());
                    url.addPath(URL_PATH);
                    url.addParameter(URL_DOCUMENT_ID, response.getDocumentId());
                    url.addParameter(URL_NAME, (String) fileNameItem.getValue());
                    url.addParameter(URL_TOKEN, command.getUserToken());
                    if (SAVE.equals(downloadTypeGroup.getValue())) {
                        url.addParameter(URL_DOWNLOAD, URL_DOWNLOAD_YES);
                        String encodedUrl = url.toString();
                        // create a hidden iframe to avoid popups ???
                        HTMLPanel hiddenFrame = new HTMLPanel("<iframe src='" + encodedUrl
                                + "'+style='position:absolute;width:0;height:0;border:0'>");
                        hiddenFrame.setVisible(false);
                        addChild(hiddenFrame);
                    } else {
                        url.addParameter(URL_DOWNLOAD, URL_DOWNLOAD_NO);
                        String encodedUrl = url.toString();
                        com.google.gwt.user.client.Window.open(encodedUrl, "_blank", null);
                    }
                }
            });
}

From source file:org.geomajas.quickstart.gwt2.client.widget.info.InfoPanel.java

License:Open Source License

/**
 * Init the info panel.//from w ww . jav  a  2  s .co  m
 */
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();
}

From source file:org.geomajas.quickstart.gwt2.client.widget.layer.LayerLegend.java

License:Open Source License

/**
 * Get a fully build layer legend for a LayersModel.
 *
 * @param layerPopupPanelContent Original HTMLPanel
 * @param layersModel LayersModel of the map
 * @return HTMLPanel fully build legend.
 *///from   ww w .  ja  v a 2  s.  co m
private HTMLPanel getLayersLegend(HTMLPanel layerPopupPanelContent, LayersModel layersModel) {

    for (int i = 0; i < mapPresenter.getLayersModel().getLayerCount(); i++) {

        HTMLPanel layer = new HTMLPanel("");
        CheckBox visible = new CheckBox();

        final int finalI = i;
        visible.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                if (mapPresenter.getLayersModel().getLayer(finalI).isMarkedAsVisible()) {
                    mapPresenter.getLayersModel().getLayer(finalI).setMarkedAsVisible(false);
                } else {
                    mapPresenter.getLayersModel().getLayer(finalI).setMarkedAsVisible(true);
                }
            }
        });

        if (mapPresenter.getLayersModel().getLayer(i).isMarkedAsVisible()) {
            visible.setValue(true);
        }

        InlineLabel layerName = new InlineLabel(mapPresenter.getLayersModel().getLayer(i).getTitle());

        layer.add(visible);
        layer.add(layerName);

        layerPopupPanelContent.add(layer);

        ////////////////////////////////
        // Add legend items
        ////////////////////////////////

        Layer legendLayer = mapPresenter.getLayersModel().getLayer(i);

        if (legendLayer instanceof VectorServerLayerImpl) {
            VectorServerLayerImpl serverLayer = (VectorServerLayerImpl) legendLayer;
            String legendUrl = GeomajasServerExtension.getInstance().getEndPointService().getLegendServiceUrl();

            NamedStyleInfo styleInfo = serverLayer.getLayerInfo().getNamedStyleInfo();
            String name = serverLayer.getLayerInfo().getNamedStyleInfo().getName();

            int x = 0;

            for (FeatureTypeStyleInfo sfi : styleInfo.getUserStyle().getFeatureTypeStyleList()) {
                for (RuleInfo rInfo : sfi.getRuleList()) {
                    UrlBuilder url = new UrlBuilder(legendUrl);
                    url.addPath(serverLayer.getServerLayerId());
                    url.addPath(name);
                    url.addPath(x + ".png");
                    x++;

                    HorizontalPanel layout = new HorizontalPanel();
                    layout.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
                    layout.add(new Image(url.toString()));
                    Label labelUi = new Label(rInfo.getName());
                    labelUi.getElement().getStyle().setMarginLeft(5, Style.Unit.PX);
                    layout.add(labelUi);

                    layout.getElement().getStyle().setMarginLeft(20, Style.Unit.PX);
                    layout.getElement().getStyle().setMarginTop(3, Style.Unit.PX);

                    layerPopupPanelContent.add(layout);
                }
            }

        } else if (legendLayer instanceof RasterServerLayerImpl) {
            RasterServerLayerImpl serverLayer = (RasterServerLayerImpl) legendLayer;

            String legendUrl = GeomajasServerExtension.getInstance().getEndPointService().getLegendServiceUrl();
            UrlBuilder url = new UrlBuilder(legendUrl);
            url.addPath(serverLayer.getServerLayerId() + ".png");

            HorizontalPanel layout = new HorizontalPanel();
            layout.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
            layout.add(new Image(url.toString()));
            Label labelUi = new Label("");
            labelUi.getElement().getStyle().setMarginLeft(5, Style.Unit.PX);
            layout.add(labelUi);

            layout.getElement().getStyle().setMarginLeft(20, Style.Unit.PX);
            layout.getElement().getStyle().setMarginTop(3, Style.Unit.PX);

            layerPopupPanelContent.add(layout);
        }

    }

    return layerPopupPanelContent;

}

From source file:org.geomajas.quickstart.gwt2.client.widget.layer.LayerLegend.java

License:Open Source License

/**
 * Init the layer legend panel.//from  w w w  . ja  v a  2  s. c  om
 */
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);

}

From source file:org.geosdi.geoplatform.gui.client.widget.GPMapLiteExportProjectWidget.java

License:Open Source License

@Override
public void addComponent() {
    mapLiteAnchor = new Anchor(MapLiteModuleConstants.INSTANCE.GPMapLiteExportProjectWidget_linkText());
    mapLiteAnchor.addClickHandler(new ClickHandler() {

        @Override/*from   ww  w.jav  a  2 s. c  o  m*/
        public void onClick(ClickEvent event) {
            mapLiteAnchor.setHref(generateMapLiteURL());
        }

    });
    mapLiteAnchor.setTarget("_blank");
    vp = new VerticalPanel();
    vp.setSpacing(5);
    vp.add(mapLiteAnchor);
    sharePanel = new HTMLPanel(
            "<div class=\"share42init\" data-tile=\"Map Lite\" data-url=\"" + generateMapLiteURL() + "\"></div>"
                    + "<script type=\"text/javascript\" src=\"" + shareJSScriptPath + "\"></script>");
    vp.add(sharePanel);
    super.add(vp);
}

From source file:org.geosdi.geoplatform.gui.client.widget.GPMapLiteExportProjectWidget.java

License:Open Source License

@Override
public void show() {
    super.show();
    vp.remove(sharePanel);/*from w  w w.  java2  s.com*/
    sharePanel = new HTMLPanel(
            "<div class=\"share42init\" data-tile=\"Map Lite\" data-url=\"" + generateMapLiteURL() + "\"></div>"
                    + "<script type=\"text/javascript\" src=\"" + shareJSScriptPath + "\"></script>");
    vp.add(sharePanel);
    updateSocialLinks();
}

From source file:org.geosdi.geoplatform.gui.client.widget.NotifyListPanel.java

License:Open Source License

public NotifyListPanel(final List<SingleNotify> listComponent, final DeckLayoutPanel deckLayoutPanel) {
    this.listComponent = listComponent;
    initWidget(uiBinder.createAndBindUi(this));
    ScrollPanel scrollPanel = new ScrollPanel();
    HTMLPanel newsPanel = new HTMLPanel("");
    newsPanel.setWidth("100%");
    newsPanel.setHeight("100%");
    scrollPanel.setSize("400px", "250px");
    for (int i = 0; i < listComponent.size(); i++) {
        final int j = i + 1;
        SingleNotify singleNotify = listComponent.get(i);
        singleNotify.setIndex(j);/*w  w  w .  ja  v a  2  s .  c o  m*/
        singleNotify.setStyleName(style.singleNews(), true);
        deckLayoutPanel.insert(new NotifyMessagePanel(listComponent.get(i)), j);
        singleNotify.addDomHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                deckLayoutPanel.setAnimationDuration(300);
                deckLayoutPanel.showWidget((j));
            }
        }, ClickEvent.getType());
        newsPanel.add(singleNotify);
    }
    scrollPanel.add(newsPanel);
    centerPanel.add(scrollPanel);
}