List of usage examples for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_MIDDLE
VerticalAlignmentConstant ALIGN_MIDDLE
To view the source code for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_MIDDLE.
Click Source Link
From source file:com.ponysdk.ui.terminal.UIBuilder.java
License:Apache License
private void showCommunicationErrorMessage(final Throwable caught) { final VerticalPanel content = new VerticalPanel(); if (caught instanceof StatusCodeException) { final StatusCodeException exception = (StatusCodeException) caught; content.add(new HTML("Server connection failed <br/>Code : " + exception.getStatusCode() + "<br/>" + "cause : " + exception.getMessage())); } else if (caught instanceof InvocationException) { content.add(new HTML("Exception durring server invocation : " + caught.getMessage())); } else {/*from w w w. j a va 2 s .c o m*/ content.add(new HTML("Failure : " + caught == null ? "" : caught.getMessage())); } final HorizontalPanel actionPanel = new HorizontalPanel(); actionPanel.setSize("100%", "100%"); final Anchor reloadAnchor = new Anchor("reload"); reloadAnchor.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { History.newItem(""); reload(); } }); final Anchor closeAnchor = new Anchor("close"); closeAnchor.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { communicationErrorMessagePanel.hide(); } }); actionPanel.add(reloadAnchor); actionPanel.add(closeAnchor); actionPanel.setCellHorizontalAlignment(reloadAnchor, HasHorizontalAlignment.ALIGN_CENTER); actionPanel.setCellHorizontalAlignment(closeAnchor, HasHorizontalAlignment.ALIGN_CENTER); actionPanel.setCellVerticalAlignment(reloadAnchor, HasVerticalAlignment.ALIGN_MIDDLE); actionPanel.setCellVerticalAlignment(closeAnchor, HasVerticalAlignment.ALIGN_MIDDLE); content.add(actionPanel); communicationErrorMessagePanel.setWidget(content); communicationErrorMessagePanel.setPopupPositionAndShow(new PositionCallback() { @Override public void setPosition(final int offsetWidth, final int offsetHeight) { communicationErrorMessagePanel.setPopupPosition((Window.getClientWidth() - offsetWidth) / 2, (Window.getClientHeight() - offsetHeight) / 2); } }); }
From source file:com.pronoiahealth.olhie.client.features.dialogs.NewBookDialog.java
License:Open Source License
/** * Watches for a list of covers to be returned and then loads the cover list * /*from w ww.j a v a2 s. c om*/ * @param bookCoverListResponseEvent */ protected void observesBookCoverListResponseEvent( @Observes BookCoverListResponseEvent bookCoverListResponseEvent) { if (mode.equals(ModeEnum.NEW)) { bookCoverDropDown.setText("Select a book cover"); } bookCoverDropDown.getMenuWiget().clear(); List<BookCover> bookCovers = bookCoverListResponseEvent.getBookCover(); if (bookCovers != null) { for (BookCover cover : bookCovers) { String coverName = cover.getCoverName(); NavWidget link = new NavWidget(); link.setName(coverName); HorizontalPanel panel = new HorizontalPanel(); Image img = new Image(); img.setUrl(cover.getCustomIcon()); HTMLPanel htmlPanel = new HTMLPanel(coverName); htmlPanel.getElement().setAttribute("style", "padding-left: 10px;"); panel.add(img); panel.add(htmlPanel); panel.setCellVerticalAlignment(htmlPanel, HasVerticalAlignment.ALIGN_MIDDLE); link.add(panel); link.addClickHandler(coverClickedHandler); panel.getElement().setAttribute("img-url", cover.getImgUrl()); bookCoverDropDown.getMenuWiget().add(link); if (mode.equals(ModeEnum.EDIT) && cover.getCoverName().equals(book.getCoverName())) { largeBookWidget.setBackground(cover.getImgUrl()); } } } }
From source file:com.qualogy.qafe.gwt.client.component.QPagingOptions.java
License:Apache License
/** * Constructor.// w w w .j a v a2 s .c om * * @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./* w ww . j a v a 2s .c om*/ * * @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.qualogy.qafe.mgwt.client.ui.component.QTable.java
License:Apache License
private QLayoutBorder createContainer() { QLayoutBorder container = new QLayoutBorder(); container.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); return container; }
From source file:com.qualogy.qafe.mgwt.client.ui.component.QTable.java
License:Apache License
private QLayoutHorizontal createRegion(QLayoutBorder container, DockLayoutConstant direction) { QLayoutHorizontal region = new QLayoutHorizontal(); region.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); region.setSpacing(2);//from ww w .jav a 2 s. c o m container.add(region, direction); container.setCellWidth(region, "100%"); return region; }
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 w w . jav a 2 s .c o 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.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);/*from w ww . ja va2 s . c om*/ 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.operators.ConditionUI.java
License:Apache License
@Override public void createLocalInterface() { init();/* w w w. j a v a 2 s .c o m*/ /* Core rule does not require a banner */ this.banner.setVisible(false); this.addStyleName(CSSConstants.esoeManagerPolicyOperatorCore); this.childAddition = new HorizontalPanel(); this.childAddition.setSpacing(5); this.childAddition.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); if (newOperator) this.conditionApplied = new Label("Condition to evaluate for this rule"); else this.conditionApplied = new Label(""); this.add(this.conditionApplied); Label conditionBase = new Label("Condition base"); this.operatorChooser = new OperatorChooserUI(this, this.validChildOperators); this.operatorChooser.setVisible(true); this.childAddition.add(conditionBase); this.childAddition.add(this.operatorChooser); this.add(this.childAddition); }
From source file:com.qut.middleware.esoemanager.client.ui.policy.operators.OperatorUI.java
License:Apache License
private void createInterface() { this.clear(); this.addStyleName(CSSConstants.esoeManagerPolicyOperator); this.banner = new HorizontalPanel(); this.banner.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); banner.addStyleName(CSSConstants.esoeManagerPolicyOperatorHeading); this.content = new VerticalPanel(); this.content.addStyleName(CSSConstants.esoeManagerPolicyOperatorContent); this.localContent = new VerticalPanel(); if (this.allowsChildren) { HorizontalPanel bannerLeft = new HorizontalPanel(); this.banner.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); this.banner.add(bannerLeft); this.desc = new HiddenIntegratedTextBox(this, 1, null, "You must provide a description", "Description", EsoeManagerConstants.areaID); this.desc.getContent().addStyleName(CSSConstants.esoeManagerPolicyOperatorHeadingDescription); if (this.newOperator) this.desc.showEditor(); if (!this.newOperator) this.content.setVisible(false); StyledButton showContent = new StyledButton("application", ""); showContent.addClickListener(new ClickListener() { public void onClick(Widget sender) { // toggle content visibility OperatorUI.this.content.setVisible(!OperatorUI.this.content.isVisible()); // If we just minimised this content close all it's children as well if (!OperatorUI.this.content.isVisible()) hideAllSubContent(); }//ww w . ja va2 s . c om }); StyledButton showSubContent = new StyledButton("cascade", ""); showSubContent.addClickListener(new ClickListener() { public void onClick(Widget sender) { showAllSubContent(); } }); bannerLeft.add(showContent); bannerLeft.add(showSubContent); bannerLeft.add(this.desc.getContent()); HorizontalPanel bannerRight = new HorizontalPanel(); this.banner.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); this.banner.add(bannerRight); this.operatorChooser = new OperatorChooserUI(this, this.validChildOperators); this.operatorChooser.setVisible(false); StyledButton add = new StyledButton("add", ""); add.addClickListener(new ClickListener() { public void onClick(Widget sender) { OperatorUI.this.content.setVisible(true); OperatorUI.this.operatorChooser.setVisible(true); } }); bannerRight.add(add); if (this.parent != null) { ConfirmationStyledButton delete = new ConfirmationStyledButton( "Delete this operator and all children?", "delete", ""); delete.addClickListener(new ClickListener() { public void onClick(Widget sender) { OperatorUI.this.parent.deleteChild(OperatorUI.this); } }); bannerRight.add(delete); } } createLocalInterface(); this.localMessages = new MessagePanel(); this.content.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); if (this.allowsChildren) this.content.add(this.operatorChooser); this.content.add(this.localMessages); this.content.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); this.content.add(this.localContent); this.add(this.banner); this.add(this.content); }