Search in sources :

Example 26 with VerticalPanel

use of com.google.gwt.user.client.ui.VerticalPanel in project che by eclipse.

the class ImageViewer method go.

/** {@inheritDoc} */
@Override
public void go(AcceptsOneWidget container) {
    VerticalPanel panel = new VerticalPanel();
    panel.setSize("100%", "100%");
    panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    panel.add(getImage());
    editorView = new ScrollPanel(panel);
    editorView.getElement().getFirstChildElement().getStyle().setHeight(100, Unit.PCT);
    container.setWidget(editorView);
}
Also used : VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) ScrollPanel(com.google.gwt.user.client.ui.ScrollPanel)

Example 27 with VerticalPanel

use of com.google.gwt.user.client.ui.VerticalPanel in project libgdx by libgdx.

the class GwtApplication method getPreloaderCallback.

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);
        }
    };
}
Also used : PreloaderCallback(com.badlogic.gdx.backends.gwt.preloader.Preloader.PreloaderCallback) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) Panel(com.google.gwt.user.client.ui.Panel) SimplePanel(com.google.gwt.user.client.ui.SimplePanel) RootPanel(com.google.gwt.user.client.ui.RootPanel) PreloaderState(com.badlogic.gdx.backends.gwt.preloader.Preloader.PreloaderState) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) InlineHTML(com.google.gwt.user.client.ui.InlineHTML) SimplePanel(com.google.gwt.user.client.ui.SimplePanel) Style(com.google.gwt.dom.client.Style) Image(com.google.gwt.user.client.ui.Image)

Example 28 with VerticalPanel

use of com.google.gwt.user.client.ui.VerticalPanel in project libgdx by libgdx.

the class GwtApplication method onModuleLoad.

@Override
public void onModuleLoad() {
    GwtApplication.agentInfo = computeAgentInfo();
    this.listener = createApplicationListener();
    this.config = getConfig();
    setApplicationLogger(new GwtApplicationLogger(this.config.log));
    addEventListeners();
    if (config.rootPanel != null) {
        this.root = config.rootPanel;
    } else {
        Element element = Document.get().getElementById("embed-" + GWT.getModuleName());
        if (element == null) {
            VerticalPanel panel = new VerticalPanel();
            panel.setWidth("" + config.width + "px");
            panel.setHeight("" + config.height + "px");
            panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
            panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
            RootPanel.get().add(panel);
            RootPanel.get().setWidth("" + config.width + "px");
            RootPanel.get().setHeight("" + config.height + "px");
            this.root = panel;
        } else {
            VerticalPanel panel = new VerticalPanel();
            panel.setWidth("" + config.width + "px");
            panel.setHeight("" + config.height + "px");
            panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
            panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
            element.appendChild(panel.getElement());
            root = panel;
        }
    }
    // initialize SoundManager2
    SoundManager.init(GWT.getModuleBaseURL(), 9, config.preferFlash, new SoundManager.SoundManagerCallback() {

        @Override
        public void onready() {
            final PreloaderCallback callback = getPreloaderCallback();
            preloader = createPreloader();
            preloader.preload("assets.txt", new PreloaderCallback() {

                @Override
                public void error(String file) {
                    callback.error(file);
                }

                @Override
                public void update(PreloaderState state) {
                    callback.update(state);
                    if (state.hasEnded()) {
                        getRootPanel().clear();
                        if (loadingListener != null)
                            loadingListener.beforeSetup();
                        setupLoop();
                        if (loadingListener != null)
                            loadingListener.afterSetup();
                    }
                }
            });
        }

        @Override
        public void ontimeout(String status, String errorType) {
            error("SoundManager", status + " " + errorType);
        }
    });
}
Also used : PreloaderCallback(com.badlogic.gdx.backends.gwt.preloader.Preloader.PreloaderCallback) PreloaderState(com.badlogic.gdx.backends.gwt.preloader.Preloader.PreloaderState) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) CanvasElement(com.google.gwt.dom.client.CanvasElement) Element(com.google.gwt.dom.client.Element) SoundManager(com.badlogic.gdx.backends.gwt.soundmanager2.SoundManager)

Example 29 with VerticalPanel

use of com.google.gwt.user.client.ui.VerticalPanel in project opentsdb by OpenTSDB.

the class QueryUi method onModuleLoad.

/**
   * This is the entry point method.
   */
public void onModuleLoad() {
    asyncGetJson(AGGREGATORS_URL, new GotJsonCallback() {

        public void got(final JSONValue json) {
            // Do we need more manual type checking?  Not sure what will happen
            // in the browser if something other than an array is returned.
            final JSONArray aggs = json.isArray();
            for (int i = 0; i < aggs.size(); i++) {
                aggregators.add(aggs.get(i).isString().stringValue());
            }
            ((MetricForm) metrics.getWidget(0)).setAggregators(aggregators);
            refreshFromQueryString();
            refreshGraph();
        }
    });
    // All UI elements need to regenerate the graph when changed.
    {
        final ValueChangeHandler<Date> vch = new ValueChangeHandler<Date>() {

            public void onValueChange(final ValueChangeEvent<Date> event) {
                refreshGraph();
            }
        };
        TextBox tb = start_datebox.getTextBox();
        tb.addBlurHandler(refreshgraph);
        tb.addKeyPressHandler(refreshgraph);
        start_datebox.addValueChangeHandler(vch);
        tb = end_datebox.getTextBox();
        tb.addBlurHandler(refreshgraph);
        tb.addKeyPressHandler(refreshgraph);
        end_datebox.addValueChangeHandler(vch);
    }
    autoreoload_interval.addBlurHandler(refreshgraph);
    autoreoload_interval.addKeyPressHandler(refreshgraph);
    yrange.addBlurHandler(refreshgraph);
    yrange.addKeyPressHandler(refreshgraph);
    y2range.addBlurHandler(refreshgraph);
    y2range.addKeyPressHandler(refreshgraph);
    ylog.addClickHandler(new AdjustYRangeCheckOnClick(ylog, yrange));
    y2log.addClickHandler(new AdjustYRangeCheckOnClick(y2log, y2range));
    ylog.addClickHandler(refreshgraph);
    y2log.addClickHandler(refreshgraph);
    ylabel.addBlurHandler(refreshgraph);
    ylabel.addKeyPressHandler(refreshgraph);
    y2label.addBlurHandler(refreshgraph);
    y2label.addKeyPressHandler(refreshgraph);
    yformat.addBlurHandler(refreshgraph);
    yformat.addKeyPressHandler(refreshgraph);
    y2format.addBlurHandler(refreshgraph);
    y2format.addKeyPressHandler(refreshgraph);
    wxh.addBlurHandler(refreshgraph);
    wxh.addKeyPressHandler(refreshgraph);
    global_annotations.addBlurHandler(refreshgraph);
    global_annotations.addKeyPressHandler(refreshgraph);
    horizontalkey.addClickHandler(refreshgraph);
    keybox.addClickHandler(refreshgraph);
    nokey.addClickHandler(refreshgraph);
    smooth.addClickHandler(refreshgraph);
    styles.addChangeHandler(refreshgraph);
    yrange.setValidationRegexp(// Nothing or
    "^(" + // "[start
    "|\\[([-+.0-9eE]+|\\*)?" + //   :end]"
    ":([-+.0-9eE]+|\\*)?\\])$");
    yrange.setVisibleLength(5);
    // MAX=2^26=20 chars: "[-$MAX:$MAX]"
    yrange.setMaxLength(44);
    yrange.setText("[0:]");
    y2range.setValidationRegexp(// Nothing or
    "^(" + // "[start
    "|\\[([-+.0-9eE]+|\\*)?" + //   :end]"
    ":([-+.0-9eE]+|\\*)?\\])$");
    y2range.setVisibleLength(5);
    // MAX=2^26=20 chars: "[-$MAX:$MAX]"
    y2range.setMaxLength(44);
    y2range.setText("[0:]");
    y2range.setEnabled(false);
    y2log.setEnabled(false);
    ylabel.setVisibleLength(10);
    // Arbitrary limit.
    ylabel.setMaxLength(50);
    y2label.setVisibleLength(10);
    // Arbitrary limit.
    y2label.setMaxLength(50);
    y2label.setEnabled(false);
    // Nothing or at least one %?
    yformat.setValidationRegexp("^(|.*%..*)$");
    yformat.setVisibleLength(10);
    // Arbitrary limit.
    yformat.setMaxLength(16);
    // Nothing or at least one %?
    y2format.setValidationRegexp("^(|.*%..*)$");
    y2format.setVisibleLength(10);
    // Arbitrary limit.
    y2format.setMaxLength(16);
    y2format.setEnabled(false);
    // 100x100
    wxh.setValidationRegexp("^[1-9][0-9]{2,}x[1-9][0-9]{2,}$");
    wxh.setVisibleLength(9);
    // 99999x99999
    wxh.setMaxLength(11);
    wxh.setText((Window.getClientWidth() - 20) + "x" + (Window.getClientHeight() * 4 / 5));
    final FlexTable table = new FlexTable();
    table.setText(0, 0, "From");
    {
        final HorizontalPanel hbox = new HorizontalPanel();
        hbox.add(new InlineLabel("To"));
        final Anchor now = new Anchor("(now)");
        now.addClickHandler(new ClickHandler() {

            public void onClick(final ClickEvent event) {
                end_datebox.setValue(new Date());
                refreshGraph();
            }
        });
        hbox.add(now);
        hbox.add(autoreload);
        hbox.setWidth("100%");
        table.setWidget(0, 1, hbox);
    }
    autoreload.addValueChangeHandler(new ValueChangeHandler<Boolean>() {

        @Override
        public void onValueChange(final ValueChangeEvent<Boolean> event) {
            if (autoreload.getValue()) {
                final HorizontalPanel hbox = new HorizontalPanel();
                hbox.setWidth("100%");
                hbox.add(new InlineLabel("Every:"));
                hbox.add(autoreoload_interval);
                hbox.add(new InlineLabel("seconds"));
                table.setWidget(1, 1, hbox);
                if (autoreoload_interval.getValue().isEmpty()) {
                    autoreoload_interval.setValue("15");
                }
                autoreoload_interval.setFocus(true);
                // Force refreshGraph.
                lastgraphuri = "";
                // Trigger the 1st auto-reload
                refreshGraph();
            } else {
                table.setWidget(1, 1, end_datebox);
            }
        }
    });
    // >=5s
    autoreoload_interval.setValidationRegexp("^([5-9]|[1-9][0-9]+)$");
    autoreoload_interval.setMaxLength(4);
    autoreoload_interval.setVisibleLength(8);
    table.setWidget(1, 0, start_datebox);
    table.setWidget(1, 1, end_datebox);
    {
        final HorizontalPanel hbox = new HorizontalPanel();
        hbox.add(new InlineLabel("WxH:"));
        hbox.add(wxh);
        table.setWidget(0, 3, hbox);
    }
    {
        final HorizontalPanel hbox = new HorizontalPanel();
        hbox.add(global_annotations);
        table.setWidget(0, 4, hbox);
    }
    {
        addMetricForm("metric 1", 0);
        metrics.selectTab(0);
        metrics.add(new InlineLabel("Loading..."), "+");
        metrics.addBeforeSelectionHandler(new BeforeSelectionHandler<Integer>() {

            public void onBeforeSelection(final BeforeSelectionEvent<Integer> event) {
                final int item = event.getItem();
                final int nitems = metrics.getWidgetCount();
                if (item == nitems - 1) {
                    // Last item: the "+" was clicked.
                    event.cancel();
                    final MetricForm metric = addMetricForm("metric " + nitems, item);
                    metrics.selectTab(item);
                    metric.setFocus(true);
                }
            }
        });
        table.setWidget(2, 0, metrics);
    }
    table.getFlexCellFormatter().setColSpan(2, 0, 2);
    table.getFlexCellFormatter().setRowSpan(1, 3, 2);
    final DecoratedTabPanel optpanel = new DecoratedTabPanel();
    optpanel.add(makeAxesPanel(), "Axes");
    optpanel.add(makeKeyPanel(), "Key");
    optpanel.add(makeStylePanel(), "Style");
    optpanel.selectTab(0);
    table.setWidget(1, 3, optpanel);
    table.getFlexCellFormatter().setColSpan(1, 3, 2);
    final DecoratorPanel decorator = new DecoratorPanel();
    decorator.setWidget(table);
    final VerticalPanel graphpanel = new VerticalPanel();
    graphpanel.add(decorator);
    {
        final VerticalPanel graphvbox = new VerticalPanel();
        graphvbox.add(graphstatus);
        graph.setVisible(false);
        // Put the graph image element and the zoombox elements inside the absolute panel
        graphbox.add(graph, 0, 0);
        zoom_box.setVisible(false);
        graphbox.add(zoom_box, 0, 0);
        graph.addMouseOverHandler(new MouseOverHandler() {

            public void onMouseOver(final MouseOverEvent event) {
                final Style style = graphbox.getElement().getStyle();
                style.setCursor(Cursor.CROSSHAIR);
            }
        });
        graph.addMouseOutHandler(new MouseOutHandler() {

            public void onMouseOut(final MouseOutEvent event) {
                final Style style = graphbox.getElement().getStyle();
                style.setCursor(Cursor.AUTO);
            }
        });
        graphvbox.add(graphbox);
        graph.addErrorHandler(new ErrorHandler() {

            public void onError(final ErrorEvent event) {
                graphstatus.setText("Oops, failed to load the graph.");
            }
        });
        graph.addLoadHandler(new LoadHandler() {

            public void onLoad(final LoadEvent event) {
                graphbox.setWidth(graph.getWidth() + "px");
                graphbox.setHeight(graph.getHeight() + "px");
            }
        });
        graphpanel.add(graphvbox);
    }
    final DecoratedTabPanel mainpanel = new DecoratedTabPanel();
    mainpanel.setWidth("100%");
    mainpanel.add(graphpanel, "Graph");
    mainpanel.add(stats_table, "Stats");
    mainpanel.add(logs, "Logs");
    mainpanel.add(build_data, "Version");
    mainpanel.selectTab(0);
    mainpanel.addBeforeSelectionHandler(new BeforeSelectionHandler<Integer>() {

        public void onBeforeSelection(final BeforeSelectionEvent<Integer> event) {
            clearError();
            final int item = event.getItem();
            switch(item) {
                case 1:
                    refreshStats();
                    return;
                case 2:
                    refreshLogs();
                    return;
                case 3:
                    refreshVersion();
                    return;
            }
        }
    });
    final VerticalPanel root = new VerticalPanel();
    root.setWidth("100%");
    root.add(current_error);
    current_error.setVisible(false);
    current_error.addStyleName("dateBoxFormatError");
    root.add(mainpanel);
    RootPanel.get("queryuimain").add(root);
    // Must be done at the end, once all the widgets are attached.
    ensureSameWidgetSize(optpanel);
    History.addHistoryListener(this);
}
Also used : LoadHandler(com.google.gwt.event.dom.client.LoadHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) TextBox(com.google.gwt.user.client.ui.TextBox) MouseOutEvent(com.google.gwt.event.dom.client.MouseOutEvent) MouseOutHandler(com.google.gwt.event.dom.client.MouseOutHandler) MouseOverEvent(com.google.gwt.event.dom.client.MouseOverEvent) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) InlineLabel(com.google.gwt.user.client.ui.InlineLabel) MouseOverHandler(com.google.gwt.event.dom.client.MouseOverHandler) Style(com.google.gwt.dom.client.Style) ErrorHandler(com.google.gwt.event.dom.client.ErrorHandler) LoadEvent(com.google.gwt.event.dom.client.LoadEvent) JSONArray(com.google.gwt.json.client.JSONArray) FlexTable(com.google.gwt.user.client.ui.FlexTable) ValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler) Date(java.util.Date) EntryPoint(com.google.gwt.core.client.EntryPoint) JSONValue(com.google.gwt.json.client.JSONValue) BeforeSelectionHandler(com.google.gwt.event.logical.shared.BeforeSelectionHandler) Anchor(com.google.gwt.user.client.ui.Anchor) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) BeforeSelectionEvent(com.google.gwt.event.logical.shared.BeforeSelectionEvent) ErrorEvent(com.google.gwt.event.dom.client.ErrorEvent) DecoratorPanel(com.google.gwt.user.client.ui.DecoratorPanel) DecoratedTabPanel(com.google.gwt.user.client.ui.DecoratedTabPanel)

Example 30 with VerticalPanel

use of com.google.gwt.user.client.ui.VerticalPanel in project rstudio by rstudio.

the class MiniDialogPopupPanel method commonInit.

private void commonInit() {
    addStyleName(ThemeStyles.INSTANCE.miniDialogPopupPanel());
    verticalPanel_ = new VerticalPanel();
    verticalPanel_.setStyleName(ThemeStyles.INSTANCE.miniDialogContainer());
    // title bar
    HorizontalPanel titleBar = new HorizontalPanel();
    titleBar.setWidth("100%");
    captionLabel_ = new Label();
    captionLabel_.setStyleName(ThemeStyles.INSTANCE.miniDialogCaption());
    titleBar.add(captionLabel_);
    titleBar.setCellHorizontalAlignment(captionLabel_, HasHorizontalAlignment.ALIGN_LEFT);
    HorizontalPanel toolsPanel = new HorizontalPanel();
    toolsPanel.setStyleName(ThemeStyles.INSTANCE.miniDialogTools());
    ToolbarButton hideButton = new ToolbarButton(new ImageResource2x(ThemeResources.INSTANCE.closeChevron2x()), new ClickHandler() {

        public void onClick(ClickEvent event) {
            MiniDialogPopupPanel.this.hideMiniDialog();
        }
    });
    hideButton.setTitle("Close");
    toolsPanel.add(hideButton);
    titleBar.add(toolsPanel);
    titleBar.setCellHorizontalAlignment(toolsPanel, HasHorizontalAlignment.ALIGN_RIGHT);
    verticalPanel_.add(titleBar);
    // main widget
    verticalPanel_.add(createMainWidget());
    setWidget(verticalPanel_);
}
Also used : VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) Label(com.google.gwt.user.client.ui.Label) ImageResource2x(org.rstudio.core.client.resources.ImageResource2x)

Aggregations

VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)49 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)16 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)16 Label (com.google.gwt.user.client.ui.Label)15 HTML (com.google.gwt.user.client.ui.HTML)12 CheckBox (com.google.gwt.user.client.ui.CheckBox)9 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)9 SmallHeading (com.google.gerrit.client.ui.SmallHeading)7 Button (com.google.gwt.user.client.ui.Button)7 ScrollPanel (com.google.gwt.user.client.ui.ScrollPanel)7 TextBox (com.google.gwt.user.client.ui.TextBox)7 GerritCallback (com.google.gerrit.client.rpc.GerritCallback)5 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)5 OnEditEnabler (com.google.gerrit.client.ui.OnEditEnabler)4 Grid (com.google.gwt.user.client.ui.Grid)4 Image (com.google.gwt.user.client.ui.Image)4 InlineLabel (com.google.gwt.user.client.ui.InlineLabel)4 SimplePanel (com.google.gwt.user.client.ui.SimplePanel)4 TabMenu (cz.metacentrum.perun.webgui.widgets.TabMenu)4 VoidResult (com.google.gerrit.client.VoidResult)3