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

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


    TextBoxBase tb;
    if ( visLines == 1 ) {
      tb = new TextBox();
    }
    else {
      TextArea ta = new TextArea();
      ta.setVisibleLines(visLines);
      tb = ta;
    }
    tb.setText(value);
    tb.setReadOnly(readOnly);
    tb.setWidth(gui.width);
View Full Code Here


    protected void _processEnter() {
     
      DeferredCommand.addCommand(new Command() {
        public void execute() {
          final TextArea ta = new TextArea();
          String text = contents.getText();
          ta.setText(text.trim());
         
          int ww = focusPanel.getOffsetWidth();
          int hh = (int) (1.3 * focusPanel.getOffsetHeight());
         
          hh = Math.max(hh, 40);
          ww = Math.max(ww, 100);
         
//          ta.setHeight(hh+ "px");
          ta.setSize(ww+ "px", hh+ "px");
//          ta.setCharacterWidth(text.length());
         
          ta.addFocusListener(new FocusListener() {
            public void onFocus(Widget sender) {
            }
            public void onLostFocus(Widget sender) {
              RootPanel.get().remove(ta);
              focusPanel.setFocus(true);
            }
          });

          ta.addKeyboardListener(new KeyboardListenerAdapter() {
            public void onKeyPress(Widget sender, char keyCode, int modifiers) {

              if ( keyCode == KEY_ENTER ) {
                ta.cancelKey();
                contents.setText(ta.getText());
                contents.setSize("100%", "100%");
                RootPanel.get().remove(ta);
                focusPanel.setFocus(true);
                return;
              }
              if ( keyCode == KEY_ESCAPE ) {
                RootPanel.get().remove(ta);
                focusPanel.setFocus(true);
                return;
              }
            }
          });
         
          int left = focusPanel.getAbsoluteLeft();
          int top = focusPanel.getAbsoluteTop();
         
          RootPanel.get().add(ta, left, top);
          ta.setFocus(true);
          ta.setCursorPos(text.length());
        }
      });
    }
View Full Code Here

        return;
      }
     
      DeferredCommand.addCommand(new Command() {
        public void execute() {
          final TextArea ta = new TextArea();
          String text = valHtml.getText();
          ta.setText(text);
         
          int ww = focusPanel.getOffsetWidth();
          int hh = (int) (1.3 * focusPanel.getOffsetHeight());
         
          hh = Math.max(hh, 40);
          ww = Math.max(ww, 100);
         
//          ta.setHeight(hh+ "px");
          ta.setSize(ww+ "px", hh+ "px");
//          ta.setCharacterWidth(text.length());
         
          ta.addFocusListener(new FocusListener() {
            public void onFocus(Widget sender) {
            }
            public void onLostFocus(Widget sender) {
              RootPanel.get().remove(ta);
              focusPanel.setFocus(true);
            }
          });

          ta.addKeyboardListener(new KeyboardListenerAdapter() {
            public void onKeyPress(Widget sender, char keyCode, int modifiers) {

              if ( keyCode == KEY_ENTER ) {
                ta.cancelKey();
                valHtml.setText(ta.getText());
                RootPanel.get().remove(ta);
                focusPanel.setFocus(true);
                return;
              }
              if ( keyCode == KEY_ESCAPE ) {
                RootPanel.get().remove(ta);
                focusPanel.setFocus(true);
                return;
              }
            }
          });
         
          int left = focusPanel.getAbsoluteLeft();
          int top = focusPanel.getAbsoluteTop();
         
          RootPanel.get().add(ta, left, top);
          ta.setFocus(true);
          ta.setCursorPos(text.length());
        }
      });
    }
View Full Code Here

        return true;
      }
    };
    popup.setText("Import terms");
   
    final TextArea textArea = popup.addTextArea(null);
    textArea.setReadOnly(false);
   
    textArea.setSize("800", "270");

   
    VerticalPanel vp = new VerticalPanel();
    vp.setSpacing(10);
    popup.getDockPanel().add(vp, DockPanel.NORTH);
    vp.add(new HTML(
        "Select the separator character, insert the new contents into the text area, " +
        "and click the \"Import\" button to update the table."
        )
    );
   
    final SeparatorPanel separatorPanel = new SeparatorPanel();
    vp.add(separatorPanel);
   
   
    final HTML status = new HTML("");
    textArea.addKeyboardListener(new KeyboardListenerAdapter(){
        public void onKeyUp(Widget sender, char keyCode, int modifiers) {
          status.setText("");
        }
    });

    PushButton importButton = new PushButton("Import", new ClickListener() {
      public void onClick(Widget sender) {
        final String text = textArea.getText().trim();
        if ( text.length() == 0 ) {
          status.setHTML("<font color=\"red\">Empty contents</font>");
          return;
        }
       
View Full Code Here

    protected void _processEnterEditing(final char firstKeyForEditing) {
     
      DeferredCommand.addCommand(new Command() {
        public void execute() {
          final TextArea ta = new TextArea();
          String text = contents.getText().trim();
         
          if ( firstKeyForEditing != 0 ) {
            text += firstKeyForEditing;
          }
          ta.setText(text);
         
          int ww = focusPanel.getOffsetWidth();
          int hh = (int) (1.3 * focusPanel.getOffsetHeight());
         
          hh = Math.max(hh, 40);
          ww = Math.max(ww, 100);
         
//          ta.setHeight(hh+ "px");
          ta.setSize(ww+ "px", hh+ "px");
//          ta.setCharacterWidth(text.length());
         
          ta.addFocusListener(new FocusListener() {
            public void onFocus(Widget sender) {
            }
            public void onLostFocus(Widget sender) {
              RootPanel.get().remove(ta);
              focusPanel.setFocus(true);
            }
          });

          ta.addKeyboardListener(new KeyboardListenerAdapter() {
            public void onKeyPress(Widget sender, char keyCode, int modifiers) {
              String text = ta.getText();
              Orr.log("onKeyPress: keyCode=" +keyCode+ ", modifiers=" +modifiers+ " text=[" +text+ "]");
             
              if ( keyCode == KEY_ENTER || keyCode == KEY_TAB ) {
                if ( keyCode == KEY_ENTER ) {
                  ta.cancelKey();
                }
                contents.setText(text);
                if ( text.length() > 0 ) {
                  contents.setSize("100%", "100%");
                }
                RootPanel.get().remove(ta);
               
                // add new row automatically if we are in the last row:
                if ( actualRow == flexTable.getRowCount() -1
                &&   actualCol == flexTable.getCellCount(actualRow) -1
                ) {
                  addRow(flexTable.getCellCount(actualRow) - 1);
                  Widget widget = flexTable.getWidget(actualRow +1, FIRST_REGULAR_COL);
//                  Orr.log("widget= " +widget.getClass().getName());
                  if ( widget instanceof TableCell ) {
                    ((TableCell) widget).setFocus(true);
                  }
                }
                else {
                  focusPanel.setFocus(true);
                }
                return;
              }
              if ( keyCode == KEY_ESCAPE ) {
                RootPanel.get().remove(ta);
                ta.cancelKey();
                focusPanel.setFocus(true);
                return;
              }
            }
          });
         
          int left = focusPanel.getAbsoluteLeft();
          int top = focusPanel.getAbsoluteTop();
         
          RootPanel.get().add(ta, left, top);
          ta.setFocus(true);
          ta.setCursorPos(text.length());
        }
      });
    }
View Full Code Here

  public EditorPart() {
  changeHandlers = new ArrayList<ChangeHandler>();
  loadHandlers = new ArrayList<LoadHandler>();
  focusHandlers = new ArrayList<FocusHandler>();
  clickHandlers = new ArrayList<ClickHandler>();
    editor = new TextArea();
    editor.setWidth("100%");
    editor.setHeight("99%");
    editor.getElement().setId("_codemirror_");
    VerticalPanel panel = new VerticalPanel();
    panel.add(editor);
View Full Code Here

 
  /**
   * Constructs a new Editor part.
   */
  public EditorPart() {
    editor = new TextArea();
    editor.setWidth("100%");
    editor.setHeight("99%");
    editor.setStylePrimaryName("lab-Text-Editor");
    initWidget(editor);
  }
View Full Code Here

    type.setStyleName(STYLE_NAME_WIKI_PAGE_NAME);
    headerPanel.add(type);
    deckPanel.add(headerPanel);
   
    // editing erea
    editing = new TextArea();
    editing.setStyleName(STYLE_NAME_WIKI_PAGE);
   
    // Let's make an 80x50 text area to go along with the other two.
    editing.setCharacterWidth(80);
      editing.setVisibleLines(30);
View Full Code Here

    else {
      // avoid huge textareas (TODO max 20 line is arbitrary)
      if ( nl > 20 ) {
        nl = 20;
      }
      tb = new TextArea();
      // TODO 16 is just a rough scaling factor
      tb.setSize(width, "" +(nl *16));
    }
    if ( cl != null ) {
      tb.addChangeListener(cl);
View Full Code Here

    private ButtonBar buttonBar;

    public DebugPanel()
    {
      setLayout(new FitLayout());
      area = new TextArea();
      //area.setWidth("500");
      //area.setHeight("500");
      add(area);
      buttonBar = new ButtonBar();
      Button clearButton = new Button("Clear");
View Full Code Here

TOP

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

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.