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

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

Introduction

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

Prototype

public DeckPanel() 

Source Link

Document

Creates an empty deck panel.

Usage

From source file:edu.caltech.ipac.firefly.core.layout.AbstractLayoutManager.java

protected Widget makeCenter() {

    final DockPanel resultsView = new DockPanel();
    resultsView.setSize("100%", "100%");

    final BaseRegion content = new BaseRegion(CONTENT_REGION);
    Widget w = content.getDisplay();//from  w w w .  ja  va 2s .c om
    w.setWidth("100%");
    addRegion(content);

    final Region query = getForm();
    final Region results = getResult();
    final Region title = getSearchTitle();
    final Region desc = getSearchDesc();

    GwtUtil.ImageButton img = GwtUtil.makeImageButton("images/disclosurePanelClosed.png", "Return to search",
            new ClickHandler() {
                public void onClick(ClickEvent event) {
                    Application.getInstance().processRequest(new Request(SearchCmd.COMMAND_NAME));
                }
            });

    boolean backToArrow = Application.getInstance().getProperties()
            .getBooleanProperty("BackToSearch.arrow.show", true);
    boolean searchDescLine = Application.getInstance().getProperties().getBooleanProperty("BackToSearch.show",
            true);

    final HorizontalPanel ttdesc = new HorizontalPanel();
    if (title != null && searchDescLine) {
        ttdesc.setWidth("100%");
        if (backToArrow) {
            ttdesc.add(img);
        }
        ttdesc.add(title.getDisplay());
        ttdesc.add(desc.getDisplay());
        ttdesc.setCellWidth(desc.getDisplay(), "100%");
        ttdesc.add(layoutSelector);
        WebEventManager.getAppEvManager().addListener(Name.REGION_SHOW, new WebEventListener() {
            public void eventNotify(WebEvent ev) {
                ttdesc.setVisible(Application.getInstance().hasSearchResult());
            }
        });
    }

    //        final Region download = getDownload();

    VerticalPanel vp = new VerticalPanel();
    vp.setWidth("100%");
    if (query.getDisplay() != null) {
        vp.add(query.getDisplay());
    }
    if (searchDescLine)
        vp.add(ttdesc);

    resultsView.add(vp, DockPanel.NORTH);
    resultsView.setCellHeight(vp, "10px");
    resultsView.add(results.getDisplay(), DockPanel.CENTER);
    resultsView.add(content.getDisplay(), DockPanel.SOUTH);

    WebEventManager.getAppEvManager().addListener(Name.REGION_SHOW, new WebEventListener() {
        public void eventNotify(WebEvent ev) {
            Region source = (Region) ev.getSource();
            if (DROPDOWN_REGION.equals(source.getId()) || RESULT_REGION.equals(source.getId())) {
                content.hide();
                resultsView.setCellHeight(results.getDisplay(), "100%");
                resultsView.setCellHeight(content.getDisplay(), "");
            } else if (CONTENT_REGION.equals(source.getId())) {
                query.hide();
                results.hide();
                resultsView.setCellHeight(content.getDisplay(), "100%");
                resultsView.setCellHeight(results.getDisplay(), "");
            }

        }
    });

    Region popoutRegion = getRegion(POPOUT_REGION);
    //        SimplePanel popoutView = new SimplePanel();
    //        popoutView.add(popoutRegion.getDisplay());

    final DeckPanel center = new DeckPanel();
    center.add(resultsView);
    center.add(popoutRegion.getDisplay());

    WebEventManager.getAppEvManager().addListener(Name.REGION_SHOW, new WebEventListener() {
        public void eventNotify(WebEvent ev) {
            Region source = (Region) ev.getSource();
            if (POPOUT_REGION.equals(source.getId())) {
                center.showWidget(1);
            } else if (RESULT_REGION.equals(source.getId())) {
                center.showWidget(0);
            }
        }
    });
    WebEventManager.getAppEvManager().addListener(Name.REGION_HIDE, new WebEventListener() {
        public void eventNotify(WebEvent ev) {
            Region source = (Region) ev.getSource();
            if (POPOUT_REGION.equals(source.getId())) {
                center.showWidget(0);
            }
        }
    });
    center.showWidget(0);
    return center;
}

From source file:edu.caltech.ipac.firefly.core.layout.IrsaLayoutManager.java

public void layout(String rootId) {

    AllPlots.getInstance().setToolBarIsPopup(false);

    init();//from  w  w w .j  a  va2 s  .c  om

    Region menuBar = getRegion(LayoutManager.MENU_REGION);
    Region appIcon = getRegion(LayoutManager.APP_ICON_REGION);
    Region adtlIcon = getRegion(LayoutManager.ADDTL_ICON_REGION);
    Region visTB = getRegion(LayoutManager.VIS_TOOLBAR_REGION);
    Region visRO = getRegion(LayoutManager.VIS_READOUT_REGION);
    Region visPV = getRegion(LayoutManager.VIS_PREVIEW_REGION);

    Widget pvOrIcoArea = visPV.getDisplay();

    if (adtlIcon != null) {
        final DeckPanel previewOrAddlIcon = new DeckPanel();
        previewOrAddlIcon.add(adtlIcon.getDisplay()); // idx 0
        previewOrAddlIcon.add(visPV.getDisplay()); // idx 1

        WebEventManager.getAppEvManager().addListener(Name.REGION_SHOW, new WebEventListener() {
            public void eventNotify(WebEvent ev) {
                Region source = (Region) ev.getSource();
                if (VIS_PREVIEW_REGION.equals(source.getId())) {
                    previewOrAddlIcon.showWidget(1);
                } else if (ADDTL_ICON_REGION.equals(source.getId())) {
                    previewOrAddlIcon.showWidget(0);
                } else if (RESULT_REGION.equals(source.getId())) {
                    // do nothing
                }
            }
        });
        WebEventManager.getAppEvManager().addListener(Name.REGION_HIDE, new WebEventListener() {
            public void eventNotify(WebEvent ev) {
                Region source = (Region) ev.getSource();
                if (VIS_PREVIEW_REGION.equals(source.getId())) {
                    previewOrAddlIcon.showWidget(0);
                }
            }
        });
        pvOrIcoArea = previewOrAddlIcon;
    }

    Widget readout = visRO == null ? new Label("") : visRO.getDisplay();
    readout.setSize("100%", "100%");

    HTMLPanel appBanner = new HTMLPanel("<div id='container' style='width:100%'>\n"
            + "<div id='app-icon' style='background: url(images/ipac_bar.jpg);height:75px;width:75px;float:left;'></div>\n"
            + "<div id='alt-app-icon' style='background: url(images/ipac_bar.jpg);height:75px;width:148px;float:right;'></div>\n"
            + "<div style='position:absolute;left:75px;right:148px;min-width:820px'>\n"
            + "<div id='readout' style='background: url(images/ipac_bar.jpg);height:45px;width:100%;'></div>\n"
            + "<div id='menu-bar' style='background: url(images/ipac_bar.jpg);height:30px;width:100%'></div>\n"
            + "</div>\n");

    appBanner.add(menuBar.getDisplay(), "menu-bar");
    appBanner.add(readout, "readout");
    appBanner.add(appIcon.getDisplay(), "app-icon");
    appBanner.add(pvOrIcoArea, "alt-app-icon");

    //        // now.. add the menu to the top
    Toolbar toolbar = Application.getInstance().getToolBar();
    GwtUtil.setStyles(toolbar, "width", "100%", "position", "absolute");
    GwtUtil.setStyles(toolbar.getDropdown(), "zIndex", "10", "position", "absolute");
    getMenu().setDisplay(toolbar);

    mainPanel.add(appBanner, DockPanel.NORTH);
    mainPanel.setCellHeight(appBanner, "1px");
    mainPanel.add(toolbar.getDropdown(), DockPanel.NORTH);
    mainPanel.setCellHeight(toolbar.getDropdown(), "1px");
    //        mainPanel.setCellHeight(toolbar.getDropDownComponent(), "1px");
    mainPanel.add(visTB.getDisplay(), DockPanel.NORTH);
    mainPanel.setCellHeight(visTB.getDisplay(), "1px");
    mainPanel.setSize("100%", "100%");

    // making results area.
    Widget center = makeCenter();
    mainPanel.add(center, DockPanel.CENTER);
    GwtUtil.setStyles(center, "position", "absolute", "left", "10px", "right", "10px", "top", "120px", "bottom",
            "1px");

    if (rootId != null) {
        RootPanel root = RootPanel.get(rootId);
        if (root == null) {
            throw new RuntimeException("Application is not setup correctly; unable to find " + rootId);
        }
        root.add(mainPanel);
        GwtUtil.setStyles(root, "position", "absolute", "top", topOffset + "px", "left", "1px", "right", "1px",
                "bottom", "1px", "minWidth", getMinWidth() + "px", "minHeight", getMinHeight() + "px");
    } else {
        RootPanel.get().add(mainPanel);
    }

    Image icon = Application.getInstance().getCreator().getMissionIcon();
    if (icon != null) {
        icon.setSize("75px", "75px");
        getRegion(APP_ICON_REGION).setDisplay(icon);
    }

}

From source file:edu.caltech.ipac.firefly.ui.table.filter.FilterPanel.java

private void build() {

    mainPanel = new FlexTable();

    // create columns field
    colsField = new ListBox(false);
    colsField.setWidth("130px");
    colsField.addChangeHandler(new ChangeHandler() {
        public void onChange(ChangeEvent event) {
            ensureValueField();//w w w.  j a v a2 s .  c  o m
        }
    });

    // create operator field
    List<EnumFieldDef.Item> opItems = new ArrayList<EnumFieldDef.Item>();
    opItems.add(new EnumFieldDef.Item("="));
    opItems.add(new EnumFieldDef.Item(">"));
    opItems.add(new EnumFieldDef.Item("<"));
    opItems.add(new EnumFieldDef.Item("!="));
    opItems.add(new EnumFieldDef.Item(">="));
    opItems.add(new EnumFieldDef.Item("<="));
    opItems.add(new EnumFieldDef.Item("IN"));
    opItems.add(new EnumFieldDef.Item("LIKE"));
    EnumFieldDef ops = new EnumFieldDef("operator");
    ops.addItems(opItems);
    ops.setNullAllow(false);
    ops.setErrMsg("This field is required. Select one from list");
    opsField = GwtUtil.createComboBox(ops);
    opsField.setWidth("50px");
    opsField.addChangeHandler(new ChangeHandler() {
        public void onChange(ChangeEvent event) {
            ensureValueField();
        }
    });

    textInput = new TextBox();
    textInput.setVisibleLength(15);
    textInput.addKeyPressHandler(new KeyPressHandler() {
        public void onKeyPress(KeyPressEvent ev) {
            final char keyCode = ev.getCharCode();
            DeferredCommand.addCommand(new Command() {
                public void execute() {
                    if (keyCode == KeyCodes.KEY_ENTER) {
                        addCondition();
                    }
                }
            });
        }
    });

    valueDisplay = new DeckPanel();
    valueDisplay.setWidth("130px");
    enumInput = createEnumInput(false);

    display = new ListBox(true);
    display.setPixelSize(210, 70);

    add = GwtUtil.makeButton("<< Add", "Add this filter to the list", new ClickHandler() {
        public void onClick(ClickEvent ev) {
            addCondition();
        }
    });

    remove = GwtUtil.makeButton("Remove", "Remove the selected filter from the list", new ClickHandler() {
        public void onClick(ClickEvent ev) {
            for (int i = 0; i < display.getItemCount(); i++) {
                if (display.isItemSelected(i)) {
                    display.removeItem(i);
                    pcs.firePropertyChange(SEL_UPDATED, true, true);
                }
            }
            ensureCommands();
        }
    });

    removeAll = GwtUtil.makeButton("Remove All", "Remove all of the filters from the list", new ClickHandler() {
        public void onClick(ClickEvent ev) {
            display.clear();
            pcs.firePropertyChange(SEL_UPDATED, true, true);
            ensureCommands();
        }
    });

    remove.setEnabled(false);
    removeAll.setEnabled(false);

    // setup listeners to enable/disable command buttons
    display.addChangeHandler(new ChangeHandler() {
        public void onChange(ChangeEvent ev) {
            ensureCommands();
        }
    });
}

From source file:edu.caltech.ipac.firefly.visualize.graph.XYPlotWidget.java

@Override
protected Widget getMenuBar() {
    FlowPanel menuBar = new FlowPanel();
    //GwtUtil.setStyle(menuBar, "borderBottom", "1px solid #bbbbbb");
    menuBar.setWidth("100%");

    HorizontalPanel left = new HorizontalPanel();
    left.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE);
    left.setSpacing(10);/*ww  w . j  a va2 s  .  co m*/
    GwtUtil.setStyle(left, "align", "left");

    HorizontalPanel rightBtnsPanel;
    rightBtnsPanel = new HorizontalPanel();
    rightBtnsPanel.setSpacing(10);
    GwtUtil.setStyle(rightBtnsPanel, "align", "center");
    GwtUtil.setStyle(rightBtnsPanel, "paddingRight", "20px");

    VisIconCreator ic = VisIconCreator.Creator.getInstance();

    left.add(GwtUtil.makeImageButton(new Image(ic.getSettings()), "Plot options and tools", new ClickHandler() {
        public void onClick(ClickEvent clickEvent) {
            showOptions();
        }
    }));

    Widget saveBtn = GwtUtil.makeImageButton(new Image(TableImages.Creator.getInstance().getSaveImage()),
            "Download data in IPAC table format", new ClickHandler() {
                public void onClick(ClickEvent clickEvent) {
                    Frame f = Application.getInstance().getNullFrame();
                    String url;
                    if (_sourceFile.contains("://")) {
                        url = _sourceFile;
                    } else {
                        Param[] params = new Param[2];
                        //if (_suggestedName != null) {
                        //    params = new Param[3];
                        //    params[2] = new Param("return", _suggestedName);
                        //} else {
                        //    params = new Param[2];
                        //}
                        params[0] = new Param("file", _sourceFile);
                        params[1] = new Param("log", "true");
                        url = WebUtil.encodeUrl(GWT.getModuleBaseURL() + "servlet/Download", params);
                    }
                    f.setUrl(url);
                }
            });

    if (plotMode.equals(PlotMode.TABLE_VIEW)) {

        // no save button in table view mode - user should use "Save" button on table
        // left.add(saveBtn);

        _filters = new FilterToggle(this);
        left.add(_filters);

        left.add(_loading);
        _loading.setVisible(false);

        zoomToggle = new DeckPanel();
        zoomToggle.setVisible(false);
        zoomToggle.add(GwtUtil.makeImageButton(new Image(ic.getZoomUpSmall()), "Zoom in the enclosed points",
                new ClickHandler() {
                    public void onClick(ClickEvent clickEvent) {
                        if (_data != null) {
                            if (_currentSelection != null) {
                                _selectionCurve.setVisible(false);
                                int numPoints = _data.getNPoints(_currentSelection.xMinMax,
                                        _currentSelection.yMinMax);
                                if (numPoints < 1) {
                                    _currentSelection = null;
                                    updateOnSelectionBtns();
                                    return;
                                }
                                _savedZoomSelection = new Selection(_currentSelection.xMinMax,
                                        _currentSelection.yMinMax);
                                updateOnSelectionBtns();
                                if (_data.isSampled()) {
                                    _meta.userMeta.setXLimits(_currentSelection.xMinMax);
                                    _meta.userMeta.setYLimits(_currentSelection.yMinMax);
                                    updateMeta(_meta, true);
                                } else {
                                    setChartAxesForSelection(_currentSelection.xMinMax,
                                            _currentSelection.yMinMax);
                                    // clear previous limits, if any
                                    _meta.userMeta.setXLimits(null);
                                    _meta.userMeta.setYLimits(null);
                                }
                                _chart.update();
                            }
                        }
                    }
                }));
        zoomToggle.add(GwtUtil.makeImageButton(new Image(ic.getZoomOriginalSmall()),
                "Zoom out to original chart", new ClickHandler() {
                    public void onClick(ClickEvent clickEvent) {
                        if (_data != null) {
                            _savedZoomSelection = null;
                            if (XYPlotData.shouldSample(_dataSet.getSize())
                                    || _tableModel.getTotalRows() >= MIN_ROWS_FOR_DECIMATION) {
                                _meta.userMeta.setXLimits(null);
                                _meta.userMeta.setYLimits(null);
                                updateMeta(_meta, false);
                            } else {
                                setChartAxes();
                            }
                            updateOnSelectionBtns();
                            _chart.update();
                        }
                    }
                }));
        zoomToggle.showWidget(1);
        rightBtnsPanel.add(zoomToggle);

        selectToggle = new DeckPanel();
        selectToggle.setVisible(false);
        selectToggle.add(GwtUtil.makeImageButton(new Image(ic.getSelectRows()), "Select enclosed points",
                new ClickHandler() {
                    public void onClick(ClickEvent clickEvent) {
                        if (_currentSelection != null) {
                            _selectionCurve.setVisible(false);
                            setSelected(_currentSelection.xMinMax, _currentSelection.yMinMax);
                            updateOnSelectionBtns();
                        }
                    }
                }));
        selectToggle.add(GwtUtil.makeImageButton(new Image(ic.getUnselectRows()),
                "Unselect all selected points", new ClickHandler() {
                    public void onClick(ClickEvent clickEvent) {
                        if (_data != null) {
                            if (_selectedPoints != null) {
                                _selectedPoints.clearPoints();
                                _selectedPoints.setCurveData(null);
                            }
                            if (_tableModel.getCurrentData() != null) {
                                _suspendEvents = true;
                                _tableModel.getCurrentData().deselectAll();
                                _suspendEvents = false;
                            }
                            updateOnSelectionBtns();
                            _chart.update();
                        }
                    }
                }));
        selectToggle.showWidget(0);
        rightBtnsPanel.add(selectToggle);

        _filterSelectedLink = GwtUtil.makeImageButton(new Image(ic.getFilterIn()),
                "Filter in the selected points", new ClickHandler() {
                    public void onClick(ClickEvent clickEvent) {
                        if (_currentSelection != null) {
                            _selectionCurve.setVisible(false);
                            setSelected(_currentSelection.xMinMax, _currentSelection.yMinMax);
                            filterSelected();
                            updateOnSelectionBtns();
                        }
                    }
                });
        _filterSelectedLink.setVisible(false);
        rightBtnsPanel.add(_filterSelectedLink);
    } else {
        // no selection or filter options

        left.add(_loading);
        _loading.setVisible(false);

        rightBtnsPanel.add(saveBtn);
        rightBtnsPanel.add(GwtUtil.makeImageButton(new Image(ic.getZoomOriginalSmall()),
                "Zoom out to original chart", new ClickHandler() {
                    public void onClick(ClickEvent clickEvent) {
                        if (_data != null) {
                            _savedZoomSelection = null;
                            setChartAxes();
                            _chart.update();
                            _actionHelp.setHTML(ZOOM_IN_HELP);
                        }
                    }
                }));
    }
    left.add(_chartTitle);

    rightBtnsPanel.add(super.getPopoutToolbar());
    enableExpansionToolbarHiding();

    menuBar.add(GwtUtil.leftRightAlign(new Widget[] { left }, new Widget[] { rightBtnsPanel }));

    return menuBar;
}

From source file:fr.aliasource.webmail.client.settings.SettingsPanel.java

License:GNU General Public License

public SettingsPanel(View wm) {
    this.ui = wm;
    sectionTitles = new HorizontalPanel();
    sectionTitles.setSpacing(5);/*from w  w  w . ja  v a  2 s. c  o m*/
    sectionTitles.addStyleName("panelActions");
    sections = new DeckPanel();
    sections.setWidth("100%");

    add(sectionTitles);
    add(sections);

    globalSettingsTab = new GlobalSettingsTab(ui);

    folderSettingsTab = new FolderSettingsTab(ui);

    filterSettingsTab = new FilterSettingsTab(ui);

    addSettingsSection(globalSettingsTab, I18N.strings.general());
    addSettingsSection(folderSettingsTab, I18N.strings.folders());
    if (Features.FILTERS) {
        addSettingsSection(filterSettingsTab, I18N.strings.filtersTabTitle());
    }
    WebmailController.get().addServerSettingsListener(this);
}

From source file:net.fabioalmeida.ferramentas.client.Principal.java

License:Apache License

public Principal() {

    dockPanel = new DockPanel();
    dockPanel.setStyleName("fan-dockPanel-principal");
    initWidget(dockPanel);/*from w ww .j a va2 s  . c o m*/
    dockPanel.setSize("950px", "1000px");

    absolutePanel = new AbsolutePanel();
    dockPanel.add(absolutePanel, DockPanel.NORTH);
    dockPanel.setCellHeight(absolutePanel, "90px");
    absolutePanel.setHeight("90px");

    lblNewLabel_1 = new Label("Ferramentas");
    lblNewLabel_1.setStyleName("fan-Label-Titulo");
    absolutePanel.add(lblNewLabel_1, 10, 10);

    absolutePanel_1 = new AbsolutePanel();
    absolutePanel_1.setStyleName("fan-titulo-menu");
    absolutePanel.add(absolutePanel_1, 0, 62);
    absolutePanel_1.setSize("950px", "28px");

    nlnhtmlNewInlinehtml = new InlineHTML(
            "<a class=\"fan-link\" href=\"http://fabioalmeida.net\">Fbio Almeida</a>");
    nlnhtmlNewInlinehtml.setStyleName("fan-InlineHTML");
    absolutePanel_1.add(nlnhtmlNewInlinehtml, 829, 10);

    panelMenuEsquerdo = new AbsolutePanel();
    panelMenuEsquerdo.setStyleName("fan-menu-esquerda");
    dockPanel.add(panelMenuEsquerdo, DockPanel.WEST);
    dockPanel.setCellWidth(panelMenuEsquerdo, "160px");
    panelMenuEsquerdo.setSize("160px", "910px");

    stackPanel = new StackPanel();
    panelMenuEsquerdo.add(stackPanel, 0, 0);
    stackPanel.setSize("156px", "908px");

    flowPanel = new FlowPanel();
    stackPanel.add(flowPanel, "Ferramentas", false);
    flowPanel.setSize("100%", "100%");

    geraCpfButton = FanFactory.createButtonMenu("CPF / CNPJ");
    flowPanel.add(geraCpfButton);
    geraCpfButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            deckPanel.showWidget(0);
        }
    });

    stringUtilButton = FanFactory.createButtonMenu("String Util");
    stringUtilButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            deckPanel.showWidget(1);
        }
    });
    flowPanel.add(stringUtilButton);
    stringUtilButton.setWidth("145px");

    stubButton = FanFactory.createButtonMenu("Stub Util");
    stubButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            deckPanel.showWidget(2);
        }
    });
    flowPanel.add(stubButton);
    stubButton.setWidth("145px");

    panelCentro = new AbsolutePanel();
    dockPanel.add(panelCentro, DockPanel.CENTER);
    panelCentro.setSize("790px", "910px");

    deckPanel = new DeckPanel();
    deckPanel.setAnimationEnabled(true);
    panelCentro.add(deckPanel);
    deckPanel.setStyleName("fan-deckPanel-centro");
    deckPanel.setSize("790px", "100%");

    panelGeradores = new AbsolutePanel();
    panelGeradores.setStyleName("fan-dockPanel-principal");
    deckPanel.add(panelGeradores);

    cpfParaValidarTextBox = new TextBox();
    panelGeradores.add(cpfParaValidarTextBox, 133, 61);

    validarCpfButton = new Button("New button");
    validarCpfButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            String scpf = cpfParaValidarTextBox.getText();
            NumeroCpf cpf = new NumeroCpf(scpf);
            boolean b = cpf.valido();
            if (b) {
                respostaCpfLabel.setText("cpf vlido");
            } else {
                respostaCpfLabel.setText("cpf invlido");
            }

        }
    });
    validarCpfButton.setText("Validar CPF");
    panelGeradores.add(validarCpfButton, 28, 65);
    validarCpfButton.setSize("93px", "25px");

    lblNewLabel = new Label("CPF / CNPJ");
    panelGeradores.add(lblNewLabel, 10, 10);
    lblNewLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    lblNewLabel.setStyleName("fan-label-titulo");
    lblNewLabel.setSize("770px", "19px");

    gerarCpfButton = new Button("Gerar CPF");
    gerarCpfButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            NumeroCpf cpf = new NumeroCpf();
            if (formatadoCpfCheckBox.getValue()) {
                cpfGeradoTextBox.setText(cpf.formatado());

            } else {
                cpfGeradoTextBox.setText(cpf.toString());

            }
        }
    });
    panelGeradores.add(gerarCpfButton, 28, 108);
    gerarCpfButton.setSize("93px", "25px");

    cpfGeradoTextBox = new TextBox();
    panelGeradores.add(cpfGeradoTextBox, 133, 106);

    respostaCpfLabel = new Label(">                    ");
    respostaCpfLabel.setStyleName("fan-resposta-Label");
    panelGeradores.add(respostaCpfLabel, 319, 69);

    validarCnpjButton = new Button("Validar CNPJ");
    validarCnpjButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            String scnpj = cnpjValidarTextBox.getText();
            NumeroCnpj cnpj = new NumeroCnpj(scnpj);
            boolean b = cnpj.valido();
            if (b) {
                respostaCnpjLabel.setText("cnpj vlido");
            } else {
                respostaCnpjLabel.setText("cnpj invlido");
            }

        }
    });
    panelGeradores.add(validarCnpjButton, 28, 167);

    gerarCnpjButton = new Button("Gerar CNPJ");
    gerarCnpjButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            NumeroCnpj cnpj = new NumeroCnpj();
            String scnpj = null;
            if (formatadoCheckBox.getValue()) {
                scnpj = cnpj.formatado();
            } else {
                scnpj = cnpj.toString();
            }
            cnpjGeradoTextBox.setText(scnpj);
        }
    });
    panelGeradores.add(gerarCnpjButton, 28, 211);
    gerarCnpjButton.setSize("93px", "25px");

    cnpjValidarTextBox = new TextBox();
    panelGeradores.add(cnpjValidarTextBox, 133, 165);

    respostaCnpjLabel = new Label(">");
    respostaCnpjLabel.setStyleName("fan-resposta-Label");
    panelGeradores.add(respostaCnpjLabel, 319, 167);

    cnpjGeradoTextBox = new TextBox();
    cnpjGeradoTextBox.setName("cnpjgerado");
    panelGeradores.add(cnpjGeradoTextBox, 133, 209);

    formatadoCheckBox = new CheckBox("Formatado");
    panelGeradores.add(formatadoCheckBox, 133, 242);

    formatadoCpfCheckBox = new CheckBox("Formatado");
    panelGeradores.add(formatadoCpfCheckBox, 133, 137);

    btnTeste = FanFactory.createButtonMenu("CPF / CNPJ");
    btnTeste.setHTML("Teste");
    panelGeradores.add(btnTeste, 28, 314);

    panelStringUtil = new AbsolutePanel();
    deckPanel.add(panelStringUtil);

    lblStringUtil = new Label("String Util");
    lblStringUtil.setStyleName("fan-label-titulo");
    lblStringUtil.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    panelStringUtil.add(lblStringUtil, 10, 10);
    lblStringUtil.setSize("770px", "19px");

    panelStubUtil = new AbsolutePanel();
    deckPanel.add(panelStubUtil);

    lblStubUtil = new Label("Stub Util");
    lblStubUtil.setStyleName("fan-label-titulo");
    lblStubUtil.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    panelStubUtil.add(lblStubUtil, 10, 10);
    lblStubUtil.setSize("770px", "19px");

    lblLabel = new Label("Label");
    panelStubUtil.add(lblLabel, 54, 99);

    textBox = new TextBox();
    textBox.setName("meutextbox");
    panelStubUtil.add(textBox, 54, 133);

    tglbtnTeste = new ToggleButton("teste");
    panelStubUtil.add(tglbtnTeste, 54, 196);

    chckbxNewCheckBox = new CheckBox("New check box");
    panelStubUtil.add(chckbxNewCheckBox, 57, 238);

    dateBox = new DateBox();
    panelStubUtil.add(dateBox, 54, 297);

    DOM.setElementProperty(dateBox.getElement(), "myid", "datebox");

    listBox = new ListBox();
    panelStubUtil.add(listBox, 114, 356);
    listBox.setVisibleItemCount(5);
    deckPanel.showWidget(2);
}

From source file:net.s17fabu.vip.gwt.showcase.client.ContentWidget.java

License:Apache License

/**
 * Initialize this widget by creating the elements that should be added to the
 * page.//from  w  w w.j  av a2 s  . c om
 */
@Override
protected final Widget createWidget() {
    deckPanel = new DeckPanel();

    setStyleName(DEFAULT_STYLE_NAME);

    // Add a tab handler
    tabBar.addSelectionHandler(this);

    // Create a container for the main example
    final VerticalPanel vPanel = new VerticalPanel();
    add(vPanel, constants.contentWidgetExample());

    // Add the name
    HTML nameWidget = new HTML(getName());
    nameWidget.setStyleName(DEFAULT_STYLE_NAME + "-name");
    vPanel.add(nameWidget);

    // Add the description
    HTML descWidget = new HTML(getDescription());
    descWidget.setStyleName(DEFAULT_STYLE_NAME + "-description");
    vPanel.add(descWidget);

    // Add source code tab
    /*if (hasSource()) {
      sourceWidget = new HTML();
      add(sourceWidget, constants.contentWidgetSource());
    } else {
      sourceLoaded = true;
    }
            
    // Add style tab
    if (hasStyle()) {
      styleDefs = new HashMap<String, String>();
      styleWidget = new HTML();
      add(styleWidget, constants.contentWidgetStyle());
    }*/

    // Initialize the showcase widget (if any) and add it to the page
    Widget widget = onInitialize();
    if (widget != null) {
        vPanel.add(widget);
    }
    onInitializeComplete();

    return deckPanel;
}

From source file:org.apache.solr.explorer.client.plugin.listview.ui.HitBox.java

License:Apache License

public HitBox(SearchResult result, final Hit hit, SolrCore solrCore, List<HitBoxTab> tabs,
        List<HitBoxLink> links) {

    SolrCoreConfiguration configuration = solrCore.getConfiguration();
    ListViewConfig renderingConfig = configuration.getConfig(ListViewConfig.class);

    VerticalPanel content = new VerticalPanel();

    String titleField = renderingConfig.getTitleFieldName();
    String title = (String) hit.get(titleField);
    if (title == null) {
        title = renderingConfig.getDefaultTitle();
    }//from   www.  j  a v a 2  s .  c om
    Label titleLabel = new HTML(title);
    titleLabel.setStyleName("HitTitle");
    content.add(titleLabel);

    String summaryField = renderingConfig.getSummaryFieldName();
    String summary = (String) hit.get(summaryField);
    if (summary == null) {
        summary = renderingConfig.getDefaultSummary();
    }
    FlowPanel summaryPane = new FlowPanel();
    Thumbnail thumbnail = renderingConfig.getThumbnail();
    if (thumbnail != null) {
        Template urlTemplate = thumbnail.getUrlTemplate();
        final String thumbnailUrl = urlTemplate.render(new MapModel(hit));
        final Image image = new Image();
        image.setVisible(false);
        image.setWidth(thumbnail.getWidth());
        image.setHeight(thumbnail.getHeight());
        image.setStylePrimaryName("HitThumbnail");
        image.addLoadHandler(new LoadHandler() {
            public void onLoad(LoadEvent event) {
                image.setVisible(true);
            }
        });
        image.addErrorHandler(new ErrorHandler() {
            public void onError(ErrorEvent event) {
                image.removeFromParent();
            }
        });

        summaryPane.add(image);

        // the url of the image needs to be set in a delay so that IE will pick up the load events!!! 
        DeferredCommand.addCommand(new Command() {
            public void execute() {
                image.setUrl(thumbnailUrl);
            }
        });

    }
    CollapsableLabel descriptionLabel = new CollapsableLabel(summary, true, renderingConfig.getSummaryLength());
    descriptionLabel.setStyleName("HitDescription");
    summaryPane.add(descriptionLabel);
    content.add(summaryPane);

    String urlField = renderingConfig.getUrlFieldName();
    String url = (String) hit.get(urlField);
    if (url == null || url.length() == 0) {
        url = "<no URL>";
    }
    final String finalUrl = URL.encode(url);
    final String finalTitle = title;
    Label urlLabel = new Label(url);
    urlLabel.setStyleName("HitUrl");
    urlLabel.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            GWT.log("final url: " + finalUrl, null);
            if (finalUrl.startsWith("http://") || finalUrl.startsWith("https://")) {
                Window.open(finalUrl, finalTitle, null);
            } else {
                Window.open("http://" + finalUrl, finalTitle, null);
            }
        }
    });

    HorizontalPanel toolbar = new HorizontalPanel();
    toolbar.setStyleName("Toolbar");
    toolbar.add(urlLabel);
    content.add(toolbar);

    addGap(toolbar, "2px");
    toolbar.add(new Label("-"));
    addGap(toolbar, "2px");
    toolbar.add(new Label("-"));
    addGap(toolbar, "2px");

    final DeckPanel tabContentHolder = new DeckPanel();
    //        tabContentHolder.setVisible(false);
    tabContentHolder.setAnimationEnabled(true);

    final SimplePanel emptyPanel = new SimplePanel();
    tabContentHolder.add(emptyPanel);
    tabContentHolder.showWidget(0);

    for (HitBoxTab tab : tabs) {

        if (!tab.isActive() || !tab.isEnabled(result, hit)) {
            continue;
        }

        final Widget tabContent = tab.createWidget(result, hit);
        tabContentHolder.add(tabContent);
        final int index = tabContentHolder.getWidgetIndex(tabContent);

        final SimpleLinkButton link = new SimpleLinkButton(tab.getName());
        link.setStyleName("ToolbarLink");
        link.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                if (shownTabIndex == index) {
                    shownTabIndex = 0;
                    tabContentHolder.showWidget(0);
                } else {
                    tabContentHolder.showWidget(index);
                    shownTabIndex = index;
                }
                //                    if (button.isDown()) {
                //                        tabContentHolder.setVisible(true);
                //                        
                //                    } else {
                //                        tabContentHolder.setVisible(false);
                //                    }
            }
        });

        addGap(toolbar, "5px");
        toolbar.add(link);
    }

    content.add(tabContentHolder);
    //        tabContentHolder.setVisible(false);

    for (HitBoxLink link : links) {
        if (!link.isActive() || !link.isEnabled(hit)) {
            continue;
        }
        SimpleLinkButton button = new SimpleLinkButton(link.getName());
        button.setStyleName("ToolbarLink");
        button.addClickHandler(link.createHandler(hit));
        addGap(toolbar, "5px");
        toolbar.add(button);
    }

    initWidget(content);
    setStyleName("HitBox");
}

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

License:Open Source License

protected Widget createBodyPanel() {
    return new DeckPanel();
}

From source file:org.gwtlib.samples.showcase.client.ui.ShowcaseEntryPoint.java

License:Apache License

private void init(RootPanel root) {
    _deckPanel = new DeckPanel();
    _tree = createTree();/*from w ww. ja  v  a2s  .  c  om*/
    _tree.addSelectionHandler(new SelectionHandler<TreeItem>() {
        public void onSelection(SelectionEvent<TreeItem> event) {
            TreeItem item = event.getSelectedItem();
            if (item.getUserObject() != null) {
                ContentWidget widget = (ContentWidget) item.getUserObject();
                widget.init();
                int i = _deckPanel.getWidgetIndex(widget);
                if (i != -1)
                    _deckPanel.showWidget(i);
            }
        }
    });

    FlexTable table = new FlexTable();
    table.setWidget(0, 0, _tree);
    table.setWidget(0, 1, _deckPanel);
    table.getRowFormatter().setVerticalAlign(0, HasVerticalAlignment.ALIGN_TOP);

    root.add(table);
}