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.obiba.opal.web.gwt.app.client.ui.MarkdownEditor.java

License:Open Source License

public MarkdownEditor() {
    initWidget(uiBinder.createAndBindUi(this));

    toggle.setTexts(translations.previewLabel(), translations.editLabel());
    toggle.setDelegate(new ToggleAnchor.Delegate() {
        @Override//from w  w w . j  ava  2  s.c  o m
        public void executeOn() {
            togglePreview(true);
        }

        @Override
        public void executeOff() {
            togglePreview(false);
        }

        public void togglePreview(boolean visible) {
            preview.setVisible(visible);
            editor.setVisible(!visible);
            preview.clear();
            if (visible) {
                preview.add(new HTMLPanel(Markdown.parse(getText())));
            }
        }
    });
}

From source file:org.obiba.opal.web.gwt.app.client.view.NotificationView.java

License:Open Source License

private void addMessages(Alert alert, List<String> messages) {

    if (messages.size() == 1) {
        alert.setHTML(messages.get(0));//from  w  w w .jav a2  s .com
    } else {
        UnorderedList list = new UnorderedList();
        for (String message : messages) {
            list.add(new ListItem(new HTMLPanel(message)));
        }
        alert.add(list);
    }
}

From source file:org.onesocialweb.gwt.client.ui.widget.VideoThumbnail.java

License:Apache License

public VideoThumbnail(String source) {

    embed = new HTMLPanel(source);
    // compose composite
    actions.add(buttonDelete);/*w  w  w. j av  a 2 s  .  c  o m*/
    thumbnail.add(embed);
    thumbnail.add(actions);
    thumbnailwrapper.add(thumbnail);

    // set tooltips
    buttonDelete.setTitle("Remove video");

    // styles
    thumbnail.addStyleName("thumbnail");
    actions.addStyleName("actions");
    embed.addStyleName("embed");
    thumbnailwrapper.addStyleName("thumbnailwrapper");

    initWidget(thumbnailwrapper);

    // actions.addMouseOverHandler(new CustomMouseEventHandler());

}

From source file:org.opencms.ade.containerpage.client.CmsContainerpageEditor.java

License:Open Source License

private static void openMessageDialog(String title, String displayHtmlContent) {

    HTMLPanel content = new HTMLPanel(displayHtmlContent);
    content.getElement().getStyle().setOverflow(Overflow.AUTO);
    content.getElement().getStyle().setPosition(Position.RELATIVE);
    CmsPopup dialog = new CmsPopup(title, content);
    content.getElement().getStyle().setProperty("maxHeight", dialog.getAvailableHeight(100), Unit.PX);
    dialog.setWidth(-1);/*from  w w  w.jav  a  2s. c o  m*/
    dialog.addDialogClose(null);
    dialog.centerHorizontally(100);
}

From source file:org.opendatakit.aggregate.client.popups.AuditCSVPopup.java

License:Apache License

public AuditCSVPopup(String keyString) {
    super();// w w  w  .j av  a 2s. co m
    String[] parts = keyString.split("\\?");
    if (parts.length != 2)
        throw new RuntimeException("blobKey missing in keyString");
    String blobKey = parts[1].split("=")[1];

    setTitle("Audit CSV");
    int width = Window.getClientWidth() / 2;
    int height = Window.getClientHeight() / 2;

    final HTMLPanel panel = new HTMLPanel("");
    panel.add(new SimplePanel(new ClosePopupButton(this)));
    panel.add(new HTML("<h2>Audit CSV contents</h2>"));
    panel.setStylePrimaryName(UIConsts.VERTICAL_FLOW_PANEL_STYLENAME);
    panel.getElement().getStyle().setProperty("overflow", "scroll");
    panel.setPixelSize(width + 6, height + 30);
    setWidget(panel);

    AsyncCallback<String> callback = new AsyncCallback<String>() {
        public void onFailure(Throwable caught) {
            AggregateUI.getUI().reportError(caught);
        }

        public void onSuccess(String csvContents) {
            String[] allLines = csvContents.split("\n");

            SafeHtmlBuilder builder = new SafeHtmlBuilder();
            builder.appendHtmlConstant("<table class=\"dataTable\">")
                    .appendHtmlConstant("<tr class=\"titleBar\">")
                    .appendHtmlConstant("<td>Event</td><td>Node</td><td>Start</td><td>End</td>")
                    .appendHtmlConstant("</tr>");

            for (int i = 1, max = allLines.length; i < max; i++) {
                builder.append(Row.from(allLines[i]).asTr());
            }
            builder.appendHtmlConstant("</table>");

            AggregateUI.getUI().clearError();
            panel.add(new HTML(builder.toSafeHtml()));
            AggregateUI.resize();
        }
    };

    SecureGWT.getSubmissionService().getSubmissionAuditCSV(blobKey, callback);
}

From source file:org.opendatakit.aggregate.client.popups.VisualizationPopup.java

License:Apache License

private MapWidget createMap() {
    int latIndex = findGpsIndex(geoPoints.getElementKey(), GeoPointConsts.GEOPOINT_LATITUDE_ORDINAL_NUMBER);
    int lonIndex = findGpsIndex(geoPoints.getElementKey(), GeoPointConsts.GEOPOINT_LONGITUDE_ORDINAL_NUMBER);

    // check to see if we have lat & long, if not display erro
    if (latIndex < 0 || lonIndex < 0) {
        String error = "ERROR:";
        if (latIndex < 0) {
            error = error + " The Latitude Coordinate is NOT included in the Filter.";
        }/*from  w  w w  .  j a  v  a 2  s  .  c o m*/
        if (lonIndex < 0) {
            error = error + " The Longitude Coordinate is NOT included in the Filter.";
        }

        Window.alert(error);
        return null;
    }

    // create a center point, stop at the first gps point found
    LatLng center = new LatLng(0.0, 0.0);
    for (SubmissionUI sub : submissions) {
        LatLng gpsPoint = getLatLonFromSubmission(latIndex, lonIndex, sub);
        if (gpsPoint != null) {
            center = gpsPoint;
            break;
        }
    }

    // create mapping area
    final MapOptions options = new MapOptions();
    options.setCenter(center);
    MapTypeId id = new MapTypeId();
    options.setMapTypeId(id.getRoadmap());
    options.setZoom(6);
    options.setMapTypeControl(true);
    options.setNavigationControl(true);
    options.setScaleControl(true);
    final MapWidget mapWidget = new MapWidget(options);
    mapWidget.setSize("100%", "100%");

    final HasMap map = mapWidget.getMap();

    // create the markers
    for (SubmissionUI sub : submissions) {
        LatLng gpsPoint = getLatLonFromSubmission(latIndex, lonIndex, sub);
        if (gpsPoint != null) {
            final Marker marker = new Marker();
            marker.setPosition(gpsPoint);
            marker.setMap(map);

            // marker needs to be added to the map before calling
            // InfoWindow.open(marker, ...)
            final SubmissionUI tmpSub = sub;
            Event.addListener(marker, "mouseover", new MouseEventCallback() {

                @Override
                public void callback(HasMouseEvent event) {
                    if (infoWindow != null) {
                        infoWindow.close();
                    }
                    infoWindow = new InfoWindow();
                    InfoContentSubmission w = createInfoWindowWidget(tmpSub);
                    HTMLPanel container = new HTMLPanel("<div></div>");
                    container.add(w);
                    infoWindow.setContent(container.getElement().getInnerHTML());
                    infoWindow.open(map, marker);
                }
            });

            Event.addListener(marker, "mouseout", new MouseEventCallback() {

                @Override
                public void callback(HasMouseEvent event) {
                    if (!mapMarkerClicked) {
                        if (infoWindow != null) {
                            infoWindow.close();
                            infoWindow = null;
                        }
                    }
                    mapMarkerClicked = false;
                }
            });

            Event.addListener(marker, "click", new MouseEventCallback() {

                @Override
                public void callback(HasMouseEvent event) {
                    mapMarkerClicked = true;
                }

            });
        }
    }
    return mapWidget;
}

From source file:org.opennms.dashboard.client.Dashboard.java

License:Open Source License

/**
 * <p>error</p>/*w  w  w .  j av  a2s  .  co  m*/
 *
 * @param err a {@link java.lang.String} object.
 */
public void error(String err) {
    m_modalContent.clear();

    HTMLPanel html = new HTMLPanel(err);
    html.setStyleName("Message");
    m_modalContent.add(html);

    m_modal.show();

}

From source file:org.opennms.dashboard.client.portlet.Dashboard.java

License:Open Source License

/**
 * <p>//from   w  w w . j  a v  a  2 s  . co  m
 * error
 * </p>
 * 
 * @param err
 *            a {@link java.lang.String} object.
 */
public void error(String err) {
    final DialogBox dialog = new DialogBox();
    dialog.setText("Error Occurred");

    VerticalPanel panel = new VerticalPanel();
    HTMLPanel html = new HTMLPanel(err);
    html.setStyleName("Message");
    panel.add(html);

    Button ok = new Button("OK");
    SimplePanel buttonPanel = new SimplePanel();
    buttonPanel.setWidget(ok);
    buttonPanel.setStyleName("Button");
    panel.add(buttonPanel);

    dialog.setPopupPosition(Window.getScrollLeft() + 100, Window.getScrollTop() + 100);
    dialog.setWidget(panel);

    ok.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent arg0) {
            dialog.hide();
        }

    });

    dialog.show();

}

From source file:org.overlord.sramp.ui.client.views.DashboardView.java

License:Apache License

/**
 * Constructor.//from  w w w  . j  a va  2 s .c  o m
 */
public DashboardView() {
    // Create the dashboard
    HorizontalPanel dashboardPanel = new HorizontalPanel();
    dashboardPanel.getElement().setId("dashboard");
    dashboardPanel.getElement().setAttribute("style", "width: 100%");

    // Create two columns
    VerticalPanel leftColumn = new VerticalPanel();
    leftColumn.getElement().setClassName("dashColumn");
    leftColumn.getElement().addClassName("left");
    VerticalPanel rightColumn = new VerticalPanel();
    rightColumn.getElement().setClassName("dashColumn");
    rightColumn.getElement().addClassName("right");
    dashboardPanel.add(leftColumn);
    dashboardPanel.add(rightColumn);

    // Create the Activities panel
    TitlePanel activitiesPanel = new TitlePanel(i18n().translate("views.dashboard.activities-panel.title"));
    activitiesPanel.getElement().setId("dash-activitiesPanel");
    UnorderedListPanel ulPanel = new UnorderedListPanel();
    List<Widget> activityLinks = createActivityLinks();
    for (Widget link : activityLinks)
        ulPanel.add(link);
    activitiesPanel.setWidget(ulPanel);

    // Create the Upload Artifact panel
    TitlePanel uploadPanel = new TitlePanel(i18n().translate("views.dashboard.upload-panel.title"));
    uploadPanel.getElement().setId("dash-uploadPanel");
    uploadPanel.setWidget(createUploadForm());

    // Create the Help panel
    TitlePanel helpPanel = new TitlePanel(i18n().translate("views.dashboard.help-panel.title"));
    helpPanel.getElement().setId("dash-helpPanel");
    HTMLPanel helpText = new HTMLPanel(i18n().translate("views.dashboard.help-panel.help-text"));
    helpPanel.setWidget(helpText);

    // Now size the columns properly
    dashboardPanel.setCellWidth(leftColumn, "50%");
    dashboardPanel.setCellWidth(rightColumn, "50%");

    // Add the panels to the dashboard
    leftColumn.add(activitiesPanel);
    leftColumn.add(uploadPanel);
    rightColumn.add(helpPanel);

    this.initWidget(dashboardPanel);
}

From source file:org.parallax3d.parallax.tests.client.WebApp.java

License:Open Source License

public void onModuleLoad() {
    resources.css().ensureInjected();//  w  ww.ja  v  a 2s. c o  m

    GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {
        public void onUncaughtException(Throwable throwable) {
            Log.error("Uncaught exception ", throwable);
            //                if (!GWT.isScript()) {
            String text = "Uncaught exception: ";
            while (throwable != null) {
                StackTraceElement[] stackTraceElements = throwable.getStackTrace();
                text += throwable.toString() + "\n";

                for (StackTraceElement stackTraceElement : stackTraceElements)
                    text += "    at " + stackTraceElement + "\n";

                throwable = throwable.getCause();
                if (throwable != null)
                    text += "Caused by: ";
            }

            History.newItem("", true);
            text = text.replaceAll("\n", "<br/>");
            RootLayoutPanel.get().add(new Alert(new HTMLPanel(text)));
            //                }
        }
    });

    GwtApp.init(this);
}