List of usage examples for com.google.gwt.user.client.ui Label setText
public void setText(String text)
From source file:org.openelis.gwt.widget.tree.TreeColumn.java
License:Open Source License
public Widget getDisplayWidget(TreeDataItem row) { TableDataCell cell = new TableDataCell(null); if (columnIndex < row.cells.size()) cell = row.cells.get(columnIndex); Widget wid = null;/* w ww . j a v a 2 s. c o m*/ Object val = null; if (colWidget instanceof CheckBox) { wid = new CheckBoxContainer(); IconContainer icon = new IconContainer(); if (CheckBox.CHECKED.equals(cell.getValue())) icon.setStyleName(CheckBox.CHECKED_STYLE); else if (controller.queryMode && cell.getValue() == null) icon.setStyleName(CheckBox.UNKNOWN_STYLE); else icon.setStyleName(CheckBox.UNCHECKED_STYLE); setAlign(HasHorizontalAlignment.ALIGN_CENTER); ((AbsolutePanel) wid).add(icon); DOM.setStyleAttribute(wid.getElement(), "align", "center"); wid.setWidth((currentWidth) + "px"); } else { if (colWidget instanceof AutoComplete) { if (controller.queryMode) { val = cell.getValue(); if (val == null) val = ""; } else { TableDataRow vrow = (TableDataRow) cell.getValue(); if (vrow != null) ((AutoComplete) colWidget).setSelection(vrow); else ((AutoComplete) colWidget).setSelection(null, ""); val = ((AutoComplete) colWidget).getTextBoxDisplay(); } } else if (colWidget instanceof Dropdown) { if (cell.getValue() instanceof ArrayList) ((Dropdown) colWidget).setSelectionKeys((ArrayList<Object>) cell.getValue()); else ((Dropdown) colWidget).setSelection(cell.getValue()); val = ((Dropdown) colWidget).getTextBoxDisplay(); } else { ((HasField) colWidget).setFieldValue(cell.getValue()); } if (val == null) val = ((HasField) colWidget).getFieldValue(); Label label = new Label(""); if (colWidget instanceof org.openelis.gwt.widget.Label) label.setStyleName(colWidget.getStyleName()); else label.setStyleName("ScreenLabel"); if (val != null) { if (colWidget instanceof CalendarLookUp) { label.setText((((CalendarLookUp) colWidget).getField().format())); } else if (colWidget instanceof AutoComplete && controller.queryMode) { label.setText((String) val); } else if (colWidget instanceof DropdownWidget) { label.setText(((DropdownWidget) colWidget).getTextBoxDisplay()); } else if (colWidget instanceof TextBoxBase) { label.setText(((TextBoxBase) colWidget).getText()); } else if (colWidget instanceof Label) label.setText(((Label) colWidget).getText()); } label.setWordWrap(false); wid = label; wid.setWidth((currentWidth) + "px"); } setExceptions(wid, cell.exceptions); wid.addStyleName("TableWidget"); return wid; }
From source file:org.openremote.manager.client.admin.syslog.QuickSyslogImpl.java
License:Open Source License
protected Widget createItem(SyslogEvent event) { FlowPanel itemPanel = new FlowPanel(); itemPanel.addStyleName(style.logItem()); itemPanel.addStyleName(widgetStyle.FormListItem()); FlowPanel levelCategoryPanel = new FlowPanel(); levelCategoryPanel.setStyleName("layout horizontal center"); levelCategoryPanel.addStyleName(style.logItemLevelCategory()); MessagesIcon levelIcon = new MessagesIcon(event.getLevel().getIcon()); levelCategoryPanel.add(levelIcon);/*w ww. ja va 2s .c o m*/ Label categoryLabel = new Label(); categoryLabel.setText(event.getCategory().name()); levelCategoryPanel.add(categoryLabel); event.getSubCategoryOptional().ifPresent(s -> { Label subCategoryLabel = new Label(); subCategoryLabel.setText(": " + s); levelCategoryPanel.add(subCategoryLabel); }); itemPanel.add(levelCategoryPanel); Label messageLabel = new Label(); messageLabel.setText(event.getMessage()); itemPanel.add(messageLabel); return itemPanel; }
From source file:org.otalo.ao.client.search.SearchFilterPanel.java
License:Apache License
public SearchFilterPanel(SearchResultMsgList searchResultContainer) { //Initializing queryParams queryParamsMap = new SearchQueryParamMap(); this.searchResultContainer = searchResultContainer; verticalPanel = new VerticalPanel(); verticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); verticalPanel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER); //Initializing other widgets searchInput = new TextBox(); searchInput.setName(AoAPI.SearchConstants.SEARCH_KEYWORD); searchInput.setTitle(AoAPI.SearchConstants.SEARCH_KEYWORD); searchInput.addStyleName("input-txt"); searchInput.addKeyUpHandler(this); Label searchLbl = new Label(); searchLbl.setText("Keywords"); searchLbl.addStyleName("label-txt"); searchLbl.addStyleName("search-label"); Label mstatusLbl = new Label(); mstatusLbl.setText("Status"); mstatusLbl.addStyleName("label-txt"); msgStatusFilter = new MsgStatusFilterCriteria(); Label dateLbl = new Label(); dateLbl.setText("From"); dateLbl.addStyleName("label-txt"); Label toLbl = new Label(); toLbl.setText("To"); toLbl.addStyleName("label-txt"); toLbl.addStyleName("to-lbl"); fromDate = new CustomDateBox(); toDate = new CustomDateBox(); fromDate.setName(AoAPI.SearchConstants.FROMDATE); toDate.setName(AoAPI.SearchConstants.TODATE); fromDate.setFormat(new DateBox.DefaultFormat(formatter)); toDate.setFormat(new DateBox.DefaultFormat(formatter)); fromDate.addStyleName("date-txt"); toDate.addStyleName("date-txt"); Label tagLbl = new Label(); tagLbl.setText("Tags"); tagLbl.addStyleName("label-txt"); tagLbl.addStyleName("tag-label"); tagsInput = new SearchTagWidget(false, false); tagsInput.setWidth("255px"); Label forumLbl = new Label(); forumLbl.setText("Forum"); forumLbl.addStyleName("label-txt"); forumList = new ForumList(); Label authorLbl = new Label(); authorLbl.setText("Search By"); authorLbl.addStyleName("label-txt"); authorFilter = new AuthorFilterCriteria(); cancelButton = new HTML("<a href='javascript:;'>Cancel</a>"); cancelButton.addStyleName("btn-cancel"); searchButton = new Button(); searchButton.setText("Search"); searchButton.addStyleName("btn-search"); ButtonClickHandler clickHandler = new ButtonClickHandler(); searchButton.addClickHandler(clickHandler); cancelButton.addClickHandler(clickHandler); FlexTable fieldGrid = new FlexTable(); fieldGrid.setCellSpacing(3);//from w ww. ja v a2s . c om fieldGrid.setWidget(0, 0, searchLbl); fieldGrid.getFlexCellFormatter().setColSpan(0, 0, 2); fieldGrid.setWidget(1, 0, searchInput); fieldGrid.getFlexCellFormatter().setColSpan(1, 0, 2); fieldGrid.setWidget(2, 0, forumLbl); fieldGrid.getFlexCellFormatter().setColSpan(2, 0, 2); fieldGrid.setWidget(3, 0, forumList); fieldGrid.getFlexCellFormatter().setColSpan(3, 0, 2); fieldGrid.getFlexCellFormatter().addStyleName(9, 0, "dropdown"); fieldGrid.setWidget(4, 0, mstatusLbl); fieldGrid.getFlexCellFormatter().setColSpan(4, 0, 2); fieldGrid.setWidget(5, 0, msgStatusFilter); fieldGrid.getFlexCellFormatter().setColSpan(5, 0, 2); fieldGrid.setWidget(6, 0, dateLbl); fieldGrid.setWidget(6, 1, toLbl); fieldGrid.setWidget(7, 0, fromDate); fieldGrid.setWidget(7, 1, toDate); fieldGrid.setWidget(8, 0, tagLbl); fieldGrid.getFlexCellFormatter().setColSpan(8, 0, 2); fieldGrid.setWidget(9, 0, tagsInput); fieldGrid.getFlexCellFormatter().setColSpan(9, 0, 2); fieldGrid.setWidget(10, 0, authorLbl); fieldGrid.getFlexCellFormatter().setColSpan(10, 0, 2); fieldGrid.setWidget(11, 0, authorFilter); fieldGrid.getFlexCellFormatter().setColSpan(11, 0, 2); HorizontalPanel buttonPlacer = new HorizontalPanel(); buttonPlacer.setSpacing(8); buttonPlacer.add(cancelButton); buttonPlacer.add(searchButton); DOM.setStyleAttribute(buttonPlacer.getElement(), "cssFloat", "right"); fieldGrid.setWidget(12, 0, buttonPlacer); fieldGrid.getFlexCellFormatter().setColSpan(12, 0, 2); verticalPanel.add(fieldGrid); initWidget(verticalPanel); //setting default search fields setDefaults(); }
From source file:org.overlord.gadgets.web.client.widgets.StoreItem.java
License:Open Source License
public StoreItem(final StoreItemModel model, final CurrentUser user, final Label messageBar) { initWidget(uiBinder.createAndBindUi(this)); itemImage.setUrl(model.getThumbnailUrl()); itemImage.setHeight("60px"); itemImage.setWidth("120px"); itemName.setText(model.getName());//from w w w .j ava2 s . c o m itemDesc.setText(model.getDescription()); itemAuthor.setText("By " + model.getAuthor()); addBtn.addClickHandler(new ClickHandler() { public void onClick(ClickEvent clickEvent) { RestfulInvoker.invoke(RequestBuilder.POST, URLBuilder.getAddGadgetToPageURL(user.getCurrentPage(), model.getId()), null, new RestfulInvoker.Response() { public void onResponseReceived(Request request, Response response) { messageBar.setText( "The Gadget [" + model.getName() + "] has been added successfully."); } }); } }); }
From source file:org.pentaho.gwt.widgets.client.text.ValidationPasswordTextBox.java
License:Open Source License
private void showMessagePopup() { Label validationMessageLabel = new Label(); validationMessageLabel.setStyleName("validation-textbox-message-label"); //$NON-NLS-1$ validationMessageLabel.setText(getValidationMessage()); VerticalPanel messagePanel = new VerticalPanel(); messagePanel.add(validationMessageLabel); HorizontalPanel bottomPanel = new HorizontalPanel(); SimplePanel hSpacer = new SimplePanel(); hSpacer.setStylePrimaryName("validation-textbox-left-image-buffer"); //$NON-NLS-1$ bottomPanel.add(hSpacer);/* ww w.j a v a2 s . c o m*/ SimplePanel tailImagePanel = new SimplePanel(); tailImagePanel.setStylePrimaryName("validation-textbox-tail-image"); //$NON-NLS-1$ bottomPanel.add(tailImagePanel); messagePanel.add(bottomPanel); popupPanel = new PopupPanel(true, false); popupPanel.setWidget(messagePanel); popupPanel.setPopupPositionAndShow(new PositionCallback() { public void setPosition(int offsetWidth, int offsetHeight) { int absLeft = -1; int absTop = -1; int offHeight = -1; absLeft = passwordTextBox.getAbsoluteLeft(); absTop = passwordTextBox.getAbsoluteTop(); offHeight = passwordTextBox.getOffsetHeight(); popupPanel.setPopupPosition(absLeft, absTop - offHeight - DEFAULT_OFFSET >= 0 ? absTop - offHeight - DEFAULT_OFFSET : absTop); } }); popupPanel.show(); }
From source file:org.pentaho.gwt.widgets.client.text.ValidationTextBox.java
License:Open Source License
private void showMessagePopup() { Label validationMessageLabel = new Label(); validationMessageLabel.setStyleName("validation-textbox-message-label"); //$NON-NLS-1$ validationMessageLabel.setText(getValidationMessage()); VerticalPanel messagePanel = new VerticalPanel(); messagePanel.add(validationMessageLabel); HorizontalPanel bottomPanel = new HorizontalPanel(); SimplePanel hSpacer = new SimplePanel(); hSpacer.setStylePrimaryName("validation-textbox-left-image-buffer"); //$NON-NLS-1$ bottomPanel.add(hSpacer);/*w w w. j a v a 2s .co m*/ SimplePanel tailImagePanel = new SimplePanel(); image = new Image(GWT.getModuleBaseURL() + "images/spacer.gif"); //$NON-NLS-1$ image.setStylePrimaryName("validation-textbox-tail-image"); //$NON-NLS-1$ tailImagePanel.add(image); bottomPanel.add(tailImagePanel); messagePanel.add(bottomPanel); popupPanel = new PopupPanel(true, false); popupPanel.setWidget(messagePanel); popupPanel.setPopupPositionAndShow(new PositionCallback() { public void setPosition(int offsetWidth, int offsetHeight) { int absLeft = -1; int absTop = -1; absLeft = textBox.getAbsoluteLeft(); absTop = textBox.getAbsoluteTop(); Rectangle popupSize = ElementUtils.getSize(popupPanel.getElement()); popupPanel.setPopupPosition(absLeft, absTop - popupSize.height >= 0 ? absTop - popupSize.height : absTop); } }); popupPanel.show(); }
From source file:org.pentaho.gwt.widgets.samples.SampleApp.java
License:Open Source License
@SuppressWarnings("deprecation") public void onModuleLoad() { DragController dragController = new PickupDragController(RootPanel.get(), false) { {//from w w w. j a v a 2 s.c o m setBehaviorDragProxy(true); setBehaviorDragStartSensitivity(5); } private Widget proxy; @Override protected void restoreSelectedWidgetsStyle() { } @Override protected void saveSelectedWidgetsLocationAndStyle() { } @Override protected void restoreSelectedWidgetsLocation() { } @Override public void dragStart() { super.dragStart(); } @Override public void dragEnd() { proxy.removeFromParent(); proxy = null; } @Override protected Widget newDragProxy(DragContext context) { proxy = ((Draggable) context.draggable).makeProxy(context.draggable); return proxy; } @Override public void previewDragEnd() throws VetoDragException { } }; final CustomListBox list = new CustomListBox(); list.setDragController(dragController); list.addItem("Alberta"); list.addItem("Atlanta"); list.addItem("San Francisco"); list.addItem("Alberta"); list.addItem("Atlanta"); list.addItem("San Francisco"); list.addItem("Alberta"); list.addItem("Atlanta"); list.addItem("San Francisco"); list.addItem("Alberta"); list.addItem(new DefaultListItem("Testing", new Image("16x16sample.png"))); list.addItem(new DefaultListItem("Testing 2", new CheckBox())); // list.setVisibleRowCount(6); list.addChangeListener(new ChangeListener() { public void onChange(Widget widget) { System.out.println("" + list.getSelectedIndex()); } }); list.setWidth("100%"); list.setHeight("100%"); // RootPanel.get().add(new Label("Combo: ")); // RootPanel.get().add(list); final CustomListBox list2 = new CustomListBox(); list2.setDragController(dragController); list2.addItem("Alberta"); list2.addItem("Atlanta"); list2.addItem("San Francisco"); list2.addItem("Alberta"); list2.addItem("Atlanta"); list2.addItem("San Francisco"); list2.addItem("Alberta"); list2.addItem("Atlanta"); list2.addItem("San Francisco"); list2.addItem("Alberta"); list2.addItem("Atlanta"); list2.addItem("San Francisco"); list2.add("Alberta"); list2.add("Atlanta"); list2.add("San Francisco"); list2.add("Alberta"); list2.add("Atlanta"); list2.add("San Francisco"); list2.add(new DefaultListItem("Testing", new Image("16x16sample.png"))); list2.addItem(new DefaultListItem("Testing 2", new CheckBox())); list2.setVisibleRowCount(6); // list2.setEditable(true); list2.setValue("Bogus"); list2.setMultiSelect(true); final Label selected = new Label(); list2.addChangeListener(new ChangeListener() { @Override public void onChange(Widget widget) { int[] sels = list2.getSelectedIndices(); selected.setText(""); for (int i = 0; i < sels.length; i++) { selected.setText(selected.getText() + ", " + sels[i]); } } }); RootPanel.get().add(new Label("")); RootPanel.get().add(new Label("Combo2: ")); RootPanel.get().add(list2); RootPanel.get().add(selected); CustomListBox list3 = new CustomListBox(); DefaultListItem dli = null; dli = new DefaultListItem("Testing 1", new Image("16x16sample.png")); dli.setValue("Value of Testing 1"); list3.add(dli); dli = new DefaultListItem("Testing 2", new CheckBox()); dli.setValue("Value of Testing 2"); list3.add(dli); // RootPanel.get().add(new Label("")); // RootPanel.get().add(new Label("Combo3: ")); // RootPanel.get().add(list3); Label showSelectedLabel = new Label("Selected item's value:"); final TextBox showSelectedTextBox = new TextBox(); showSelectedTextBox.setReadOnly(true); list3.addChangeListener(new ChangeListener() { public void onChange(Widget widget) { String val = (String) ((CustomListBox) widget).getSelectedItem().getValue(); if (val != null) { showSelectedTextBox.setText(val); } } }); final CustomListBox list4 = new CustomListBox(); list4.addItem("Albert"); list4.addItem("Greg"); list4.setWidth("170px"); RootPanel.get().add(new Label("")); RootPanel.get().add(new Label("Combo4: ")); RootPanel.get().add(list4); RootPanel.get().add(showSelectedLabel); RootPanel.get().add(showSelectedTextBox); final ColorPicker picker = new ColorPicker(); picker.addColorPickerListener(new ColorPickerListener() { public void colorPicked(ColorPicker picker) { System.out.println("color: " + picker.getColor()); } }); RootPanel.get().add(picker); Button btn = new Button("colorPicker"); RootPanel.get().add(btn); btn.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { picker.showPicker(); } }); }
From source file:org.pentaho.mantle.client.dialogs.scheduling.ScheduleCreateStatusDialog.java
License:Open Source License
public ScheduleCreateStatusDialog() { super(Messages.getString("scheduleCreated"), Messages.getString("yes"), Messages.getString("no"), false, true);/*from ww w.java 2 s.c o m*/ Label label = new Label(); label.setText(Messages.getString("scheduleCreateSuccess")); label.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); setContent(label); setWidth("400px"); }
From source file:org.pentaho.pac.client.common.ui.TableListCtrl.java
License:Open Source License
public void setTempMessage(String msg) { removeAll();// ww w .java 2 s . c o m Label l = new Label(); l.setText(msg); table.setWidget(FIRST_ROW, 0, l); table.getFlexCellFormatter().setColSpan(FIRST_ROW, 0, getNumColumns()); }
From source file:org.pepstock.jem.gwt.client.panels.swarm.commons.inspector.config.NetworkPanel.java
License:Open Source License
/** * Constructs all UI using role instance information * /*from w w w . j a v a2s . co m*/ * @param header * */ public NetworkPanel(String header) { setWidth(Sizes.toString(WIDTH)); setSpacing(SPACING); // sets disable the buttons because // they will be available when address properties will be selected // or inserted in text boxes add.setEnabled(false); Label label = new Label(header); label.addStyleName(Styles.INSTANCE.common().bold()); label.setHeight(Sizes.toString(LABEL_HEIGHT)); add(label); addressBox.setVisibleLength(40); addressBox.setTitle(ADDRESS_OK_TITLE); addressBox.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { // if some text is inserted, add button is enabled if (addressBox.isValidText()) { add.setEnabled(true); } else { add.setEnabled(false); } } }); add.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // adds the network address when click on add button if (listener != null) { listener.inspect(addressBox.getText()); } } }); Label addressLabel = new Label(); addressLabel.setText(ADDRESS_LABEL); add(addressLabel); add(addressBox); add(add); }