List of usage examples for com.google.gwt.user.client.ui HorizontalPanel setVerticalAlignment
public void setVerticalAlignment(VerticalAlignmentConstant align)
From source file:org.mobicents.slee.container.management.console.client.common.BrowseContainer.java
License:Open Source License
private void refreshLinks() { if (links.size() <= 1) return;// w ww . java 2 s. com HorizontalPanel header = new HorizontalPanel(); header.setStyleName("common-BrowseContainer-links"); header.setSpacing(5); header.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); int firstLink = 0; if (!showAllLinks) { firstLink = Math.max(0, links.size() - MAX_BREADCRUMB_LINKS); if (firstLink > 0) { MenuBar hiddenMenu = new MenuBar(); MenuBar subMenu = new MenuBar(true); for (int q = firstLink - 1; q >= 0; q--) { final int fq = q; Command cmd = new Command() { public void execute() { select(fq); } }; BrowseLink link = (BrowseLink) links.get(q); subMenu.addItem(link.getTitle(), cmd); } MenuItem root = new MenuItem("History", subMenu); hiddenMenu.addItem(root); /* * Hyperlink showAllLink = new Hyperlink("(show hidden)", "(show hidden)"); ClickListener listener = new ClickListener() { public * void onClick(Widget source) { showAllLinks = true; refresh(); showAllLinks = false; } }; showAllLink.addClickListener(listener); */ header.add(hiddenMenu); header.add(new Image("images/chain.separator.gif")); } } for (int i = firstLink; i <= links.size() - 1; i++) { BrowseLink link = links.get(i); shortifyAndAddLink(header, link); if (i != links.size() - 1) { header.add(new Image("images/chain.separator.gif")); ((BrowseLink) links.get(i)).setStyle(false); } else { ((BrowseLink) links.get(i)).setStyle(true); } } rootPanel.add(header); }
From source file:org.ned.server.nedadminconsole.client.widgets.NedItemEditor.java
License:Open Source License
public NedItemEditor(NedDataModel model) { this.model = model; VerticalPanel verticalPanel = new VerticalPanel(); verticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); verticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); verticalPanel.setSpacing(8);//from www . ja va 2 s.c o m verticalPanel.setBorderWidth(0); verticalPanel.setSize("400px", "100%"); initWidget(verticalPanel); lblElementInfo = new Label(NedRes.instance().itemEditElementInfo()); lblElementInfo.setStyleName("gwt-Label-element"); verticalPanel.add(lblElementInfo); verticalPanel.setCellVerticalAlignment(lblElementInfo, HasVerticalAlignment.ALIGN_MIDDLE); verticalPanel.setCellHorizontalAlignment(lblElementInfo, HasHorizontalAlignment.ALIGN_CENTER); lblElementInfo.setSize("100%", ""); Grid gridItemInfo = new Grid(8, 2); gridItemInfo.setCellPadding(10); gridItemInfo.setStyleName("NedItemEditorPanel"); verticalPanel.add(gridItemInfo); verticalPanel.setCellVerticalAlignment(gridItemInfo, HasVerticalAlignment.ALIGN_MIDDLE); verticalPanel.setCellWidth(gridItemInfo, "300px"); verticalPanel.setCellHorizontalAlignment(gridItemInfo, HasHorizontalAlignment.ALIGN_CENTER); gridItemInfo.setSize("392px", "470px"); Label lblNewLabel_3 = new Label(NedRes.instance().id() + ":"); gridItemInfo.setWidget(0, 0, lblNewLabel_3); gridItemInfo.getCellFormatter().setWidth(0, 0, "30%"); textBoxId = new TextBox(); gridItemInfo.setWidget(0, 1, textBoxId); textBoxId.setWidth("97%"); gridItemInfo.getCellFormatter().setWidth(0, 1, ""); textBoxId.setReadOnly(true); Label lblNewLabel_5 = new Label(NedRes.instance().itemEditParentId() + ":"); gridItemInfo.setWidget(1, 0, lblNewLabel_5); gridItemInfo.getCellFormatter().setWidth(1, 0, "30%"); textBoxIdParent = new TextBox(); gridItemInfo.setWidget(1, 1, textBoxIdParent); gridItemInfo.getCellFormatter().setWidth(1, 1, ""); textBoxIdParent.setMaxLength(20); textBoxIdParent.setReadOnly(true); textBoxIdParent.setWidth("97%"); Label lblNewLabel = new Label(NedRes.instance().itemEditTitle() + ":"); gridItemInfo.setWidget(2, 0, lblNewLabel); textBoxTitle = new TextBox(); gridItemInfo.setWidget(2, 1, textBoxTitle); textBoxTitle.setMaxLength(40); textBoxTitle.setWidth("97%"); Label lblNewLabel_1 = new Label(NedRes.instance().itemEditType() + ":"); gridItemInfo.setWidget(3, 0, lblNewLabel_1); textBoxType = new TextBox(); gridItemInfo.setWidget(3, 1, textBoxType); textBoxType.setReadOnly(true); textBoxType.setWidth("97%"); Label lblNewLabel_2 = new Label(NedRes.instance().itemEditDescription() + ":"); gridItemInfo.setWidget(4, 0, lblNewLabel_2); textAreaDescription = new TextArea(); gridItemInfo.setWidget(4, 1, textAreaDescription); textAreaDescription.setVisibleLines(4); textAreaDescription.setCharacterWidth(30); textAreaDescription.setSize("97%", ""); Label lblKeywords = new Label(NedRes.instance().itemEditKeywords() + ":"); gridItemInfo.setWidget(5, 0, lblKeywords); textBoxKeywords = new TextBox(); gridItemInfo.setWidget(5, 1, textBoxKeywords); textBoxKeywords.setVisibleLength(30); textBoxKeywords.setWidth("97%"); Label lblExternalLinks = new Label(NedRes.instance().itemEditExternalLinks() + ":"); gridItemInfo.setWidget(6, 0, lblExternalLinks); textAreaLinks = new TextArea(); gridItemInfo.setWidget(6, 1, textAreaLinks); textAreaLinks.setCharacterWidth(30); textAreaLinks.setWidth("97%"); labelFile = new Label(NedRes.instance().itemFile() + ":"); gridItemInfo.setWidget(7, 0, labelFile); horizontalPanelFile = new HorizontalPanel(); horizontalPanelFile.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); horizontalPanelFile.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); gridItemInfo.setWidget(7, 1, horizontalPanelFile); horizontalPanelFile.setWidth("100%"); gridItemInfo.getCellFormatter().setWidth(7, 1, ""); textBoxFile = new TextBox(); horizontalPanelFile.add(textBoxFile); horizontalPanelFile.setCellWidth(textBoxFile, "60%"); textBoxFile.setReadOnly(true); textBoxFile.setWidth("147px"); buttonUpload = new Button(); horizontalPanelFile.add(buttonUpload); horizontalPanelFile.setCellHorizontalAlignment(buttonUpload, HasHorizontalAlignment.ALIGN_RIGHT); horizontalPanelFile.setCellWidth(buttonUpload, "40%"); buttonUpload.setText(NedRes.instance().uploadDlgUpload()); buttonUpload.addClickHandler(new CommandUploadFile()); buttonUpload.setWidth("100%"); gridItemInfo.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_LEFT); gridItemInfo.getCellFormatter().setHorizontalAlignment(2, 0, HasHorizontalAlignment.ALIGN_LEFT); gridItemInfo.getCellFormatter().setHorizontalAlignment(3, 0, HasHorizontalAlignment.ALIGN_LEFT); gridItemInfo.getCellFormatter().setHorizontalAlignment(4, 0, HasHorizontalAlignment.ALIGN_LEFT); gridItemInfo.getCellFormatter().setHorizontalAlignment(5, 0, HasHorizontalAlignment.ALIGN_LEFT); gridItemInfo.getCellFormatter().setHorizontalAlignment(6, 0, HasHorizontalAlignment.ALIGN_LEFT); gridItemInfo.getCellFormatter().setHorizontalAlignment(7, 0, HasHorizontalAlignment.ALIGN_LEFT); gridItemInfo.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_LEFT); gridItemInfo.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_LEFT); gridItemInfo.getCellFormatter().setHorizontalAlignment(4, 1, HasHorizontalAlignment.ALIGN_LEFT); textAreaLinks.getElement().setAttribute("wrap", "off"); HorizontalPanel horizontalPanel_4 = new HorizontalPanel(); horizontalPanel_4.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); verticalPanel.add(horizontalPanel_4); verticalPanel.setCellVerticalAlignment(horizontalPanel_4, HasVerticalAlignment.ALIGN_MIDDLE); horizontalPanel_4.setWidth("100%"); Button buttonSave = new Button(""); buttonSave.setText(NedRes.instance().save()); horizontalPanel_4.add(buttonSave); horizontalPanel_4.setCellWidth(buttonSave, "25%"); buttonSave.addClickHandler(new UpdateItemCommand()); buttonSave.setWidth("100%"); Button buttonDelete = new Button(""); buttonDelete.setText(NedRes.instance().delete()); buttonDelete.addClickHandler(new CommandDeleteItem()); horizontalPanel_4.add(buttonDelete); horizontalPanel_4.setCellHorizontalAlignment(buttonDelete, HasHorizontalAlignment.ALIGN_RIGHT); buttonDelete.setWidth("100%"); horizontalPanel_4.setCellWidth(buttonDelete, "25%"); // decoratorPanel.add(verticalPanel); setVisible(false); }
From source file:org.ned.server.nedadminconsole.client.widgets.NedLibraryTree.java
License:Open Source License
public NedLibraryTree(final NedDataModel model) { this.model = model; model.addListener(this); VerticalPanel verticalPanelTreeContent = new VerticalPanel(); verticalPanelTreeContent.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); verticalPanelTreeContent.setSpacing(8); verticalPanelTreeContent.setSize("350px", "100%"); initWidget(verticalPanelTreeContent); labelLibraryName = new Label(); verticalPanelTreeContent.add(labelLibraryName); verticalPanelTreeContent.setCellVerticalAlignment(labelLibraryName, HasVerticalAlignment.ALIGN_MIDDLE); labelLibraryName.setDirectionEstimator(false); labelLibraryName.setStyleName("gwt-Label-element"); labelLibraryName.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); labelLibraryName.setSize("100%", ""); libTree = new NedTree(); libTree.setSize("100%", "100%"); libTree.addSelectionHandler(new SelectionHandler<TreeItem>() { @Override//from ww w.j ava2s . c om public void onSelection(SelectionEvent<TreeItem> event) { NedObject obj = ((NedTreeItem) event.getSelectedItem()).getNedObject(); model.treeObjectSelection(obj, event.getSelectedItem()); updateAddButton(obj); } }); HorizontalPanel horizontalPanel = new HorizontalPanel(); horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); verticalPanelTreeContent.add(horizontalPanel); verticalPanelTreeContent.setCellVerticalAlignment(horizontalPanel, HasVerticalAlignment.ALIGN_MIDDLE); horizontalPanel.setSize("100%", "100%"); ScrollPanel scrollPanel = new ScrollPanel(); horizontalPanel.add(scrollPanel); verticalPanelTreeContent.setCellHeight(scrollPanel, "440px"); verticalPanelTreeContent.setCellVerticalAlignment(scrollPanel, HasVerticalAlignment.ALIGN_MIDDLE); scrollPanel.setStyleName("treeScrollPanel"); scrollPanel.setSize("350px", "470px"); scrollPanel.setWidget(libTree); VerticalPanel verticalPanel = new VerticalPanel(); verticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); verticalPanelTreeContent.add(verticalPanel); verticalPanelTreeContent.setCellVerticalAlignment(verticalPanel, HasVerticalAlignment.ALIGN_MIDDLE); verticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); verticalPanel.setSize("100%", ""); btnNewButton = new Button(NedRes.instance().add()); verticalPanel.add(btnNewButton); verticalPanel.setCellVerticalAlignment(btnNewButton, HasVerticalAlignment.ALIGN_BOTTOM); verticalPanel.setCellHorizontalAlignment(btnNewButton, HasHorizontalAlignment.ALIGN_CENTER); btnNewButton.setSize("100%", ""); btnNewButton.addClickHandler(new AddButtonClickHandler()); btnNewButton.setEnabled(false); setVisible(false); }
From source file:org.olanto.TranslationText.client.SideWidget.java
License:Open Source License
public SideWidget() { HorizontalPanel hp = new HorizontalPanel(); hp.setHeight("50"); hp.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE); hp.add(findS);/*from ww w . jav a 2 s. c o m*/ hp.add(txtS); hp.add(langS); HorizontalPanel hp1 = new HorizontalPanel(); hp1.setHeight("50"); hp1.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE); hp1.add(findT); hp1.add(txtT); hp1.add(langT); ContentPanel srch = new ContentPanel(); srch.setBodyBorder(true); srch.setHeading("File Finder"); srch.setButtonAlign(HorizontalAlignment.CENTER); srch.add(hp); srch.add(hp1); srch.add(GoSrch); initWidget(pWidget); pWidget.add(srch); }
From source file:org.openelis.gwt.widget.ScreenWindow.java
License:Open Source License
public void init(Mode mode, boolean noBorder) { this.mode = mode; setWidget(outer);/*from w w w.j a v a 2 s .c om*/ setVisible(false); if (browser != null) zIndex = browser.index; if (!noBorder) { tlCorner.addStyleName("WindowTL"); trCorner.addStyleName("WindowTR"); blCorner.addStyleName("WindowBL"); brCorner.addStyleName("WindowBR"); leftSide.addStyleName("WindowLeft"); rightSide.addStyleName("WindowRight"); HorizontalPanel hp = new HorizontalPanel(); hp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); titleButtonsContainer = new HorizontalPanel(); titleButtonsContainer.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); hp.setWidth("100%"); titleButtonsContainer.addStyleName("Caption"); titleButtonsContainer.setWidth("100%"); cap.addMouseDownHandler(this); winLabel.setStyleName("ScreenWindowLabel"); cap.add(winLabel); cap.setWidth("100%"); cap.setHeight("100%"); cap.setCellVerticalAlignment(winLabel, HasAlignment.ALIGN_MIDDLE); close.addClickHandler(this); close.setStyleName("CloseButton"); collapse.addClickHandler(this); collapse.setStyleName("MinimizeButton"); hp.add(tlCorner); titleButtonsContainer.add(cap); titleButtonsContainer.setCellWidth(cap, "100%"); hp.add(titleButtonsContainer); hp.setCellWidth(titleButtonsContainer, "100%"); if (mode == Mode.SCREEN || mode == Mode.LOOK_UP) { HorizontalPanel hp2 = new HorizontalPanel(); hp2.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); hp2.add(collapse); hp2.add(close); titleButtonsContainer.add(hp2); titleButtonsContainer.setCellHorizontalAlignment(hp2, HasAlignment.ALIGN_RIGHT); hp.setCellWidth(hp2, "32px"); hp.setCellHorizontalAlignment(hp2, HasAlignment.ALIGN_RIGHT); } hp.add(trCorner); statusImg.addMouseOverHandler(this); statusImg.addMouseOutHandler(this); status.setStyleName("StatusBar"); status.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); status.add(statusImg); status.add(message); status.add(progressBar); progressBar.setVisible(false); status.setWidth("100%"); status.setCellWidth(message, "100%"); message.setStyleName("ScreenWindowLabel"); outer.add(hp); bottomRow.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); bottomRow.setWidth("100%"); bottomRow.setSpacing(0); middleGrid.setCellPadding(0); middleGrid.setCellSpacing(0); middleGrid.getCellFormatter().addStyleName(0, 0, "WindowLeft"); middleGrid.setWidget(0, 1, body); middleGrid.getCellFormatter().addStyleName(0, 2, "WindowRight"); bottomRow.add(blCorner); bottomRow.add(status); bottomRow.add(brCorner); bottomRow.setCellWidth(status, "100%"); body.addStyleName("WindowBody"); outer.add(middleGrid); outer.add(bottomRow); outer.addStyleName("WindowPanel"); outer.sinkEvents(Event.ONCLICK); outer.setWidth("auto"); } else { outer.add(body); outer.addStyleName("WindowPanel"); outer.sinkEvents(Event.ONCLICK); outer.setWidth("auto"); } Window.addResizeHandler(this); if (browser != null) { browser.dragController.makeDraggable(this, cap); return; } if (mode == Mode.LOOK_UP || mode == Mode.DIALOG) { modalGlass = new AbsolutePanel(); modalGlass.setStyleName("GlassPanel"); modalGlass.setHeight(Window.getClientHeight() + "px"); modalGlass.setWidth(Window.getClientWidth() + "px"); RootPanel.get().add(modalGlass); RootPanel.get().setWidgetPosition(modalGlass, 0, 0); modalPanel = new AbsolutePanel(); modalPanel.setStyleName("ModalPanel"); modalPanel.setHeight(Window.getClientHeight() + "px"); modalPanel.setWidth(Window.getClientWidth() + "px"); modalPanel.add(this, position, position); RootPanel.get().add(modalPanel); RootPanel.get().setWidgetPosition(modalPanel, 0, 0); setVisible(true); dragController = new PickupDragController(modalPanel, true); dropController = new AbsolutePositionDropController(modalPanel); dragController.registerDropController(dropController); dragController.makeDraggable(this, cap); dragController.setBehaviorDragProxy(true); } else { RootPanel.get().add(this); RootPanel.get().setWidgetPosition(this, position, position); setVisible(true); dragController = new PickupDragController(RootPanel.get(), true); dropController = new AbsolutePositionDropController(RootPanel.get()); dragController.registerDropController(dropController); dragController.makeDraggable(this, cap); dragController.setBehaviorDragProxy(true); } }
From source file:org.openremote.web.console.client.SlidingToolbar.java
License:Open Source License
private SlidingToolbar(PanelSizeInfo sizeInfo) { HorizontalPanel container = new HorizontalPanel(); this.initWidget(container); setWidth("340px"); setStylePrimaryName("toolbar"); setHeight("100%"); container.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); DOM.setStyleAttribute(getElement(), "marginLeft", "-320px"); mainPanel = new VerticalPanel(); mainPanel.setStylePrimaryName("mainToolbarPanel"); tab = new Label(">"); tab.setStylePrimaryName("tabToolbarPanel"); container.add(mainPanel);/*from w w w . java 2s . c o m*/ container.add(tab); // Configure Main Panel mainPanel.setHeight("80%"); mainPanel.setWidth("320px"); mainPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); Element mainElem = mainPanel.getElement(); DOM.setStyleAttribute(mainElem, "paddingLeft", "70px"); DOM.setStyleAttribute(mainElem, "paddingTop", "20px"); DOM.setStyleAttribute(mainElem, "paddingRight", "20px"); DOM.setStyleAttribute(mainElem, "paddingBottom", "20px"); // Configure Tab tab.setWidth("20px"); tab.setHeight("50px"); tab.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); Element tabElem = tab.getElement(); DOM.setStyleAttribute(tabElem, "lineHeight", "50px"); // Add to Window RootPanel.get().add(this, 0, 0); addAnimation(); createToolbarContent(sizeInfo); }
From source file:org.openremote.web.console.client.SlidingToolbar.java
License:Open Source License
private void createToolbarContent(PanelSizeInfo sizeInfo) { // Create Toolbar Content HTML title = new HTML(); title.setHTML("<span>OpenRemote</span><br /><span>Web Console 2.1.5</span>"); title.setWidth("100%"); title.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); title.setStylePrimaryName("title"); mainPanel.add(title);/*from w w w . j a va 2s. com*/ VerticalPanel panelSizePanel = new VerticalPanel(); panelSizePanel.setStylePrimaryName("panelSizePanel"); panelSizePanel.setHeight("150px"); panelSizePanel.add(new HTML( "<h3>Panel Size</h3><p>If you specify a panel size then the dimensions are as if the panel was in Portrait orientation (i.e. Width<=Height).<br /><br />Min Panel Size: 320px x 480px</p>")); fullscreenOpt = new RadioButton("panelSize", "Fullscreen"); fullscreenOpt.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { setPanelSizeType(PanelSizeType.FULLSCREEN); } }); fixedOpt = new RadioButton("panelSize", "Specify (W X H):"); fixedOpt.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { setPanelSizeType(PanelSizeType.FIXED); } }); panelSizePanel.add(fullscreenOpt); panelSizePanel.add(fixedOpt); HorizontalPanel sizeInputPanel = new HorizontalPanel(); sizeInputPanel.setStylePrimaryName("sizeInputBoxes"); sizeInputPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); widthInput = new TextBox(); heightInput = new TextBox(); widthInput.setStylePrimaryName("panelSize"); heightInput.setStylePrimaryName("panelSize"); widthInput.addDomHandler(this, KeyUpEvent.getType()); widthInput.addDomHandler(this, BlurEvent.getType()); heightInput.addDomHandler(this, KeyUpEvent.getType()); heightInput.addDomHandler(this, BlurEvent.getType()); sizeInputPanel.add(widthInput); sizeInputPanel.add(new Label("X")); sizeInputPanel.add(heightInput); panelSizePanel.add(sizeInputPanel); mainPanel.add(panelSizePanel); Button rotateBtn = new Button(); rotateBtn.setWidth("100px"); rotateBtn.setHeight("50px"); rotateBtn.setText("ROTATE"); rotateBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { String eventOrientation = "landscape"; if (WebConsole.getConsoleUnit().getOrientation().equals("landscape")) { eventOrientation = "portrait"; } ConsoleUnitEventManager.getInstance().getEventBus().fireEvent(new RotationEvent(eventOrientation, BrowserUtils.getWindowWidth(), BrowserUtils.getWindowHeight())); // Update local storage orientation LocalDataServiceImpl.getInstance().setObject("orientation", eventOrientation); } }); Button resizeBtn = new Button(); resizeBtn.setWidth("100px"); resizeBtn.setHeight("50px"); resizeBtn.setText("RESIZE"); resizeBtn.getElement().setId("resizeBtn"); resizeBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { int widthInt = 0; int heightInt = 0; if (currentType == PanelSizeType.FULLSCREEN) { WebConsole.getConsoleUnit().setSize(true); } else { if (widthValid && heightValid) { try { widthInt = Integer.parseInt(widthInput.getValue()); heightInt = Integer.parseInt(heightInput.getValue()); if (widthInt <= heightInt && widthInt >= 320 && heightInt >= 480) { ConsoleUnit unit = WebConsole.getConsoleUnit(); unit.setSize(widthInt, heightInt, false); unit.setPosition(); unit.setOrientation(unit.getOrientation()); // // Check if unit went to fullscreen due to large dimensions // if (unit.getIsFullscreen()) { // currentType = PanelSizeType.FULLSCREEN; // widthInt = 0; // heightInt = 0; // } } else { Window.alert( "Width must be less than or equal to the Height.\n\nMinimum Panel Size: 320px x 480px"); return; } } catch (Exception e) { return; } } else { Window.alert("Width and Height values must be Integers!"); return; } } // Store new preference LocalDataService dataService = LocalDataServiceImpl.getInstance(); PanelSizeInfo sizeInfo = AutoBeanService.getInstance().getFactory().create(PanelSizeInfo.class) .as(); sizeInfo.setPanelSizeType(currentType == PanelSizeType.FULLSCREEN ? "fullscreen" : "fixed"); sizeInfo.setPanelSizeHeight(heightInt); sizeInfo.setPanelSizeWidth(widthInt); dataService.setObject("panelSizeInfo", AutoBeanService.getInstance().toJsonString(sizeInfo)); syncUI(sizeInfo); } }); // // Panel Width Input // widthLbl = new Label("Panel Width:"); // widthLbl.setStylePrimaryName("toolbarInputLabel"); // widthLbl.setWidth("100%"); // widthLbl.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); // mainPanel.add(widthLbl); // widthInput = new TextBox(); // widthInput.setStylePrimaryName("toolbarInput"); // widthInput.setWidth("100%"); // widthInput.addDomHandler(this, KeyUpEvent.getType()); // widthInput.addDomHandler(this, BlurEvent.getType()); // mainPanel.add(widthInput); // validateInput(widthInput); // // // Panel Height Input // heightLbl = new Label("Panel Height:"); // heightLbl.setStylePrimaryName("toolbarInputLabel"); // heightLbl.setWidth("100%"); // heightLbl.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); // mainPanel.add(heightLbl); // heightInput = new TextBox(); // heightInput.setStylePrimaryName("toolbarInput"); // heightInput.setWidth("100%"); // heightInput.addDomHandler(this, KeyUpEvent.getType()); // heightInput.addDomHandler(this, BlurEvent.getType()); // mainPanel.add(heightInput); // validateInput(heightInput); panelSizePanel.add(resizeBtn); panelSizePanel.setCellHorizontalAlignment(resizeBtn, HasHorizontalAlignment.ALIGN_CENTER); mainPanel.add(rotateBtn); // Add Version String String versionStr = "Build: " + BrowserUtils.getBuildVersionString(); mainPanel.add(new Label(versionStr)); // Match UI to Panel Size Info syncUI(sizeInfo); }
From source file:org.openxdata.designer.client.util.FormDesignerUtil.java
/** * Creates an HTML fragment that places an image & caption together, for use * in a group header./* ww w . j a v a 2s . c o m*/ * * @param imageProto an image prototype for an image * @param caption the group caption * @return the header HTML fragment */ public static String createHeaderHTML(ImageResource imageProto, String caption) { //Add the image and text to a horizontal panel HorizontalPanel hPanel = new HorizontalPanel(); hPanel.setSpacing(0); hPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); hPanel.add(FormUtil.createImage(imageProto)); //HTML headerText = new HTML(caption); Widget headerText = new Label(caption); hPanel.add(headerText); return hPanel.getElement().getString(); }
From source file:org.openxdata.designer.client.widget.TreeItemWidget.java
/** * Creates a new tree item.//from w w w. j ava2 s . c o m * * @param imageProto the item image. * @param caption the time caption or text. * @param popup the pop up panel for context menu. * @param formActionListener listener to form action events. */ public TreeItemWidget(ImageResource imageProto, String caption, PopupPanel popup, IFormActionListener formActionListener) { this.popup = popup; this.formActionListener = formActionListener; HorizontalPanel hPanel = new HorizontalPanel(); hPanel.setSpacing(0); hPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); hPanel.add(FormUtil.createImage(imageProto)); //HTML headerText = new HTML(caption); //Replaced with Label due to bug which surfaces when we have text including things like "<sdsff>" Widget headerText = new Label(caption); hPanel.add(headerText); hPanel.setStyleName("gwt-noWrap"); initWidget(hPanel); DOM.sinkEvents(getElement(), DOM.getEventsSunk(getElement()) | Event.ONMOUSEDOWN | Event.ONKEYDOWN); }
From source file:org.openxdata.sharedlib.client.view.OpenFileDialog.java
/** * Sets up the widgets.//from w w w . j a v a2 s . c o m * * @param url the url to post to. */ public void initWidgets(String url) { actionUrl = url; form.setAction(actionUrl); form.setEncoding(FormPanel.ENCODING_MULTIPART); form.setMethod(FormPanel.METHOD_POST); VerticalPanel verticalPanel = new VerticalPanel(); verticalPanel.setSpacing(20); form.add(verticalPanel); fileUpload = new FileUpload(); fileUpload.setName("filecontents"); verticalPanel.add(fileUpload); HorizontalPanel horizontalPanel = new HorizontalPanel(); horizontalPanel.setWidth("100%"); horizontalPanel.setHeight("100%"); horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM); Button button = new Button(constants.open(), new ClickHandler() { public void onClick(ClickEvent event) { String action = actionUrl; if (action.contains("?")) action += "&"; else action += "?"; action += "pathname=" + fileUpload.getFilename(); //action += "&time="+ new java.util.Date().getTime(); form.setAction(action); form.submit(); //hide(); FormUtil.dlg.setText(constants.processingMsg()); FormUtil.dlg.center(); } }); horizontalPanel.add(button); horizontalPanel.setCellHorizontalAlignment(button, HasHorizontalAlignment.ALIGN_LEFT); button = new Button(constants.cancel(), new ClickHandler() { public void onClick(ClickEvent event) { hide(); FormUtil.dlg.hide(); } }); horizontalPanel.add(button); horizontalPanel.setCellHorizontalAlignment(button, HasHorizontalAlignment.ALIGN_RIGHT); verticalPanel.add(horizontalPanel); setWidget(form); form.addSubmitCompleteHandler(new SubmitCompleteHandler() { public void onSubmitComplete(FormPanel.SubmitCompleteEvent event) { eventListener.onSetFileContents(event.getResults()); hide(); FormUtil.dlg.hide(); } }); setText(constants.openFile()); }