Package com.sencha.gxt.widget.core.client.event.SelectEvent

Examples of com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler


  }

  protected void initTools() {
    if (collapsible && !hideCollapseTool) {
      collapseBtn = new ToolButton(collapsed ? getAppearance().expandIcon() : getAppearance().collapseIcon());
      collapseBtn.addSelectHandler(new SelectHandler() {
        @Override
        public void onSelect(SelectEvent event) {
          setExpanded(!isExpanded());
        }
      });
View Full Code Here


      default:
        // do nothing
    }

    expandBtn = new ToolButton(config);
    expandBtn.addSelectHandler(new SelectHandler() {

      @Override
      public void onSelect(SelectEvent event) {
        if (expanded) {
          disableAnimations = false;
View Full Code Here

  }

  protected void initTools() {
    if (collapsible && !hideCollapseTool) {
      collapseBtn = new ToolButton(appearance.collapseIcon());
      collapseBtn.addSelectHandler(new SelectHandler() {
        @Override
        public void onSelect(SelectEvent event) {
          setExpanded(!isExpanded());
        }
      });
View Full Code Here

    buttonBar.getElement().getStyle().setProperty("margin", "7px");
    buttonBar.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    up = new IconButton(appearance.up());
    up.setToolTip(getMessages().moveUp());
    up.addSelectHandler(new SelectHandler() {

      @Override
      public void onSelect(SelectEvent event) {
        onUp();
      }
    });

    allRight = new IconButton(appearance.allRight());
    allRight.setToolTip(getMessages().addAll());
    allRight.addSelectHandler(new SelectHandler() {
      @Override
      public void onSelect(SelectEvent event) {
        onAllRight();
      }
    });

    right = new IconButton(appearance.right());
    right.setToolTip(getMessages().addSelected());
    right.addSelectHandler(new SelectHandler() {

      @Override
      public void onSelect(SelectEvent event) {
        onRight();
      }
    });

    left = new IconButton(appearance.left());
    left.setToolTip(getMessages().removeSelected());
    left.addSelectHandler(new SelectHandler() {
      @Override
      public void onSelect(SelectEvent event) {
        onLeft();
      }
    });

    allLeft = new IconButton(appearance.allLeft());
    allLeft.setToolTip(getMessages().removeAll());
    allLeft.addSelectHandler(new SelectHandler() {
      @Override
      public void onSelect(SelectEvent event) {
        onAllLeft();
      }
    });

    down = new IconButton(appearance.down());
    down.setToolTip(getMessages().moveDown());
    down.addSelectHandler(new SelectHandler() {

      @Override
      public void onSelect(SelectEvent event) {
        onDown();
      }
View Full Code Here

        break;

    }

    expandBtn = new ToolButton(config);
    expandBtn.addSelectHandler(new SelectHandler() {

      @Override
      public void onSelect(SelectEvent event) {
        if (expanded) {
          disableAnimations = false;
View Full Code Here

  protected void initTools() {
    super.initTools();

    if (minimizable) {
      minBtn = new ToolButton(ToolButton.MINIMIZE);
      minBtn.addSelectHandler(new SelectHandler() {

        @Override
        public void onSelect(SelectEvent event) {
          minimize();
        }
      });
      header.addTool(minBtn);
    }

    if (maximizable) {
      maxBtn = new ToolButton(ToolButton.MAXIMIZE);
      maxBtn.addSelectHandler(new SelectHandler() {

        @Override
        public void onSelect(SelectEvent event) {
          maximize();
        }
      });
      header.addTool(maxBtn);

      restoreBtn = new ToolButton(ToolButton.RESTORE);
      restoreBtn.setVisible(false);
      restoreBtn.addSelectHandler(new SelectHandler() {

        @Override
        public void onSelect(SelectEvent event) {
          restore();
        }
      });
      header.addTool(restoreBtn);
    }

    if (closable) {
      closeBtn = new ToolButton(ToolButton.CLOSE);
      closeBtn.addSelectHandler(new SelectHandler() {

        @Override
        public void onSelect(SelectEvent event) {
          hide();
        }
View Full Code Here

    }

    appearance.onUpdateDayOfWeeks(getElement(), temp);

    todayBtn = new TextButton(getMessages().todayText());
    todayBtn.addSelectHandler(new SelectHandler() {

      @Override
      public void onSelect(SelectEvent event) {
        selectToday();
      }
View Full Code Here

  protected void initToolBar() {
    if (!showToolbar) {
      return;
    }

    buttonHandler = new SelectHandler() {

      @Override
      public void onSelect(SelectEvent event) {
        Widget button = (Widget) event.getSource();

        if (button == fontIncrease) {
          int i = fontSizesConstants.indexOf(activeFontSize);
          if (i < (fontSizesConstants.size() - 1)) {
            i++;
            activeFontSize = fontSizesConstants.get(i);
            textArea.getFormatter().setFontSize(activeFontSize);
          } else {
            // brings focus back to the editor
            focus();
          }
        } else if (button == fontDecrease) {
          int i = fontSizesConstants.indexOf(activeFontSize);
          if (i > 0) {
            i--;
            activeFontSize = fontSizesConstants.get(i);
            textArea.getFormatter().setFontSize(activeFontSize);
          } else {
            // brings focus back to the editor
            focus();
          }
        } else if (button == bold) {
          textArea.getFormatter().toggleBold();
        } else if (button == italic) {
          textArea.getFormatter().toggleItalic();
        } else if (button == underline) {
          textArea.getFormatter().toggleUnderline();
        } else if (button == justifyLeft) {
          textArea.getFormatter().setJustification(Justification.LEFT);
        } else if (button == justifyCenter) {
          textArea.getFormatter().setJustification(Justification.CENTER);
        } else if (button == justifyRight) {
          textArea.getFormatter().setJustification(Justification.RIGHT);
        } else if (button == ol) {
          textArea.getFormatter().insertOrderedList();
        } else if (button == ul) {
          textArea.getFormatter().insertUnorderedList();
        } else if (button == link) {
          String link = Window.prompt(getMessages().createLinkText(), "http://");
          if (link != null && link.length() > 0) {
            textArea.getFormatter().createLink(link);
          } else {
            textArea.getFormatter().removeLink();
          }
        }
      }
    };

    HtmlEditorMessages m = getMessages();

    if (enableFont) {
      final ListBox fonts = new ListBox();
      fonts.addItem("Arial");
      fonts.addItem("Courier New");
      fonts.addItem("Times New Roman");
      fonts.addItem("Verdana");
      fonts.setItemSelected(0, true);

      fonts.addChangeHandler(new ChangeHandler() {

        public void onChange(ChangeEvent event) {
          int index = fonts.getSelectedIndex();
          if (index != 0) {
            textArea.getFormatter().setFontName(fonts.getItemText(index));
          }
        }
      });

      toolBar.add(fonts);
      toolBar.add(new SeparatorToolItem());
    }

    if (enableFontSize) {
      fontIncrease = new TextButton();
      configureButton(fontIncrease, appearance.fontIncrease(), m.increaseFontSizeTipTitle(),
          m.increaseFontSizeTipText());
      fontIncrease.addSelectHandler(buttonHandler);
      toolBar.add(fontIncrease);

      fontDecrease = new TextButton();
      configureButton(fontDecrease, appearance.fontDecrease(), m.decreaseFontSizeTipTitle(),
          m.decreaseFontSizeTipText());
      fontDecrease.addSelectHandler(buttonHandler);
      toolBar.add(fontDecrease);

      toolBar.add(new SeparatorToolItem());
    }

    if (enableFormat) {
      bold = new ToggleButton();
      configureButton(bold, appearance.bold(), m.boldTipTitle(), m.boldTipText());
      bold.addSelectHandler(buttonHandler);
      toolBar.add(bold);

      italic = new ToggleButton();
      configureButton(italic, appearance.italic(), m.italicTipTitle(), m.italicTipText());
      italic.addSelectHandler(buttonHandler);
      toolBar.add(italic);

      underline = new ToggleButton();
      configureButton(underline, appearance.underline(), m.underlineTipTitle(), m.underlineTipText());
      underline.addSelectHandler(buttonHandler);
      toolBar.add(underline);

      toolBar.add(new SeparatorToolItem());
    }

    if (enableAlignments) {
      justifyLeft = new TextButton();
      configureButton(justifyLeft, appearance.justifyLeft(), m.justifyLeftTipTitle(), m.justifyLeftTipText());
      justifyLeft.addSelectHandler(buttonHandler);
      toolBar.add(justifyLeft);

      justifyCenter = new TextButton();
      configureButton(justifyCenter, appearance.justifyCenter(), m.justifyCenterTipTitle(), m.justifyCenterTipText());
      justifyCenter.addSelectHandler(buttonHandler);
      toolBar.add(justifyCenter);

      justifyRight = new TextButton();
      configureButton(justifyRight, appearance.justifyRight(), m.justifyRightTipTitle(), m.justifyRightTipText());
      justifyRight.addSelectHandler(buttonHandler);
      toolBar.add(justifyRight);

      toolBar.add(new SeparatorToolItem());
    }

    if (enableLists) {
      ol = new TextButton();
      configureButton(ol, appearance.ol(), m.olTipTitle(), m.olTipText());
      ol.addSelectHandler(buttonHandler);
      toolBar.add(ol);

      ul = new TextButton();
      configureButton(ul, appearance.ul(), m.ulTipTitle(), m.ulTipText());
      ul.addSelectHandler(buttonHandler);
      toolBar.add(ul);

      toolBar.add(new SeparatorToolItem());
    }

    if (enableLinks) {
      link = new TextButton();
      configureButton(link, appearance.link(), m.linkTipTitle(), m.linkTipText());
      link.addSelectHandler(buttonHandler);
      toolBar.add(link);

      toolBar.add(new SeparatorToolItem());
    }

    if (enableColors) {
      fontColor = new TextButton();
      configureButton(fontColor, appearance.fontColor(), m.foreColorTipTitle(), m.foreColorTipText());
      ColorMenu menu = new ColorMenu();
      menu.getPalette().addValueChangeHandler(new ValueChangeHandler<String>() {

        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
          textArea.getFormatter().setForeColor(event.getValue());
        }
      });
      fontColor.setMenu(menu);

      toolBar.add(fontColor);

      fontHighlight = new TextButton();
      configureButton(fontHighlight, appearance.fontHighlight(), m.backColorTipTitle(), m.backColorTipText());

      menu = new ColorMenu();
      menu.getPalette().addValueChangeHandler(new ValueChangeHandler<String>() {
        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
          textArea.getFormatter().setBackColor(event.getValue());
        }
      });
      fontHighlight.setMenu(menu);

      toolBar.add(fontHighlight);
    }

    if (sourceEditMode) {
      toolBar.add(new SeparatorToolItem());
      sourceEdit = new ToggleButton();
      configureButton(sourceEdit, appearance.source(), m.sourceEditTipTitle(), m.sourceEditTipText());

      sourceEdit.addSelectHandler(new SelectHandler() {
        @Override
        public void onSelect(SelectEvent event) {
          toggleSourceEditMode();
          focus();
        }
View Full Code Here

        if (panelData.isCollapseHidden()) {
          collapse.collapseHidden();
        }

        bar.addSelectHandler(new SelectHandler() {
          @Override
          public void onSelect(SelectEvent event) {
            onExpandClick((CollapsePanel) c);
          }
        });
      }
    }

    if (data.isCollapsible() && c instanceof ContentPanel && !c.isRendered()) {
      final ContentPanel cp = (ContentPanel) c;
      cp.setCollapsible(true);
      cp.setHideCollapseTool(true);

      IconConfig config = ToolButton.DOUBLELEFT;

      switch (getRegion(cp)) {
        case NORTH:
          config = ToolButton.DOUBLEUP;
          break;
        case SOUTH:
          config = ToolButton.DOUBLEDOWN;
          break;
        case EAST:
          config = ToolButton.DOUBLERIGHT;
          break;
        case WEST:
        case CENTER:
          // do nothing
      }

      cp.getHeader().addTool(new ToolButton(config, new SelectHandler() {

        @Override
        public void onSelect(SelectEvent event) {
          cp.collapse();
        }
      }));
      cp.addBeforeCollapseHandler(collapseHandler);
      cp.addBeforeExpandHandler(collapseHandler);
    }

    if (data.isSplit()) {
      SplitBar bar = c.getData("splitBar");
      if (bar == null || bar.getTargetWidget() != c) {
        bar = createSplitBar(c);
        final SplitBar fbar = bar;
        bar.setCollapsible(data.isCollapseMini());
        if (data.isCollapseMini()) {
          switch (getRegion(c)) {
            case EAST:
              bar.updateMini(Direction.RIGHT);
              break;
            case WEST:
              bar.updateMini(Direction.LEFT);
              break;
            case NORTH:
              bar.updateMini(Direction.UP);
              break;
            case SOUTH:
              bar.updateMini(Direction.DOWN);
              break;
            case CENTER:
              // do nothing
          }
          bar.addSelectHandler(new SelectHandler() {
            @Override
            public void onSelect(SelectEvent event) {
              if (c instanceof Collapsible) {
                ((Collapsible) c).collapse();
              }
View Full Code Here

    }
  }

  protected RowEditorComponent createRowEditor() {
    RowEditorComponent rowEditor = new RowEditorComponent();
    rowEditor.getSaveButton().addSelectHandler(new SelectHandler() {

      @Override
      public void onSelect(SelectEvent event) {
        completeEditing();

      }
    });

    rowEditor.getCancelButton().addSelectHandler(new SelectHandler() {
      @Override
      public void onSelect(SelectEvent event) {
        cancelEditing();
      }
    });
View Full Code Here

TOP

Related Classes of com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler

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.