List of usage examples for com.google.gwt.user.client.ui HorizontalPanel setVerticalAlignment
public void setVerticalAlignment(VerticalAlignmentConstant align)
From source file:com.qualogy.qafe.gwt.client.component.QPagingOptions.java
License:Apache License
/** * Constructor./* w ww . ja va2 s . co m*/ * * @param table * the table being affected * @param images * the images to use */ public QPagingOptions(PagingScrollTable<?> table, PagingOptionsImages images) { this.table = table; if (this.table instanceof QPagingScrollTable) { ((QPagingScrollTable) this.table).setPagingOptions(this); } // Create the main widget HorizontalPanel hPanel = new HorizontalPanel(); initWidget(hPanel); hPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); setStyleName(DEFAULT_STYLENAME); // Create the paging image buttons createPageButtons(images); // Create the current page box createCurPageBox(); // Create the page count label numPagesLabel = new HTML(); // Create the loading image loadingImage = new Image(GWT.getModuleBaseURL() + "scrollTableLoading.gif"); loadingImage.setVisible(false); // Create the error label errorLabel = new HTML(); errorLabel.setStylePrimaryName("errorMessage"); // Add the widgets to the panel hPanel.add(createSpacer()); hPanel.add(firstImage); hPanel.add(createSpacer()); hPanel.add(prevImage); hPanel.add(createSpacer()); hPanel.add(curPageBox); hPanel.add(createSpacer()); hPanel.add(numPagesLabel); hPanel.add(createSpacer()); hPanel.add(nextImage); hPanel.add(createSpacer()); hPanel.add(lastImage); hPanel.add(createSpacer()); hPanel.add(loadingImage); hPanel.add(errorLabel); // Add handlers to the table table.addPageLoadHandler(new PageLoadHandler() { public void onPageLoad(PageLoadEvent event) { loadingImage.setVisible(false); errorLabel.setHTML(""); } }); table.addPageChangeHandler(new PageChangeHandler() { public void onPageChange(PageChangeEvent event) { curPageBox.setText((event.getNewPage() + 1) + ""); loadingImage.setVisible(true); errorLabel.setHTML(""); } }); table.addPagingFailureHandler(new PagingFailureHandler() { public void onPagingFailure(PagingFailureEvent event) { loadingImage.setVisible(false); errorLabel.setHTML(event.getException().getMessage()); } }); table.addPageCountChangeHandler(new PageCountChangeHandler() { public void onPageCountChange(PageCountChangeEvent event) { setPageCount(event.getNewPageCount()); } }); setPageCount(table.getPageCount()); }
From source file:com.qualogy.qafe.gwt.client.component.QPagingScrollTableOperation.java
License:Apache License
/** * Constructor./* ww w.j a v a 2 s.c o m*/ * * @param table * the table being affected * @param images * the images to use */ // CHECKSTYLE.OFF: CyclomaticComplexity public QPagingScrollTableOperation(final QPagingScrollTable table, ScrollTableOperationImages images) { this.table = table; if (this.table instanceof QPagingScrollTable) { ((QPagingScrollTable) this.table).setScrollTableOperations(this); } // Create the main widget HorizontalPanel hPanel = new HorizontalPanel(); initWidget(hPanel); hPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); setStyleName(DEFAULT_STYLENAME); // Create the paging image buttons createPageButtons(images); // Create the error label errorLabel = new HTML(); errorLabel.setStylePrimaryName("errorMessage"); // Add the widgets to the panel hPanel.add(createSpacer()); if (hasAddControl(table)) { hPanel.add(addImage); hPanel.add(createSpacer()); } if (hasDeleteControl(table)) { hPanel.add(deleteImage); hPanel.add(createSpacer()); } if (isEditableDatagrid(table) || hasDeleteControl(table) || hasAddControl(table)) { if (saveDatagrid(table)) { hPanel.add(saveImage); hPanel.add(createSpacer()); } if (refreshDatagrid(table)) { hPanel.add(refreshImage); hPanel.add(createSpacer()); } if (cancelDatagrid(table)) { hPanel.add(cancelImage); hPanel.add(createSpacer()); } } hPanel.add(errorLabel); if (table.getSource().getImportEnabled() != null && table.getSource().getImportEnabled().booleanValue()) { final DisclosurePanel importPanel = new DisclosurePanel("Upload data"); hPanel.add(importPanel); final FormPanel formPanel = new FormPanel(); formPanel.setAction(GWT.getModuleBaseURL() + "/rpc.datagridupload"); formPanel.setEncoding(FormPanel.ENCODING_MULTIPART); formPanel.setMethod(FormPanel.METHOD_POST); FileUpload fileUploadComponent = new FileUpload(); fileUploadComponent.setName("uploadElement"); Button uploadButtonComponent = new Button("Upload"); uploadButtonComponent.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { formPanel.submit(); } }); CheckBox isFirstLineHeader = new CheckBox("Is first row header ?"); isFirstLineHeader.setName("isFirstLineHeader"); isFirstLineHeader.setTitle( "Check wheter or not the first line of the uploaded file is a header/column definition"); HorizontalPanel hp = new HorizontalPanel(); Label label = new Label("Delimeter"); final TextBox delimiter = new TextBox(); delimiter.setValue(","); delimiter.setTitle("Insert the delimeter (can be any value, as long it's length 1)"); delimiter.setName("delimiter"); delimiter.setWidth("15px"); hp.setSpacing(10); hp.add(label); hp.add(delimiter); Grid gridPanel = new Grid(2, 4); gridPanel.setWidget(0, 0, fileUploadComponent); gridPanel.setWidget(0, 1, uploadButtonComponent); gridPanel.setWidget(1, 0, isFirstLineHeader); gridPanel.setWidget(1, 1, hp); formPanel.add(gridPanel); formPanel.addSubmitHandler(new FormPanel.SubmitHandler() { public void onSubmit(SubmitEvent event) { // This event is fired just before the form is submitted. We can // take // this opportunity to perform validation. if (delimiter.getText().length() == 0 || delimiter.getText().length() > 1) { ClientApplicationContext.getInstance().log("Ooops...Delimeter invalid", "Make sure there is valid delimeter value.One character only (current value ='" + delimiter.getText() + "'", true); event.cancel(); } } }); formPanel.addSubmitCompleteHandler(new SubmitCompleteHandler() { public void onSubmitComplete(SubmitCompleteEvent event) { String uuId = event.getResults(); if (uuId != null && uuId.indexOf("=") > 0) { uuId = uuId.substring(uuId.indexOf("=") + 1); processData(uuId); importPanel.setOpen(false); } else { ClientApplicationContext.getInstance().log("Upload failed", event.getResults(), true); } } }); importPanel.add(formPanel); } if (table.getSource() != null && table.getSource().getExport() != null && table.getSource().getExport().booleanValue()) { createExportLabelsAndImages(); final DisclosurePanel exportPanel = new DisclosurePanel("Export"); String[] labels = getExportLabels(table.getSource().getExportFormats()); Image[] exportImages = getExportImages(labels); FlexTable gridExportPanel = new FlexTable(); hPanel.add(exportPanel); exportPanel.add(gridExportPanel); final Frame frame = new Frame(); frame.setHeight("0"); frame.setWidth("0"); frame.setVisible(false); final String moduleRelativeURL = GWT.getModuleBaseURL() + "/rpc.export"; gridExportPanel.setWidget(0, 0, frame); final CheckBox generateColumnHeaderBox = new CheckBox("Generate Column Header"); gridExportPanel.getFlexCellFormatter().setColSpan(1, 1, 7); gridExportPanel.setWidget(2, 1, generateColumnHeaderBox); gridExportPanel.getFlexCellFormatter().setColSpan(2, 1, 6); for (int i = 0; i < labels.length; i++) { exportImages[i].setStylePrimaryName("datagridexportlabel"); exportImages[i].setTitle(labels[i]); gridExportPanel.setWidget(0, i + 1, exportImages[i]); exportImages[i].addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { if (event.getSource() instanceof Image) { Image image = (Image) (event.getSource()); final String exportCode = image.getTitle(); RPCServiceAsync service = MainFactoryActions.createService(); AsyncCallback<?> callback = new AsyncCallback<Object>() { public void onSuccess(Object result) { String uuid = (String) result; // set frame frame.setUrl(moduleRelativeURL + "?uuid=" + uuid); ClientApplicationContext.getInstance().setBusy(false); } public void onFailure(Throwable caught) { ClientApplicationContext.getInstance().log("Export failed", "Export failed for " + exportCode + " ", true, true, caught); ClientApplicationContext.getInstance().setBusy(false); FunctionsExecutor.setProcessedBuiltIn(true); } }; List<DataContainerGVO> dList = new ArrayList<DataContainerGVO>(); // following loop is to maintain the order of rows while exporting. for (int i = 0; i < (table.getAbsoluteLastRowIndex() + 1); i++) { dList.add(table.getRowValue(i)); } service.prepareForExport(dList, exportCode, null, generateColumnHeaderBox.getValue().booleanValue(), callback); } } }); } } }
From source file:com.qut.middleware.esoemanager.client.ui.panels.CryptoPanel.java
License:Apache License
private void createInterface() { this.loader = new Loader(); this.keyTable = new FlexibleTable(5, 5); this.keyTable.insertHeading(0, "Name"); this.keyTable.insertHeading(1, "Passphrase"); this.keyTable.insertHeading(2, "Keystore Passphrase"); this.keyTable.insertHeading(3, "Expiry Date"); this.expiredKeyTable = new FlexibleTable(5, 5); this.expiredKeyTable.insertHeading(0, "Name"); this.expiredKeyTable.insertHeading(1, "Passphrase"); this.expiredKeyTable.insertHeading(2, "Keystore Passphrase"); this.expiredKeyTable.insertHeading(3, "Expiry Date"); EsoeManager.contentService.retrieveServiceKeys(this.serviceIdentifier, new KeysRetrievalHandler(this.loader)); final ConfirmationStyledButton addKey = new ConfirmationStyledButton( "Are you sure you wish to create a new key for this service?", "add", "Add Key"); addKey.addClickListener(new ClickListener() { public void onClick(Widget sender) { CryptoPanel.this.loader.setVisible(true); EsoeManager.contentService.createServiceKey(serviceIdentifier, new KeyCreationHandler(CryptoPanel.this.loader)); }/*from w ww . j a v a2s . co m*/ }); Label title = new Label("Valid Keys"); title.addStyleName(CSSConstants.esoeManagerSubSectionTitle); Label expiredTitle = new Label("Expired Keys"); expiredTitle.addStyleName(CSSConstants.esoeManagerSubSectionTitle); HorizontalPanel banner = new HorizontalPanel(); banner.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); banner.setSpacing(5); banner.add(title); banner.add(this.loader); this.add(banner); this.add(addKey); this.add(this.keyTable); this.add(expiredTitle); this.add(this.expiredKeyTable); }
From source file:com.qut.middleware.esoemanager.client.ui.panels.DashboardPanel.java
License:Apache License
private void createInterface() { HorizontalPanel importantKeyDetails = new HorizontalPanel(); importantKeyDetails.setSpacing(5);/*from w ww . ja v a2 s .c o m*/ importantKeyDetails.setVerticalAlignment(ALIGN_TOP); this.esoeDash = new VerticalPanel(); this.esoeDash.addStyleName(CSSConstants.esoeDash); this.metadataDash = new VerticalPanel(); this.metadataDash.addStyleName(CSSConstants.metadataDash); this.serviceDash = new VerticalPanel(); this.serviceDash.addStyleName(CSSConstants.serviceDash); this.startupDash = new VerticalPanel(); this.startupDash.addStyleName(CSSConstants.startupDash); VerticalPanel col1 = new VerticalPanel(); VerticalPanel col2 = new VerticalPanel(); col1.add(this.esoeDash); col1.add(this.startupDash); col2.add(this.serviceDash); importantKeyDetails.add(col1); importantKeyDetails.add(col2); // This disabled on purpose until more MD data can be retrieved // this.createMetadataDashboard(); this.createESOEDashboard(); this.createServicesDashboard(); this.createStartupDashboard(); this.add(importantKeyDetails); }
From source file:com.qut.middleware.esoemanager.client.ui.panels.PolicyEditorPanel.java
License:Apache License
private void createInterface() { this.policies = new ArrayList<com.qut.middleware.esoemanager.client.ui.policy.PolicyUI>(); this.policiesPanel = new VerticalPanel(); HorizontalPanel heading = new HorizontalPanel(); heading.setSpacing(5);/* w ww .j av a2 s . c o m*/ heading.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); Label title = new Label("Policies governing access to service resources"); title.addStyleName(CSSConstants.esoeManagerSubSectionTitle); StyledButton addPolicy = new StyledButton("add", "Add Policy"); addPolicy.addClickListener(new ClickListener() { public void onClick(Widget sender) { PolicyUI policyUI = new PolicyUI(PolicyEditorPanel.this.serviceIdentifier, true); PolicyEditorPanel.this.policies.add(policyUI); PolicyEditorPanel.this.policiesPanel.add(policyUI); } }); // display loader until data returns this.loader = new Loader(); heading.add(this.loader); heading.add(addPolicy); this.add(title); this.add(heading); this.add(this.policiesPanel); }
From source file:com.qut.middleware.esoemanager.client.ui.policy.PolicyUI.java
License:Apache License
private void createGraphicalInterface() { this.policyPanel = new VerticalPanel(); this.validationPanel = new HorizontalPanel(); this.resources = new PolicyResourcesUI(); this.actions = new PolicyActionsUI(); this.rules = new ArrayList<RuleUI>(); this.desc = new HiddenIntegratedTextBox(this, 1, null, "Policies are required to have a description", "Description", EsoeManagerConstants.areaID); this.id = new IntegratedLabel(this, "ID"); this.active = new ActiveState(); if (!this.newPolicy) { this.active.setDeactivated(); this.loader = new Loader(); this.loader.setVisible(false); this.activeToggle = new ConfirmationStyledButton("Change policy active state?", "toggle", ""); this.activeToggle.addClickListener(new ClickListener() { public void onClick(Widget sender) { EsoeManager.contentService.toggleServicePolicyState(PolicyUI.this.serviceIdentifier, PolicyUI.this.id.getText(), PolicyUI.this.active.isActive(), new PolicyActivationHandler()); }//ww w. j a va 2 s. c o m }); } else { this.resources.addValue(); this.actions.addValue(); this.active.setDeactivated(); } if (this.newPolicy) { this.desc.showEditor(); } this.content = new FlexibleTable(2, 2); this.localMessages = new MessagePanel(); this.content.insertWidget(this.localMessages); this.content.nextRow(); if (!this.newPolicy) { HorizontalPanel actPan = new HorizontalPanel(); actPan.setSpacing(2); actPan.setVerticalAlignment(ALIGN_MIDDLE); actPan.add(this.active); actPan.add(this.activeToggle); this.content.insertWidget(actPan); this.content.nextRow(); } HorizontalPanel descPan = new HorizontalPanel(); descPan.setSpacing(2); descPan.setVerticalAlignment(ALIGN_MIDDLE); descPan.add(this.desc.getTitle()); descPan.add(this.desc.getContent()); this.content.insertWidget(descPan); this.content.nextRow(); Label rulesLbl = new Label("This policy contains the following rules"); StyledButton addRule = new StyledButton("add", "Add Rule"); addRule.addClickListener(new ClickListener() { public void onClick(Widget sender) { RuleUI rule = new RuleUI(PolicyUI.this, true); PolicyUI.this.rules.add(rule); PolicyUI.this.renderRules(); } }); this.rulesPanel = new VerticalPanel(); this.rulesPanel.addStyleName(CSSConstants.esoeManagerPolicyRules); this.content.insertWidget(this.resources.getContent()); this.content.nextRow(); this.content.insertWidget(this.actions.getContent()); this.content.nextRow(); this.content.insertWidget(rulesLbl); this.content.insertWidget(addRule); this.content.nextRow(); this.policyPanel.add(this.content); this.policyPanel.add(this.rulesPanel); this.validationMessage = new Label(); this.validationPanel.setSpacing(5); this.validationPanel.add(new Loader()); this.validationPanel.add(this.validationMessage); this.validationPanel.setVisible(false); this.graphicalEditor.add(this.policyPanel); this.graphicalEditor.add(this.validationPanel); }
From source file:com.risevision.ui.client.common.widgets.background.BackgroundWidget.java
License:Open Source License
public BackgroundWidget() { HorizontalPanel panel = new HorizontalPanel(); panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); styleLabel.addStyleName("rdn-OverflowElipsis"); styleLabel.setWidth("175px"); panel.add(styleLabel);//w ww .j a v a 2 s . com panel.add(new SpacerWidget()); panel.add(editLink); editLink.addClickHandler(this); hideCommand = new Command() { @Override public void execute() { init(backgroundDialog.getStyle(), backgroundDialog.isScaleToFit()); } }; initWidget(panel); }
From source file:com.risevision.ui.client.common.widgets.colorPicker.ColorPickerDialog.java
License:Open Source License
public ColorPickerDialog() { super(false, true); //set auto-hide and modal contentPanel.add(colorPalette);/*from ww w.j ava 2s .c o m*/ contentPanel.add(colorRGB); contentPanel.add(colorHSV); contentPanel.add(colorMap); contentBar.addTab("Palette"); contentBar.addTab("RGB"); contentBar.addTab("HSV"); contentBar.addTab("Map"); contentPanel.showWidget(PALETTE_PANEL); contentBar.selectTab(PALETTE_PANEL); // Define the panels HorizontalPanel colorPanel = new HorizontalPanel(); colorPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); colorPanel.add(new Label("Color:")); colorPanel.add(new SpacerWidget()); colorPanel.add(colorTextBox); HorizontalPanel transparencyPanel = new HorizontalPanel(); transparencyPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); transparencyPanel.add(new Label("None:")); transparencyPanel.add(new SpacerWidget()); transparencySwab.setWidth("20px"); transparencySwab.setHeight("20px"); transparencySwab.getElement().getStyle().setProperty("border", "1px solid #666"); // DOM.setStyleAttribute(getElement(), "cursor", "default"); transparencySwab.getElement().getStyle().setProperty("backgroundImage", "url(/images/preview-opacity.png)"); transparencyPanel.add(transparencySwab); VerticalPanel previewPanel = new VerticalPanel(); previewPanel.setHeight("100%"); previewPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); previewPanel.add(previewWidget); previewPanel.add(historyWidget); HorizontalPanel alphaPanel = new HorizontalPanel(); alphaPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); alphaPanel.setWidth("100%"); alphaPanel.add(new Label("Alpha:")); HTML spacer3 = new HTML(" "); alphaPanel.add(spacer3); alphaPanel.setCellWidth(spacer3, "100%"); alphaPanel.add(alphaSlider); buttonPanel.add(okButton); buttonPanel.add(new SpacerWidget()); buttonPanel.add(cancelButton); // Put it together FlexTable middleTable = new FlexTable(); middleTable.setCellSpacing(0); middleTable.setCellPadding(0); middleTable.setWidget(0, 0, colorPanel); middleTable.getCellFormatter().setWidth(0, 1, "5px"); middleTable.setWidget(0, 2, transparencyPanel); middleTable.getCellFormatter().setHeight(1, 0, "5px"); middleTable.setWidget(2, 0, contentBar); middleTable.setWidget(3, 0, contentPanel); middleTable.getCellFormatter().setVerticalAlignment(3, 2, HasVerticalAlignment.ALIGN_MIDDLE); middleTable.getCellFormatter().setHorizontalAlignment(3, 2, HasHorizontalAlignment.ALIGN_CENTER); middleTable.setWidget(3, 2, previewPanel); middleTable.getCellFormatter().setHeight(4, 0, "5px"); middleTable.setWidget(5, 0, alphaPanel); middleTable.setWidget(5, 2, alphaTextBox); middleTable.setWidget(6, 0, buttonPanel); setWidget(middleTable); styleControls(); initButtons(); initHandlers(); initCommands(); }
From source file:com.risevision.ui.client.common.widgets.RiseMultiSelectWidget.java
License:Open Source License
public void addOther() { CheckBox itemCheckBox = new CheckBox(); itemCheckBox.addValueChangeHandler(this); // itemCheckBox.setStyleName("rdn-CheckBox"); Label nameLabel = new Label("Other:"); nameLabel.setStyleName("rva-ShortText"); nameLabel.getElement().getStyle().setProperty("whiteSpace", "nowrap"); otherTextBox = new TextBox(); HorizontalPanel checkBoxPanel = new HorizontalPanel(); checkBoxPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); checkBoxPanel.add(itemCheckBox);// w ww .j a va 2 s .c o m checkBoxPanel.add(new SpacerWidget()); checkBoxPanel.add(nameLabel); checkBoxPanel.add(new SpacerWidget()); checkBoxPanel.add(otherTextBox); listPanel.add(checkBoxPanel); checkBoxList.add(itemCheckBox); valuesList.add(null); }
From source file:com.risevision.ui.client.common.widgets.textStyle.TextStyleDialog.java
License:Open Source License
public TextStyleDialog() { super(false, true); //set auto-hide and modal buttonPanel.add(okButton);/* w w w . ja v a 2 s .c o m*/ buttonPanel.add(new SpacerWidget()); buttonPanel.add(cancelButton); HorizontalPanel stylePanel = new HorizontalPanel(); stylePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); stylePanel.add(boldCheckBox); stylePanel.add(new Label("Bold")); stylePanel.add(new SpacerWidget()); stylePanel.add(italicCheckBox); stylePanel.add(new Label("Italic")); HorizontalPanel cssPanel = new HorizontalPanel(); cssPanel.add(cssLabel); cssPanel.add(cssTextBox); cssPanel.add(new SpacerWidget()); cssPanel.add(showCssLink); gridAdd("Use URL Font:", useUrlCheckBox, "rdn-CheckBox"); gridAdd("Font URL:", fontUrlTextBox, "rdn-TextBoxMedium"); mainGrid.getRowFormatter().setVisible(1, false); gridAdd("Font Family:", familyListBox, "rdn-ListBoxMedium"); gridAdd("Font Color:", colorTextBox, "rdn-TextBoxMedium"); gridAdd("Font Size:", sizeListBox, "rdn-ListBoxShort"); gridAdd("", stylePanel, ""); gridAdd("CSS Style:", cssPanel, ""); mainGrid.getFlexCellFormatter().setColSpan(6, 1, 2); mainGrid.getFlexCellFormatter().setRowSpan(0, 2, 6); mainGrid.getCellFormatter().setWidth(0, 2, "100%"); mainGrid.getCellFormatter().setHorizontalAlignment(0, 2, HasHorizontalAlignment.ALIGN_CENTER); mainGrid.setWidget(0, 2, previewWidget); VerticalPanel mainPanel = new VerticalPanel(); mainPanel.add(mainGrid); mainPanel.add(buttonPanel); setWidget(mainPanel); updateTextBoxes(); styleControls(); initButtons(); initHandlers(); }