List of usage examples for com.google.gwt.user.client.ui HorizontalPanel setHorizontalAlignment
public void setHorizontalAlignment(HorizontalAlignmentConstant align)
From source file:org.otalo.ao.client.AreYouSureDialog.java
License:Apache License
public AreYouSureDialog(String message) { // Use this opportunity to set the dialog's caption. setText("Awaaz De Administration"); // Create a VerticalPanel to contain the 'about' label and the 'OK' button. VerticalPanel outer = new VerticalPanel(); // Create the 'about' text and set a style name so we can style it with CSS. HTML text = new HTML(message); text.setStyleName("mail-AboutText"); outer.add(text);//w w w . ja v a2 s.c om HorizontalPanel buttons = new HorizontalPanel(); buttons.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); buttons.setWidth("100%"); // Create the 'OK' button, along with a handler that hides the dialog // when the button is clicked. buttons.add(new Button("No", new ClickHandler() { public void onClick(ClickEvent event) { confirm = false; hide(); } })); buttons.add(new Button("Yes", new ClickHandler() { public void onClick(ClickEvent event) { confirm = true; hide(); } })); outer.add(buttons); setWidget(outer); }
From source file:org.otalo.ao.client.Broadcasts.java
License:Apache License
/** * Constructs a new list of forum widgets with a bundle of images. * //w ww. j av a 2s. com * @param images a bundle that provides the images for this widget */ public Broadcasts(Images images) { this.images = images; p = new VerticalPanel(); Anchor more = new Anchor("More"); more.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { startIndex += BCAST_PAGE_SIZE; Messages.get().loadBroadcasts(startIndex); } }); Anchor newbcast = new Anchor("New Broadcast"); newbcast.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { Messages.get().forwardThread(null); } }); //p.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); HorizontalPanel bcastOpts = new HorizontalPanel(); bcastOpts.setWidth("100%"); bcastOpts.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); bcastOpts.add(more); bcastOpts.add(newbcast); p.add(bcastOpts); initWidget(p); load(startIndex); }
From source file:org.pentaho.gwt.widgets.client.dialogs.PromptDialogBox.java
License:Open Source License
public PromptDialogBox(String title, String okText, String notOkText, String cancelText, boolean autoHide, boolean modal) { super(autoHide, modal); setText(title);//w ww. j a v a 2 s. c o m okButton = new Button(okText); okButton.setStylePrimaryName("pentaho-button"); okButton.getElement().setAttribute("id", "okButton"); //$NON-NLS-1$ //$NON-NLS-2$ okButton.addClickListener(new ClickListener() { public void onClick(Widget sender) { onOk(); } }); final HorizontalPanel dialogButtonPanel = new HorizontalPanel(); dialogButtonPanel.setSpacing(0); dialogButtonPanel.add(okButton); if (notOkText != null) { notOkButton = new Button(notOkText); notOkButton.setStylePrimaryName("pentaho-button"); notOkButton.getElement().setAttribute("id", "notOkButton"); //$NON-NLS-1$ //$NON-NLS-2$ notOkButton.addClickListener(new ClickListener() { public void onClick(Widget sender) { onNotOk(); } }); dialogButtonPanel.add(notOkButton); } if (cancelText != null) { cancelButton = new Button(cancelText); cancelButton.setStylePrimaryName("pentaho-button"); cancelButton.getElement().setAttribute("id", "cancelButton"); //$NON-NLS-1$ //$NON-NLS-2$ cancelButton.addClickListener(new ClickListener() { public void onClick(Widget sender) { onCancel(); } }); dialogButtonPanel.add(cancelButton); } HorizontalPanel dialogButtonPanelWrapper = new HorizontalPanel(); if (okText != null && cancelText != null) { dialogButtonPanelWrapper.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); } else { dialogButtonPanelWrapper.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); } dialogButtonPanelWrapper.setStyleName("button-panel"); //$NON-NLS-1$ dialogButtonPanelWrapper.setWidth("100%"); //$NON-NLS-1$ dialogButtonPanelWrapper.add(dialogButtonPanel); if (content instanceof FocusWidget) { setFocusWidget((FocusWidget) content); } dialogContent.setCellPadding(0); dialogContent.setCellSpacing(0); // add button panel dialogContent.setWidget(1, 0, dialogButtonPanelWrapper); dialogContent.getCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_BOTTOM); // dialogContent.getFlexCellFormatter().setColSpan(2, 0, 2); dialogContent.setWidth("100%"); //$NON-NLS-1$ setWidget(dialogContent); }
From source file:org.pentaho.gwt.widgets.client.dialogs.ResizableDialogBox.java
License:Open Source License
public ResizableDialogBox(final String headerText, String okText, String cancelText, final Widget content, final boolean modal) { this.content = content; boundaryPanel = new AbsolutePanel() { public void onBrowserEvent(Event event) { super.onBrowserEvent(event); if (!modal && event.getTypeInt() == Event.ONCLICK) { hide();/*from w ww. j a va 2 s.com*/ } } }; boundaryPanel.setSize("100%", Window.getClientHeight() + Window.getScrollTop() + "px"); //$NON-NLS-1$ //$NON-NLS-2$ boundaryPanel.setVisible(true); RootPanel.get().add(boundaryPanel, 0, 0); boundaryPanel.sinkEvents(Event.ONCLICK); boundaryPanel.getElement().getStyle().setProperty("cursor", "wait"); //$NON-NLS-1$ //$NON-NLS-2$ // initialize window controller which provides drag and resize windows WindowController windowController = new WindowController(boundaryPanel); // content wrapper Button ok = new Button(okText); ok.setStylePrimaryName("pentaho-button"); ok.getElement().setAttribute("id", "okButton"); //$NON-NLS-1$ //$NON-NLS-2$ ok.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (validatorCallback == null || (validatorCallback != null && validatorCallback.validate())) { try { if (callback != null) { callback.okPressed(); } } catch (Throwable dontCare) { //ignore } hide(); } } }); final HorizontalPanel dialogButtonPanel = new HorizontalPanel(); dialogButtonPanel.setSpacing(2); dialogButtonPanel.add(ok); if (cancelText != null) { Button cancel = new Button(cancelText); cancel.setStylePrimaryName("pentaho-button"); cancel.getElement().setAttribute("id", "cancelButton"); //$NON-NLS-1$ //$NON-NLS-2$ cancel.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { try { if (callback != null) { callback.cancelPressed(); } } catch (Throwable dontCare) { //ignore } hide(); } }); dialogButtonPanel.add(cancel); } HorizontalPanel dialogButtonPanelWrapper = new HorizontalPanel(); if (okText != null && cancelText != null) { dialogButtonPanelWrapper.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); } else { dialogButtonPanelWrapper.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); } dialogButtonPanelWrapper.setStyleName("dialogButtonPanel"); //$NON-NLS-1$ dialogButtonPanelWrapper.setWidth("100%"); //$NON-NLS-1$ dialogButtonPanelWrapper.add(dialogButtonPanel); Grid dialogContent = new Grid(2, 1); dialogContent.setCellPadding(0); dialogContent.setCellSpacing(0); dialogContent.getCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_TOP); dialogContent.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_LEFT); // add content dialogContent.setWidget(0, 0, content); dialogContent.getCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP); // add button panel dialogContent.setWidget(1, 0, dialogButtonPanelWrapper); dialogContent.getCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_BOTTOM); dialogContent.setWidth("100%"); //$NON-NLS-1$ dialogContent.setHeight("100%"); //$NON-NLS-1$ windowPanel = new WindowPanel(windowController, headerText, dialogContent, true); }
From source file:org.pentaho.gwt.widgets.client.filechooser.FileChooser.java
License:Open Source License
public void initUI() { if (mode == FileChooserMode.OPEN_READ_ONLY) { fileNameTextBox.setReadOnly(true); }/*w ww . j a v a 2 s. com*/ // We are here because we are initiating a fresh UI for a new directory // Since there is no file selected currently, we are setting file selected to false. setFileSelected(false); String path = this.selectedPath; // find the selected item from the list List<String> pathSegments = new ArrayList<String>(); if (path != null) { int index = path.indexOf("/", 0); //$NON-NLS-1$ while (index >= 0) { int oldIndex = index; index = path.indexOf("/", oldIndex + 1); //$NON-NLS-1$ if (index >= 0) { pathSegments.add(path.substring(oldIndex + 1, index)); } } pathSegments.add(path.substring(path.lastIndexOf("/") + 1)); //$NON-NLS-1$ } selectedTreeItem = getTreeItem(pathSegments); navigationListBox = new ListBox(); navigationListBox.getElement().setId("navigationListBox"); //$NON-NLS-1$ navigationListBox.setWidth("350px"); //$NON-NLS-1$ // now we can find the tree nodes who match the path segments navigationListBox.addItem("/", "/"); //$NON-NLS-1$ //$NON-NLS-2$ for (int i = 0; i < pathSegments.size(); i++) { String segment = pathSegments.get(i); String fullPath = ""; //$NON-NLS-1$ for (int j = 0; j <= i; j++) { String segmentPath = pathSegments.get(j); if (segmentPath != null && segmentPath.length() > 0) { fullPath += "/" + segmentPath; //$NON-NLS-1$ } } if (!fullPath.equals("/")) { //$NON-NLS-1$ navigationListBox.addItem(fullPath, segment); } } navigationListBox.setSelectedIndex(navigationListBox.getItemCount() - 1); navigationListBox.addChangeListener(new ChangeListener() { public void onChange(Widget sender) { changeToPath(navigationListBox.getItemText(navigationListBox.getSelectedIndex())); } }); clear(); VerticalPanel locationBar = new VerticalPanel(); locationBar.add(new Label(FileChooserEntryPoint.messages.getString("location"))); //$NON-NLS-1$ HorizontalPanel navigationBar = new HorizontalPanel(); final Image upDirImage = new Image(); upDirImage.setUrl(GWT.getModuleBaseURL() + "images/spacer.gif"); //$NON-NLS-1$ upDirImage.addStyleName("pentaho-filechooseupbutton"); //$NON-NLS-1$ upDirImage.setTitle(FileChooserEntryPoint.messages.getString("upOneLevel")); //$NON-NLS-1$ upDirImage.addMouseListener(new MouseListener() { public void onMouseDown(Widget sender, int x, int y) { } public void onMouseEnter(Widget sender) { } public void onMouseLeave(Widget sender) { } public void onMouseMove(Widget sender, int x, int y) { } public void onMouseUp(Widget sender, int x, int y) { } }); upDirImage.addClickListener(new ClickListener() { public void onClick(Widget sender) { // go up a dir TreeItem tmpItem = selectedTreeItem; List<String> parentSegments = new ArrayList<String>(); while (tmpItem != null) { RepositoryFileTree tree = (RepositoryFileTree) tmpItem.getUserObject(); if (tree.getFile() != null && tree.getFile().getName() != null) { parentSegments.add(tree.getFile().getName()); } tmpItem = tmpItem.getParentItem(); } Collections.reverse(parentSegments); String myPath = ""; //$NON-NLS-1$ // If we have a file selected then we need to go one lesser level deep final int loopCount = isFileSelected() ? parentSegments.size() - 2 : parentSegments.size() - 1; for (int i = 0; i < loopCount; i++) { String pathSegment = parentSegments.get(i); if (pathSegment != null && pathSegment.length() > 0) { myPath += "/" + pathSegment; //$NON-NLS-1$ } } if (myPath.equals("")) { //$NON-NLS-1$ myPath = "/"; //$NON-NLS-1$ } selectedTreeItem = selectedTreeItem.getParentItem(); if (selectedTreeItem == null) { selectedTreeItem = repositoryTree.getItem(0); } changeToPath(myPath); } }); navigationBar.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); navigationBar.add(navigationListBox); navigationBar.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); navigationBar.add(upDirImage); navigationBar.setCellWidth(upDirImage, "100%"); //$NON-NLS-1$ DOM.setStyleAttribute(upDirImage.getElement(), "marginLeft", "4px"); navigationBar.setWidth("100%"); //$NON-NLS-1$ locationBar.add(navigationBar); locationBar.setWidth("100%"); //$NON-NLS-1$ Label filenameLabel = new Label(FileChooserEntryPoint.messages.getString("filename")); //$NON-NLS-1$ filenameLabel.setWidth("550px"); //$NON-NLS-1$ add(filenameLabel); fileNameTextBox.setWidth("300px"); //$NON-NLS-1$ add(fileNameTextBox); add(locationBar); add(buildFilesList(selectedTreeItem)); }
From source file:org.pentaho.gwt.widgets.client.wizards.AbstractWizardDialog.java
License:Open Source License
/** * layout()//from w w w.ja v a 2s .c o m * * Lays out the GUI elements. Should only be called ONCE during the objects lifecycle */ protected void layout() { // Create the overall container to be displayed in the dialog SimplePanel deckWrapper = new SimplePanel(); deckWrapper.setHeight("100%"); deckWrapper.setWidth("100%"); deckWrapper.setStyleName("dialog-content"); DockPanel content = new DockPanel(); // Create the Steps and add it to the content stepsList = new VerticalPanel(); stepsList.add(new Label(Messages.getString("dialog.steps"))); steps.setVisibleItemCount(STEPS_COUNT); stepsList.add(steps); // steps.setSize("30%", "100%"); content.add(stepsList, DockPanel.WEST); // Add the wizardPanels to the Deck and add the deck to the content // wizardDeckPanel.setSize("70%", "100%"); deckWrapper.setWidget(wizardDeckPanel); content.add(deckWrapper, DockPanel.CENTER); wizardDeckPanel.addStyleName(WIZARD_DECK_PANEL); // Add the control buttons HorizontalPanel wizardButtonPanel = new HorizontalPanel(); wizardButtonPanel.setSpacing(2); // If we have only one button then we dont need to show the back and next button. wizardButtonPanel.add(backButton); wizardButtonPanel.add(nextButton); wizardButtonPanel.add(finishButton); wizardButtonPanel.add(cancelButton); wizardButtonPanel.addStyleName(WIZARD_BUTTON_PANEL); HorizontalPanel wizardButtonPanelWrapper = new HorizontalPanel(); wizardButtonPanelWrapper.setWidth("100%"); //$NON-NLS-1$ wizardButtonPanelWrapper.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); wizardButtonPanelWrapper.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM); wizardButtonPanelWrapper.add(wizardButtonPanel); content.add(wizardButtonPanelWrapper, DockPanel.SOUTH); content.setCellVerticalAlignment(wizardButtonPanelWrapper, HasVerticalAlignment.ALIGN_BOTTOM); // Add the content to the dialog add(content); content.setWidth("100%"); //$NON-NLS-1$ content.setHeight("100%"); //$NON-NLS-1$ content.setCellHeight(deckWrapper, "98%"); }
From source file:org.pentaho.mantle.client.admin.EmailTestDialog.java
License:Open Source License
public EmailTestDialog() { /* autohide= false; modal= true */ super(false, true); setText(Messages.getString("connectionTest.label")); closeButton = new Button(Messages.getString("close")); closeButton.setStylePrimaryName("pentaho-button"); closeButton.getElement().setAttribute("id", "okButton"); //$NON-NLS-1$ //$NON-NLS-2$ closeButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { onOk();/*from w w w . j a va 2 s . c om*/ } }); final HorizontalPanel dialogButtonPanel = new HorizontalPanel(); dialogButtonPanel.setSpacing(0); dialogButtonPanel.add(closeButton); HorizontalPanel dialogButtonPanelWrapper = new HorizontalPanel(); dialogButtonPanelWrapper.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); dialogButtonPanelWrapper.setStyleName("button-panel"); //$NON-NLS-1$ dialogButtonPanelWrapper.setWidth("100%"); //$NON-NLS-1$ dialogButtonPanelWrapper.add(dialogButtonPanel); if (content instanceof FocusWidget) { setFocusWidget((FocusWidget) content); } dialogContent.setCellPadding(0); dialogContent.setCellSpacing(0); dialogContent.getFlexCellFormatter().setHeight(0, 0, "100%"); // add button panel dialogContent.setWidget(1, 0, dialogButtonPanelWrapper); dialogContent.getCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_BOTTOM); dialogContent.setWidth("100%"); //$NON-NLS-1$ setWidget(dialogContent); this.setWidth("360px"); this.setHeight("100px"); HorizontalPanel hp = new HorizontalPanel(); statusLabel = new Label(""); hp.add(statusLabel); hp.setHeight("100%"); hp.setWidth("100%"); this.setContent(hp); closeButton.setEnabled(true); closeButton.setVisible(true); }
From source file:org.pentaho.pac.client.common.ui.dialog.BasicDialog.java
License:Open Source License
/** * Displays the dialog on the screen.//www. j a v a2s . c om */ public void show() { super.show(); if (null == titleBarSpan) { try { titleBarSpan = RootPanel.get(titleBarSpanId); } catch (Throwable ex) { } final BasicDialog localThis = this; HorizontalPanel p = new HorizontalPanel(); p.setWidth("99%"); //$NON-NLS-1$ p.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); p.add(titleBarLabel); p.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); if (showCloseButton) { Image img = PacImageBundle.getBundle().closeIcon().createImage(); img.setStyleName("basicDialog.closeIcon"); //$NON-NLS-1$ img.addClickListener(new ClickListener() { public void onClick(Widget sender) { if (null != localThis.closeHandler) { localThis.closeHandler.onHandle(localThis); } else { localThis.hide(); } } }); p.add(img); } if (titleBarSpan != null) { titleBarSpan.add(p); } } titleBarLabel.setText(title); }
From source file:org.pentaho.reporting.platform.plugin.gwt.client.ReportViewer.java
License:Open Source License
public void openUrlInDialog(final String title, final String url, String width, String height) { if (StringUtils.isEmpty(height)) { height = "600px"; //$NON-NLS-1$ }// w w w .j av a 2s . c o m if (StringUtils.isEmpty(width)) { width = "800px"; //$NON-NLS-1$ } if (height.endsWith("px") == false) //$NON-NLS-1$ { height += "px"; //$NON-NLS-1$ } if (width.endsWith("px") == false) //$NON-NLS-1$ { width += "px"; //$NON-NLS-1$ } final DialogBox dialogBox = new DialogBox(false, true); dialogBox.setStylePrimaryName("pentaho-dialog"); dialogBox.setText(title); final Frame frame = new Frame(url); frame.setSize(width, height); final Button okButton = new Button(messages.getString("ok", "OK")); //$NON-NLS-1$ //$NON-NLS-2$ okButton.setStyleName("pentaho-button"); okButton.addClickHandler(new ClickHandler() { public void onClick(final ClickEvent event) { dialogBox.hide(); } }); final HorizontalPanel buttonPanel = new HorizontalPanel(); DOM.setStyleAttribute(buttonPanel.getElement(), "padding", "0px 5px 5px 5px"); //$NON-NLS-1$ //$NON-NLS-2$ buttonPanel.setWidth("100%"); //$NON-NLS-1$ buttonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); buttonPanel.add(okButton); final VerticalPanel dialogContent = new VerticalPanel(); DOM.setStyleAttribute(dialogContent.getElement(), "padding", "0px 5px 0px 5px"); //$NON-NLS-1$ //$NON-NLS-2$ dialogContent.add(frame); dialogContent.add(buttonPanel); dialogBox.setWidget(dialogContent); // dialogBox.setHeight(height); // dialogBox.setWidth(width); dialogBox.center(); }
From source file:org.pentaho.reporting.platform.plugin.gwt.client.ReportViewerUtil.java
License:Open Source License
public static void showMessageDialog(final ResourceBundle messages, final String title, final String message) { if (ReportViewerUtil.isInPUC()) { ReportViewerUtil.showPUCMessageDialog(title, message); return;// w ww . ja v a 2s.c o m } final DialogBox dialogBox = new DialogBox(false, true); dialogBox.setStylePrimaryName("pentaho-dialog"); dialogBox.setText(title); final VerticalPanel dialogContent = new VerticalPanel(); DOM.setStyleAttribute(dialogContent.getElement(), "padding", "0px 5px 0px 5px"); //$NON-NLS-1$ //$NON-NLS-2$ dialogContent.add(new HTML(message, true)); final HorizontalPanel buttonPanel = new HorizontalPanel(); DOM.setStyleAttribute(buttonPanel.getElement(), "padding", "0px 5px 5px 5px"); //$NON-NLS-1$ //$NON-NLS-2$ buttonPanel.setWidth("100%"); //$NON-NLS-1$ buttonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); final Button okButton = new Button(messages.getString("ok", "OK")); //$NON-NLS-1$ //$NON-NLS-2$ okButton.setStyleName("pentaho-button"); okButton.addClickHandler(new ClickHandler() { public void onClick(final ClickEvent event) { dialogBox.hide(); } }); buttonPanel.add(okButton); dialogContent.add(buttonPanel); dialogBox.setWidget(dialogContent); dialogBox.center(); // prompt }