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:de.tigertech.appnavigation.client.loginview.LoginView.java
License:Open Source License
public LoginView() { int windowHeight = Window.getClientHeight(); int windowWidth = Window.getClientWidth(); loginLayout.setCellSpacing(6);/* www . j a v a 2s . c o m*/ FlexCellFormatter cellFormatter = loginLayout.getFlexCellFormatter(); // Add a title to the form loginLayout.setHTML(0, 0, this.headline); cellFormatter.setColSpan(0, 0, 2); cellFormatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER); // Add username and password fields username.setWidth("150px"); password.setWidth("150px"); loginLayout.setHTML(1, 0, this.usernameLabel); loginLayout.setWidget(1, 1, username); loginLayout.setHTML(2, 0, passwordLabel); loginLayout.setWidget(2, 1, password); //Add the loginbutton to the form loginLayout.setWidget(3, 0, loginbutton); cellFormatter.setColSpan(3, 0, 2); cellFormatter.setHorizontalAlignment(3, 0, HasHorizontalAlignment.ALIGN_CENTER); // Create some advanced options Grid advancedOptions = new Grid(2, 2); advancedOptions.setCellSpacing(6); advancedOptions.setHTML(0, 0, ipLabel); advancedOptions.setWidget(0, 1, ipadresse); advancedOptions.setHTML(1, 0, portLabel); advancedOptions.setWidget(1, 1, port); // Add advanced options to form in a disclosure panel DisclosurePanel advancedDisclosure = new DisclosurePanel("Advanced Settings"); advancedDisclosure.setAnimationEnabled(true); advancedDisclosure.ensureDebugId("DisclosurePanel"); advancedDisclosure.setContent(advancedOptions); loginLayout.setWidget(4, 0, advancedDisclosure); cellFormatter.setColSpan(4, 0, 2); // Wrap the content in a DecoratorPanel decPanel.setWidget(loginLayout); mainpanel.setWidth(windowWidth / 2 + "px"); mainpanel.setHeight(windowHeight * 0.6 + "px"); mainpanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); mainpanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); mainpanel.add(logo); mainpanel.add(secondoHeadline); mainpanel.add(decPanel); }
From source file:edu.caltech.ipac.firefly.ui.background.DownloadGroupPanel.java
private void addSuccessFootnote(BackgroundStatus bgStat) { if (bgStat.isSuccess()) { int partCount = getPartCount(_monItem); TablePos tpos = getStatusPosCol(_monItem, partCount - 1); int currentRow = tpos.getRow() + 1 + (partCount % 2); String paddingTop = "15px"; if (bgStat.hasAttribute(EmailSent)) { Label msgL = new Label(EMAIL_SENT); GwtUtil.setStyle(msgL, "paddingTop", paddingTop); _content.setWidget(currentRow, FOOTNOTE_POS_B, msgL); _content.getFlexCellFormatter().setAlignment(currentRow, FOOTNOTE_POS_A, HasHorizontalAlignment.ALIGN_LEFT, HasVerticalAlignment.ALIGN_MIDDLE); }/*w ww. j a va 2 s .c o m*/ if (partCount > 1 && bgStat.hasAttribute(DownloadScript)) { Widget downButton = GwtUtil.makeLinkButton(_prop.makeBase("downloadScript"), new ClickHandler() { public void onClick(ClickEvent event) { showDialogScriptDialog(_monItem.getID(), _monItem.getStatus().getDataSource()); } }); _content.getFlexCellFormatter().setAlignment(currentRow, FOOTNOTE_POS_B, HasHorizontalAlignment.ALIGN_LEFT, HasVerticalAlignment.ALIGN_MIDDLE); _content.setWidget(currentRow, FOOTNOTE_POS_A, downButton); GwtUtil.setStyle(downButton, "paddingTop", paddingTop); } } }
From source file:edu.caltech.ipac.firefly.ui.imageGrid.BasicImageGrid.java
protected void handleDoubleClick(TableData.Row row) { VerticalPanel vp = new VerticalPanel(); final Image previewImage = new Image(getFullSizeUrl(row)); final HTML caption = new HTML(getPopUpCaption(row)); String title = getThumbnailDesc(row).replace("<em>", "").replace("</em>", ""); caption.setWidth("320px"); previewImage.addLoadHandler(new LoadHandler() { public void onLoad(LoadEvent ev) { caption.setWidth(previewImage.getWidth() + "px"); }/* w w w. j a v a 2s .co m*/ }); GwtUtil.setStyle(vp, "margin", "8px"); vp.setCellHorizontalAlignment(previewImage, HasHorizontalAlignment.ALIGN_CENTER); vp.setCellVerticalAlignment(previewImage, HasVerticalAlignment.ALIGN_MIDDLE); vp.add(previewImage); vp.add(caption); PopupPane popupPane = new PopupPane(title, vp, PopupType.STANDARD, false, false); popupPane.show(); }
From source file:edu.caltech.ipac.firefly.ui.imageGrid.PagingOptions.java
public PagingOptions(ImageGridPanel imageGridPanel, PagingOptionsImages images) { this.imageGridPanel = imageGridPanel; HorizontalPanel hPanel = new HorizontalPanel(); initWidget(hPanel);/*from ww w. j a v a2 s . c o m*/ 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 this.imageGridPanel.getImageGrid().addPageLoadHandler(new PageLoadHandler() { public void onPageLoad(PageLoadEvent event) { loadingImage.setVisible(false); errorLabel.setHTML(""); } }); this.imageGridPanel.getImageGrid().addPageChangeHandler(new PageChangeHandler() { public void onPageChange(PageChangeEvent event) { curPageBox.setText((event.getNewPage() + 1) + ""); loadingImage.setVisible(true); errorLabel.setHTML(""); } }); this.imageGridPanel.getImageGrid().addPagingFailureHandler(new PagingFailureHandler() { public void onPagingFailure(PagingFailureEvent event) { loadingImage.setVisible(false); errorLabel.setHTML(event.getException().getMessage()); } }); this.imageGridPanel.getImageGrid().addPageCountChangeHandler(new PageCountChangeHandler() { public void onPageCountChange(PageCountChangeEvent event) { setPageCount(event.getNewPageCount()); } }); setPageCount(this.imageGridPanel.getImageGrid().getPageCount()); }
From source file:edu.caltech.ipac.firefly.ui.imageGrid.PagingToolbar.java
public PagingToolbar(ImageGridPanel imageGridPanel) { this.imageGridPanel = imageGridPanel; // Create the main widget mainPanel = new FlexTable(); initWidget(mainPanel);/*from w w w .j av a 2 s . c o m*/ setStyleName(DEFAULT_STYLENAME); FlexTable.FlexCellFormatter formatter = mainPanel.getFlexCellFormatter(); // paging controls pagingBar = new PagingOptions(this.imageGridPanel, new Images()); mainPanel.setWidget(0, 0, pagingBar); formatter.setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE); formatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_LEFT); // display status status = new Label(); status.addStyleName("status"); status.setWordWrap(false); mainPanel.setWidget(0, 2, status); formatter.setVerticalAlignment(0, 2, HasVerticalAlignment.ALIGN_MIDDLE); formatter.setHorizontalAlignment(0, 2, HasHorizontalAlignment.ALIGN_RIGHT); // display status addtlButtons = new HorizontalPanel(); mainPanel.setWidget(0, 1, addtlButtons); formatter.setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_MIDDLE); formatter.setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_CENTER); // page size field TOTO: this is using GXT lib.. remove when we remove GXT pageSize = SimpleInputField.createByProp("TablePanel.pagesize"); addtlButtons.add(pageSize); pageSize.setValue(imageGridPanel.getDataModel().getPageSize() + ""); pageSize.getField().addValueChangeHandler(new ValueChangeHandler<String>() { public void onValueChange(ValueChangeEvent<String> stringValueChangeEvent) { if (doPageReload) { if (pageSize.validate()) { reloadPageSize(pageSize.getField()); } } } }); //TODO: need to add this into InputField // pageSize.addListener(Events.KeyPress, new EnterKeyListener(){ // public void doAction(FieldEvent event) { // if (pageSize.isValid()) { // FocusImpl.getFocusImplForWidget().blur(pageSize.getElement()); // } // } // }); // Add handlers to the table this.imageGridPanel.getImageGrid().addPageLoadHandler(new PageLoadHandler() { public void onPageLoad(PageLoadEvent event) { PagingToolbar.this.onPageLoad(); // pageSize.setValue(PagingToolbar.this.table.getTable().getPageSize()+""); } }); this.imageGridPanel.getImageGrid().addPageChangeHandler(new PageChangeHandler() { public void onPageChange(PageChangeEvent event) { PagingToolbar.this.onPageChange(); } }); this.imageGridPanel.getImageGrid().addPagingFailureHandler(new PagingFailureHandler() { public void onPagingFailure(PagingFailureEvent event) { PagingToolbar.this.onPagingFailure(); } }); this.imageGridPanel.getImageGrid().addPageCountChangeHandler(new PageCountChangeHandler() { public void onPageCountChange(PageCountChangeEvent event) { PagingToolbar.this.onPageCountChange(); } }); onPageLoad(); }
From source file:edu.caltech.ipac.firefly.ui.input.CheckBoxGroupInputField.java
public CheckBoxGroupInputField(EnumFieldDef fieldDef) { _fieldDef = fieldDef;/* w w w. ja va 2 s. c om*/ if (fieldDef.getOrientation().equals(EnumFieldDef.Orientation.Vertical)) { _panel = new VerticalPanel(); _fieldWidgetPanel = new VerticalPanel(); } else { _panel = new HorizontalPanel(); _fieldWidgetPanel = new HorizontalPanel(); } initWidget(_fieldWidgetPanel); _panel.setSpacing(5); _panel.setTitle(_fieldDef.getShortDesc()); //list box setup _items = ((EnumFieldDef) _fieldDef).getEnumValues(); _cbs = new ArrayList<CheckBox>(_items.size()); CheckBox cb; int idx = 0; for (EnumFieldDef.Item item : _items) { cb = new CheckBox(" " + item.getTitle(), true); _cbs.add(cb); _panel.add(cb); if (item.getName().equals(ALL)) { _idxOfAll = idx; } idx++; } // add warning area _warningArea.setWidth("16px"); _warningArea.setHeight("16px"); DOM.setStyleAttribute(_warningArea.getElement(), "padding", "3px"); ErrorHandler eh = new ErrorHandler(); _warningArea.addFocusHandler(eh); _warningArea.addBlurHandler(eh); _warningArea.addMouseDownHandler(eh); _warningArea.addMouseOverHandler(eh); _warningArea.addMouseOutHandler(eh); _fieldWidgetPanel.add(_panel); _fieldWidgetPanel.add(_warningArea); _fieldWidgetPanel.setCellHorizontalAlignment(_warningArea, HasHorizontalAlignment.ALIGN_CENTER); _fieldWidgetPanel.setCellVerticalAlignment(_warningArea, HasVerticalAlignment.ALIGN_MIDDLE); // add click listeners for (idx = 0; idx < _cbs.size(); idx++) { final CheckBox current = _cbs.get(idx); final int currentIdx = idx; current.addClickHandler(new ClickHandler() { public void onClick(ClickEvent ev) { if ((currentIdx == _idxOfAll) && current.getValue()) { //uncheck all other for (int i = 0; i < _cbs.size(); i++) { if (i != _idxOfAll) { _cbs.get(i).setValue(true); } } } else if ((currentIdx == _idxOfAll) && !current.getValue()) { //all is unchecked so uncheck all that were checked for (int i = 0; i < _cbs.size(); i++) { if (i != _idxOfAll) { _cbs.get(i).setValue(false); } } } else if (_idxOfAll >= 0) { // uncheck _all_ unless all other checkboxes are checked CheckBox all = null; int nChecked = 0; for (int i = 0; i < _cbs.size(); i++) { if (i == _idxOfAll) { all = _cbs.get(i); } else { if (_cbs.get(i).getValue()) { nChecked++; } } } assert (all != null); // all checkboxes are checked if (nChecked == _cbs.size() - 1) { all.setValue(true); for (int i = 0; i < _cbs.size(); i++) { if (i != _idxOfAll) { _cbs.get(i).setValue(true); } } } else { all.setValue(false); } } ValueChangeEvent.fire(CheckBoxGroupInputField.this, getValue()); } }); } reset(); addValueChangeHandler(new ValueChangeHandler<String>() { public void onValueChange(ValueChangeEvent valueChangeEvent) { if (validate()) { } } }); // label setup }
From source file:edu.caltech.ipac.firefly.ui.PopoutWidget.java
public void setEnableChecking(boolean enable) { if (enable == _enableChecking) return;//from w w w .j av a 2 s. co m _enableChecking = enable; ensureCheckBoxCreated(); if (enable) { if (_titleContainer.getWidgetIndex(_titleCheckBox) == -1) { _titleContainer.insert(_titleCheckBox, 0); _titleContainer.setCellVerticalAlignment(_titleCheckBox, HasVerticalAlignment.ALIGN_MIDDLE); GwtUtil.setStyle(_titleCheckBox, "paddingLeft", "2px"); } } else { if (_titleContainer.getWidgetIndex(_titleCheckBox) > -1) { _titleContainer.remove(_titleCheckBox); } } }
From source file:edu.caltech.ipac.firefly.ui.table.PagingPanel.java
License:Apache License
/** * Constructor./*from w w w . j a v a2s. c o m*/ * * @param table the table being affected * @param images the images to use */ public PagingPanel(PagingScrollTable<?> table, PagingOptions.PagingOptionsImages images) { this.table = table; // 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"); // display status status = new Label(); status.addStyleName("status"); status.setWordWrap(false); // 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(status); hPanel.add(createSpacer()); hPanel.add(loadingImage); hPanel.add(errorLabel); // Add handlers to the table table.addPageLoadHandler(new PageLoadHandler() { public void onPageLoad(PageLoadEvent event) { setIsLoading(false); } }); table.addPageChangeHandler(new PageChangeHandler() { public void onPageChange(PageChangeEvent event) { curPageBox.setText((event.getNewPage() + 1) + ""); setIsLoading(true); } }); 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:edu.caltech.ipac.firefly.ui.table.PagingToolbar.java
public PagingToolbar(TablePanel table) { this.table = table; // Create the main widget mainPanel = new FlexTable(); initWidget(mainPanel);/*from w w w . j a v a2 s. c o m*/ setStyleName(DEFAULT_STYLENAME); FlexTable.FlexCellFormatter formatter = mainPanel.getFlexCellFormatter(); // paging controls pagingBar = new PagingPanel(table.getTable(), new Images()); mainPanel.setWidget(0, 0, pagingBar); formatter.setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP); // formatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_LEFT); // display status addtlButtons = new HorizontalPanel(); mainPanel.setWidget(0, 1, addtlButtons); formatter.setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_MIDDLE); // formatter.setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_CENTER); // Add handlers to the table table.getTable().addPageLoadHandler(new PageLoadHandler() { public void onPageLoad(PageLoadEvent event) { PagingToolbar.this.onPageLoad(); // pageSize.setValue(PagingToolbar.this.table.getTable().getPageSize()+""); } }); table.getTable().addPageChangeHandler(new PageChangeHandler() { public void onPageChange(PageChangeEvent event) { PagingToolbar.this.onPageChange(); } }); table.getTable().addPagingFailureHandler(new PagingFailureHandler() { public void onPagingFailure(PagingFailureEvent event) { PagingToolbar.this.onPagingFailure(); } }); table.getTable().addPageCountChangeHandler(new PageCountChangeHandler() { public void onPageCountChange(PageCountChangeEvent event) { PagingToolbar.this.onPageCountChange(); } }); onPageLoad(); }
From source file:edu.caltech.ipac.firefly.ui.table.TableOptions.java
private ScrollTable makeColsTable(final BasicPagingTable table) { final FixedWidthFlexTable header = new FixedWidthFlexTable(); header.setHTML(0, 0, "Column"); header.setWidget(0, 1, selectAllCheckBox); selectAllCheckBox.addClickHandler(new ClickHandler() { public void onClick(ClickEvent ev) { boolean hasSel = false; for (Map.Entry<ColDef, CheckBox> entry : checkBoxes.entrySet()) { if (entry.getValue().getValue()) { hasSel = true;//from w w w . ja v a 2 s . com break; } } if (selectAllCheckBox.getValue() && !hasSel) { for (Map.Entry<ColDef, CheckBox> entry : checkBoxes.entrySet()) { entry.getValue().setValue(true); } } else { for (Map.Entry<ColDef, CheckBox> entry : checkBoxes.entrySet()) { entry.getValue().setValue(false); } selectAllCheckBox.setValue(false); } applyChanges(); } }); // final SortableGrid.ColumnSorter[] origSorter = new SortableGrid.ColumnSorter[1]; @SuppressWarnings("deprecation") final FixedWidthGrid data = new FixedWidthGrid(0, 2); data.unsinkEvents(Event.ONMOUSEOVER); data.setSelectionEnabled(false); final ScrollTable view = new ScrollTable(data, header, new BasicTable.Images()); FlexTable.FlexCellFormatter formatter = header.getFlexCellFormatter(); formatter.setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_CENTER); view.setMaximumColumnWidth(1, 35); view.setMinimumColumnWidth(1, 35); view.setColumnSortable(1, false); final DefaultTableDefinition<TableData.Row> tdef = (DefaultTableDefinition<TableData.Row>) table .getTableDefinition(); int cRowIdx = 0; for (int i = 0; i < tdef.getColumnDefinitionCount(); i++) { final ColDef col = (ColDef) tdef.getColumnDefinition(i); if (!col.isImmutable()) { data.insertRow(cRowIdx); data.setHTML(cRowIdx, 0, col.getTitle()); CheckBox cb = new CheckBox(); cb.setValue(tdef.isColumnVisible(col)); checkBoxes.put(col, cb); data.setWidget(cRowIdx, 1, cb); data.getCellFormatter().setAlignment(cRowIdx, 1, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE); cRowIdx++; cb.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { applyChanges(); } }); } } return view; }