List of usage examples for com.google.gwt.user.client.ui HorizontalPanel remove
@Override public boolean remove(Widget w)
From source file:ch.heftix.mailxel.client.MultiLinePanel.java
License:Open Source License
public void removeWidget(final Widget widget) { HorizontalPanel p = widgetPanelMap.get(widget); p.remove(widget); widgetPanelMap.remove(widget);/* w w w .ja v a 2 s .c o m*/ }
From source file:com.dimdim.conference.ui.common.client.list.DefaultListBrowseControl.java
License:Open Source License
protected Image setImage(HorizontalPanel panel, Image newImage, Image image) { panel.remove(image); Image image2 = newImage;// w w w. jav a2 s . c o m image2.addClickListener(this); image2.setStyleName("list-browse-control-image"); panel.add(image2); panel.setCellVerticalAlignment(image2, VerticalPanel.ALIGN_MIDDLE); return image2; }
From source file:com.dimdim.conference.ui.common.client.list.ListEntryPanel.java
License:Open Source License
protected Image setImage(DockPanel imagePanel, Image image, Image imageUrl, ClickListener clickListener, HorizontalPanel subPanel, String tooltip, boolean rightAlign) { Image image2 = image;//from ww w .j a va 2 s . co m if (image != null) { //Window.alert("prev image = is not null"); if (subPanel != null) { //Window.alert("subpanel = is not null so removing.."); subPanel.remove(image); image2 = null; } else if (imagePanel != null) { imagePanel.remove(image); image2 = null; } } if (imageUrl != null) { /* if (imageUrl.endsWith("xxx")) { Image image = new Image(imageUrl); image.addStyleName("list-entry-panel-image"); imagePanel.add(image,DockPanel.WEST); imagePanel.setCellHorizontalAlignment(image,HorizontalPanel.ALIGN_CENTER); imagePanel.setCellVerticalAlignment(image,VerticalPanel.ALIGN_MIDDLE); if (clickListener != null) { image.addClickListener(clickListener); } } else */ // else { image2 = imageUrl; image2.addStyleName("list-entry-panel-image"); if (subPanel != null) { subPanel.add(image2); subPanel.setCellHorizontalAlignment(image2, HorizontalPanel.ALIGN_CENTER); subPanel.setCellVerticalAlignment(image2, VerticalPanel.ALIGN_MIDDLE); } else { if (rightAlign) { imagePanel.add(image2, DockPanel.EAST); imagePanel.setCellHorizontalAlignment(image2, HorizontalPanel.ALIGN_RIGHT); imagePanel.setCellVerticalAlignment(image2, VerticalPanel.ALIGN_MIDDLE); } else { imagePanel.add(image2, DockPanel.WEST); imagePanel.setCellHorizontalAlignment(image2, HorizontalPanel.ALIGN_CENTER); imagePanel.setCellVerticalAlignment(image2, VerticalPanel.ALIGN_MIDDLE); } } if (clickListener != null) { image2.addClickListener(clickListener); //image2.addStyleName("anchor-cursor"); } if (tooltip != null) { image2.setTitle(tooltip); } } } return image2; }
From source file:com.dimdim.conference.ui.resources.client.ResourceTypeListEntryPanel.java
License:Open Source License
protected Image setImage(DockPanel imagePanel, Image currentImage, Image newImage, ClickListener clickListener, HorizontalPanel subPanel, String tooltip, boolean rightAlign) { Image image2 = currentImage;//from ww w .j a v a2 s.co m if (currentImage != null) { if (subPanel != null) { //Window.alert("subpanel = is not null so removing.."); subPanel.remove(currentImage); image2 = null; } else if (imagePanel != null) { imagePanel.remove(currentImage); image2 = null; } } if (newImage != null) { { image2 = newImage; image2.addStyleName("list-entry-panel-image"); if (subPanel != null) { subPanel.add(image2); subPanel.setCellHorizontalAlignment(image2, HorizontalPanel.ALIGN_CENTER); subPanel.setCellVerticalAlignment(image2, VerticalPanel.ALIGN_MIDDLE); } else { if (rightAlign) { imagePanel.add(image2, DockPanel.EAST); imagePanel.setCellHorizontalAlignment(image2, HorizontalPanel.ALIGN_RIGHT); imagePanel.setCellVerticalAlignment(image2, VerticalPanel.ALIGN_MIDDLE); } else { imagePanel.add(image2, DockPanel.WEST); imagePanel.setCellHorizontalAlignment(image2, HorizontalPanel.ALIGN_CENTER); imagePanel.setCellVerticalAlignment(image2, VerticalPanel.ALIGN_MIDDLE); } } if (clickListener != null) { image2.addClickListener(clickListener); //image2.addStyleName("anchor-cursor"); } if (tooltip != null) { image2.setTitle(tooltip); } } } return image2; }
From source file:com.gwt.conn.client.Dashboard.java
/** * Called whenever a menu needs to be loaded. Parameter "message" is * displayed after loading.//from w ww .java2 s. c o m */ public static void loadMenu(final Menu menu, String message, boolean internet) { // this is used so that buttons don't do anything when clicked // if the contents that the button would load are already visible // need to use storage to save state of editor when interacting with // buttons storage.setItem("curDashPage", "vis"); // default to visual editor first // initialize panels for widgets to be placed in final VerticalPanel dashboardPan = new VerticalPanel(); dashboardPan.addStyleName("marginlessPanel"); // interacts with Connfrontend.css dashboardPan.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); dashboardPan.setSize("100%", "100%"); final HorizontalPanel buttonPan = new HorizontalPanel(); buttonPan.addStyleName("marginPanel"); // initialize buttons and put them into the button panel final Button visualButton = new Button("Visual Editor"); final Button dataButton = new Button("Data Editor"); visualButton.addStyleName("myButton"); dataButton.addStyleName("myButton"); buttonPan.add(visualButton); buttonPan.add(dataButton); // put the button panel in the dashboard panel dashboardPan.add(buttonPan); dashboardPan.setCellHeight(buttonPan, "0%"); // get static instances of all possible editor app contents final Frame previewContent = Previewer.getPreviewer(menu); final HorizontalPanel visualContent = VisualEditor.getVisualEditor(menu, previewContent, internet); final HorizontalPanel dataContent = DataEditor.getDataEditor(menu); // put the dashboard panel in the root panel dashboardPan.add(visualContent); // load visual editor by default dashboardPan.setCellHeight(visualContent, "100%"); RootPanel.get().add(dashboardPan, 0, 0); // handler for visualButton shows the visual editor class VisualHandler implements ClickHandler { public void onClick(ClickEvent event) { String cur = storage.getItem("curDashPage"); if (cur.equals("dat")) { dashboardPan.remove(dataContent); storage.setItem("curDashPage", "vis"); dashboardPan.add(visualContent); dashboardPan.setCellHeight(visualContent, "100%"); } } } final VisualHandler visualHandler = new VisualHandler(); visualButton.addClickHandler(visualHandler); // handler for dataButton shows the data editor class DataHandler implements ClickHandler { public void onClick(ClickEvent event) { String cur = storage.getItem("curDashPage"); if (cur.equals("vis")) { dashboardPan.remove(visualContent); storage.setItem("curDashPage", "dat"); dashboardPan.add(dataContent); dashboardPan.setCellHeight(dataContent, "100%"); } } } final DataHandler dataHandler = new DataHandler(); dataButton.addClickHandler(dataHandler); if (internet == false) showNoInternetError(); // internet connection detected, so attach synchronize button to the dashboard else { // attach a push-to-server button final Button pushButton = new Button("Synchronize"); pushButton.addStyleName("myButton"); buttonPan.add(pushButton); class PushHandler implements ClickHandler { public void onClick(ClickEvent event) { boolean internetStill = Communicate.hasInternet(); if (internetStill) { // false because not authenticating Communicate.sync(menu.getName(), storage.getItem("restID"), false); } else { buttonPan.remove(pushButton); showNoInternetError(); } } } final PushHandler pushHandler = new PushHandler(); pushButton.addClickHandler(pushHandler); } }
From source file:com.ikon.frontend.client.widget.form.FormManager.java
License:Open Source License
/** * getDrawEditFormElement/*w w w . j a v a2s. c o m*/ * * Called externally by file browser to draw form element, really used to do not reply draw logic and use actual * Use with caution table elements will be removed after executed this method * * @param gwtFormElement * @return */ public Widget getDrawEditFormElement(GWTFormElement gwtFormElement, HasSearch search) { this.search = search; Widget widget = new HTML(""); // empty widget ( used in case not applicable form elements ) if (gwtFormElement == null) { // To show empty value return widget; } int row = table.getRowCount(); isSearchView = true; setFormElements(Arrays.asList(gwtFormElement)); // Initilizing form element list ( needed by edit drawFormElement(row, gwtFormElement, false, isSearchView); drawed = true; edit(); if (gwtFormElement instanceof GWTTextArea) { HorizontalPanel hPanel = (HorizontalPanel) table.getWidget(row, 1); widget = hPanel.getWidget(0); } else if (gwtFormElement instanceof GWTInput) { HorizontalPanel hPanel = (HorizontalPanel) table.getWidget(row, 1); if (((GWTInput) gwtFormElement).getType().equals(GWTInput.TYPE_TEXT)) { widget = hPanel.getWidget(0); } else if (((GWTInput) gwtFormElement).getType().equals(GWTInput.TYPE_DATE)) { hPanel.remove(8); // Removing delete icon return hPanel; } else if (((GWTInput) gwtFormElement).getType().equals(GWTInput.TYPE_FOLDER)) { return hPanel; } else if (((GWTInput) gwtFormElement).getType().equals(GWTInput.TYPE_LINK)) { return hPanel; } } else if (gwtFormElement instanceof GWTSuggestBox) { return table.getWidget(row, 1); } else if (gwtFormElement instanceof GWTCheckBox) { return table.getWidget(row, 1); } else if (gwtFormElement instanceof GWTSelect) { if (((GWTSelect) gwtFormElement).getType().equals(GWTSelect.TYPE_SIMPLE)) { HorizontalPanel hPanel = (HorizontalPanel) table.getWidget(row, 1); return hPanel.getWidget(0); } else if (((GWTSelect) gwtFormElement).getType().equals(GWTSelect.TYPE_MULTIPLE)) { HorizontalPanel hPanel = (HorizontalPanel) table.getWidget(row, 1); return hPanel; } } else if (gwtFormElement instanceof GWTUpload) { // Not aplicable } else if (gwtFormElement instanceof GWTText) { // Not aplicable } else if (gwtFormElement instanceof GWTSeparator) { // Not aplicable } else if (gwtFormElement instanceof GWTDownload) { // Not aplicable } else if (gwtFormElement instanceof GWTPrint) { // Not aplicable } table.removeAllRows(); return widget; }
From source file:com.ikon.frontend.client.widget.form.FormManager.java
License:Open Source License
/** * getFilesToUpload/*ww w . j a v a2s . co m*/ */ public Collection<FileToUpload> getFilesToUpload(String transition) { List<FileToUpload> filesToUpload = new ArrayList<FileToUpload>(); int rows = 0; for (GWTFormElement formElement : formElementList) { if (formElement instanceof GWTUpload) { HorizontalPanel hPanel = (HorizontalPanel) hWidgetProperties.get(formElement.getName()); table.setWidget(rows, 1, hPanel); FileUpload fileUpload = (FileUpload) hPanel.getWidget(1); if (!fileUpload.getFilename().equals("")) { hPanel.remove(fileUpload); hPanel.add(new HTML(fileUpload.getFilename())); // replace uploadfile widget to text file FileToUpload fileToUpload = new FileToUpload(); GWTUpload upload = (GWTUpload) formElement; if (upload.getType().equals(GWTUpload.TYPE_CREATE)) { fileToUpload.setAction(UIFileUploadConstants.ACTION_INSERT); } else if (upload.getType().equals(GWTUpload.TYPE_UPDATE)) { fileToUpload.setAction(UIFileUploadConstants.ACTION_UPDATE); } fileToUpload.setName(formElement.getName()); fileToUpload.setFileUpload(fileUpload); fileToUpload.setSize(upload.getWidth()); fileToUpload.setFireEvent(false); fileToUpload.setPath(upload.getFolderPath()); fileToUpload.setDesiredDocumentName(upload.getDocumentName()); fileToUpload.setWorkflow(workflow); fileToUpload.setLastToBeUploaded(false); fileToUpload.setEnableAddButton(false); fileToUpload.setEnableImport(false); fileToUpload.setWorkflowTaskId(taskInstance.getId()); fileToUpload.setWorkflowTransition(transition); filesToUpload.add(fileToUpload); } } rows++; } // Indicates is the last file to be upload in the cycle if (filesToUpload.size() > 0) { filesToUpload.get(filesToUpload.size() - 1).setLastToBeUploaded(true); } return filesToUpload; }
From source file:com.openkm.frontend.client.widget.form.FormManager.java
License:Open Source License
/** * getDrawEditFormElement/*w w w .ja v a2s. c om*/ * * Called externally by file browser to draw form element, really used to do not reply draw logic and use actual * Use with caution table elements will be removed after executed this method * * @param gwtFormElement * @return */ public Widget getDrawEditFormElement(GWTFormElement gwtFormElement, HasPropertyHandler propertyHandler) { this.propertyHandler = propertyHandler; Widget widget = new HTML(""); // empty widget ( used in case not applicable form elements ) if (gwtFormElement == null) { // To show empty value return widget; } int row = table.getRowCount(); isSearchView = true; setFormElements(Arrays.asList(gwtFormElement)); // Initilizing form element list ( needed by edit drawFormElement(row, gwtFormElement, false, isSearchView); drawed = true; edit(); if (gwtFormElement instanceof GWTTextArea) { HorizontalPanel hPanel = (HorizontalPanel) table.getWidget(row, 1); widget = hPanel.getWidget(0); } else if (gwtFormElement instanceof GWTInput) { HorizontalPanel hPanel = (HorizontalPanel) table.getWidget(row, 1); if (((GWTInput) gwtFormElement).getType().equals(GWTInput.TYPE_TEXT)) { widget = hPanel.getWidget(0); } else if (((GWTInput) gwtFormElement).getType().equals(GWTInput.TYPE_DATE)) { hPanel.remove(8); // Removing delete icon return hPanel; } else if (((GWTInput) gwtFormElement).getType().equals(GWTInput.TYPE_FOLDER)) { return hPanel; } else if (((GWTInput) gwtFormElement).getType().equals(GWTInput.TYPE_LINK)) { return hPanel; } } else if (gwtFormElement instanceof GWTSuggestBox) { return table.getWidget(row, 1); } else if (gwtFormElement instanceof GWTCheckBox) { return table.getWidget(row, 1); } else if (gwtFormElement instanceof GWTSelect) { if (((GWTSelect) gwtFormElement).getType().equals(GWTSelect.TYPE_SIMPLE)) { HorizontalPanel hPanel = (HorizontalPanel) table.getWidget(row, 1); return hPanel.getWidget(0); } else if (((GWTSelect) gwtFormElement).getType().equals(GWTSelect.TYPE_MULTIPLE)) { HorizontalPanel hPanel = (HorizontalPanel) table.getWidget(row, 1); return hPanel; } } else if (gwtFormElement instanceof GWTUpload) { // Not aplicable } else if (gwtFormElement instanceof GWTText) { // Not aplicable } else if (gwtFormElement instanceof GWTSeparator) { // Not aplicable } else if (gwtFormElement instanceof GWTDownload) { // Not aplicable } else if (gwtFormElement instanceof GWTPrint) { // Not aplicable } table.removeAllRows(); return widget; }
From source file:com.sun.labs.aura.music.wsitm.client.ui.HelpPopup.java
License:Open Source License
/** * Build the menu of the pannel and create the rounded popup *///from w w w .ja v a 2 s.c om private void buildPanel() { HorizontalPanel menu = new HorizontalPanel(); menu.setStyleName("helpPopupMenu"); menu.setWidth("460px"); menu.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER); for (HelpSection hS : sections) { Label sL = hS.lbl; sL.addClickHandler(new DEClickHandler<HELP_SECTIONS>(hS.section) { @Override public void onClick(ClickEvent event) { showHelp(data); } }); menu.add(sL); menu.add(new Label(" - ")); } menu.remove(menu.getWidgetCount() - 1); RoundedPanel rp = new RoundedPanel(menu, RoundedPanel.ALL, 3); rp.setCornerStyleName("helpPopupMenu"); rp.setWidth("460px"); rp.getElement().getStyle().setPropertyPx("marginBottom", 8); VerticalPanel vP = new VerticalPanel(); vP.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER); vP.add(rp); vP.add(contentPanel); Popup.showRoundedPopup(vP, "Music Explaura Help", popup, 800); isInit = true; }
From source file:org.dataconservancy.dcs.access.client.model.JsCoreMetadata.java
License:Apache License
public Widget display(final String entityId, final CellTree tree) { //final Grid grid = //new Grid(7,2); final FlexTable grid = Util.createTable("Title:", "", "Contact:", "Subjects:", "Type:", "Rights:"); grid.setWidth("90%"); grid.getCellFormatter().setStyleName(1, 1, "PaddedCell"); final HorizontalPanel hp = new HorizontalPanel(); hp.setSpacing(5);// w ww . ja va2 s . c o m final Image image = new Image("images/wait.gif"); final Label delete = Util.label("Delete [X]", "SimplerButton"); final Label title = Util.label(getTitle(), "HeadingField"); final Label expand = new Label("[+]"); expand.setStyleName("Expand"); final Label collapse = new Label("[-]"); collapse.setStyleName("Collapse"); final ScrollPanel treePanel = getTree(tree); delete.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { depositService.deleteCollection(entityId, SeadApp.accessurl, new AsyncCallback<Boolean>() { @Override public void onSuccess(Boolean result) { Window.alert("The collection was deleted."); History.newItem(SeadState.HOME.toToken()); } @Override public void onFailure(Throwable caught) { Window.alert("Sorry, the collection could not be deleted."); History.newItem(SeadState.HOME.toToken()); } }); } }); expand.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { hp.remove(expand); hp.remove(title); int del = 0; if (delete.isAttached()) { hp.remove(delete); del = 1; } hp.add(collapse); hp.add(title); if (del == 1) hp.add(delete); if (tree != null) { //grid.setWidget(1, 0, new Label("Contains")); grid.setWidget(1, 1, treePanel); } else { History.newItem("related;" + entityId); } } }); collapse.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { grid.remove(treePanel); hp.remove(collapse); hp.remove(title); int del = 0; if (delete.isAttached()) { hp.remove(delete); del = 1; } hp.add(expand); hp.add(title); if (del == 1) hp.add(delete); } }); //TODO:Loading of related files takes too much time if (tree == null) { hp.add(expand); } else { hp.add(collapse); //hp.add(collapse); } hp.add(title); hp.add(image); final AsyncCallback<UserSession> cb = new AsyncCallback<UserSession>() { public void onSuccess(final UserSession result) { if (image.isAttached()) hp.remove(image); if (getSubmitter().getSubmitterId().equals(result.getEmail())) { hp.add(delete); } } public void onFailure(Throwable error) { Window.alert("Failed to login: " + error.getMessage()); } }; SeadApp.userService.checkSession(null, cb); grid.setWidget(0, 1, hp); grid.setWidget(2, 1, new Label(getContact())); grid.setWidget(3, 1, new Label(toString(getSubjects()))); grid.setWidget(4, 1, new Label(getType())); grid.setWidget(5, 1, new Label(getRights())); if (tree != null) grid.setWidget(1, 1, treePanel); return grid; }