Exemplo n.º 1
0
 private void initClickModeSelectionUI(IGame game) {
   DockPanel clickModePanel = new DockPanel();
   add(clickModePanel);
   clickModePanel.setWidth(
       Integer.toString(FieldCanvas.SIZE * game.getBoard().getDimension().x) + "px");
   clickModePanel.setHorizontalAlignment(DockPanel.ALIGN_CENTER);
   clickOpenButton = new RadioButton("ClickOpens", "click opens");
   clickOpenButton.setValue(true);
   clickFlagButton = new RadioButton("ClickFlags", "click flags");
   clickFlagButton.setValue(false);
   ValueChangeHandler<Boolean> checkBoxToggler =
       new ValueChangeHandler<Boolean>() {
         @Override
         public void onValueChange(ValueChangeEvent<Boolean> event) {
           CheckBox checkBox = (CheckBox) event.getSource();
           if (checkBox == clickOpenButton) clickFlagButton.setValue(!event.getValue());
           else clickOpenButton.setValue(!event.getValue());
         }
       };
   clickOpenButton.addValueChangeHandler(checkBoxToggler);
   clickFlagButton.addValueChangeHandler(checkBoxToggler);
   clickModePanel.add(clickFlagButton, DockPanel.WEST);
   clickModePanel.add(clickOpenButton, DockPanel.EAST);
   clickModePanel.setCellHorizontalAlignment(clickOpenButton, DockPanel.ALIGN_LEFT);
   clickModePanel.setCellHorizontalAlignment(clickFlagButton, DockPanel.ALIGN_RIGHT);
 }
Exemplo n.º 2
0
  /** Constructor */
  public ConfirmDialog() {
    dialogBox = new DialogBox(false, true);

    confirmPanel = new DockPanel();
    messageLabel = createMessageLabel();
    confirmPanel.add(messageLabel, DockPanel.CENTER);

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setSpacing(10);
    okButton = createOkButton();
    horizontalPanel.add(okButton);
    cancelButton = createCancelButton();
    horizontalPanel.add(cancelButton);

    if (defaultCloseHandlers != null) {
      for (CloseHandler<ConfirmDialog> closeHandler : defaultCloseHandlers) {
        this.addCloseHandler(closeHandler);
      }
    }

    if (defaultOpenHandlers != null) {
      for (OpenHandler<ConfirmDialog> openHandler : defaultOpenHandlers) {
        this.addOpenHandler(openHandler);
      }
    }

    confirmPanel.add(horizontalPanel, DockPanel.SOUTH);
    confirmPanel.setCellHorizontalAlignment(horizontalPanel, HasHorizontalAlignment.ALIGN_CENTER);

    dialogBox.add(confirmPanel);
    confirmPanel.getElement().getParentElement().setAttribute("align", "center");

    setStyleName(DEFAULT_STYLE_NAME);
  }
Exemplo n.º 3
0
  public TitlePanel() {
    text = new HTML(hardCodedText);
    text.setStyleName("title-text");

    // initialize the DockPanel
    dockPanel = new DockPanel();
    // horizontalPanel = new HorizontalPanel();
    if (dockPanel != null) {
      // indentation/border between text and frame
      dockPanel.setSpacing(3);

      dockPanel.add(text, DockPanel.CENTER);
      dockPanel.setCellHorizontalAlignment(text, DockPanel.ALIGN_CENTER);
      dockPanel.setCellVerticalAlignment(text, DockPanel.ALIGN_MIDDLE);
      dockPanel.setWidth("100%");
      dockPanel.setCellWidth(text, "100%");

      dockPanel.setStyleName("title-panel");
    } else {
      System.out.println("Unable to create dockPanel panels");
      throw new NullPointerException("Unable to initialize the dockPanel panel");
    }
  }
Exemplo n.º 4
0
  @Override
  public void onModuleLoad() {
    // Initialize the singleton before calling the constructors of the
    // various widgets that might call GSS.get().
    singleton = this;
    parseUserCredentials();

    topPanel = new TopPanel(GSS.images);
    topPanel.setWidth("100%");

    messagePanel.setWidth("100%");
    messagePanel.setVisible(false);

    search = new Search(images);
    searchStatus.add(search, DockPanel.WEST);
    searchStatus.add(userDetailsPanel, DockPanel.EAST);
    searchStatus.setCellHorizontalAlignment(userDetailsPanel, HasHorizontalAlignment.ALIGN_RIGHT);
    searchStatus.setCellVerticalAlignment(search, HasVerticalAlignment.ALIGN_MIDDLE);
    searchStatus.setCellVerticalAlignment(userDetailsPanel, HasVerticalAlignment.ALIGN_MIDDLE);
    searchStatus.setWidth("100%");

    fileList = new FileList(images);

    searchResults = new SearchResults(images);

    // Inner contains the various lists.
    inner.sinkEvents(Event.ONCONTEXTMENU);
    inner.setAnimationEnabled(true);
    inner.getTabBar().addStyleName("gss-MainTabBar");
    inner.getDeckPanel().addStyleName("gss-MainTabPanelBottom");
    inner.add(
        fileList, createHeaderHTML(AbstractImagePrototype.create(images.folders()), "Files"), true);

    inner.add(
        groups, createHeaderHTML(AbstractImagePrototype.create(images.groups()), "Groups"), true);
    inner.add(
        searchResults,
        createHeaderHTML(AbstractImagePrototype.create(images.search()), "Search Results"),
        true);
    // inner.add(new CellTreeView(images),
    // createHeaderHTML(AbstractImagePrototype.create(images.search()), "Cell tree sample"), true);
    inner.setWidth("100%");
    inner.selectTab(0);

    inner.addSelectionHandler(
        new SelectionHandler<Integer>() {

          @Override
          public void onSelection(SelectionEvent<Integer> event) {
            int tabIndex = event.getSelectedItem();
            //				TreeItem treeItem = GSS.get().getFolders().getCurrent();
            switch (tabIndex) {
              case 0:
                //						Files tab selected
                // fileList.clearSelectedRows();
                fileList.updateCurrentlyShowingStats();
                break;
              case 1:
                //						Groups tab selected
                groups.updateCurrentlyShowingStats();
                updateHistory("Groups");
                break;
              case 2:
                //						Search tab selected
                searchResults.clearSelectedRows();
                searchResults.updateCurrentlyShowingStats();
                updateHistory("Search");
                break;
            }
          }
        });
    //		If the application starts with no history token, redirect to a new "Files" state
    String initToken = History.getToken();
    if (initToken.length() == 0) History.newItem("Files");
    //		   Add history listener to handle any history events
    History.addValueChangeHandler(
        new ValueChangeHandler<String>() {
          @Override
          public void onValueChange(ValueChangeEvent<String> event) {
            String tokenInput = event.getValue();
            String historyToken = handleSpecialFolderNames(tokenInput);
            try {
              if (historyToken.equals("Search")) inner.selectTab(2);
              else if (historyToken.equals("Groups")) inner.selectTab(1);
              else if (historyToken.equals("Files") || historyToken.length() == 0)
                inner.selectTab(0);
              else {
                /*TODO: CELLTREE
                PopupTree popupTree = GSS.get().getFolders().getPopupTree();
                TreeItem treeObj = GSS.get().getFolders().getPopupTree().getTreeItem(historyToken);
                SelectionEvent.fire(popupTree, treeObj);
                */
              }
            } catch (IndexOutOfBoundsException e) {
              inner.selectTab(0);
            }
          }
        });

    // Add the left and right panels to the split panel.
    splitPanel.setLeftWidget(treeView);
    splitPanel.setRightWidget(inner);
    splitPanel.setSplitPosition("25%");
    splitPanel.setSize("100%", "100%");
    splitPanel.addStyleName("gss-splitPanel");

    // Create a dock panel that will contain the menu bar at the top,
    // the shortcuts to the left, the status bar at the bottom and the
    // right panel taking the rest.
    VerticalPanel outer = new VerticalPanel();
    outer.add(topPanel);
    outer.add(searchStatus);
    outer.add(messagePanel);
    outer.add(splitPanel);
    outer.add(statusPanel);
    outer.setWidth("100%");
    outer.setCellHorizontalAlignment(messagePanel, HasHorizontalAlignment.ALIGN_CENTER);

    outer.setSpacing(4);

    // Hook the window resize event, so that we can adjust the UI.
    Window.addResizeHandler(this);
    // Clear out the window's built-in margin, because we want to take
    // advantage of the entire client area.
    Window.setMargin("0px");
    // Finally, add the outer panel to the RootPanel, so that it will be
    // displayed.
    RootPanel.get().add(outer);
    // 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() {
            onWindowResized(Window.getClientHeight());
          }
        });
  }