Package com.google.gwt.user.client.ui

Examples of com.google.gwt.user.client.ui.DockPanel


    private TextArea ticker;

    public Calculator() {

        DockPanel dockPanel = new DockPanel();

        Grid controls = new Grid(5, 2);
        Grid numbersP = new Grid(4, 3);

        // initialize the 1-9 buttons
        for (int row = 0; row < 3; row++) {
            for (int col = 0; col < 3; col++) {
                numbersP.setWidget(row, col, new NumberButton(this, row
                        * 3 + col + 1));
            }
        }
        numbersP.setWidget(3, 0, new NumberButton(this, 0));
        numbersP.setWidget(3, 1, new NumberButton(this, "."));
        numbersP.setWidget(3, 2, new ControlButton(this,
                new ControlAction(this, "+/-") {
                    @Override
                    public boolean isMultiArg() {
                        return false;
                    }

                    @Override
                    public double performAction(ControlAction lastAction,
                            double previous, double current) {
                        return -1 * current;
                    }
                }));

        controls.setWidget(0, 0, new ControlButton(this,
                new ControlAction(this, "/") {

                    @Override
                    public double performAction(ControlAction lastAction,
                            double previous, double current) {
                        return previous / current;
                    }
                }));

        controls.setWidget(0, 1, new ControlButton(this,
                new ControlAction(this, "sqrt") {
                    @Override
                    public boolean isMultiArg() {
                        return false;
                    }

                    @Override
                    public double performAction(ControlAction lastAction,
                            double previous, double current) {
                        return Math.sqrt(current);
                    }
                }));

        controls.setWidget(1, 0, new ControlButton(this,
                new ControlAction(this, "*") {
                    @Override
                    public double performAction(ControlAction lastAction,
                            double previous, double current) {
                        return previous * current;
                    }
                }));
        controls.setWidget(1, 1, new ControlButton(this,
                new ControlAction(this, "%") {
                    @Override
                    public double performAction(ControlAction lastAction,
                            double previous, double current) {
                        return previous % current;
                    }
                }));
        controls.setWidget(2, 0, new ControlButton(this,
                new ControlAction(this, "-") {
                    @Override
                    public double performAction(ControlAction lastAction,
                            double previous, double current) {
                        return previous - current;
                    }
                }));
        controls.setWidget(2, 1, new ControlButton(this,
                new ControlAction(this, "1/x") {
                    @Override
                    public boolean isMultiArg() {
                        return false;
                    }

                    @Override
                    public double performAction(ControlAction lastAction,
                            double previous, double current) {
                        return 1 / current;
                    }
                }));
        controls.setWidget(3, 0, new ControlButton(this,
                new ControlAction(this, "+") {
                    @Override
                    public double performAction(ControlAction lastAction,
                            double previous, double current) {
                        return previous + current;
                    }
                }));
        controls.setWidget(3, 1, new ControlButton(this,
                new ControlAction(this, "=") {
                    @Override
                    public boolean isMultiArg() {
                        return false;
                    }

                    @Override
                    public double performAction(ControlAction lastAction,
                            double previous, double current) {
                        if (lastAction == null) {
                            return current;
                        }
                        return lastAction.performAction(null, previous,
                                current);
                    }

                }));

        controls.setWidget(4, 0, new ControlButton(this,
                new ControlAction(this, "bksp") {
                    @Override
                    public boolean isMultiArg() {
                        return false;
                    }

                    @Override
                    public double performAction(ControlAction lastAction,
                            double previous, double current) {
                        String cStr = current + "";
                        if (cStr.endsWith(".0")) {
                            cStr = cStr.substring(0, cStr.length() - 3);
                        } else {
                            cStr = cStr.substring(0, cStr.length() - 1);
                        }
                        if (cStr.equals("")) {
                            cStr = "0";
                        }
                        return Double.parseDouble(cStr);
                    }

                }));

        controls.setWidget(4, 1, new ControlButton(this,
                new ControlAction(this, "clear") {
                    @Override
                    public boolean isMultiArg() {
                        return false;
                    }

                    @Override
                    public double performAction(ControlAction lastAction,
                            double previous, double current) {
                        return 0;
                    }
                }));

        dockPanel.add(numbersP, DockPanel.CENTER);
        dockPanel.add(controls, DockPanel.EAST);

        inputBox = new TextBox();
        inputBox.addStyleName("ResultBox");
        dockPanel.add(inputBox, DockPanel.NORTH);

        ticker = new TextArea();
        ticker.setSize("7em", "140px");

        MultiWordSuggestOracle oracle = new MultiWordSuggestOracle();
        oracle.add("Jill");
        oracle.add("Jeff");
        oracle.add("James");
        oracle.add("Jennifer");

        SuggestBox box = new SuggestBox(oracle);
        box.addEventHandler(new SuggestionHandler() {
            public void onSuggestionSelected(SuggestionEvent suggE) {
                String selected = suggE.getSelectedSuggestion()
                        .getReplacementString();
                // do something with selected suggestion
            }
        });

        dockPanel.add(box, DockPanel.SOUTH);

        HorizontalPanel mainP = new HorizontalPanel();
        mainP.add(dockPanel);
        mainP.add(ticker);

View Full Code Here


    this.getFlexCellFormatter().setAlignment(row, 0,
        HasHorizontalAlignment.ALIGN_LEFT, HasVerticalAlignment.ALIGN_TOP
    );

     
    DockPanel dockPanel = new DockPanel();

   
    dockPanel.add(tabPanel, DockPanel.NORTH);
      container.add(dockPanel, DockPanel.CENTER);
     
    for ( AttrGroup attrGroup: Orr.getMetadataBaseInfo().getAttrGroups() ) {
      CellPanel groupPanel = new MetadataGroupPanel(this, attrGroup, editing);
      tabPanel.add(groupPanel, attrGroup.getName());
View Full Code Here

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

    HorizontalPanel buttonPanel = new HorizontalPanel();

    Button addButton = new Button("Draw new object");
    addButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        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.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        editPolyline();
      }
    });
    buttonPanel.add(editPolylineButton);

    editPolygonButton.setEnabled(false);
    editPolygonButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        editPolygon();
      }
    });
    buttonPanel.add(editPolygonButton);

    p.add(buttonPanel, DockPanel.EAST);

    return p;
  }
View Full Code Here

            dayOfMonth = dayOfMonth - 10;
          }
     
      rootPanel.setStyleName("mybody"+ dayOfMonth);
     
      dockPanel = new DockPanel();
      rootPanel.add(dockPanel, 29, 265);
      dockPanel.setSize("1193px", "550px");

      // Add a file upload widget
        final FileUpload fileUpload = new FileUpload();
View Full Code Here

            dayOfMonth = dayOfMonth - 10;
          }
     
      rootPanel.setStyleName("mybody"+ dayOfMonth);
     
      dockPanel = new DockPanel();
      rootPanel.add(dockPanel, 29, 265);
      dockPanel.setSize("1193px", "550px");

 
        int posTop = 10;
View Full Code Here

    controls.add(status);
    controls.add(input);
    controls.add(send);
    controls.add(logout);
   
    DockPanel dockPanel = new DockPanel();
    messages = new HTML();
    scrollPanel = new ScrollPanel();
    scrollPanel.setHeight("250px");
    scrollPanel.add(messages);
    dockPanel.add(scrollPanel, DockPanel.CENTER);
    dockPanel.add(controls, DockPanel.SOUTH);
   
    RootPanel.get().add(dockPanel);
  }
View Full Code Here

    public RepoConfigManager() {
        PrettyFormLayout form = new PrettyFormLayout();
        form.addHeader( images.config(),
                        new HTML( constants.ManageRepositoryConfig() ) );

        DockPanel dock = new DockPanel();
        dock.setSpacing( 4 );
        dock.setHorizontalAlignment( DockPanel.ALIGN_CENTER );
        hPanel1.add( getDbTypePanel() );
        dataInputPanel.add( hPanel1 );
        SimplePanel divider = new SimplePanel();
        divider.setSize( "100px",
                         "30px" );
        vPanel2.add( divider );
        vPanel2.add( noJndiInfo );
        vPanel2.add( jndiInfo );
        vPanel2.setVisible( false );
        dataInputPanel.add( vPanel2 );
        dock.add( dataInputPanel,
                  DockPanel.WEST );

        repoDisplayArea.setSize( "740px",
                                 "470px" );
        repoDisplayArea.setTitle( "repository.xml" );
        repoDisplayArea.setVisible( false );

        DockPanel idock = new DockPanel();
        idock.setSpacing( 4 );
        idock.setHorizontalAlignment( DockPanel.ALIGN_CENTER );
        idock.add( repoDisplayArea,
                   DockPanel.WEST );

        final Button saveButton = new Button( constants.SaveRepo() );
        saveButton.addClickHandler( new ClickHandler() {
            public void onClick(ClickEvent w) {
                String name = rdbmsConf.getDbType() + "-repository";
                if ( rdbmsConf.isJndi() ) name += "-jndi";
                hiddenRepoConfig.setValue( repoDisplayArea.getText() );
                saveRepoConfigForm.submit();
            }
        } );

        saveRepoConfigForm.setEncoding( FormPanel.ENCODING_URLENCODED );
        saveRepoConfigForm.setMethod( FormPanel.METHOD_POST );
        saveRepoConfigForm.setAction( GWT.getModuleBaseURL() + "backup" );

        VerticalPanel formHolder = new VerticalPanel();
        HorizontalPanel saveInfoHolder = new HorizontalPanel();
        saveInfoHolder.add( saveButton );
        saveInfoHolder.add( new InfoPopup( constants.SaveRepo(),
                                           constants.SaveRepoInfo() ) );
        formHolder.add( saveInfoHolder );
        formHolder.add( hiddenRepoConfig );

        saveRepoConfigForm.add( formHolder );
        saveRepoConfigForm.setVisible( false );

        idock.add( saveRepoConfigForm,
                   DockPanel.EAST );

        dock.add( idock,
                  DockPanel.EAST );
View Full Code Here

    Window.enableScrolling(false);
    // resize the panels on main window resize
    Window.addWindowResizeListener(this);       
   
    // main application
    dockPanel = new DockPanel();   
    dockPanel.setStyleName("restDescribe-mainApplicationPanel");
    dockPanel.setWidth("99.7%");
    dockPanel.setHeight("99.7%");   
    dockPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);   
    dockPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);   

    // main menu
    MainMenuPanel mainMenuPanel = new MainMenuPanel();   
    dockPanel.add(mainMenuPanel, DockPanel.NORTH);
    dockPanel.setCellHeight(mainMenuPanel, "10%");

    // rest compile panel
    RestCompilePanel restCompilePanel = new RestCompilePanel();   
    dockPanel.add(restCompilePanel, DockPanel.NORTH);
   
    // request sample panel   
    RequestUriPanel requestUriPanel = new RequestUriPanel();
    dockPanel.add(requestUriPanel, DockPanel.NORTH);
    dockPanel.setCellHeight(requestUriPanel, "10%");   
   
    // navigation panel
    ParameterPanel parameterPanel = new ParameterPanel();   
    dockPanel.add(parameterPanel, DockPanel.WEST);
    dockPanel.setCellHeight(parameterPanel, "80%");
    dockPanel.setCellWidth(parameterPanel, "45%");
    dockPanel.setCellVerticalAlignment(parameterPanel, HasVerticalAlignment.ALIGN_TOP);
   
    // wadl panel
    WadlPanel wadlPanel = new WadlPanel();
    dockPanel.add(wadlPanel, DockPanel.EAST);   
    dockPanel.setCellHeight(wadlPanel, "80%");
    dockPanel.setCellWidth(wadlPanel, "55%");
    dockPanel.setCellVerticalAlignment(wadlPanel, HasVerticalAlignment.ALIGN_TOP);
   
    toggleMode(restDescribe);
   
    RootPanel.get().add(dockPanel);
   
    // semi-transparent screen blocker for dialogs
    blockScreen = new DockPanel();       
    HTML semiTransparentDiv = getBlockedScreenDiv(Window.getClientWidth(), Window.getClientHeight());
    blockScreen.add(semiTransparentDiv, DockPanel.SOUTH);
    blockScreen.setVisible(false);   
    RootPanel.get().add(blockScreen);
View Full Code Here

    public RepoConfigManager() {
        PrettyFormLayout form = new PrettyFormLayout();
        form.addHeader( images.config(),
                        new HTML( constants.ManageRepositoryConfig() ) );

        DockPanel dock = new DockPanel();
        dock.setSpacing( 4 );
        dock.setHorizontalAlignment( DockPanel.ALIGN_CENTER );
        hPanel1.add( getDbTypePanel() );
        dataInputPanel.add( hPanel1 );
        SimplePanel divider = new SimplePanel();
        divider.setSize( "100px",
                         "30px" );
        vPanel2.add( divider );
        vPanel2.add( noJndiInfo );
        vPanel2.add( jndiInfo );
        vPanel2.setVisible( false );
        dataInputPanel.add( vPanel2 );
        dock.add( dataInputPanel,
                  DockPanel.WEST );

        repoDisplayArea.setSize( "740px",
                                 "470px" );
        repoDisplayArea.setTitle( "repository.xml" );
        repoDisplayArea.setVisible( false );

        DockPanel idock = new DockPanel();
        idock.setSpacing( 4 );
        idock.setHorizontalAlignment( DockPanel.ALIGN_CENTER );
        idock.add( repoDisplayArea,
                   DockPanel.WEST );

        final Button saveButton = new Button( constants.SaveRepo() );
        saveButton.addClickHandler( new ClickHandler() {
            public void onClick(ClickEvent w) {
                String name = rdbmsConf.getDbType() + "-repository";
                if ( rdbmsConf.isJndi() ) name += "-jndi";
                hiddenRepoConfig.setValue( repoDisplayArea.getText() );
                saveRepoConfigForm.submit();
            }
        } );

        saveRepoConfigForm.setEncoding( FormPanel.ENCODING_URLENCODED );
        saveRepoConfigForm.setMethod( FormPanel.METHOD_POST );
        saveRepoConfigForm.setAction( GWT.getModuleBaseURL() + "backup" );

        VerticalPanel formHolder = new VerticalPanel();
        HorizontalPanel saveInfoHolder = new HorizontalPanel();
        saveInfoHolder.add( saveButton );
        saveInfoHolder.add( new InfoPopup( constants.SaveRepo(),
                                           constants.SaveRepoInfo() ) );
        formHolder.add( saveInfoHolder );
        formHolder.add( hiddenRepoConfig );

        saveRepoConfigForm.add( formHolder );
        saveRepoConfigForm.setVisible( false );

        idock.add( saveRepoConfigForm,
                   DockPanel.EAST );

        dock.add( idock,
                  DockPanel.EAST );
View Full Code Here

   public TabOverflowPopupPanel()
   {
      super(true, false);

      DockPanel dockPanel = new DockPanel();

      search_ = new SearchWidget(new DocsOracle());
      search_.addValueChangeHandler(this);

      search_.getElement().getStyle().setMarginRight(0, Unit.PX);
      dockPanel.add(search_, DockPanel.NORTH);

      menu_ = new DocsMenu();
      menu_.setOwnerPopupPanel(this);
      menu_.setWidth("100%");
      dockPanel.add(menu_, DockPanel.CENTER);
      setWidget(dockPanel);

      setStylePrimaryName(ThemeStyles.INSTANCE.tabOverflowPopup());

      addDomHandler(new MenuKeyHandler(menu_), KeyDownEvent.getType());
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.ui.DockPanel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.