List of usage examples for com.google.gwt.user.client.ui TextArea setCharacterWidth
public void setCharacterWidth(int width)
From source file:ch.heftix.mailxel.client.AttachmentPanel.java
License:Open Source License
public AttachmentPanel(final AttachmentTO attachmentTO, final MailServiceAsync mailxelService, final MailxelPanel mailxelPanel, final boolean directDownload) { String url = GWT.getModuleBaseURL() + "mailxel?id=" + Integer.toString(attachmentTO.id); int type = MimeTypeDescriptor.TYPE_ANY; final MimeTypeDescriptor mtd = MimeTypeUtil.mimeTypeByName(attachmentTO.name); type = mtd.fileType;//from w ww . jav a 2s .com Frame frame = null; if (directDownload) { frame = new Frame(url); add(frame); return; } ServiceCall sc = new ServiceCall() { public String getMessage() { return "get attachment data"; }; public boolean runSynchronized() { return true; }; public void run(final StatusItem si) { mailxelService.getAttachmentData(attachmentTO.id, new AsyncCallback<String>() { public void onSuccess(String result) { si.done(); switch (mtd.fileType) { case MimeTypeDescriptor.TYPE_HTM: HTML html = new HTML(); html.setHTML(result); add(html); break; default: TextArea ta = new TextArea(); ta.setCharacterWidth(80); ta.setVisibleLines(25); ta.setReadOnly(true); ta.setText(result); add(ta); break; } } public void onFailure(Throwable caught) { si.error(caught); } }); } }; switch (type) { case MimeTypeDescriptor.TYPE_IMG: Image img = new Image(url); add(img); break; case MimeTypeDescriptor.TYPE_HTM: case MimeTypeDescriptor.TYPE_TXT: mailxelPanel.statusStart(sc); break; default: frame = new Frame(url); add(frame); break; } }
From source file:com.gmail.cjbooms.thesis.pythonappengine.client.menus.git.GitCommitLocalChangesDialogWidget.java
License:Open Source License
/** * Create and return the Text holder for the log messsage * @return//from www . j av a 2 s . c o m */ private VerticalPanel createLogMessageTextBox() { VerticalPanel logPanel = new VerticalPanel(); logPanel.add(new Label("Enter Log Message:")); TextArea logMessageBox = new TextArea(); logMessageBox.setCharacterWidth(40); logMessageBox.setVisibleLines(4); logMessageBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { logMessage = event.getValue(); } }); logPanel.add(logMessageBox); logPanel.setSpacing(10); logPanel.setHeight("100px"); return logPanel; }
From source file:com.google.gwt.examples.TextBoxExample.java
License:Apache License
public void onModuleLoad() { // Make some text boxes. The password text box is identical to the text // box, except that the input is visually masked by the browser. PasswordTextBox ptb = new PasswordTextBox(); TextBox tb = new TextBox(); // TODO(ECC) must be tested. tb.addKeyPressHandler(new KeyPressHandler() { public void onKeyPress(KeyPressEvent event) { if (!Character.isDigit(event.getCharCode())) { ((TextBox) event.getSource()).cancelKey(); }// w w w. j a v a 2 s. co m } }); // Let's make an 80x50 text area to go along with the other two. TextArea ta = new TextArea(); ta.setCharacterWidth(80); ta.setVisibleLines(50); // Add them to the root panel. VerticalPanel panel = new VerticalPanel(); panel.add(tb); panel.add(ptb); panel.add(ta); RootPanel.get().add(panel); }
From source file:com.google.javascript.jscomp.gwt.client.JsCompGwtMain.java
License:Apache License
@Override public void onModuleLoad() { final TextArea tb = new TextArea(); tb.setCharacterWidth(80); tb.setVisibleLines(25);/*from w w w.j av a 2 s. c o m*/ tb.setReadOnly(true); final TextArea ta = new TextArea(); ta.setCharacterWidth(80); ta.setVisibleLines(25); ta.addKeyUpHandler(new KeyUpHandler() { public void onKeyUp(KeyUpEvent event) { clearConsole(); tb.setValue(compile(ta.getValue())); } }); VerticalPanel panel = new VerticalPanel(); panel.add(ta); panel.add(tb); RootPanel.get().add(panel); }
From source file:com.google.sampling.experiential.client.ExperimentDescriptionPanel.java
License:Open Source License
private Widget createFormArea(String key, String value, int width, String height) { VerticalPanel line = new VerticalPanel(); line.setStyleName("left"); Label keyLabel = new Label(key + ": "); keyLabel.setStyleName("keyLabel"); final TextArea valueBox = new TextArea(); valueBox.setCharacterWidth(width); valueBox.setHeight(height);/* w w w. j av a 2 s .c o m*/ if (value != null) { valueBox.setText(value); } valueBox.setEnabled(false); line.add(keyLabel); line.add(valueBox); return line; }
From source file:com.googlesource.gerrit.plugins.cookbook.client.FoodPreferencesScreen.java
License:Apache License
FoodPreferencesScreen() {
setStyleName("cookbook-panel");
Panel messagePanel = new VerticalPanel();
messagePanel.add(new Label("Food Allergies or Dietary Concerns:"));
TextArea txt = new TextArea();
txt.addKeyPressHandler(new KeyPressHandler() {
@Override/*w w w . j a v a 2 s . co m*/
public void onKeyPress(final KeyPressEvent event) {
event.stopPropagation();
}
});
txt.setVisibleLines(12);
txt.setCharacterWidth(80);
txt.getElement().setPropertyBoolean("spellcheck", false);
messagePanel.add(txt);
add(messagePanel);
Button helloButton = new Button("Save");
helloButton.addStyleName("cookbook-helloButton");
helloButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(final ClickEvent event) {
Window.alert("TODO: implement save");
}
});
add(helloButton);
helloButton.setEnabled(true);
}
From source file:com.googlesource.gerrit.plugins.examples.wuisettingsscreen.client.FoodPreferencesScreen.java
License:Apache License
FoodPreferencesScreen() {
setStyleName("example-panel");
Panel messagePanel = new VerticalPanel();
messagePanel.add(new Label("Food Allergies or Dietary Concerns:"));
TextArea txt = new TextArea();
txt.addKeyPressHandler(new KeyPressHandler() {
@Override//from w w w. j a v a 2 s. c o m
public void onKeyPress(final KeyPressEvent event) {
event.stopPropagation();
}
});
txt.setVisibleLines(12);
txt.setCharacterWidth(80);
txt.getElement().setPropertyBoolean("spellcheck", false);
messagePanel.add(txt);
add(messagePanel);
Button helloButton = new Button("Save");
helloButton.addStyleName("example-helloButton");
helloButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(final ClickEvent event) {
Window.alert("TODO: implement save");
}
});
add(helloButton);
helloButton.setEnabled(true);
}
From source file:com.milmaps.client.MapTouchController.java
License:Open Source License
public MapTouchController.AddTrackDialog addDialogWidget(final Touch touch) {//, String content) { final MapTouchController.AddTrackDialog box = new MapTouchController.AddTrackDialog(); box.setText("Track Name"); final VerticalPanel vertPanel = new VerticalPanel(); final TextArea ta = new TextArea(); ta.setCharacterWidth(20); ta.setVisibleLines(1);//from w ww . j a v a2s . c o m ta.setReadOnly(false); vertPanel.add(ta); final Button btnSave = new Button("Save", new ClickHandler() { @Override public void onClick(ClickEvent event) { sendReport(ta.getText(), touchToGeo(touch)); box.hide(); } }); final Button btnCancel = new Button("Cancel", new ClickHandler() { @Override public void onClick(ClickEvent event) { box.hide(); } }); final HorizontalPanel btnPanel = new HorizontalPanel(); btnPanel.add(btnSave); btnPanel.add(btnCancel); vertPanel.add(btnPanel); box.add(vertPanel); box.getElement().getStyle().setProperty("zIndex", Integer.toString(9000)); return box; }
From source file:com.moesol.gwt.maps.client.controls.TagControl.java
License:Open Source License
public AddTagDialog addDialogWidget(final String header) {//, String content) { final AddTagDialog box = new AddTagDialog(); box.setText(header);/*from ww w.j av a 2 s . c o m*/ final VerticalPanel panel = new VerticalPanel(); // Add icon selection drop list HorizontalPanel iconPanel = new HorizontalPanel(); final Image image = new Image("images/icons/sfap-----------.jpeg"); iconPanel.add(image); Button button = new Button("Select Symbol"); iconPanel.add(button); final TextBox iconName = new TextBox(); iconName.setVisible(false); iconName.setText("sfap-----------"); iconPanel.add(iconName); button.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // show cell list SymbolSelectionDialog symbolSelectionDialog = new SymbolSelectionDialog(image, iconName); symbolSelectionDialog.getElement().getStyle().setProperty("zIndex", Integer.toString(9000)); symbolSelectionDialog.setPopupPosition(box.getPopupLeft(), box.getPopupTop()); symbolSelectionDialog.show(); } }); panel.add(iconPanel); final TextArea ta = new TextArea(); ta.setCharacterWidth(20); ta.setVisibleLines(1); ta.setReadOnly(false); panel.add(ta); final Button btnSave = new Button("Save"); final Button btnCancel = new Button("Cancel"); ClickHandler saveHandler = new ClickHandler() { @Override public void onClick(ClickEvent event) { m_name = ta.getText(); m_symbol = iconName.getText(); if (box.setTag(m_mapView, m_gc, m_name, m_symbol) == true) { m_bTagOn = false; saveTagToDisk(); } } private void saveTagToDisk() { if (tagControlServiceOn) { // Set up the callback object. AsyncCallback<Boolean> callback = new AsyncCallback<Boolean>() { @Override public void onFailure(Throwable caught) { Window.alert("Internal Server Error:" + caught.getMessage()); } @Override public void onSuccess(Boolean result) { } }; tagControlService.saveTagToDisk(m_name, m_gc, m_symbol, callback); } } }; btnSave.addClickHandler(saveHandler); ClickHandler cancelHandler = new ClickHandler() { @Override public void onClick(ClickEvent event) { box.hide(); } }; btnCancel.addClickHandler(cancelHandler); // few empty labels to make widget larger final Label emptyLabel = new Label("----------"); emptyLabel.setSize("auto", "25px"); final HorizontalPanel btnPanel = new HorizontalPanel(); btnPanel.add(btnSave); btnPanel.add(emptyLabel); //btnPanel.setCellHorizontalAlignment(btnSave, HasAlignment.ALIGN_RIGHT); //btnSave.setWidth("50px"); btnPanel.add(btnCancel); //btnPanel.setCellHorizontalAlignment(btnCancel, HasAlignment.ALIGN_LEFT); //btnPanel.setSpacing(40); panel.add(btnPanel); box.add(panel); box.getElement().getStyle().setProperty("zIndex", Integer.toString(9000)); return box; }
From source file:com.threerings.gwt.ui.Widgets.java
License:Open Source License
/** * Creates a text area with all of the configuration that you're bound to want to do. * * @param width the width of the text area or -1 to use the default (or CSS styled) width. *///from w ww .j a va 2 s. c om public static TextArea newTextArea(String text, int width, int height) { TextArea area = new TextArea(); if (text != null) { area.setText(text); } if (width > 0) { area.setCharacterWidth(width); } if (height > 0) { area.setVisibleLines(height); } return area; }