List of usage examples for com.google.gwt.user.client.ui TextBox TextBox
public TextBox()
From source file:ar.com.kyol.jet.client.wrappers.TextBoxWrapper.java
License:Open Source License
/** * Instantiates a new text box wrapper.//from ww w. j ava2 s . c o m * * @param objSetter the obj setter */ public TextBoxWrapper(ObjectSetter objSetter) { this(objSetter, new TextBox()); }
From source file:asquare.gwt.tests.focus.client.Demo.java
License:Apache License
private Widget createFocusPanel() { Table outer = new Table(); outer.add(new FocusPanel(new Label("Label in a FocusPanel"))); outer.add(new Button("Button")); outer.add(new CheckBox("CheckBox")); outer.add(new TextBox()); outer.add(new PasswordTextBox()); outer.add(new TextArea()); outer.add(new RadioButton("group1", "RadioButton1")); outer.add(new RadioButton("group1", "RadioButton2")); ListBox listBox1 = new ListBox(); listBox1.addItem("ListBox1"); listBox1.addItem("item2"); listBox1.addItem("item3"); outer.add(listBox1);// w ww .ja va 2 s .co m ListBox listBox2 = new ListBox(true); listBox2.setVisibleItemCount(3); listBox2.addItem("ListBox2"); listBox2.addItem("item2"); listBox2.addItem("item3"); outer.add(listBox2); Tree tree = new Tree(); tree.addItem("Tree"); tree.addItem("item2"); tree.addItem("item3"); outer.add(tree); return outer; }
From source file:asquare.gwt.tests.focusevent.client.Demo.java
License:Apache License
private Widget createDemoPanel() { TestPanel outer = new TestPanel(); outer.add(new Label("GWT onfocus Event Handler")); outer.add(new Button("Button"), "Button"); outer.add(new CheckBox("CheckBox"), "CheckBox"); outer.add(new RadioButton("group1", "RadioButton1"), "RadioButton1"); TextBox textBox = new TextBox(); textBox.setText("TextBox"); outer.add(textBox, "TextBox"); PasswordTextBox passwordTextBox = new PasswordTextBox(); passwordTextBox.setText("PasswordTextBox"); outer.add(passwordTextBox, "PasswordTextBox"); TextArea textArea = new TextArea(); textArea.setText("TextArea"); outer.add(textArea, "TextArea"); ListBox listBox = new ListBox(); listBox.addItem("ListBox"); listBox.addItem("item2"); listBox.addItem("item3"); outer.add(listBox, "ListBox"); outer.add(new FocusPanel(new Label("Label in a FocusPanel")), "FocusPanel"); Tree tree = new Tree(); tree.addItem("item1"); tree.addItem("item2"); tree.addItem("item3"); outer.add(tree, "Tree"); return outer; }
From source file:asquare.gwt.tests.mousebutton.client.Demo.java
License:Apache License
private Widget createDemoPanel() { VerticalPanel outer = new VerticalPanel(); TextBox input = new TextBox(); input.setText("Click Here"); TextArea output = new TextArea(); outer.add(input);//from w w w . java 2 s. c o m outer.add(output); MouseHandler handler = new MouseHandler(output); HandlesAllMouseEvents.handle(input, handler); return outer; }
From source file:asquare.gwt.tk.uitest.isvisible.client.Demo.java
License:Apache License
public void onModuleLoad() { RootPanel outer = RootPanel.get();//from w w w .ja va 2 s . c om TextBox rowInput = new TextBox(); TextBox colInput = new TextBox(); Grid input = new Grid(2, 2); input.setText(0, 0, "Row: "); input.setWidget(0, 1, rowInput); input.setText(1, 0, "Col: "); input.setWidget(1, 1, colInput); outer.add(input); final int ROWS = 20; final int COLS = 20; Grid grid = new Grid(ROWS, COLS); grid.setCellPadding(0); grid.setCellSpacing(0); for (int row = 0; row < ROWS; row++) { for (int col = 0; col < COLS; col++) { grid.setWidget(row, col, new Label("(" + row + "," + col + ")")); } } ScrollPanel scrollInner = new ScrollPanel(); scrollInner.setAlwaysShowScrollBars(true); scrollInner.setPixelSize(400, 400); scrollInner.setWidget(grid); ScrollPanel scrollOuter = new ScrollPanel(); scrollOuter.add(scrollInner); scrollOuter.setAlwaysShowScrollBars(true); scrollOuter.setPixelSize(600, 200); outer.add(scrollOuter); scrollInner.setScrollPosition(100); scrollInner.setHorizontalScrollPosition(100); }
From source file:asquare.gwt.tkdemo.client.demos.DialogPanel.java
License:Apache License
private Widget createModalDialogDemo() { BasicPanel panel = new BasicPanel("div", "block"); panel.setStyleName("example division"); DomUtil.setStyleAttribute(panel, "whiteSpace", "nowrap"); panel.add(new HTML("<h4>ModalDialog examples</h4>")); class CloseListener implements ClickHandler { private final ModalDialog m_dialog; public CloseListener(ModalDialog dialog) { m_dialog = dialog;//from w w w. j ava 2 s.c om } public void onClick(ClickEvent event) { m_dialog.hide(); } } class CloseButton extends Button { public CloseButton(ModalDialog dialog) { super("Close"); addClickHandler(new CloseListener(dialog)); } public CloseButton(ModalDialog dialog, String text) { super(text); addClickHandler(new CloseListener(dialog)); } } final Button plainDialog = new Button("Plain"); plainDialog.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final ModalDialog dialog = new ModalDialog(); dialog.setCaption("Caption area", false); dialog.add(new Label("Content area")); dialog.add(new CloseButton(dialog)); dialog.show(plainDialog); } }); panel.add(plainDialog); final Button verboseDialog = new Button("Verbose"); verboseDialog.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final ModalDialog dialog = new ModalDialog(); dialog.setCaption("Verbose dialog", false); dialog.add(new Label("Twas brillig, and the slithy toves " + " Did gyre and gimble in the wabe: " + "All mimsy were the borogoves, " + " And the mome raths outgrabe " + "Beware the Jabberwock, my son! " + "The jaws that bite, the claws that catch! " + "Beware the Jubjub bird, and shun " + "The frumious Bandersnatch!")); dialog.add(new CloseButton(dialog)); dialog.show(verboseDialog); } }); panel.add(verboseDialog); final Button captionLessDialog = new Button("No caption"); captionLessDialog.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final ModalDialog dialog = new ModalDialog(); dialog.add(new Label("Captionless dialog")); dialog.add(new CloseButton(dialog)); dialog.show(captionLessDialog); } }); panel.add(captionLessDialog); final Button loadingDialog = new Button("Loading..."); loadingDialog.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final ModalDialog dialog = new ModalDialog(); final Label label = new Label("0% loaded"); dialog.add(label); dialog.show(loadingDialog); new Timer() { private int m_count = 0; public void run() { label.setText(++m_count + "% loaded"); if (m_count == 100) { dialog.hide(); cancel(); } } }.scheduleRepeating(1); } }); panel.add(loadingDialog); final Button undraggableDialog = new Button("Drag disabled"); undraggableDialog.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final ModalDialog dialog = new ModalDialog() { protected List<Controller> createCaptionControllers() { List<Controller> result = new ArrayList<Controller>(); result.add(ControlSurfaceController.getInstance()); return result; } }; dialog.setCaption("Drag disabled", false); dialog.add(new Label( "This dialog uses a custom controller in the header which does not provide drag support.")); dialog.add(new CloseButton(dialog)); dialog.show(undraggableDialog); } }); panel.add(undraggableDialog); final Button styledDragDialog = new Button("Drag style"); styledDragDialog.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final ModalDialog dialog = new ModalDialog(); String oldPrimaryName = dialog.getStylePrimaryName(); dialog.setStylePrimaryName("dialog-dragstyle"); dialog.addStyleName(oldPrimaryName); dialog.setCaption("Drag me", false); dialog.add(new Label( "This dialog employs the \"tk-ModalDialog-dragging\" style which is applied while dragging. ")); dialog.add(new CloseButton(dialog)); dialog.show(styledDragDialog); } }); panel.add(styledDragDialog); final Button focusManagementDialog = new Button("Focus management"); focusManagementDialog.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final ModalDialog dialog = new ModalDialog(); dialog.setCaption("Register", false); FocusModel fModel = dialog.getFocusModel(); final int FIELD_COUNT = 3; Grid table = new Grid(FIELD_COUNT, 2); dialog.add(table); Widget[] labels = new Widget[FIELD_COUNT]; labels[0] = new Label("User name: "); labels[1] = new Label("Password: "); labels[2] = new Label("Retype password: "); FocusWidget[] fields = new FocusWidget[FIELD_COUNT]; fields[0] = new TextBox(); fields[1] = new PasswordTextBox(); fields[2] = new PasswordTextBox(); CellFormatter formatter = table.getCellFormatter(); for (int i = 0; i < labels.length; i++) { table.setWidget(i, 0, labels[i]); formatter.setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_LEFT); table.setWidget(i, 1, fields[i]); /* * Manually add fields to focus cycle. (The dialog does not * scan the children of panels for focusable widgets.) */ fModel.add(fields[i]); } // this widget will be focused when the dialog is shown fModel.setFocusWidget(fields[0]); ColumnPanel buttonPanel = new ColumnPanel(); buttonPanel.setWidth("100%"); dialog.add(buttonPanel); Button closeButton = new CloseButton(dialog, "Register!"); fModel.add(closeButton); buttonPanel.add(closeButton); Button cancelButton = new CloseButton(dialog, "Cancel"); fModel.add(cancelButton); buttonPanel.addWidget(cancelButton, false); buttonPanel.setCellHorizontalAlignment(ColumnPanel.ALIGN_RIGHT); dialog.show(focusManagementDialog); } }); panel.add(focusManagementDialog); final Button explicitlyPositionedDialog = new Button("Explicitly positioned"); explicitlyPositionedDialog.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final ModalDialog dialog = new ModalDialog(); dialog.removeController(dialog.getController(ModalDialog.PositionDialogController.class)); int contentWidth = 300; int contentHeight = 100; dialog.setContentWidth(contentWidth + "px"); dialog.setContentHeight(contentHeight + "px"); dialog.setPopupPosition(100, 100); dialog.setCaption("Explicitly positioned dialog", false); dialog.add(new Label( "Automatic positioning is disabled. Dimensions and position are set explicitly. ")); dialog.add(new CloseButton(dialog)); dialog.show(explicitlyPositionedDialog); } }); panel.add(explicitlyPositionedDialog); final Button multipleDialogs = new Button("Multiple dialogs"); multipleDialogs.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { ModalDialog dialog = new ModalDialog(); dialog.setCaption("First dialog", false); FocusModel fModel = dialog.getFocusModel(); RowPanel outer = new RowPanel(); dialog.add(new HTML("")); final UrlLocation urlBox = new UrlLocation(); urlBox.setText("http://www.asquare.net"); urlBox.setWidth("350px"); fModel.add(urlBox); outer.add(urlBox); Button goButton = new Button("Go"); fModel.add(goButton); fModel.setFocusWidget(goButton); outer.addWidget(goButton, false); ListBox addressList = new ListBox(); addressList.addItem("Select an address"); addressList.addItem("http://www.asquare.net"); addressList.addItem("http://www.google.com"); addressList.addItem("http://www.sourceforge.net"); addressList.addItem("http://www.apache.org"); fModel.add(addressList); outer.add(addressList); final Frame frame = new Frame(); frame.setSize("400px", "200px"); outer.add(frame); urlBox.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { frame.setUrl(urlBox.getURL()); } }); goButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { frame.setUrl(urlBox.getURL()); } }); addressList.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { ListBox list = (ListBox) event.getSource(); if (list.getSelectedIndex() > 0) { urlBox.setText(list.getItemText(list.getSelectedIndex())); frame.setUrl(list.getItemText(list.getSelectedIndex())); } } }); final Button secondDialog = new Button("Show second dialog"); secondDialog.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final ModalDialog dialog = new ModalDialog(); dialog.setCaption("Second dialog", false); dialog.add(new Label("Note that you cannot manipulate the widgets in the first dialog. ")); dialog.add(new CloseButton(dialog)); dialog.show(secondDialog); } }); fModel.add(secondDialog); outer.add(secondDialog); Button closeButton = new CloseButton(dialog); fModel.add(closeButton); outer.add(closeButton); dialog.add(outer); dialog.show(multipleDialogs); } }); panel.add(multipleDialogs); final Button styledDialog = new Button("Styled"); styledDialog.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final ModalDialog dialog = new ModalDialog(); dialog.addStyleName("dialog-styled"); HorizontalPanel caption = new HorizontalPanel(); caption.setWidth("100%"); Label captionText = new Label("Oopsie!"); caption.add(captionText); caption.setCellWidth(captionText, "100%"); Image close = new Image("close.gif"); close.addClickHandler(new CloseListener(dialog)); caption.add(close); dialog.setCaption(caption); dialog.add(new Label("I've been a bad, bad browser.")); dialog.add(new Button("Deny ice cream", new CloseListener(dialog))); dialog.show(styledDialog); } }); panel.add(styledDialog); return panel; }
From source file:asquare.gwt.tkdemo.client.demos.EventsPanel.java
License:Apache License
private static Collection<Widget> createSomeWidgets() { ArrayList<Widget> result = new ArrayList<Widget>(); result.add(new HTML("<b>Double-click a widget to select it</b>")); result.add(new Button("Button")); result.add(new CheckBox("CheckBox")); result.add(new RadioButton("group", "RadioButton")); result.add(new SimpleHyperLink("SimpleHyperLink")); TextBox tb = new TextBox(); tb.setText("TextBox"); result.add(tb);/*from ww w. j a v a2 s.co m*/ PasswordTextBox ptb = new PasswordTextBox(); ptb.setText("PasswordTextBox"); result.add(ptb); return result; }
From source file:asquare.gwt.tkdemo.client.demos.FocusCycleDemo.java
License:Apache License
private Widget createFocusCycle1() { FocusCyclePanel cycle1 = new FocusCyclePanel("div", "block"); cycle1.add(new Label("Cycle 1")); cycle1.add(new FocusStyleDecorator(new Button("Button"))); Button buttonDisabled = new Button("disabled"); buttonDisabled.setEnabled(false);/* ww w . j a v a2s .c o m*/ cycle1.add(new FocusStyleDecorator(buttonDisabled)); Button buttonNegativeTabIndex = new Button("tabIndex = -1"); buttonNegativeTabIndex.setTabIndex(-1); cycle1.add(new FocusStyleDecorator(buttonNegativeTabIndex)); cycle1.add(new FocusStyleDecorator(new CheckBox("CheckBox"))); cycle1.add(new FocusStyleDecorator(new FocusPanel(new Label("FocusPanel")))); ListBox listBox = new ListBox(); listBox.addItem("ListBox"); listBox.addItem("Item 1"); listBox.addItem("Item 2"); listBox.addItem("Item 3"); cycle1.add(new FocusStyleDecorator(listBox)); TextBox textBox = new TextBox(); textBox.setText("TextBox"); cycle1.add(new FocusStyleDecorator(textBox)); PasswordTextBox pwBox = new PasswordTextBox(); pwBox.setText("PasswordTextBox"); cycle1.add(new FocusStyleDecorator(pwBox)); TextArea textArea = new TextArea(); textArea.setText("TextArea"); cycle1.add(new FocusStyleDecorator(textArea)); Tree tree = new Tree(); TreeItem treeRoot = new TreeItem("Tree"); for (int branchNum = 1; branchNum < 4; branchNum++) { TreeItem branch = new TreeItem("Branch " + branchNum); for (int item = 1; item < 4; item++) { branch.addItem("Item " + item); } treeRoot.addItem(branch); } tree.addItem(treeRoot); cycle1.add(new FocusStyleDecorator(tree)); new WidgetFocusStyleController(cycle1.getFocusModel()); return cycle1; }
From source file:at.ait.dme.yuma.client.colorpicker.ColorPicker.java
License:Artistic License
public ColorPicker() { // UI Drawing //------------------ hue = 0;/* w w w. jav a 2 s.c om*/ saturation = 100; brightness = 100; red = 255; green = 0; blue = 0; HorizontalPanel panel = new HorizontalPanel(); FlexTable table = new FlexTable(); // Add the large slider map slidermap = new SliderMap(this); panel.add(slidermap); panel.setCellWidth(slidermap, "258px"); panel.setCellHeight(slidermap, "258px"); // Add the small slider bar sliderbar = new SliderBar(this); panel.add(sliderbar); panel.setCellWidth(sliderbar, "40px"); panel.setCellHeight(sliderbar, "258px"); // Define the Flextable's content // Color preview at the top colorpreview = new HTML(""); colorpreview.setWidth("50px"); colorpreview.setHeight("50px"); DOM.setStyleAttribute(colorpreview.getElement(), "border", "1px solid black"); // Radio buttons rbHue = new RadioButton("color", "H:"); rbHue.addClickHandler(this); rbSaturation = new RadioButton("color", "S:"); rbSaturation.addClickHandler(this); rbBrightness = new RadioButton("color", "V:"); rbBrightness.addClickHandler(this); rbRed = new RadioButton("color", "R:"); rbRed.addClickHandler(this); rbGreen = new RadioButton("color", "G:"); rbGreen.addClickHandler(this); rbBlue = new RadioButton("color", "B:"); rbBlue.addClickHandler(this); // Textboxes tbHue = new TextBox(); tbHue.setText(new Integer(hue).toString()); tbHue.setMaxLength(3); tbHue.setVisibleLength(4); tbHue.addKeyPressHandler(this); tbHue.addChangeHandler(this); tbSaturation = new TextBox(); tbSaturation.setText(new Integer(saturation).toString()); tbSaturation.setMaxLength(3); tbSaturation.setVisibleLength(4); tbSaturation.addKeyPressHandler(this); tbSaturation.addChangeHandler(this); tbBrightness = new TextBox(); tbBrightness.setText(new Integer(brightness).toString()); tbBrightness.setMaxLength(3); tbBrightness.setVisibleLength(4); tbBrightness.addKeyPressHandler(this); tbBrightness.addChangeHandler(this); tbRed = new TextBox(); tbRed.setText(new Integer(red).toString()); tbRed.setMaxLength(3); tbRed.setVisibleLength(4); tbRed.addKeyPressHandler(this); tbRed.addChangeHandler(this); tbGreen = new TextBox(); tbGreen.setText(new Integer(green).toString()); tbGreen.setMaxLength(3); tbGreen.setVisibleLength(4); tbGreen.addKeyPressHandler(this); tbGreen.addChangeHandler(this); tbBlue = new TextBox(); tbBlue.setText(new Integer(blue).toString()); tbBlue.setMaxLength(3); tbBlue.setVisibleLength(4); tbBlue.addKeyPressHandler(this); tbBlue.addChangeHandler(this); tbHexColor = new TextBox(); tbHexColor.setText("ff0000"); tbHexColor.setMaxLength(6); tbHexColor.setVisibleLength(6); tbHexColor.addKeyPressHandler(this); tbHexColor.addChangeHandler(this); // Put together the FlexTable table.setWidget(0, 0, colorpreview); table.getFlexCellFormatter().setColSpan(0, 0, 3); table.setWidget(1, 0, rbHue); table.setWidget(1, 1, tbHue); table.setWidget(1, 2, new HTML("°")); table.setWidget(2, 0, rbSaturation); table.setWidget(2, 1, tbSaturation); table.setText(2, 2, "%"); table.setWidget(3, 0, rbBrightness); table.setWidget(3, 1, tbBrightness); table.setText(3, 2, "%"); table.setWidget(4, 0, rbRed); table.setWidget(4, 1, tbRed); table.setWidget(5, 0, rbGreen); table.setWidget(5, 1, tbGreen); table.setWidget(6, 0, rbBlue); table.setWidget(6, 1, tbBlue); table.setText(7, 0, "#:"); table.setWidget(7, 1, tbHexColor); table.getFlexCellFormatter().setColSpan(7, 1, 2); // Final setup panel.add(table); rbSaturation.setValue(true); setPreview("ff0000"); DOM.setStyleAttribute(colorpreview.getElement(), "cursor", "default"); // First event onClick(rbSaturation); initWidget(panel); }
From source file:at.ait.dme.yuma.client.map.annotation.ControlPointForm.java
License:EUPL
public ControlPointForm(ImageAnnotationComposite annotationComposite, ControlPointLayer controlPointLayer, ImageAnnotationTreeNode annotationTreeNode, boolean fragmentAnnotation, boolean update) { // Reference to control point layer this.controlPointLayer = controlPointLayer; // Place name (will be geo-coded) HorizontalPanel placeNamePanel = new HorizontalPanel(); Label placeNameLabel = new Label("Place: "); placeNameLabel.setStyleName("cp-Editor-Label"); placeNamePanel.add(placeNameLabel);//from w ww . j a v a2 s . c o m placeName = new TextBox(); placeName.setStyleName("cp-Editor-Field"); placeName.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { doAsyncGeocoding(placeName.getText() + event.getCharCode()); } }); placeNamePanel.add(placeName); // Lon (determined automatically - field disabled) HorizontalPanel lonPanel = new HorizontalPanel(); Label lonLabel = new Label("Lon: "); lonLabel.setStyleName("cp-Editor-Label"); lonPanel.add(lonLabel); lon = new TextBox(); lon.setEnabled(false); lon.setStyleName("cp-Editor-Field"); lonPanel.add(lon); // Lat (determined automatically - field disabled) HorizontalPanel latPanel = new HorizontalPanel(); Label latLabel = new Label("Lat: "); latLabel.setStyleName("cp-Editor-Label"); latPanel.add(latLabel); lat = new TextBox(); lat.setEnabled(false); lat.setStyleName("cp-Editor-Field"); latPanel.add(lat); // X/Y (determined automatically - field disabled) HorizontalPanel xyPanel = new HorizontalPanel(); Label xyLabel = new Label("X/Y: "); xyLabel.setStyleName("cp-Editor-Label"); xyPanel.add(xyLabel); xy = new TextBox(); xy.setEnabled(false); xy.setStyleName("cp-Editor-Field"); xyPanel.add(xy); if (update) { ImageAnnotation annotation = annotationTreeNode.getAnnotation(); placeName.setText(annotation.getTitle()); GeoPoint p = (GeoPoint) annotation.getFragment().getShape(); lon.setText(Double.toString(p.getLng())); lat.setText(Double.toString(p.getLat())); setXY(p.getX(), p.getY()); } // Assemble the main FlowPanel FlowPanel form = new FlowPanel(); form.setStyleName("cp-Editor"); form.add(placeNamePanel); form.add(lonPanel); form.add(latPanel); form.add(xyPanel); form.add(createButtonsPanel(update, annotationTreeNode, annotationComposite)); form.setStyleName("imageAnnotation-form"); initWidget(form); controlPointLayer.setControlPointForm(this); if (update) { controlPointLayer.showActiveFragmentPanel(annotationTreeNode.getAnnotation(), false); } else { controlPointLayer.showActiveFragmentPanel(null, false); } }