List of usage examples for com.google.gwt.user.client.ui HorizontalPanel setHorizontalAlignment
public void setHorizontalAlignment(HorizontalAlignmentConstant align)
From source file:org.pepstock.jem.gwt.client.panels.administration.TreeOptions.java
License:Open Source License
/** * /* ww w . jav a 2s . c om*/ * @param description * @param option * @return */ private final CellPanel createItem(String description, final String option, ImageResource icon, String permission) { if (!ClientPermissions.isAuthorized(Permissions.ADMINISTRATION, permission)) { return null; } /*-------------------------+ | Node inspect | +-------------------------*/ // this is the inside panel final HorizontalPanel options = new HorizontalPanel(); options.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); options.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); options.setSpacing(8); options.setWidth(Sizes.HUNDRED_PERCENT); final Anchor anchor = new Anchor(description); anchor.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (listener != null) { listener.inspect(option); selectPanel(options); } } }); // add the icon if present if (icon != null) { options.add(new Image(icon)); } options.add(anchor); options.setCellWidth(anchor, Sizes.HUNDRED_PERCENT); return options; }
From source file:org.pepstock.jem.gwt.client.panels.administration.TreeOptions.java
License:Open Source License
private final DisclosurePanel createContainer(String label, ImageResource icon, CellPanel... panels) { HorizontalPanel header = new HorizontalPanel(); header.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); header.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); header.setSpacing(8);//from w w w . ja v a 2s. c om if (icon != null) { Image image = new Image(icon); image.addStyleName(Styles.INSTANCE.common().noBorder()); header.add(image); } header.add(new Label(label)); DisclosurePanel disclosure = new DisclosurePanel(); disclosure.setHeader(header); disclosure.setAnimationEnabled(true); VerticalPanel panel = new VerticalPanel(); for (int i = 0; i < panels.length; i++) { panel.add(panels[i]); } disclosure.setContent(panel); return disclosure; }
From source file:org.pepstock.jem.gwt.client.panels.gfs.TreeOptions.java
License:Open Source License
public TreeOptions() { setWidth(Sizes.HUNDRED_PERCENT);//from w w w . ja va 2s.co m setHeight(Sizes.HUNDRED_PERCENT); // Root of output tree HorizontalPanel header = new HorizontalPanel(); header.setHorizontalAlignment(ALIGN_LEFT); header.setVerticalAlignment(ALIGN_MIDDLE); header.setSpacing(8); header.add(new Image(Images.INSTANCE.driveOpen24())); header.add(new Label("Global file system")); DisclosurePanel admin = new DisclosurePanel(); admin.setHeader(header); admin.setAnimationEnabled(true); admin.setOpen(true); CellPanel data = createItem("Data", DATA_OPTION, Images.INSTANCE.folderRed24(), Permissions.GFS_DATA); CellPanel lib = createItem("Library", LIBRARY_OPTION, Images.INSTANCE.folderRed24(), Permissions.GFS_LIBRARY); CellPanel src = createItem("Sources", SOURCES_OPTION, Images.INSTANCE.folderRed24(), Permissions.GFS_SOURCES); CellPanel classes = createItem("Class", CLASS_OPTION, Images.INSTANCE.folderRed24(), Permissions.GFS_CLASS); CellPanel bin = createItem("Binary", BINARY_OPTION, Images.INSTANCE.folderRed24(), Permissions.GFS_BINARY); /*-------------------------+ | Add options | +-------------------------*/ VerticalPanel statusPanel = new VerticalPanel(); if (data != null) { statusPanel.add(data); } if (lib != null) { statusPanel.add(lib); } if (src != null) { statusPanel.add(src); } if (classes != null) { statusPanel.add(classes); } if (bin != null) { statusPanel.add(bin); } if (statusPanel.getElement().getChildCount() > 0) { admin.setContent(statusPanel); Grid grid = new Grid(1, 1); grid.setWidget(0, 0, admin); add(grid); } }
From source file:org.pepstock.jem.gwt.client.panels.gfs.TreeOptions.java
License:Open Source License
/** * //from ww w . j av a2 s . com * @param description * @param option * @return */ private final CellPanel createItem(String description, final String option, ImageResource icon, String permission) { if (!ClientPermissions.isAuthorized(Permissions.GFS, permission)) { return null; } /*-------------------------+ | Node inspect | +-------------------------*/ // this is the inside panel final HorizontalPanel options = new HorizontalPanel(); options.setHorizontalAlignment(ALIGN_LEFT); options.setVerticalAlignment(ALIGN_MIDDLE); options.setSpacing(8); // create the link final Anchor anchor = new Anchor(description); anchor.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (listener != null) { listener.inspect(option); selectPanel(options); } } }); // add the icon if present if (icon != null) { options.add(new Image(icon)); } // add the link options.add(anchor); setCellWidth(anchor, Sizes.HUNDRED_PERCENT); return options; }
From source file:org.pepstock.jem.gwt.client.panels.jobs.commons.inspector.Output.java
License:Open Source License
/** * Constructs UI using the job that is in inspect mode, and the tree of produced output * //from w w w .j av a 2 s.c om * @param job job instance in inspect mode * @param outputTree the tree of produced output * */ public Output(Job job, OutputTree outputTree) { final Job thisJob = job; // Root of output tree DisclosurePanel root = new DisclosurePanel(job.getName()); root.setAnimationEnabled(true); // this is the inside panel VerticalPanel firstLevelPanel = new VerticalPanel(); firstLevelPanel.setSpacing(1); // scans first level for (OutputListItem item : outputTree.getFirstLevelItems()) { final HorizontalPanel options = new HorizontalPanel(); options.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); options.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); options.setSpacing(8); options.setWidth(Sizes.HUNDRED_PERCENT); // create a item anchor for all elements of tree final ItemAnchor anchor = new ItemAnchor(item); anchor.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // asks to load and show the output output(thisJob, anchor.getItem()); selectPanel(options); } }); options.add(anchor); options.setCellWidth(anchor, Sizes.HUNDRED_PERCENT); firstLevelPanel.add(options); } root.setOpen(true); // subpanel VerticalPanel secondAndFirstLevelPanel = new VerticalPanel(); secondAndFirstLevelPanel.add(firstLevelPanel); for (List<OutputListItem> items : outputTree.getSecondLevelItems()) { if (!items.isEmpty()) { String key = items.get(0).getParent(); // for every step creates a disclosure panel DisclosurePanel secondPanel = new DisclosurePanel(key); secondPanel.setAnimationEnabled(true); // lists of anchor with produced output VerticalPanel secondLevelPanel = new VerticalPanel(); secondLevelPanel.setSpacing(1); // scans items for (OutputListItem item : items) { final HorizontalPanel options = new HorizontalPanel(); options.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); options.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); options.setSpacing(8); options.setWidth(Sizes.HUNDRED_PERCENT); // create a item anchor for all elements of tree final ItemAnchor anchor = new ItemAnchor(item); anchor.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // asks to load and show the output output(thisJob, anchor.getItem()); selectPanel(options); } }); options.add(anchor); options.setCellWidth(anchor, Sizes.HUNDRED_PERCENT); secondLevelPanel.add(options); } secondPanel.setContent(secondLevelPanel); secondAndFirstLevelPanel.add(secondPanel); } } root.setContent(secondAndFirstLevelPanel); // west panel with a disclosure scrollerFiles.add(root); scrollerFiles.setWidth(Sizes.toString(Sizes.SPLIT_PANEL_WEST_DEFAULT_SIZE)); log.add(viewOutput); log.setVisible(false); addWest(scrollerFiles, Sizes.SPLIT_PANEL_WEST_DEFAULT_SIZE); add(log); }
From source file:org.primaresearch.web.gwt.client.ui.page.tool.DeleteContentObjectTool.java
License:Apache License
private static void showConfiramtionDialog(Panel parent, UIObject showRelativeTo, final PageLayoutC layout, final ContentObjectC object, final PageSyncManager syncManager, final SelectionManager selectionManager) { final DialogBox confirmationDialog = new DialogBox(); final VerticalPanel vertPanel = new VerticalPanel(); confirmationDialog.add(vertPanel);// ww w.ja va 2 s .co m Label confirmLabel = new Label(); vertPanel.add(confirmLabel); final HorizontalPanel horPanel = new HorizontalPanel(); horPanel.setWidth("100%"); horPanel.setSpacing(5); horPanel.setHorizontalAlignment(HorizontalAlignmentConstant.endOf(Direction.LTR)); vertPanel.add(horPanel); Button buttonCancel = new Button("Cancel"); horPanel.add(buttonCancel); buttonCancel.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { confirmationDialog.hide(); } }); Button buttonDelete = new Button("Delete"); horPanel.add(buttonDelete); buttonDelete.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { syncManager.deleteContentObject(object); layout.remove(object); selectionManager.clearSelection(); confirmationDialog.hide(); } }); String text = "Delete selected "; if (object.getType() instanceof RegionType) text += "region"; else if (LowLevelTextType.TextLine.equals(object.getType())) text += "text line"; else if (LowLevelTextType.Word.equals(object.getType())) text += "word"; else if (LowLevelTextType.Glyph.equals(object.getType())) text += "glyph"; text += "?"; confirmLabel.setText(text); parent.add(confirmationDialog); if (showRelativeTo != null) confirmationDialog.showRelativeTo(showRelativeTo); else confirmationDialog.show(); }
From source file:org.primaresearch.web.layouteditor.client.WebLayoutEditor.java
License:Apache License
/** * Shows a dialogue asking for confirmation to revert all changes. Proceeds with 'revert' if confirmed by the user. *//*ww w . j a v a 2 s . c o m*/ private void showRevertConfiramtionDialog(Panel parent, UIObject showRelativeTo, final PageSyncManager pageSync) { try { final DialogBox confirmationDialog = new DialogBox(); final VerticalPanel vertPanel = new VerticalPanel(); confirmationDialog.add(vertPanel); Label confirmLabel = new Label(CONSTANTS.MessagePromptRevertChanges()); vertPanel.add(confirmLabel); final HorizontalPanel horPanel = new HorizontalPanel(); horPanel.setWidth("100%"); horPanel.setSpacing(5); horPanel.setHorizontalAlignment(HorizontalAlignmentConstant.endOf(Direction.LTR)); vertPanel.add(horPanel); //Cancel button Button buttonCancel = new Button(CONSTANTS.RevertDialogButtonCaptionCancel()); horPanel.add(buttonCancel); buttonCancel.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { confirmationDialog.hide(); } }); //Revert button Button buttonDelete = new Button(CONSTANTS.RevertDialogButtonCaptionRevert()); horPanel.add(buttonDelete); buttonDelete.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { pageSync.revertChanges(); confirmationDialog.hide(); } }); parent.add(confirmationDialog); if (showRelativeTo != null) confirmationDialog.showRelativeTo(showRelativeTo); else confirmationDialog.show(); } catch (Exception exc) { logManager.logError(ERROR_REVERT_CONFIRMATION_DIALOG, "Error on diplaying the revert confiramtion dialogue"); exc.printStackTrace(); } }
From source file:org.rebioma.client.Portal.java
License:Apache License
public void onModuleLoad() { // loadMapApi(); // Uncomment this to test new view stuff: DisplayPopup.setCloseImageUrl("images/xclose.gif"); Window.enableScrolling(false); HorizontalPanel hp = new HorizontalPanel(); hp.add(new Label(constants.LoadingUser())); hp.setWidth("100%"); hp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); RootPanel.get().add(hp);// w w w. j a va2 s . c o m checkCurrentSession(); // Window.confirm(browserDetect()); }
From source file:org.rstudio.studio.client.workbench.exportplot.ExportPlotSizeEditor.java
License:Open Source License
private void configureHorizontalOptionsPanel(HorizontalPanel panel) { panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); }
From source file:org.rstudio.studio.client.workbench.views.plots.ui.manipulator.ManipulatorControlCheckBox.java
License:Open Source License
public ManipulatorControlCheckBox(String variable, boolean value, Manipulator.CheckBox checkBox, final ManipulatorChangedHandler changedHandler) { super(variable, checkBox, changedHandler); // get manipulator styles ManipulatorStyles styles = ManipulatorResources.INSTANCE.manipulatorStyles(); // main control HorizontalPanel panel = new HorizontalPanel(); panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); // checkbox//ww w .j av a 2 s . c o m checkBox_ = new CheckBox(); checkBox_.setValue(value); checkBox_.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { ManipulatorControlCheckBox.this.onValueChanged(JSONBoolean.getInstance(checkBox_.getValue())); } }); panel.add(checkBox_); // label Label label = new Label(getLabel()); panel.add(label); initWidget(panel); addControlStyle(styles.checkBox()); }