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:org.cruxframework.crux.widgets.client.transferlist.TransferList.java
License:Apache License
/** * @return/*from ww w . j a v a 2 s. co m*/ */ protected VerticalPanel createCommands() { VerticalPanel commandsPanel = new VerticalPanel(); commandsPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); commandsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); commandsPanel.setStyleName("commands"); commandsPanel.setSpacing(5); this.moveToRightButton = new Button(); moveToRightButton.setStyleName("moveToRight"); moveToRightButton.addClickHandler(new TransferItemClickHandler(this, true)); commandsPanel.add(this.moveToRightButton); this.moveAllToRightButton = new Button(); moveAllToRightButton.setStyleName("moveAllToRight"); moveAllToRightButton.addClickHandler(new TransferAllItemClickHandler(this, true)); moveAllToRightButton.setVisible(false); commandsPanel.add(this.moveAllToRightButton); this.moveToLeftButton = new Button(); moveToLeftButton.setStyleName("moveToLeft"); moveToLeftButton.addClickHandler(new TransferItemClickHandler(this, false)); commandsPanel.add(this.moveToLeftButton); this.moveAllToLeftButton = new Button(); moveAllToLeftButton.setStyleName("moveAllToLeft"); moveAllToLeftButton.addClickHandler(new TransferAllItemClickHandler(this, false)); moveAllToLeftButton.setVisible(false); commandsPanel.add(this.moveAllToLeftButton); return commandsPanel; }
From source file:org.dashbuilder.renderer.google.client.GoogleTableDisplayer.java
License:Apache License
protected void createTablePager() { pagerPanel.clear();/*from w w w . j a v a 2 s. c o m*/ pagerPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); pagerPanel.getElement().setAttribute("cellpadding", "5"); Pagination pagination = new Pagination(); pagination.setSize(Pagination.PaginationSize.NORMAL); pagination.setAlignment(Bootstrap.Pagination.LEFT.toString()); for (int i = getLeftMostPageNumber(); i <= getRightMostPageNumber(); i++) { NavLink pageLink = new NavLink(Integer.toString(i)); final Integer _currentPage = Integer.valueOf(i); if (currentPage != i) { pageLink.setActive(false); pageLink.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { gotoPage(_currentPage.intValue()); } }); } else { pageLink.setActive(true); } pagination.add(pageLink); } Icon leftPageIcon = new Icon(IconType.ANGLE_LEFT); leftPageIcon.setIconSize(IconSize.LARGE); leftPageIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER); leftPageIcon.sinkEvents(Event.ONCLICK); leftPageIcon.addHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { gotoPage(currentPage - 1); } }, ClickEvent.getType()); Tooltip leftPageTooltip = new Tooltip( GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_gotoPreviousPage()); leftPageTooltip.add(leftPageIcon); Icon rightPageIcon = new Icon(IconType.ANGLE_RIGHT); rightPageIcon.setIconSize(IconSize.LARGE); rightPageIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER); rightPageIcon.sinkEvents(Event.ONCLICK); rightPageIcon.addHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { gotoPage(currentPage + 1); } }, ClickEvent.getType()); Tooltip rightPageTooltip = new Tooltip( GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_gotoNextPage()); rightPageTooltip.add(rightPageIcon); Icon firstPageIcon = new Icon(IconType.DOUBLE_ANGLE_LEFT); firstPageIcon.setIconSize(IconSize.LARGE); firstPageIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER); firstPageIcon.sinkEvents(Event.ONCLICK); firstPageIcon.addHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { gotoPage(1); } }, ClickEvent.getType()); Tooltip firstPageTooltip = new Tooltip( GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_gotoFirstPage()); firstPageTooltip.add(firstPageIcon); Icon lastPageIcon = new Icon(IconType.DOUBLE_ANGLE_RIGHT); lastPageIcon.setIconSize(IconSize.LARGE); lastPageIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER); lastPageIcon.sinkEvents(Event.ONCLICK); lastPageIcon.addHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { gotoPage(numberOfPages); } }, ClickEvent.getType()); Tooltip lastPageTooltip = new Tooltip( GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_gotoLastPage()); lastPageTooltip.add(lastPageIcon); Label totalPages = null; if (showTotalPagesHint) { totalPages = new Label(GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_pages( Integer.toString(getLeftMostPageNumber()), Integer.toString(getRightMostPageNumber()), Integer.toString(numberOfPages))); } Label totalRows = null; if (numberOfRows == 0) { totalRows = new Label(GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_noData()); } else if (showTotalRowsHint) { int currentRowsShown = currentPage * pageSize > numberOfRows ? numberOfRows : currentPage * pageSize; totalRows = new Label(GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_rows( Integer.toString(((currentPage - 1) * pageSize) + 1), Integer.toString(currentRowsShown), Integer.toString(numberOfRows))); } if (numberOfPages > 1) { pagerPanel.add(firstPageTooltip); pagerPanel.add(leftPageTooltip); pagerPanel.add(pagination); pagerPanel.add(rightPageTooltip); pagerPanel.add(lastPageTooltip); } if (showTotalPagesHint || showTotalRowsHint) { if (totalPages != null && numberOfPages > 1) pagerPanel.add(totalPages); if (totalRows != null) pagerPanel.add(totalRows); } }
From source file:org.dashbuilder.renderer.google.client.GoogleTableDisplayerView.java
License:Apache License
protected HorizontalPanel createTablePager() { HorizontalPanel pagerPanel = new HorizontalPanel(); pagerPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); pagerPanel.getElement().setAttribute("cellpadding", "5"); Pagination pagination = new Pagination(); pagination.setPaginationSize(PaginationSize.NONE); for (int i = leftMostPageNumber; i <= rightMostPageNumber; i++) { AnchorListItem pageLink = new AnchorListItem(Integer.toString(i)); final Integer _currentPage = i; if (currentPage != i) { pageLink.setActive(false);/* w w w .j a va 2 s . c om*/ pageLink.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { getPresenter().gotoPage(_currentPage.intValue()); } }); } else { pageLink.setActive(true); } pagination.add(pageLink); } Icon leftPageIcon = new Icon(IconType.ANGLE_LEFT); leftPageIcon.setSize(IconSize.LARGE); leftPageIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER); leftPageIcon.sinkEvents(Event.ONCLICK); leftPageIcon.addHandler(createGotoPageHandler(currentPage - 1), ClickEvent.getType()); Tooltip leftPageTooltip = new Tooltip( GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_gotoPreviousPage()); leftPageTooltip.add(leftPageIcon); Icon rightPageIcon = new Icon(IconType.ANGLE_RIGHT); rightPageIcon.setSize(IconSize.LARGE); rightPageIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER); rightPageIcon.sinkEvents(Event.ONCLICK); rightPageIcon.addHandler(createGotoPageHandler(currentPage + 1), ClickEvent.getType()); Tooltip rightPageTooltip = new Tooltip( GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_gotoNextPage()); rightPageTooltip.add(rightPageIcon); Icon firstPageIcon = new Icon(IconType.ANGLE_DOUBLE_LEFT); firstPageIcon.setSize(IconSize.LARGE); firstPageIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER); firstPageIcon.sinkEvents(Event.ONCLICK); firstPageIcon.addHandler(createGotoPageHandler(1), ClickEvent.getType()); Tooltip firstPageTooltip = new Tooltip( GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_gotoFirstPage()); firstPageTooltip.add(firstPageIcon); Icon lastPageIcon = new Icon(IconType.ANGLE_DOUBLE_RIGHT); lastPageIcon.setSize(IconSize.LARGE); lastPageIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER); lastPageIcon.sinkEvents(Event.ONCLICK); lastPageIcon.addHandler(createGotoPageHandler(totalPages), ClickEvent.getType()); Tooltip lastPageTooltip = new Tooltip( GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_gotoLastPage()); lastPageTooltip.add(lastPageIcon); pagerPanel.add(firstPageTooltip); pagerPanel.add(leftPageTooltip); pagerPanel.add(pagination); pagerPanel.add(rightPageTooltip); pagerPanel.add(lastPageTooltip); if (totalPagesHintEnabled) { pagerPanel.add(new Label(GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_pages( Integer.toString(leftMostPageNumber), Integer.toString(rightMostPageNumber), Integer.toString(totalPages)))); } if (totalRowsHintEnabled) { int currentRowsShown = currentPage * pageSize > totalRows ? totalRows : currentPage * pageSize; pagerPanel.add(new Label(GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_rows( Integer.toString(((currentPage - 1) * pageSize) + 1), Integer.toString(currentRowsShown), Integer.toString(totalRows)))); } return pagerPanel; }
From source file:org.dataconservancy.dcs.access.client.presenter.PublishDataPresenter.java
License:Apache License
@Override public void bind() { projectNameTB = this.display.getProjectNameTB(); abstractTB = this.display.getAbstractTB(); warningPanel = this.display.getWarningPanel(); previewButton = this.display.getPreviewButton(); errorMessage = this.display.getErrorMessage(); researchObjectPanel = this.display.getResearchObjectPanel(); roId = this.display.getRoId(); licenseBox = this.display.getLicenseBox(); ir = this.display.getIr(); ROList = this.display.getROList(); registerPreviewUpdate();//w ww . ja va2 s. c o m this.display.getUploadBag().addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { display.getForm().submit(); // new UploadBagDialog(SeadApp.bagIturl); if (acrContainer.isAttached()) acrContainer.removeFromParent(); } }); this.display.getForm().addSubmitCompleteHandler(new SubmitCompleteHandler() { public void onSubmitComplete(SubmitCompleteEvent event) { if (event.getResults() == null) { new ErrorPopupPanel("File upload failed").show(); return; } if (event.getResults().contains("Warning")) { new ErrorPopupPanel(new HTML(event.getResults())).show(); return; } String[] tempString = event.getResults().split(";"); final String sipPath = tempString[tempString.length - 1].split("<")[0]; String jsonString = event.getResults(); jsonString = jsonString.substring(jsonString.indexOf('{'), jsonString.lastIndexOf('}') + 1); JsDcp dcp = JsDcp.create(); JsSearchResult result = JsSearchResult.create(jsonString); for (int i = 0; i < result.matches().length(); i++) { Util.add(dcp, result.matches().get(i)); } PublishDataView.EVENT_BUS.fireEvent(new EntityEditEvent(dcp, true, sipPath)); } }); SeadApp.userService.checkSession(null, new AsyncCallback<UserSession>() { @Override public void onSuccess(final UserSession result) { if (result.isSession()) { if (result.getRole() == Role.ROLE_CURATOR) { acrContainer = new VerticalPanel(); acrContainer.addStyleName("PublishContainer"); Button importButton = new Button("Import from ACR"); importButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { History.newItem(SeadState.ACRUPLOAD.toToken()); } }); Grid grid = new Grid(2, 3); grid.getColumnFormatter().setWidth(0, "33%"); grid.getColumnFormatter().setWidth(1, "33%"); grid.getColumnFormatter().setWidth(2, "33%"); HTMLTable.CellFormatter formatter = grid.getCellFormatter(); formatter.setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_CENTER); formatter.setVerticalAlignment(1, 1, HasVerticalAlignment.ALIGN_MIDDLE); grid.setWidth("100%"); grid.setWidget(1, 1, importButton); acrContainer .setWidth(String.valueOf(display.getPublishContainer().getOffsetWidth()) + "px"); acrContainer.setHeight(Window.getClientHeight() / 10 + "px"); acrContainer.add(grid); verticalPanel.add(acrContainer); } } } @Override public void onFailure(Throwable caught) { Window.alert(caught.getMessage()); } }); }
From source file:org.drools.brms.client.modeldriven.ui.FactPatternWidget.java
License:Apache License
public FactPatternWidget(RuleModeller mod, IPattern p, SuggestionCompletionEngine com, boolean canBind) { this.pattern = (FactPattern) p; this.completions = com; this.modeller = mod; this.bindable = canBind; layout.setWidget(0, 0, getPatternLabel()); FlexCellFormatter formatter = layout.getFlexCellFormatter(); formatter.setAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE); formatter.setStyleName(0, 0, "modeller-fact-TypeHeader"); final DirtyableFlexTable inner = new DirtyableFlexTable(); layout.setWidget(1, 0, inner);//from w ww .j a va2s.c om for (int row = 0; row < pattern.getFieldConstraints().length; row++) { FieldConstraint constraint = pattern.getFieldConstraints()[row]; final int currentRow = row; renderFieldConstraint(inner, row, constraint, true); //now the clear icon Image clear = new ImageButton("images/delete_item_small.gif"); clear.setTitle("Remove this whole restriction"); clear.addClickListener(new ClickListener() { public void onClick(Widget w) { if (Window.confirm("Remove this item?")) { pattern.removeConstraint(currentRow); modeller.refreshWidget(); } } }); inner.setWidget(row, 5, clear); } if (bindable) layout.setStyleName("modeller-fact-pattern-Widget"); initWidget(layout); }
From source file:org.drools.brms.client.packages.PackageExplorerWidget.java
License:Apache License
/** * This will open an explorer locked to one specific package. * * @param edit//from w ww .j av a 2s . c o m * The edit event (action) when the user wants to open an item. * @param uuid * The package to lock this to. */ public PackageExplorerWidget(EditItemEvent edit, String uuid, String snapshotName) { this.editEvent = edit; this.uuid = uuid; exTree = new Tree(); layout = new DirtyableFlexTable(); treeListener = new TreeListener() { public void onTreeItemSelected(TreeItem selected) { PackageTreeItem event = (PackageTreeItem) selected.getUserObject(); Command selectEvent = event.command; LoadingPopup.showMessage("Please wait..."); DeferredCommand.add(selectEvent); } public void onTreeItemStateChanged(TreeItem arg0) { // ignore } }; exTree.addTreeListener(treeListener); VerticalPanel left = new VerticalPanel(); if (snapshotName == null) { // only care about new buttons if its not read only FlexTable buttons = new FlexTable(); buttons.getCellFormatter().setStyleName(0, 0, "new-asset-Icons"); buttons.getCellFormatter().setAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE); buttons.setWidget(0, 0, getNewWizardButtons()); left.add(buttons); buttons.setWidth("100%"); } // ScrollPanel scroll = new ScrollPanel(); // scroll.add(exTree); // scroll.setHeight("100%"); // left.add(scroll); left.add(exTree); layout.setWidget(0, 0, left); FlexCellFormatter formatter = layout.getFlexCellFormatter(); formatter.setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP); layout.getFlexCellFormatter().setRowSpan(0, 1, 2); layout.getFlexCellFormatter().setAlignment(0, 1, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_TOP); refreshTreeView(); TreeItem item = exTree.getItem(0); if (item != null) exTree.setSelectedItem(item); layout.setWidget(0, 1, new HTML("<i>Please choose a package to edit, explore, or create a new package.</i>")); layout.getFlexCellFormatter().setWidth(0, 0, "25%"); layout.getFlexCellFormatter().setAlignment(0, 1, HasHorizontalAlignment.ALIGN_LEFT, HasVerticalAlignment.ALIGN_TOP); listView = new AssetItemListViewer(this.editEvent, AssetItemListViewer.RULE_LIST_TABLE_ID); initWidget(layout); }
From source file:org.drools.guvnor.client.asseteditor.drools.DSLRuleEditor.java
License:Apache License
public DSLRuleEditor(Asset asset) { RuleContentText cont = (RuleContentText) asset.getContent(); this.data = cont; text = new TextArea(); text.setWidth("100%"); text.setVisibleLines(16);//from ww w . jav a 2 s . com text.setText(data.content); SuggestionCompletionEngine eng = SuggestionCompletionCache.getInstance() .getEngineFromCache(asset.getMetaData().getModuleName()); this.actions = eng.actionDSLSentences; this.conditions = eng.conditionDSLSentences; text.setStyleName("dsl-text-Editor"); //NON-NLS FlexTable layout = new FlexTable(); layout.setWidget(0, 0, text); text.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { data.content = text.getText(); makeDirty(); } }); text.addKeyDownHandler(new KeyDownHandler() { public void onKeyDown(KeyDownEvent event) { if (event.getNativeKeyCode() == ' ' && event.getNativeKeyCode() == KeyCodes.KEY_CTRL) { showInTextOptions(); } if (event.getNativeKeyCode() == KeyCodes.KEY_TAB) { int nextPos = text.getCursorPos() + 1; text.cancelKey(); insertText("\t"); text.setCursorPos(nextPos); } } }); VerticalPanel vert = new VerticalPanel(); Image lhsOptions = DroolsGuvnorImages.INSTANCE.NewDSLPattern(); lhsOptions.setTitle(Constants.INSTANCE.AddANewCondition()); lhsOptions.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { showSuggestions(conditions); } }); Image rhsOptions = DroolsGuvnorImages.INSTANCE.NewDSLAction(); rhsOptions.setTitle(Constants.INSTANCE.AddAnAction()); rhsOptions.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { showSuggestions(actions); } }); vert.add(lhsOptions); vert.add(rhsOptions); layout.setWidget(0, 1, vert); layout.getCellFormatter().setWidth(0, 0, "95%"); layout.getFlexCellFormatter().setAlignment(0, 0, HasHorizontalAlignment.ALIGN_LEFT, HasVerticalAlignment.ALIGN_TOP); layout.getCellFormatter().setWidth(0, 1, "5%"); layout.getFlexCellFormatter().setAlignment(0, 1, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE); layout.setWidth("100%"); layout.setHeight("100%"); initWidget(layout); }
From source file:org.drools.guvnor.client.asseteditor.drools.modeldriven.ui.ActionValueEditor.java
License:Apache License
private Widget wrap(Widget w) { HorizontalPanel wrapper = new HorizontalPanel(); Image clear = DroolsGuvnorImages.INSTANCE.DeleteItemSmall(); clear.setAltText(Constants.INSTANCE.RemoveActionValueDefinition()); clear.setTitle(Constants.INSTANCE.RemoveActionValueDefinition()); clear.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { //Reset Constraint's value and value type if (Window.confirm(Constants.INSTANCE.RemoveActionValueDefinitionQuestion())) { value.setNature(FieldNature.TYPE_UNDEFINED); value.setValue(null);//from w w w . j av a 2 s . c om doTypeChosen(); } } }); wrapper.add(w); wrapper.add(clear); wrapper.setCellVerticalAlignment(clear, HasVerticalAlignment.ALIGN_MIDDLE); return wrapper; }
From source file:org.drools.guvnor.client.asseteditor.drools.modeldriven.ui.ConstraintValueEditor.java
License:Apache License
private Widget wrap(Widget w) { HorizontalPanel wrapper = new HorizontalPanel(); Image clear = DroolsGuvnorImages.INSTANCE.DeleteItemSmall(); clear.setTitle(Constants.INSTANCE.RemoveConstraintValueDefinition()); clear.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { //Reset Constraint's value and value type if (Window.confirm(Constants.INSTANCE.RemoveConstraintValueDefinitionQuestion())) { constraint.setConstraintValueType(BaseSingleFieldConstraint.TYPE_UNDEFINED); constraint.setValue(null); constraint.clearParameters(); constraint.setExpressionValue(new ExpressionFormLine()); doTypeChosen();/*w w w. java2s . co m*/ } } }); wrapper.add(w); wrapper.add(clear); wrapper.setCellVerticalAlignment(clear, HasVerticalAlignment.ALIGN_MIDDLE); return wrapper; }
From source file:org.drools.guvnor.client.asseteditor.drools.modeldriven.ui.ConstraintValueEditor.java
License:Apache License
private Panel widgets(Widget left, Widget right) { HorizontalPanel panel = new HorizontalPanel(); panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); panel.add(left);//from w w w . ja v a 2 s . c o m panel.add(right); panel.setWidth("100%"); return panel; }