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

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

Introduction

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

Prototype

public DockPanel() 

Source Link

Document

Creates an empty dock panel.

Usage

From source file:com.dimdim.conference.ui.resources.client.ResourceTypeListEntryPopupPanel.java

License:Open Source License

public void paintPanel(String typeName) {
    this.typeName = typeName;
    ClickListener headerClickListener = rtpcp.getTypePopupHeaderClickListener(typeName);
    ClickListener footerClickListener = rtpcp.getTypePopupFooterClickListener(this.typeName);

    /*if(UIResourceObject.RESOURCE_TYPE_COBROWSE.equalsIgnoreCase(typeName))
    {/*from  w  w w.  ja v a2s.c  o m*/
       headerClickListener = rtpcp.getShareCobClickListener();
    }*/
    pane.addMouseListener(this);
    pane.addFocusListener(this);

    DockPanel outer = new DockPanel();
    outer.setStyleName("dm-hover-popup-body");
    pane.add(outer);

    if (headerClickListener != null) {
        //         headerPanel.setStyleName("dm-hover-popup-header");
        outer.add(headerPanel, DockPanel.NORTH);
        outer.setCellWidth(headerPanel, "100%");

        String selectLabel = ConferenceGlobals.getDisplayString(typeName + ".select.label", "Upload Document");
        Label headerLink = new Label(selectLabel);
        //         headerLink.setStyleName("tool-entry");
        headerLink.setStyleName("resource-popup-header-entry");
        headerLink.addStyleName("anchor-cursor");
        headerPanel.add(headerLink);
        headerPanel.setCellWidth(headerLink, "100%");
        headerPanel.setStyleName("resource-popup-header-panel");
        headerPanel.setCellHorizontalAlignment(headerLink, HorizontalPanel.ALIGN_LEFT);
        headerPanel.setCellVerticalAlignment(headerLink, VerticalPanel.ALIGN_MIDDLE);
        headerLink.addClickListener(headerClickListener);
        headerLink.addClickListener(this);
    } else {
        //         Window.alert("No header listener");
    }

    this.writeListPanel(outer);
    //      this.contentPanel.setStyleName("dm-hover-popup-content");
    //      outer.add(contentPanel,DockPanel.NORTH);
    //      outer.setCellHeight(contentPanel,"100%");
    //      outer.setCellWidth(contentPanel,"100%");

    if (footerClickListener != null) {
        //         this.linksPanel.setStyleName("dm-hover-popup-header");
        outer.add(linksPanel, DockPanel.SOUTH);
        outer.setCellHeight(linksPanel, "100%");

        String manageLabel = ConferenceGlobals.getDisplayString(typeName + ".manage.label", "Manage Document");
        Label footerLink = new Label(manageLabel);
        //         footerLink.setStyleName("tool-entry");
        footerLink.setStyleName("resource-popup-footer-entry");
        footerLink.addStyleName("anchor-cursor");
        linksPanel.add(footerLink);
        linksPanel.setCellHorizontalAlignment(footerLink, HorizontalPanel.ALIGN_LEFT);
        linksPanel.setCellVerticalAlignment(footerLink, VerticalPanel.ALIGN_MIDDLE);
        footerLink.addClickListener(footerClickListener);
        footerLink.addClickListener(this);
    } else {
        //         Window.alert("No footer listener");
    }

    //      if (panel != null)
    //      {
    //         this.contentPanel.add(panel);
    //         this.contentPanel.setCellWidth(panel, "100%");
    //         this.contentPanel.setCellHeight(panel, "100%");
    //      }

    this.add(pane);
    this.addPopupListener(this);
}

From source file:com.google.appinventor.client.editor.youngandroid.YaFormEditor.java

License:Open Source License

/**
 * Creates a new YaFormEditor.// w  w w .  j  a v a2s.  com
 *
 * @param projectEditor  the project editor that contains this file editor
 * @param formNode the YoungAndroidFormNode associated with this YaFormEditor
 */
YaFormEditor(ProjectEditor projectEditor, YoungAndroidFormNode formNode) {
    super(projectEditor, formNode);

    this.formNode = formNode;
    COMPONENT_DATABASE = SimpleComponentDatabase.getInstance(getProjectId());

    // Get reference to the source structure explorer
    sourceStructureExplorer = SourceStructureBox.getSourceStructureBox().getSourceStructureExplorer();

    // Create UI elements for the designer panels.
    nonVisibleComponentsPanel = new SimpleNonVisibleComponentsPanel();
    visibleComponentsPanel = new SimpleVisibleComponentsPanel(this, nonVisibleComponentsPanel);
    DockPanel componentsPanel = new DockPanel();
    componentsPanel.setHorizontalAlignment(DockPanel.ALIGN_CENTER);
    componentsPanel.add(visibleComponentsPanel, DockPanel.NORTH);
    componentsPanel.add(nonVisibleComponentsPanel, DockPanel.SOUTH);
    componentsPanel.setSize("100%", "100%");

    // Create palettePanel, which will be used as the content of the PaletteBox.
    palettePanel = new YoungAndroidPalettePanel(this);
    palettePanel.loadComponents(new DropTargetProvider() {
        @Override
        public DropTarget[] getDropTargets() {
            // TODO(markf): Figure out a good way to memorize the targets or refactor things so that
            // getDropTargets() doesn't get called for each component.
            // NOTE: These targets must be specified in depth-first order.
            List<DropTarget> dropTargets = form.getDropTargetsWithin();
            dropTargets.add(visibleComponentsPanel);
            dropTargets.add(nonVisibleComponentsPanel);
            return dropTargets.toArray(new DropTarget[dropTargets.size()]);
        }
    });
    palettePanel.setSize("100%", "100%");
    addComponentDatabaseChangeListener(palettePanel);

    // Create designProperties, which will be used as the content of the PropertiesBox.
    designProperties = new PropertiesPanel();
    designProperties.setSize("100%", "100%");
    initWidget(componentsPanel);
    setSize("100%", "100%");
}

From source file:com.google.appinventor.client.Ode.java

License:Open Source License

private void initializeUi() {
    BlocklyPanel.initUi();/*from   ww w  .j  a  va2s  .c o  m*/

    rpcStatusPopup = new RpcStatusPopup();

    // Register services with RPC status popup
    rpcStatusPopup.register((ExtendedServiceProxy<?>) helpService);
    rpcStatusPopup.register((ExtendedServiceProxy<?>) projectService);
    rpcStatusPopup.register((ExtendedServiceProxy<?>) galleryService);
    rpcStatusPopup.register((ExtendedServiceProxy<?>) userInfoService);

    Window.setTitle(MESSAGES.titleYoungAndroid());
    Window.enableScrolling(true);

    topPanel = new TopPanel();
    statusPanel = new StatusPanel();

    DockPanel mainPanel = new DockPanel();
    mainPanel.add(topPanel, DockPanel.NORTH);

    // Create tab panel for subsequent tabs
    deckPanel = new DeckPanel() {
        @Override
        public final void onBrowserEvent(Event event) {
            switch (event.getTypeInt()) {
            case Event.ONCONTEXTMENU:
                event.preventDefault();
                break;
            }
        }
    };

    deckPanel.setAnimationEnabled(true);
    deckPanel.sinkEvents(Event.ONCONTEXTMENU);
    deckPanel.setStyleName("ode-DeckPanel");

    // Projects tab
    VerticalPanel pVertPanel = new VerticalPanel();
    pVertPanel.setWidth("100%");
    pVertPanel.setSpacing(0);
    HorizontalPanel projectListPanel = new HorizontalPanel();
    projectListPanel.setWidth("100%");
    projectToolbar = new ProjectToolbar();
    projectListPanel.add(ProjectListBox.getProjectListBox());
    pVertPanel.add(projectToolbar);
    pVertPanel.add(projectListPanel);
    projectsTabIndex = deckPanel.getWidgetCount();
    deckPanel.add(pVertPanel);

    // Design tab
    VerticalPanel dVertPanel = new VerticalPanel();
    dVertPanel.setWidth("100%");
    dVertPanel.setHeight("100%");

    // Add the Code Navigation arrow
    //    switchToBlocksButton = new VerticalPanel();
    //    switchToBlocksButton.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
    //    switchToBlocksButton.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
    //    switchToBlocksButton.setStyleName("ode-NavArrow");
    //    switchToBlocksButton.add(new Image(RIGHT_ARROW_IMAGE_URL));
    //    switchToBlocksButton.setWidth("25px");
    //    switchToBlocksButton.setHeight("100%");

    // Add the Code Navigation arrow
    //    switchToDesignerButton = new VerticalPanel();
    //    switchToDesignerButton.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
    //    switchToDesignerButton.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
    //    switchToDesignerButton.setStyleName("ode-NavArrow");
    //    switchToDesignerButton.add(new Image(LEFT_ARROW_IMAGE_URL));
    //    switchToDesignerButton.setWidth("25px");
    //    switchToDesignerButton.setHeight("100%");

    designToolbar = new DesignToolbar();
    dVertPanel.add(designToolbar);

    workColumns = new HorizontalPanel();
    workColumns.setWidth("100%");

    //workColumns.add(switchToDesignerButton);

    Box palletebox = PaletteBox.getPaletteBox();
    palletebox.setWidth("222px");
    workColumns.add(palletebox);

    Box viewerbox = ViewerBox.getViewerBox();
    workColumns.add(viewerbox);
    workColumns.setCellWidth(viewerbox, "97%");
    workColumns.setCellHeight(viewerbox, "97%");

    structureAndAssets = new VerticalPanel();
    structureAndAssets.setVerticalAlignment(VerticalPanel.ALIGN_TOP);
    // Only one of the SourceStructureBox and the BlockSelectorBox is visible
    // at any given time, according to whether we are showing the form editor
    // or the blocks editor. They share the same screen real estate.
    structureAndAssets.add(SourceStructureBox.getSourceStructureBox());
    structureAndAssets.add(BlockSelectorBox.getBlockSelectorBox()); // initially not visible
    structureAndAssets.add(AssetListBox.getAssetListBox());
    workColumns.add(structureAndAssets);

    Box propertiesbox = PropertiesBox.getPropertiesBox();
    propertiesbox.setWidth("222px");
    workColumns.add(propertiesbox);
    //switchToBlocksButton.setHeight("650px");
    //workColumns.add(switchToBlocksButton);
    dVertPanel.add(workColumns);
    designTabIndex = deckPanel.getWidgetCount();
    deckPanel.add(dVertPanel);

    // Gallery list tab
    VerticalPanel gVertPanel = new VerticalPanel();
    gVertPanel.setWidth("100%");
    gVertPanel.setSpacing(0);
    galleryListToolbar = new GalleryToolbar();
    gVertPanel.add(galleryListToolbar);
    HorizontalPanel appListPanel = new HorizontalPanel();
    appListPanel.setWidth("100%");
    appListPanel.add(GalleryListBox.getGalleryListBox());

    gVertPanel.add(appListPanel);
    galleryTabIndex = deckPanel.getWidgetCount();
    deckPanel.add(gVertPanel);

    // Gallery app tab
    VerticalPanel aVertPanel = new VerticalPanel();
    aVertPanel.setWidth("100%");
    aVertPanel.setSpacing(0);
    galleryPageToolbar = new GalleryToolbar();
    aVertPanel.add(galleryPageToolbar);
    HorizontalPanel appPanel = new HorizontalPanel();
    appPanel.setWidth("100%");
    appPanel.add(GalleryAppBox.getGalleryAppBox());

    aVertPanel.add(appPanel);
    galleryAppTabIndex = deckPanel.getWidgetCount();
    deckPanel.add(aVertPanel);

    // User Admin Panel
    VerticalPanel uaVertPanel = new VerticalPanel();
    uaVertPanel.setWidth("100%");
    uaVertPanel.setSpacing(0);
    HorizontalPanel adminUserListPanel = new HorizontalPanel();
    adminUserListPanel.setWidth("100%");
    adminUserListPanel.add(AdminUserListBox.getAdminUserListBox());
    uaVertPanel.add(adminUserListPanel);
    userAdminTabIndex = deckPanel.getWidgetCount();
    deckPanel.add(uaVertPanel);

    // KM: DEBUGGING BEGIN
    // User profile tab
    VerticalPanel uVertPanel = new VerticalPanel();
    uVertPanel.setWidth("100%");
    uVertPanel.setSpacing(0);
    HorizontalPanel userProfilePanel = new HorizontalPanel();
    userProfilePanel.setWidth("100%");
    userProfilePanel.add(ProfileBox.getUserProfileBox());

    uVertPanel.add(userProfilePanel);
    userProfileTabIndex = deckPanel.getWidgetCount();
    deckPanel.add(uVertPanel);
    // KM: DEBUGGING END

    // Private User Profile TabPanel
    VerticalPanel ppVertPanel = new VerticalPanel();
    ppVertPanel.setWidth("100%");
    ppVertPanel.setSpacing(0);
    HorizontalPanel privateUserProfileTabPanel = new HorizontalPanel();
    privateUserProfileTabPanel.setWidth("100%");
    privateUserProfileTabPanel.add(PrivateUserProfileTabPanel.getPrivateUserProfileTabPanel());
    ppVertPanel.add(privateUserProfileTabPanel);
    privateUserProfileIndex = deckPanel.getWidgetCount();
    deckPanel.add(ppVertPanel);

    // Moderation Page tab
    VerticalPanel mPVertPanel = new VerticalPanel();
    mPVertPanel.setWidth("100%");
    mPVertPanel.setSpacing(0);
    HorizontalPanel moderationPagePanel = new HorizontalPanel();
    moderationPagePanel.setWidth("100%");

    moderationPagePanel.add(ModerationPageBox.getModerationPageBox());

    mPVertPanel.add(moderationPagePanel);
    moderationPageTabIndex = deckPanel.getWidgetCount();
    deckPanel.add(mPVertPanel);

    // Debugging tab
    if (AppInventorFeatures.hasDebuggingView()) {

        Button dismissButton = new Button(MESSAGES.dismissButton());
        dismissButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                if (currentView == DESIGNER)
                    switchToDesignView();
                else
                    switchToProjectsView();
            }
        });

        ColumnLayout defaultLayout = new ColumnLayout("Default");
        Column column = defaultLayout.addColumn(100);
        column.add(MessagesOutputBox.class, 300, false);
        column.add(OdeLogBox.class, 300, false);
        final WorkAreaPanel debuggingTab = new WorkAreaPanel(new OdeBoxRegistry(), defaultLayout);

        debuggingTab.add(dismissButton);

        debuggingTabIndex = deckPanel.getWidgetCount();
        deckPanel.add(debuggingTab);

        // Hook the window resize event, so that we can adjust the UI.
        Window.addResizeHandler(new ResizeHandler() {
            @Override
            public void onResize(ResizeEvent event) {
                resizeWorkArea(debuggingTab);
            }
        });

        // Call the window resized handler to get the initial sizes setup. Doing this in a deferred
        // command causes it to occur after all widgets' sizes have been computed by the browser.
        DeferredCommand.addCommand(new Command() {
            @Override
            public void execute() {
                resizeWorkArea(debuggingTab);
            }
        });

        resizeWorkArea(debuggingTab);
    }

    // We do not select the designer tab here because at this point there is no current project.
    // Instead, we select the projects tab. If the user has a previously opened project, we will
    // open it and switch to the designer after the user settings are loaded.
    // Remember, the user may not have any projects at all yet.
    // Or, the user may have deleted their previously opened project.
    // ***** THE DESIGNER TAB DOES NOT DISPLAY CORRECTLY IF THERE IS NO CURRENT PROJECT. *****
    deckPanel.showWidget(projectsTabIndex);

    mainPanel.add(deckPanel, DockPanel.CENTER);
    mainPanel.setCellHeight(deckPanel, "100%");
    mainPanel.setCellWidth(deckPanel, "100%");

    //    mainPanel.add(switchToDesignerButton, DockPanel.WEST);
    //    mainPanel.add(switchToBlocksButton, DockPanel.EAST);

    //Commenting out for now to gain more space for the blocks editor
    mainPanel.add(statusPanel, DockPanel.SOUTH);
    mainPanel.setSize("100%", "100%");
    RootPanel.get().add(mainPanel);

    // Add a handler to the RootPanel to keep track of Google Chrome Pinch Zooming and
    // handle relevant bugs. Chrome maps a Pinch Zoom to a MouseWheelEvent with the
    // control key pressed.
    RootPanel.get().addDomHandler(new MouseWheelHandler() {
        @Override
        public void onMouseWheel(MouseWheelEvent event) {
            if (event.isControlKeyDown()) {
                // Trip the appropriate flag in PZAwarePositionCallback when the page
                // is Pinch Zoomed. Note that this flag does not need to be removed when
                // the browser is un-zoomed because the patched function for determining
                // absolute position works in all circumstances.
                PZAwarePositionCallback.setPinchZoomed(true);
            }
        }
    }, MouseWheelEvent.getType());

    // There is no sure-fire way of preventing people from accidentally navigating away from ODE
    // (e.g. by hitting the Backspace key). What we do need though is to make sure that people will
    // not lose any work because of this. We hook into the window closing  event to detect the
    // situation.
    Window.addWindowClosingHandler(new Window.ClosingHandler() {
        @Override
        public void onWindowClosing(Window.ClosingEvent event) {
            onClosing();
        }
    });

    setupMotd();
}

From source file:com.google.appinventor.client.widgets.boxes.Box.java

License:Open Source License

/**
 * Creates a new box.//from   ww  w . j  av a  2 s  . com
 *
 * @param caption  box caption
 * @param height  box initial height in pixel
 * @param minimizable  indicates whether box can be minimized
 * @param removable  indicates whether box can be closed/removed
 * @param startMinimized indicates whether box should always start minimized
 * @param bodyPadding indicates whether box should have padding
 * @param highlightCaption indicates whether caption should be highlighted
 *                         until user has "seen" it (interacts with the box)
 */
protected Box(String caption, int height, boolean minimizable, boolean removable, boolean startMinimized,
        boolean bodyPadding, boolean highlightCaption) {
    this.height = height;
    this.restoreHeight = height;
    this.startMinimized = startMinimized;
    this.highlightCaption = highlightCaption;

    captionLabel = new Label(caption, false);
    captionAlreadySeen = false;
    if (highlightCaption) {
        captionLabel.setStylePrimaryName("ode-Box-header-caption-highlighted");
    } else {
        captionLabel.setStylePrimaryName("ode-Box-header-caption");
    }
    header = new HandlerPanel();
    header.add(captionLabel);
    header.setWidth("100%");

    headerContainer = new DockPanel();
    headerContainer.setStylePrimaryName("ode-Box-header");
    headerContainer.setWidth("100%");
    headerContainer.add(header, DockPanel.LINE_START);

    Images images = Ode.getImageBundle();

    if (removable) {
        PushButton closeButton = Ode.createPushButton(images.boxClose(), MESSAGES.hdrClose(),
                new ClickHandler() {
                    @Override
                    public void onClick(ClickEvent event) {
                        // TODO(user) - remove the box
                        Window.alert("Not implemented yet!");
                    }
                });
        headerContainer.add(closeButton, DockPanel.LINE_END);
        headerContainer.setCellWidth(closeButton,
                (closeButton.getOffsetWidth() + HEADER_CONTROL_PADDING) + "px");
    }

    if (!minimizable) {
        minimizeButton = null;
    } else {
        minimizeButton = Ode.createPushButton(images.boxMinimize(), MESSAGES.hdrMinimize(), new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                if (isMinimized()) {
                    restore();
                } else {
                    minimize();
                }
            }
        });
        headerContainer.add(minimizeButton, DockPanel.LINE_END);
        headerContainer.setCellWidth(minimizeButton,
                (minimizeButton.getOffsetWidth() + HEADER_CONTROL_PADDING) + "px");
    }

    if (minimizable || removable) {
        menuButton = Ode.createPushButton(images.boxMenu(), MESSAGES.hdrSettings(), new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                final ContextMenu contextMenu = new ContextMenu();
                contextMenu.addItem(MESSAGES.cmMinimize(), new Command() {
                    @Override
                    public void execute() {
                        if (!isMinimized()) {
                            minimize();
                        }
                    }
                });
                contextMenu.addItem(MESSAGES.cmRestore(), new Command() {
                    @Override
                    public void execute() {
                        if (isMinimized()) {
                            restore();
                        }
                    }
                });
                if (!variableHeightBoxes) {
                    contextMenu.addItem(MESSAGES.cmResize(), new Command() {
                        @Override
                        public void execute() {
                            restore();
                            final ResizeControl resizeControl = new ResizeControl();
                            resizeControl.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
                                @Override
                                public void setPosition(int offsetWidth, int offsetHeight) {
                                    // SouthEast
                                    int left = menuButton.getAbsoluteLeft() + menuButton.getOffsetWidth()
                                            - offsetWidth;
                                    int top = menuButton.getAbsoluteTop() + menuButton.getOffsetHeight();
                                    resizeControl.setPopupPosition(left, top);
                                }
                            });
                        }
                    });
                }
                contextMenu.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
                    @Override
                    public void setPosition(int offsetWidth, int offsetHeight) {
                        // SouthEast
                        int left = menuButton.getAbsoluteLeft() + menuButton.getOffsetWidth() - offsetWidth;
                        int top = menuButton.getAbsoluteTop() + menuButton.getOffsetHeight();
                        contextMenu.setPopupPosition(left, top);
                    }
                });
            }
        });
        headerContainer.add(menuButton, DockPanel.LINE_END);
        headerContainer.setCellWidth(menuButton, (menuButton.getOffsetWidth() + HEADER_CONTROL_PADDING) + "px");
    } else {
        menuButton = null;
    }

    body = new SimplePanel();
    body.setSize("100%", "100%");

    scrollPanel = new ScrollPanel();
    scrollPanel.setStylePrimaryName("ode-Box-body");
    if (bodyPadding) {
        scrollPanel.addStyleName("ode-Box-body-padding");
    }
    scrollPanel.add(body);

    FlowPanel boxContainer = new FlowPanel();
    boxContainer.setStyleName("ode-Box-content");
    boxContainer.add(headerContainer);
    boxContainer.add(scrollPanel);

    setStylePrimaryName("ode-Box");
    setWidget(boxContainer);
}

From source file:com.google.code.p.gwtchismes.client.GWTCDatePickerAbstract.java

License:Apache License

/**
 * Creates the calendar instance based in the configuration provided. 
 * //from   w w  w .  j  av a2 s. co  m
 * Options can be passed joining these using the or bit wise operator
 * <ul>
 * <li>CONFIG_DIALOG            show as modal dialog</li>
 * <li>CONFIG_ROUNDED_BOX       wrap with a rounded-corner box</li>
 * <li>CONFIG_NO_AUTOHIDE       don't autohide dialog when the user click out of the picker</li>
 * <li>CONFIG_NO_ANIMATION      don't animate the dialog box when it is showed/hidden</li>
 * <li>CONFIG_NO_ANIMATION      don't animate the dialog box when it is showed/hidden</li>
 * <li>CONFIG_BACKGROUND        show a semitransparent background covering all the document</li>
 * <li>CONFIG_FLAT_BUTTONS      use native Buttons instead of GWTCButton also add the dependent class 'flat'</li>
 * <li>CONFIG_STANDARD_BUTTONS  use native browser Buttons instead of GWTCButton</li>
 * </ul>
 */
public void initialize(int config) {

    int buttonsType = config & CONFIG_FLAT_BUTTONS | config & CONFIG_STANDARD_BUTTONS;
    helpBtn = createButton(buttonsType, "?", this);
    closeBtn = createButton(buttonsType, "x", this);
    todayBtn = createButton(buttonsType, "-", this);
    prevMBtn = createButton(buttonsType, "\u003c", this);
    prevYBtn = createButton(buttonsType, "\u00AB", this);
    nextMBtn = createButton(buttonsType, "\u003e", this);
    nextYBtn = createButton(buttonsType, "\u00BB", this);

    if ((config & CONFIG_DIALOG) == CONFIG_DIALOG) {
        int opt = 0;
        if ((config & CONFIG_ROUNDED_BOX) == CONFIG_ROUNDED_BOX) {
            opt |= GWTCModalBox.OPTION_ROUNDED_FLAT;
        }
        if ((config & CONFIG_BACKGROUND) != CONFIG_BACKGROUND) {
            opt |= GWTCModalBox.OPTION_DISABLE_BACKGROUND;
            if ((config & CONFIG_NO_AUTOHIDE) == CONFIG_NO_AUTOHIDE) {
                opt |= GWTCModalBox.OPTION_DISABLE_AUTOHIDE;
            }
        }
        calendarDlg = new GWTCModalBox(opt);
        calendarDlg.setAnimationEnabled((config & CONFIG_NO_ANIMATION) != CONFIG_NO_ANIMATION);

        outer = calendarDlg;
        initWidget(new DockPanel());

        setStyleName(styleName);
        addStyleDependentName(StyleDialog);
        setZIndex(999);
    } else {
        if ((config & CONFIG_ROUNDED_BOX) == CONFIG_ROUNDED_BOX) {
            outer = new GWTCBox(GWTCBox.STYLE_FLAT);
        } else {
            outer = new VerticalPanel();
        }
        String s = outer.getStyleName();
        initWidget(outer);
        setStyleName(styleName);
        addStyleDependentName(StyleEmbeded);
        if (s != null && s.length() > 0)
            addStyleName(s);
    }

    helpDlg.addStyleName(StyleHelp);
    navButtonsTop.setStyleName(StyleCButtonsTop);
    navButtonsBottom.setStyleName(StyleCButtonsBottom);
    calendarGrid.setStyleName(StyleMonthGrid);
    navButtonsTop.setWidth("100%");
    calendarGrid.setWidth("100%");
    navButtonsBottom.setWidth("100%");

    if ((config & CONFIG_ROUNDED_BOX) == CONFIG_ROUNDED_BOX)
        addStyleDependentName(StyleBox);
    else
        addStyleDependentName(StyleNoBox);

    if ((config & CONFIG_DIALOG) != CONFIG_DIALOG)
        closeBtn.setVisible(false);

    monthSelectorHeader.setAnimationEnabled(true);

    outer.add(navButtonsTop);
    outer.add(calendarGrid);
    outer.add(navButtonsBottom);

    drawDatePickerWidget();
    refresh();

    DOM.sinkEvents(outer.getElement(), Event.ONMOUSEOVER | Event.ONMOUSEOUT | Event.ONCLICK);
    DOM.setStyleAttribute(outer.getElement(), "cursor", "default");
    DOM.setElementAttribute(monthMenu.getElement(), "align", "center");
}

From source file:com.google.code.p.gwtchismes.client.GWTCPopupBox.java

License:Apache License

protected void initialize(int options) {
    super.clear();
    if ((options & OPTION_ROUNDED_GREY) == OPTION_ROUNDED_GREY) {
        panelbox = new GWTCBox(GWTCBox.STYLE_GREY);
    } else if ((options & OPTION_ROUNDED_BLUE) == OPTION_ROUNDED_BLUE) {
        panelbox = new GWTCBox(GWTCBox.STYLE_BLUE);
        super.add(panelbox);
    } else if ((options & OPTION_ROUNDED_FLAT) == OPTION_ROUNDED_FLAT) {
        panelbox = new GWTCBox(GWTCBox.STYLE_FLAT);
        super.add(panelbox);
    } else {//from   w ww  . j a  v a2s  .c om
        panel = new DockPanel();
        super.add(panel);
    }

    setAnimationEnabled((options & OPTION_ANIMATION) == OPTION_ANIMATION);
    if ((options & OPTION_DISABLE_BACKGROUND) != OPTION_DISABLE_BACKGROUND) {
        background = new GWTCGlassPanel();
        if ((options & OPTION_DISABLE_AUTOHIDE) != OPTION_DISABLE_AUTOHIDE) {
            background.addClickHandler(new ClickHandler() {
                public void onClick(ClickEvent event) {
                    hide();
                }
            });
        }
    }
    setZIndex(zIndex);
    setWidth("auto");
    setStyleName(MAIN_STYLE);
    if (panelbox != null)
        addStyleDependentName(STYLE_BOX);
}

From source file:com.google.gwt.maps.sample.hellomaps.client.DrawingOverlayDemo.java

License:Apache License

/**
 * Create the toolbar above the map. Note that the map must be initialized
 * before this method is called./*from  w w w .j  ava  2s .c  om*/
 */
private Widget makeToolbar() {
    DockPanel p = new DockPanel();
    p.setWidth("100%");

    HorizontalPanel buttonPanel = new HorizontalPanel();

    Button addButton = new Button("Draw new object");
    addButton.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            if (addPolyDialog == null) {
                addPolyDialog = makeAddPolyDialog();
            }
            addPolyDialog.center();
            addPolyDialog.show();
            if (lastPolygon != null) {
                lastPolygon.setEditingEnabled(false);
            }
            if (lastPolyline != null) {
                lastPolyline.setEditingEnabled(false);
            }
        }
    });
    buttonPanel.add(addButton);

    editPolylineButton.setEnabled(false);
    editPolylineButton.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            editPolyline();
        }
    });
    buttonPanel.add(editPolylineButton);

    editPolygonButton.setEnabled(false);
    editPolygonButton.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            editPolygon();
        }
    });
    buttonPanel.add(editPolygonButton);

    p.add(buttonPanel, DockPanel.EAST);

    return p;
}

From source file:com.google.gwt.sample.kitchensink.client.Images.java

License:Apache License

public Images() {
    image.addLoadListener(this);
    prevButton.addClickListener(this);
    nextButton.addClickListener(this);

    DockPanel topPanel = new DockPanel();
    topPanel.setVerticalAlignment(DockPanel.ALIGN_MIDDLE);
    topPanel.add(prevButton, DockPanel.WEST);
    topPanel.add(nextButton, DockPanel.EAST);
    topPanel.add(loadingImage, DockPanel.CENTER);

    VerticalPanel panel = new VerticalPanel();
    panel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
    panel.add(new HTML("<h2>A Bit of Rembrandt</h2>", true));
    panel.add(topPanel);/*from  w ww .ja v a2 s. c o  m*/
    panel.add(image);

    panel.setWidth("100%");
    initWidget(panel);
    image.setStyleName("ks-images-Image");
    nextButton.setStyleName("ks-images-Button");
    prevButton.setStyleName("ks-images-Button");

    loadImage(0);
}

From source file:com.google.gwt.sample.kitchensink.client.KitchenSink.java

License:Apache License

public void onModuleLoad() {
    // Load all the sinks.
    loadSinks();//w w w.  ja va  2 s . c  o m

    // Put the sink list on the left, and add the outer dock panel to the
    // root.
    sinkContainer = new DockPanel();
    sinkContainer.setStyleName("ks-Sink");

    VerticalPanel vp = new VerticalPanel();
    vp.setWidth("100%");
    vp.add(description);
    vp.add(sinkContainer);

    description.setStyleName("ks-Info");

    panel.add(list, DockPanel.WEST);
    panel.add(vp, DockPanel.CENTER);

    panel.setCellVerticalAlignment(list, HasAlignment.ALIGN_TOP);
    panel.setCellWidth(vp, "100%");

    History.addHistoryListener(this);
    RootPanel.get().add(panel);

    // Show the initial screen.
    String initToken = History.getToken();
    if (initToken.length() > 0)
        onHistoryChanged(initToken);
    else
        showInfo();
}

From source file:com.google.gwt.sample.kitchensink.client.Layouts.java

License:Apache License

public Layouts() {
    HTML contents = new HTML("This is a <code>ScrollPanel</code> contained at "
            + "the center of a <code>DockPanel</code>.  " + "By putting some fairly large contents "
            + "in the middle and setting its size explicitly, it becomes a "
            + "scrollable area within the page, but without requiring the use of " + "an IFRAME."
            + "Here's quite a bit more meaningless text that will serve primarily "
            + "to make this thing scroll off the bottom of its visible area.  "
            + "Otherwise, you might have to make it really, really small in order "
            + "to see the nifty scroll bars!");
    ScrollPanel scroller = new ScrollPanel(contents);
    scroller.setStyleName("ks-layouts-Scroller");

    DockPanel dock = new DockPanel();
    dock.setHorizontalAlignment(DockPanel.ALIGN_CENTER);
    HTML north0 = new HTML("This is the <i>first</i> north component", true);
    HTML east = new HTML("<center>This<br>is<br>the<br>east<br>component</center>", true);
    HTML south = new HTML("This is the south component");
    HTML west = new HTML("<center>This<br>is<br>the<br>west<br>component</center>", true);
    HTML north1 = new HTML("This is the <b>second</b> north component", true);
    dock.add(north0, DockPanel.NORTH);//from w  w w.  j  a v  a  2s.  c  o  m
    dock.add(east, DockPanel.EAST);
    dock.add(south, DockPanel.SOUTH);
    dock.add(west, DockPanel.WEST);
    dock.add(north1, DockPanel.NORTH);
    dock.add(scroller, DockPanel.CENTER);

    FlowPanel flow = new FlowPanel();
    for (int i = 0; i < 8; ++i)
        flow.add(new CheckBox("Flow " + i));

    HorizontalPanel horz = new HorizontalPanel();
    horz.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
    horz.add(new Button("Button"));
    horz.add(new HTML("<center>This is a<br>very<br>tall thing</center>", true));
    horz.add(new Button("Button"));

    VerticalPanel vert = new VerticalPanel();
    vert.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
    vert.add(new Button("Small"));
    vert.add(new Button("--- BigBigBigBig ---"));
    vert.add(new Button("tiny"));

    MenuBar menu = new MenuBar();
    MenuBar menu0 = new MenuBar(true), menu1 = new MenuBar(true);
    menu.addItem("menu0", menu0);
    menu.addItem("menu1", menu1);
    menu0.addItem("child00", (Command) null);
    menu0.addItem("child01", (Command) null);
    menu0.addItem("child02", (Command) null);
    menu1.addItem("child10", (Command) null);
    menu1.addItem("child11", (Command) null);
    menu1.addItem("child12", (Command) null);

    String id = HTMLPanel.createUniqueId();
    HTMLPanel html = new HTMLPanel("This is an <code>HTMLPanel</code>.  It allows you to add "
            + "components inside existing HTML, like this:" + "<span id='" + id + "'></span>"
            + "Notice how the menu just fits snugly in there?  Cute.");
    DOM.setStyleAttribute(menu.getElement(), "display", "inline");
    html.add(menu, id);

    VerticalPanel panel = new VerticalPanel();
    panel.setSpacing(8);
    panel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);

    panel.add(makeLabel("Dock Panel"));
    panel.add(dock);
    panel.add(makeLabel("Flow Panel"));
    panel.add(flow);
    panel.add(makeLabel("Horizontal Panel"));
    panel.add(horz);
    panel.add(makeLabel("Vertical Panel"));
    panel.add(vert);
    panel.add(makeLabel("HTML Panel"));
    panel.add(html);

    initWidget(panel);
    setStyleName("ks-layouts");
}