Search in sources :

Example 36 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 37 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 38 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)

Example 39 with VerticalPanel

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

the class ModifyKeyboardShortcutsWidget method createMainWidget.

@Override
protected Widget createMainWidget() {
    resetState();
    setEscapeDisabled(true);
    setEnterDisabled(true);
    previewHandler_ = Event.addNativePreviewHandler(new NativePreviewHandler() {

        @Override
        public void onPreviewNativeEvent(NativePreviewEvent preview) {
            if (swallowNextKeyUpEvent_ && preview.getTypeInt() == Event.ONKEYUP) {
                swallowNextKeyUpEvent_ = false;
                preview.cancel();
                preview.getNativeEvent().stopPropagation();
                preview.getNativeEvent().preventDefault();
            } else if (preview.getTypeInt() == Event.ONKEYDOWN) {
                int keyCode = preview.getNativeEvent().getKeyCode();
                if (keyCode == KeyCodes.KEY_ESCAPE || keyCode == KeyCodes.KEY_ENTER) {
                    // If the DataGrid (or an underlying element) has focus, let it
                    // handle the escape / enter key.
                    Element target = preview.getNativeEvent().getEventTarget().cast();
                    Element foundTable = DomUtils.findParentElement(target, new ElementPredicate() {

                        @Override
                        public boolean test(Element el) {
                            return el.equals(table_.getElement());
                        }
                    });
                    if (foundTable != null)
                        return;
                    // the widget.
                    if (filterWidget_.isFocused()) {
                        if (keyCode == KeyCodes.KEY_ENTER) {
                            table_.setKeyboardSelectedRow(0);
                            table_.setKeyboardSelectedColumn(0);
                            return;
                        } else if (keyCode == KeyCodes.KEY_ESCAPE) {
                            focusOkButton();
                            return;
                        }
                    }
                    // Otherwise, handle Enter / Escape 'modally' as we might normally do.
                    preview.cancel();
                    preview.getNativeEvent().stopPropagation();
                    preview.getNativeEvent().preventDefault();
                    if (keyCode == KeyCodes.KEY_ENTER) {
                        clickOkButton();
                        return;
                    } else if (keyCode == KeyCodes.KEY_ESCAPE) {
                        closeDialog();
                        return;
                    }
                }
            }
        }
    });
    addAttachHandler(new AttachEvent.Handler() {

        @Override
        public void onAttachOrDetach(AttachEvent event) {
            if (event.isAttached())
                ;
            else
                previewHandler_.removeHandler();
        }
    });
    VerticalPanel container = new VerticalPanel();
    FlowPanel headerPanel = new FlowPanel();
    Label radioLabel = new Label("Show:");
    radioLabel.getElement().getStyle().setFloat(Style.Float.LEFT);
    radioLabel.getElement().getStyle().setMarginRight(8, Unit.PX);
    headerPanel.add(radioLabel);
    headerPanel.add(radioAll_);
    radioAll_.setValue(true);
    headerPanel.add(radioCustomized_);
    filterWidget_.getElement().getStyle().setFloat(Style.Float.LEFT);
    filterWidget_.getElement().getStyle().setMarginLeft(10, Unit.PX);
    filterWidget_.getElement().getStyle().setMarginTop(-1, Unit.PX);
    headerPanel.add(filterWidget_);
    HelpLink link = new HelpLink("Customizing Keyboard Shortcuts", "custom_keyboard_shortcuts");
    link.getElement().getStyle().setFloat(Style.Float.RIGHT);
    headerPanel.add(link);
    container.add(headerPanel);
    FlowPanel spacer = new FlowPanel();
    spacer.setWidth("100%");
    spacer.setHeight("4px");
    container.add(spacer);
    DockPanel dockPanel = new DockPanel();
    dockPanel.add(table_, DockPanel.CENTER);
    container.add(dockPanel);
    return container;
}
Also used : NativePreviewHandler(com.google.gwt.user.client.Event.NativePreviewHandler) NativePreviewEvent(com.google.gwt.user.client.Event.NativePreviewEvent) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) AttachEvent(com.google.gwt.event.logical.shared.AttachEvent) DockPanel(com.google.gwt.user.client.ui.DockPanel) Element(com.google.gwt.dom.client.Element) TableRowElement(com.google.gwt.dom.client.TableRowElement) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) Label(com.google.gwt.user.client.ui.Label) HelpLink(org.rstudio.studio.client.common.HelpLink) ElementPredicate(org.rstudio.core.client.dom.DomUtils.ElementPredicate)

Example 40 with VerticalPanel

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

the class Wizard method createMainWidget.

@Override
protected Widget createMainWidget() {
    WizardResources res = WizardResources.INSTANCE;
    WizardResources.Styles styles = res.styles();
    VerticalPanel mainWidget = new VerticalPanel();
    mainWidget.addStyleName(getMainWidgetStyle());
    headerPanel_ = new LayoutPanel();
    headerPanel_.addStyleName(styles.headerPanel());
    // layout constants
    final int kTopMargin = 5;
    final int kLeftMargin = 8;
    final int kCaptionWidth = 400;
    final int kCaptionHeight = 30;
    final int kPageUILeftMargin = 123;
    // first page caption
    subCaptionLabel_ = new Label(firstPage_.getPageCaption());
    subCaptionLabel_.addStyleName(styles.headerLabel());
    headerPanel_.add(subCaptionLabel_);
    headerPanel_.setWidgetLeftWidth(subCaptionLabel_, kTopMargin, Unit.PX, kCaptionWidth, Unit.PX);
    headerPanel_.setWidgetTopHeight(subCaptionLabel_, kLeftMargin, Unit.PX, kCaptionHeight, Unit.PX);
    // second page back button
    ImageResource bkImg = res.wizardBackButton();
    backButton_ = new Label("Back");
    backButton_.addStyleName(styles.wizardBackButton());
    backButton_.addStyleName(ThemeResources.INSTANCE.themeStyles().handCursor());
    headerPanel_.add(backButton_);
    headerPanel_.setWidgetLeftWidth(backButton_, kTopMargin - 2, Unit.PX, bkImg.getWidth(), Unit.PX);
    headerPanel_.setWidgetTopHeight(backButton_, kTopMargin - 2, Unit.PX, bkImg.getHeight(), Unit.PX);
    backButton_.setVisible(false);
    backButton_.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            goBack();
        }
    });
    // second page caption label
    pageCaptionLabel_ = new Label();
    pageCaptionLabel_.addStyleName(styles.headerLabel());
    headerPanel_.add(pageCaptionLabel_);
    headerPanel_.setWidgetLeftWidth(pageCaptionLabel_, kPageUILeftMargin, Unit.PX, kCaptionWidth, Unit.PX);
    headerPanel_.setWidgetTopHeight(pageCaptionLabel_, kLeftMargin, Unit.PX, kCaptionHeight, Unit.PX);
    pageCaptionLabel_.setVisible(false);
    mainWidget.add(headerPanel_);
    // main body panel for transitions
    bodyPanel_ = new LayoutPanel();
    ArrayList<String> wizardBodyStyles = getWizardBodyStyles();
    for (String styleName : wizardBodyStyles) bodyPanel_.addStyleName(styleName);
    bodyPanel_.getElement().getStyle().setProperty("overflowX", "hidden");
    mainWidget.add(bodyPanel_);
    // add first page (and all sub-pages recursively)
    addAndInitializePage(firstPage_, true);
    setNextButtonState(firstPage_);
    return mainWidget;
}
Also used : VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) ImageResource(com.google.gwt.resources.client.ImageResource) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) Label(com.google.gwt.user.client.ui.Label) LayoutPanel(com.google.gwt.user.client.ui.LayoutPanel)

Aggregations

VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)63 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)19 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)19 Label (com.google.gwt.user.client.ui.Label)18 HTML (com.google.gwt.user.client.ui.HTML)14 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)12 CheckBox (com.google.gwt.user.client.ui.CheckBox)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 FlexTable (com.google.gwt.user.client.ui.FlexTable)6 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)6 SimplePanel (com.google.gwt.user.client.ui.SimplePanel)6 GerritCallback (com.google.gerrit.client.rpc.GerritCallback)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 TabMenu (cz.metacentrum.perun.webgui.widgets.TabMenu)4