List of usage examples for com.google.gwt.user.client.ui Label Label
protected Label(Element element)
From source file:com.controlj.addon.gwttree.client.TreeManager.java
License:Open Source License
private void resetResultPanel(String message) { // Add loading label to the result panel setResultPanelContents(new Label(message)); }
From source file:com.controlj.addon.gwttree.client.TreeOptions.java
License:Open Source License
public void showDialog() { VerticalPanel dialogContents = new VerticalPanel(); dialogContents.setSpacing(4);//from w ww .j ava 2 s.c o m // Add the tree type radio buttons RadioButton dynamicChoice = createTreeChoice("treeTypeGroup", "Dynamic Tree", false); RadioButton staticChoice = createTreeChoice("treeTypeGroup", "Static Tree", true); if (state.isStaticTree) staticChoice.setValue(true); else dynamicChoice.setValue(true); dialogContents.add(dynamicChoice); dialogContents.add(staticChoice); // Add filtering support dialogContents.add(new Label("Filter by trend name (leave empty to not filter)")); HorizontalPanel sourcesPanel = new HorizontalPanel(); sourcesPanel.setSpacing(10); final ListBox sourceListBox = new ListBox(true); sourceListBox.setSize("10em", "5em"); for (String sourceName : state.sourceNames) sourceListBox.addItem(sourceName); sourcesPanel.add(sourceListBox); VerticalPanel sourcesButtonPanel = new VerticalPanel(); sourcesButtonPanel.add(new Button("Add...", new ClickHandler() { @Override public void onClick(ClickEvent clickEvent) { final TextBox textBox = new TextBox(); Dialog.showInputDialog("Add Filter", textBox, new Dialog.Handler() { @Override public void setupButtons(final Button ok, final Button cancel) { textBox.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent keyPressEvent) { if (keyPressEvent.getCharCode() == (char) 13) ok.click(); else if (keyPressEvent.getCharCode() == (char) 27) cancel.click(); } }); } @Override public void dialogClosed(boolean wasCancelled) { String name = textBox.getText().trim(); if (!wasCancelled && !name.isEmpty()) { state.sourceNames.add(name); sourceListBox.addItem(name); } } }); textBox.setFocus(true); } })); sourcesButtonPanel.add(new Button("Remove", new ClickHandler() { @Override public void onClick(ClickEvent clickEvent) { int count = sourceListBox.getItemCount(); for (int i = count - 1; i >= 0; i--) if (sourceListBox.isItemSelected(i)) { state.sourceNames.remove(sourceListBox.getItemText(i)); sourceListBox.removeItem(i); } } })); sourcesPanel.add(sourcesButtonPanel); dialogContents.add(sourcesPanel); final State originalState = state.copy(); Dialog.showInputDialog("Tree Options", dialogContents, new Dialog.Handler() { @Override public void setupButtons(Button ok, Button cancel) { } @Override public void dialogClosed(boolean wasCancelled) { if (wasCancelled) state = originalState; else if (!state.equals(originalState)) handler.optionsChanged(TreeOptions.this); } }); }
From source file:com.cristal.storm.prototype.client.mvp.view.MainPageView.java
License:Apache License
@Inject public MainPageView() { MCECell.Images images = GWT.create(MCECell.Images.class); MCECell textCell = new MCECell(images.icon()); ProvidesKey<MCE> keyProvider = new ProvidesKey<MCE>() { public Object getKey(MCE item) { // Always do a null check. return (item == null) ? null : item.getURI(); }//from w w w . jav a 2 s. co m }; mceCollectionDraggable = new DragAndDropCellList<MCE>(textCell, DEFAULT_RESOURCES, keyProvider); mceSelectionModel = new SingleSelectionModel<MCE>(keyProvider); mceCollectionDraggable.setSelectionModel(mceSelectionModel); // mceCollectionDraggable.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED); widget = uiBinder.createAndBindUi(this); HorizontalPanel horzPanel = new HorizontalPanel(); // Push the data into the widget. // TODO Remove this hardcoded definition of tags Set<String> mcetags1 = new TreeSet<String>(); mcetags1.add("search"); mcetags1.add("mail"); mcetags1.add("travel"); // TODO Remove this hardcoded definition of MCE MCE mce = new MCE("kayak.com", mcetags1); // MCE mce3 = new MCE("kayak.com", mcetags2); mceListVisible = new Vector<MCE>(); mceListVisible.add(mce); mceCollectionDraggable.setRowData(0, mceListVisible); mceSelectionModel.setSelected(mce, true); // The cell of this CellList are only draggable mceCollectionDraggable.setCellDraggableOnly(); // setup the drag operation DraggableOptions options = new DraggableOptions(); // use a clone of the original cell as drag helper options.setHelper(HelperType.CLONE); // set the opacity of the drag helper options.setOpacity((float) 0.9); // append the drag helper to the body element options.setAppendTo("body"); // configure the drag operations of the cell list with this options mceCollectionDraggable.setDraggableOptions(options); /** * Create a droppable CellList */ final FlowPanel aGwtPanel = new FlowPanel(); aGwtPanel.add(new Label("test")); DroppableWidget<FlowPanel> droppablePanel = new DroppableWidget<FlowPanel>(aGwtPanel); // configure the drop behaviour (see next paragraph) droppablePanel.setTolerance(DroppableTolerance.POINTER); droppablePanel.getOriginalWidget(); droppablePanel.addDropHandler(new DropEventHandler() { public void onDrop(DropEvent event) { // retrieve the droppable widget DroppableWidget<FlowPanel> droppableLabel = (DroppableWidget<FlowPanel>) event.getDroppableWidget(); // retrieve the dropped draggable widget (we assume it is a // draggable label) DraggableWidget<Label> draggableLabel = (DraggableWidget<Label>) event.getDraggableWidget(); Label toto = (Label) (droppableLabel.getOriginalWidget().getWidget(0)); Label toto2 = (Label) (droppableLabel.getOriginalWidget().getWidget(0)); aGwtPanel.add(toto2); // toto.setText("Let's eat!!!!"); // remove the draggabeLable // draggableLabel.removeFromParent(); // aGwtPanel.add( new // Label(event.getDraggableWidget().toString())); // event.getDraggableWidget().removeFromParent(); aGwtPanel.add(new Label("just dragged item1")); aGwtPanel.add(new Label("just dragged item2")); } }); horzPanel.add(droppablePanel); centerAbsPanel.add(horzPanel); }
From source file:com.databasepreservation.visualization.client.common.Dialogs.java
public static void showConfirmDialog(String title, String message, String cancelButtonText, String confirmButtonText, final AsyncCallback<Boolean> callback) { final DialogBox dialogBox = new DialogBox(false, true); dialogBox.setText(title);/*from w ww .java 2 s . co m*/ FlowPanel layout = new FlowPanel(); Label messageLabel = new Label(message); Button cancelButton = new Button(cancelButtonText); Button confirmButton = new Button(confirmButtonText); FlowPanel footer = new FlowPanel(); layout.add(messageLabel); layout.add(footer); footer.add(cancelButton); footer.add(confirmButton); dialogBox.setWidget(layout); dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(false); cancelButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { dialogBox.hide(); callback.onSuccess(false); } }); confirmButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { dialogBox.hide(); callback.onSuccess(true); } }); dialogBox.addStyleName("wui-dialog-confirm"); layout.addStyleName("wui-dialog-layout"); footer.addStyleName("wui-dialog-layout-footer"); messageLabel.addStyleName("wui-dialog-message"); cancelButton.addStyleName("btn btn-link"); confirmButton.addStyleName("btn btn-play"); dialogBox.center(); dialogBox.show(); }
From source file:com.databasepreservation.visualization.client.common.Dialogs.java
public static void showInformationDialog(String title, String message, String continueButtonText, final AsyncCallback<Void> callback) { final DialogBox dialogBox = new DialogBox(false, true); dialogBox.setText(title);//from ww w .j av a2 s. c o m FlowPanel layout = new FlowPanel(); Label messageLabel = new Label(message); Button continueButton = new Button(continueButtonText); layout.add(messageLabel); layout.add(continueButton); dialogBox.setWidget(layout); dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(false); continueButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { dialogBox.hide(); callback.onSuccess(null); } }); dialogBox.addStyleName("wui-dialog-information"); layout.addStyleName("wui-dialog-layout"); messageLabel.addStyleName("wui-dialog-message"); continueButton.addStyleName("btn btn-play"); dialogBox.center(); dialogBox.show(); }
From source file:com.databasepreservation.visualization.client.common.Dialogs.java
public static void showPromptDialog(String title, String message, String placeHolder, final RegExp validator, String cancelButtonText, String confirmButtonText, final AsyncCallback<String> callback) { final DialogBox dialogBox = new DialogBox(false, true); dialogBox.setText(title);/*w w w .ja v a2s. c o m*/ final FlowPanel layout = new FlowPanel(); if (message != null) { final Label messageLabel = new Label(message); layout.add(messageLabel); messageLabel.addStyleName("wui-dialog-message"); } final TextBox inputBox = new TextBox(); if (placeHolder != null) { inputBox.getElement().setPropertyString("placeholder", placeHolder); } final Button cancelButton = new Button(cancelButtonText); final Button confirmButton = new Button(confirmButtonText); layout.add(inputBox); layout.add(cancelButton); layout.add(confirmButton); dialogBox.setWidget(layout); dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(false); cancelButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { dialogBox.hide(); callback.onFailure(null); } }); confirmButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { dialogBox.hide(); callback.onSuccess(inputBox.getText()); } }); inputBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { boolean isValid = validator.test(inputBox.getText()); if (isValid) { inputBox.addStyleName("error"); } else { inputBox.removeStyleName("error"); } } }); inputBox.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { boolean isValid = validator.test(inputBox.getText()); confirmButton.setEnabled(isValid); } }); inputBox.addKeyDownHandler(new KeyDownHandler() { @Override public void onKeyDown(KeyDownEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { boolean isValid = validator.test(inputBox.getText()); if (isValid) { dialogBox.hide(); callback.onSuccess(inputBox.getText()); } } } }); confirmButton.setEnabled(validator.test(inputBox.getText())); dialogBox.addStyleName("wui-dialog-prompt"); layout.addStyleName("wui-dialog-layout"); inputBox.addStyleName("form-textbox wui-dialog-message"); cancelButton.addStyleName("btn btn-link"); confirmButton.addStyleName("pull-right btn btn-play"); dialogBox.center(); dialogBox.show(); inputBox.setFocus(true); }
From source file:com.databasepreservation.visualization.client.common.Dialogs.java
public static DialogBox showLoadingModel() { final DialogBox dialogBox = new DialogBox(false, true); dialogBox.setText("Loading..."); FlowPanel layout = new FlowPanel(); Label messageLabel = new Label(messages.executingTaskMessage()); layout.add(messageLabel);//from ww w . j a v a 2 s .com dialogBox.setWidget(layout); dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(false); dialogBox.addStyleName("wui-dialog-information"); layout.addStyleName("wui-dialog-layout"); messageLabel.addStyleName("wui-dialog-message"); dialogBox.center(); dialogBox.show(); return dialogBox; }
From source file:com.databasepreservation.visualization.client.common.lists.AsyncTableCell.java
public AsyncTableCell(Filter filter, boolean justActive, Facets facets, String summary, boolean selectable, boolean exportable, int initialPageSize, int pageSizeIncrement, O object) { super();/*from w w w.ja v a 2s .c o m*/ this.initialPageSize = initialPageSize; this.pageSizeIncrement = pageSizeIncrement; this.object = object; if (summary == null) { summary = "summary" + Random.nextInt(1000); } this.filter = filter; this.justActive = justActive; this.facets = facets; this.selectable = selectable; display = new AccessibleCellTable<T>(getInitialPageSize(), (MyCellTableResources) GWT.create(MyCellTableResources.class), getKeyProvider(), summary); display.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED); display.setLoadingIndicator(new HTML(SafeHtmlUtils.fromSafeConstant( "<div class='spinner'><div class='double-bounce1'></div><div class='double-bounce2'></div></div>"))); configure(display); this.dataProvider = new MyAsyncDataProvider<T>(display, new IndexResultDataProvider<T>() { @Override public void getData(Sublist sublist, ColumnSortList columnSortList, AsyncCallback<IndexResult<T>> callback) { AsyncTableCell.this.getData(sublist, columnSortList, callback); } }) { @Override protected void fireChangeEvent(IndexResult<T> result) { ValueChangeEvent.fire(AsyncTableCell.this, result); } }; dataProvider.addDataDisplay(display); if (exportable) { // mimic PageSizePager exportButtons = new FlexTable(); exportButtons.setCellPadding(0); exportButtons.setCellSpacing(0); exportVisibleButton = new Anchor("Export visible"); exportVisibleButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { AsyncTableCell.this.exportVisibleClickHandler(); } }); exportAllButton = new Anchor("Export all"); exportAllButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { AsyncTableCell.this.exportAllClickHandler(); } }); exportButtons.setWidget(0, 0, exportVisibleButton); exportButtons.setText(0, 1, " | "); exportButtons.setWidget(0, 2, exportAllButton); } resultsPager = new AccessibleSimplePager(AccessibleSimplePager.TextLocation.LEFT, (SimplePager.Resources) GWT.create(SimplePager.Resources.class), false, initialPageSize, false, false, (SimplePager.ImageButtonsConstants) GWT.create(SimplePager.ImageButtonsConstants.class)); resultsPager.setDisplay(display); pageSizePager = new PageSizePager(getPageSizePagerIncrement()); pageSizePager.setDisplay(display); createSelectAllPanel(); displayScroll = new ScrollPanel(display); displayScrollWrapper = new SimplePanel(displayScroll); add(selectAllPanel); add(displayScrollWrapper); add(resultsPager); if (exportButtons != null) { add(exportButtons); } add(pageSizePager); selectionModel = new SingleSelectionModel<>(getKeyProvider()); Handler<T> selectionEventManager = getSelectionEventManager(); if (selectionEventManager != null) { display.setSelectionModel(selectionModel, selectionEventManager); } else { display.setSelectionModel(selectionModel); } columnSortHandler = new AsyncHandler(display); display.addColumnSortHandler(columnSortHandler); display.addLoadingStateChangeHandler(new LoadingStateChangeEvent.Handler() { @Override public void onLoadingStateChanged(LoadingStateChangeEvent event) { if (LoadingStateChangeEvent.LoadingState.LOADED.equals(event.getLoadingState())) { handleScrollChanges(); } } }); addStyleName("my-asyncdatagrid"); resultsPager.addStyleName("my-asyncdatagrid-pager-results"); pageSizePager.addStyleName("my-asyncdatagrid-pager-pagesize"); displayScrollWrapper.addStyleName("my-asyncdatagrid-display-scroll-wrapper"); display.addStyleName("my-asyncdatagrid-display"); if (exportButtons != null) { exportButtons.addStyleName("my-asyncdatagrid-pager-pagesize"); // exportVisibleButton.addStyleName("btn btn-export btn-export-visible"); // exportAllButton.addStyleName("btn btn-export btn-export-all"); } displayScroll.addScrollHandler(new ScrollHandler() { @Override public void onScroll(ScrollEvent event) { handleScrollChanges(); } }); addValueChangeHandler(new ValueChangeHandler<IndexResult<T>>() { @Override public void onValueChange(ValueChangeEvent<IndexResult<T>> event) { selected = new HashSet<T>(); hideSelectAllPanel(); } }); Label emptyInfo = new Label(messages.noItemsToDisplay()); display.setEmptyTableWidget(emptyInfo); }
From source file:com.databasepreservation.visualization.client.common.lists.AsyncTableCell.java
public void createSelectAllPanel() { selectAllPanel = new FlowPanel(); selectAllPanelBody = new FlowPanel(); selectAllCheckBox = new CheckBox(); selectAllLabel = new Label("Select all"); selectAllPanelBody.add(selectAllCheckBox); selectAllPanelBody.add(selectAllLabel); selectAllPanel.add(selectAllPanelBody); selectAllPanel.setVisible(false);//from w w w . jav a 2 s .c om selectAllPanel.addStyleName("panel"); selectAllPanelBody.addStyleName("panel-body"); selectAllCheckBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { fireOnCheckboxSelectionChanged(); } }); }
From source file:com.databasepreservation.visualization.client.common.search.Dropdown.java
public void addItem(final String label, final String value) { popupValues.put(label, value);//from www . j a va2 s. co m Label item = new Label(label); popupPanel.add(item); item.addStyleName("dropdown-item"); item.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { selectedLabel.setText(label); onChange(); popup(); } }); popup.setWidget(popupPanel); setPanelWidth(); }