コード例 #1
0
 @Override
 public void proceedSettingReadonly() {
   textArea.setEnabled(!isReadonly());
 }
コード例 #2
0
  public DescriptionCellEditor() {
    super();

    ensureResources();
    setStyleName("");

    addCloseHandler(
        new CloseHandler<PopupPanel>() {
          @Override
          public void onClose(CloseEvent<PopupPanel> event) {
            if (event.isAutoClosed()) {
              commit();
              hide();
            }
          }
        });

    VerticalPanel verticalPanel = new VerticalPanel();

    textArea = new RichTextArea();
    textArea.setTabIndex(0);
    textArea.addStyleName(resources.style().bDescriptionCellEditor__editor());
    textArea.addKeyDownHandler(
        new KeyDownHandler() {
          @Override
          public void onKeyDown(KeyDownEvent event) {
            int keyCode = event.getNativeKeyCode();
            if (keyCode == KeyCodes.KEY_ESCAPE) {
              cancelButton.setFocus(true); // or grid did not get back focus
              hide();
            } else if (keyCode == KeyCodes.KEY_ENTER && event.isControlKeyDown()) {
              okButton.setFocus(true); // or grid did not get back focus
              okButton.click();
            }
          }
        });
    VerticalPanel textAreaPanel = new VerticalPanel();
    textAreaPanel.add(textArea);

    HorizontalPanel buttonPanel = new HorizontalPanel();

    okButton = new Button(strings.ok());
    okButton.addStyleName(resources.style().bDescriptionCellEditor__ok());
    okButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            commit();
            hide();
          }
        });
    buttonPanel.add(okButton);

    cancelButton = new Button(strings.cancel());
    cancelButton.addStyleName(resources.style().bDescriptionCellEditor__cancel());
    cancelButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            hide();
          }
        });
    buttonPanel.add(cancelButton);

    textAreaPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    textAreaPanel.add(buttonPanel);

    RichTextToolbar textToolbar = new RichTextToolbar(textArea);
    SimplePanel toolBarPanel = new SimplePanel(textToolbar);
    toolBarPanel.addStyleName(resources.style().bDescriptionCellEditor__toolbar());

    verticalPanel.add(toolBarPanel);
    verticalPanel.add(textAreaPanel);

    add(verticalPanel);
  }
コード例 #3
0
 /** Focus on the text area editor */
 public void focus() {
   textArea.setFocus(true);
 }
コード例 #4
0
 public void setTextAreaWidth(int width) {
   textArea.setWidth(width + "px");
 }
コード例 #5
0
 public int getTextAreaOffsetTop() {
   return textArea.getAbsoluteTop() - getAbsoluteTop();
 }
コード例 #6
0
 public int getTextAreaOffsetLeft() {
   return textArea.getAbsoluteLeft() - getAbsoluteLeft();
 }
コード例 #7
0
 private void commit() {
   this.fireEvent(new ValueChangedEvent<String>(textArea.getHTML()));
 }