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.totsp.gwittir.client.fx.ui.ReflectedImageGroup.java
License:Open Source License
/** Creates a new instance of ReflectedImageGroup */ public ReflectedImageGroup(final int baseWidth, final int baseHeight, final double reflectHeight, final double opacity) { super();//www . j a va2 s .c om this.baseWidth = baseWidth; this.baseHeight = baseHeight; this.reflectHeight = reflectHeight; this.opacity = opacity; this.imagesPanel.setHeight("100%"); final int padding = ((int) (baseHeight * maxScalar) - baseHeight) / 4; this.grid.setCellSpacing(padding); this.grid.setHeight("100%"); this.grid.setStyleName("gwittir-ReflectedFisheyeImageGroup"); this.grid.getRowFormatter().setVerticalAlign(0, HasVerticalAlignment.ALIGN_MIDDLE); this.imagesPanel.getRowFormatter().setVerticalAlign(0, HasVerticalAlignment.ALIGN_MIDDLE); this.grid.setWidget(0, 1, imagesPanel); this.imagesPanel.setCellPadding(0); this.imagesPanel.setCellSpacing(2); Renderer<T, String> renderer = (Renderer<T, String>) ToStringRenderer.INSTANCE; this.setRenderer(renderer); super.initWidget(grid); }
From source file:com.unilorraine.projetdevie.client.ui.viewmodules.unitchoosermodule.UnitChooserViewImpl.java
License:Open Source License
public UnitChooserViewImpl() { viewerPictureSmall = new DetailViewerField("picture"); viewerPictureSmall.setType("image"); viewerPictureSmall.setImageWidth(50); viewerPictureSmall.setImageHeight(50); viewerPicture = new DetailViewerField("picture"); viewerPicture.setType("image"); viewerPicture.setImageWidth(100);/* w w w . jav a2 s .c o m*/ viewerPicture.setImageHeight(100); viewerName = new DetailViewerField("name"); VerticalPanel verticalPanel = new VerticalPanel(); add(verticalPanel); verticalPanel.setSize("602px", "602px"); Label title = new Label("Cr\u00E9ateur commun du projet de vie"); title.setStyleName("title"); verticalPanel.add(title); EdgedCanvas edgedCanvasChoice = new EdgedCanvas(); edgedCanvasChoice.setSize("590px", "150px"); unitChoiceGrid = new TileGrid(); unitChoiceGrid.setSize("590px", "135px"); unitChoiceGrid.setSelectionType(SelectionStyle.SINGLE); unitChoiceGrid.setFields(viewerPicture, viewerName); unitChoiceGrid.setEdgeSize(0); unitChoiceGrid.setShowEdges(false); unitChoiceGrid.setCanAcceptDrop(true); unitChoiceGrid.setCanDrag(true); unitChoiceGrid.setTileWidth(120); unitChoiceGrid.setTileHeight(120); edgedCanvasChoice.addChild(unitChoiceGrid); verticalPanel.add(edgedCanvasChoice); VerticalPanel middlePanel = new VerticalPanel(); middlePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); middlePanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); verticalPanel.add(middlePanel); middlePanel.setSize("602px", "155px"); EdgedCanvas edgedCanvas = new EdgedCanvas(); edgedCanvas.setSize("150px", "150px"); edgedCanvas.setAlign(Alignment.CENTER); Label dropText = new Label("La cible"); targetGrid = new TileGrid(); targetGrid.setSize("125px", "125px"); targetGrid.setSelectionType(SelectionStyle.SINGLE); targetGrid.setFields(viewerPicture, viewerName); targetGrid.setEdgeSize(0); targetGrid.setShowEdges(false); targetGrid.setCanAcceptDrop(true); targetGrid.setCanDrag(true); targetGrid.setTileWidth(120); targetGrid.setTileHeight(120); targetGrid.setData(new ActivityRecord[1]); targetGrid.addDropHandler(new DropHandler() { @Override public void onDrop(DropEvent event) { if (targetGrid.getData().length >= 1) { event.cancel(); System.out.println("Target full"); } } }); edgedCanvas.addChild(targetGrid); middlePanel.add(dropText); middlePanel.add(edgedCanvas); DisclosurePanel disclosurePanel = new DisclosurePanel("Activites choisies"); verticalPanel.add(disclosurePanel); disclosurePanel.setWidth("586px"); ScrollPanel scrollPanel = new ScrollPanel(); disclosurePanel.setContent(scrollPanel); scrollPanel.setSize("581px", "112px"); activityGrid = new TileGrid(); activityGrid.setSize("572px", "106px"); activityGrid.setSelectionType(SelectionStyle.NONE); activityGrid.setFields(viewerPictureSmall, viewerName); activityGrid.setEdgeSize(0); activityGrid.setShowEdges(false); activityGrid.setCanAcceptDrop(false); activityGrid.setCanDrag(false); activityGrid.setTileWidth(80); activityGrid.setTileHeight(80); scrollPanel.setWidget(activityGrid); box = new DialogBox(); // Set the dialog box's caption. box.setText("My First Dialog"); // Enable animation. box.setAnimationEnabled(true); // Enable glass background. box.setGlassEnabled(true); // DialogBox is a SimplePanel, so you have to set its widget // property to whatever you want its contents to be. Button ok = new Button("OK"); ok.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { box.hide(); } }); Label label = new Label("Il n'y a plus d'unit\u00E9 de choix"); VerticalPanel panel = new VerticalPanel(); panel.setHeight("100"); panel.setWidth("300"); panel.setSpacing(10); panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); panel.add(label); panel.add(ok); box.setWidget(panel); }
From source file:com.webgocommerce.client.model.HeaderMenu.java
private void initComponents() { FlexCellFormatter headCellFormatter = this.getFlexCellFormatter(); this.setWidth("100%"); //this.setHeight("12mm"); headCellFormatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_LEFT); headCellFormatter.setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_CENTER); headCellFormatter.setHorizontalAlignment(0, 2, HasHorizontalAlignment.ALIGN_RIGHT); headCellFormatter.setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE); headCellFormatter.setWidth(0, 0, "32px"); headCellFormatter.setVerticalAlignment(0, 2, HasVerticalAlignment.ALIGN_MIDDLE); headCellFormatter.setWidth(0, 2, "32px"); }
From source file:com.webgocommerce.client.view.uiadditemlista.UIAddItemLista.java
private void initComponents() { lstFamilia = new ListModelFamilia(); progreso = new ProgressBar(); header = new HeaderMenu(); lblCenter = new Label("CATEGORIA - LISTA"); btnActualizar = new Button("Buscar"); btnBack = new PushButton(new Image(MyResource.INSTANCE.getImgBack32())); btnBack.setTitle("Volver Atras"); header.setLeftWidget(btnBack);/*from w ww. j a v a2 s .co m*/ header.setCenterWidget(lblCenter); //header.setRightWidget(btnActualizar); //formBuscar = new FlexTable(); //lblBuscar = new Label("Buscar:"); txtBuscar = new MSearchBox(); txtBuscar.getElement().setPropertyString("placeholder", "escriba aqui"); //formBuscar.setWidget(0, 0, lblBuscar); //formBuscar.setWidget(0, 1, txtBuscar); grid = new GridItemSinLista(); //grid.setAlwaysShowScrollBars(true); grid.setMinimumTableWidth(1024, Style.Unit.PX); pnlGuardar = new FlowPanel(); btnGuardar = new com.googlecode.mgwt.ui.client.widget.button.Button("Agregar a Lista"); pnlGuardar.add(btnGuardar); btnGuardar.setConfirm(true); this.getPnlTabla().add(grid); this.getPnlTabla().add(grid.getPager()); this.getPnlTabla().add(pnlGuardar); this.getPnlBusqueda().add(header); HorizontalPanel pnlSearch = new HorizontalPanel(); pnlSearch.add(lstFamilia); pnlSearch.add(txtBuscar); pnlSearch.add(btnActualizar); pnlSearch.setCellVerticalAlignment(lstFamilia, HasVerticalAlignment.ALIGN_MIDDLE); pnlSearch.setCellVerticalAlignment(btnActualizar, HasVerticalAlignment.ALIGN_MIDDLE); this.getPnlBusqueda().add(pnlSearch); this.getPnlBotones().setVisible(false); Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent event) { reCalcularWindows(); } }); }
From source file:custgwttbl.client.CustGwtNavPanel.java
License:Apache License
/** * Creates a navigation panel/*from ww w.j ava2s. c om*/ * * @param inDataSource * CustGwtDataSource object * @see custgwttbl.client.CustGwtDataSource */ public CustGwtNavPanel(CustGwtDataSource inDataSource) { this.dataSource = inDataSource; horizontalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); horizontalPanel.setWidth("100%"); horizontalPanel.setSpacing(2); if (!CustGwtUtil.isNull(inDataSource.getLoadImageUrl())) { loadImage = new Image(inDataSource.getLoadImageUrl()); loadImage.addStyleName(CustGwtUtil.CUST_GWT_TABLE_NAV_IMG_STYLE); horizontalPanel.add(loadImage); } horizontalPanel.add(extraPanel); horizontalPanel.setCellWidth(extraPanel, "100%"); prevBtnPanel.setSpacing(2); nextBtnPanel.setSpacing(2); prevBtnPanel.add(prevBtn); nextBtnPanel.add(nextBtn); prevBtn.addClickListener(panelClickListener); nextBtn.addClickListener(panelClickListener); horizontalPanel.add(prevBtnPanel); horizontalPanel.add(nextBtnPanel); initWidget(horizontalPanel); prevBtn.addStyleName(CustGwtUtil.CUST_GWT_TABLE_NAV_PREVBTN_STYLE); nextBtn.addStyleName(CustGwtUtil.CUST_GWT_TABLE_NAV_NEXTBTN_STYLE); this.setNextButtonEnabled(false); this.setPrevButtonEnabled(false); this.addStyleName(CustGwtUtil.CUST_GWT_TABLE_NAVPANEL_STYLE); }
From source file:de.decidr.workflowmodeleditor.client.ui.dialogs.humantask.TaskItemFieldSet.java
License:Apache License
/** * Constructs a field set with the given parameters. * //from www . ja v a 2s . c o m * @param labelField * this field is for the name of the input field which later * appears to the user * @param hintField * this field is for s short hint message for the user * @param variableField * from this field the variable can be selected into which the * input from the user shall be written */ public TaskItemFieldSet(TextField<String> labelField, TextField<String> hintField, ComboBox<Variable> variableField, FlexTable table, List<TaskItemFieldSet> fieldsets) { this.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); this.setSpacing(3); this.labelField = labelField; this.add(new Label(WorkflowEditorWidget.getMessages().taskItemLabel())); this.add(labelField); this.hintField = hintField; this.add(new Label(WorkflowEditorWidget.getMessages().taskItemHint())); this.add(hintField); this.variableField = variableField; this.add(new Label(WorkflowEditorWidget.getMessages().taskItemInputVar())); this.add(variableField); TaskItemClickHandler handler = new TaskItemClickHandler(table, this, fieldsets); PushButton button = new PushButton(WorkflowEditorWidget.getMessages().delTaskItem(), handler); this.add(button); }
From source file:de.decidr.workflowmodeleditor.client.ui.dialogs.valueeditor.ValueFieldWidget.java
License:Apache License
/** * Default constructor.//from w w w.j a v a 2s . c o m * * @param table * the table where the widget is to be displayed * @param text * the text field for the variable value * @param fields * the list of references to all value text fields * */ public ValueFieldWidget(FlexTable table, TextField<String> text, List<TextField<String>> fields) { this.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); this.textField = text; this.add(this.textField); ValueFieldClickHandler handler = new ValueFieldClickHandler(table, this, fields); this.button = new PushButton(WorkflowEditorWidget.getMessages().delValue(), handler); this.add(this.button); }
From source file:de.eckhartarnold.client.ControlPanel.java
License:Apache License
/** * (Re-)creates the button panel using the images stored in the * <code>icons</code> map as symbols on the buttons. */// w ww . jav a2 s . c om protected void composePanel() { VerticalPanel vpanel = new VerticalPanel(); HorizontalPanel buttonPanel = new HorizontalPanel(); buttonPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); // progress bar progress = new ProgressBar(slideshow.size()); int btnSize; if (filmstrip != null) btnSize = buttonSize / 2; else btnSize = buttonSize; if (btnSize >= 24) progress.setLabelingType(ProgressBar.VALUE_LABEL); else progress.setLabelingType(ProgressBar.NO_LABEL); if (btnSize <= 32) progress.getFrame().addStyleDependentName("thin"); if (btnSize > 48) progress.getBar().addStyleDependentName("16px"); else if (btnSize > 32) progress.getBar().addStyleDependentName("12px"); else if (btnSize >= 28) progress.getBar().addStyleDependentName("10px"); else if (btnSize >= 24) progress.getBar().addStyleDependentName("9px"); else if (btnSize >= 20) progress.getBar().addStyleDependentName("4px"); else progress.getBar().addStyleDependentName("3px"); int value = slideshow.getCurrentSlide(); if (value >= 0) progress.setValue(value + 1); // button panel // begin = new PushButton(icons.get("begin"), icons.get("begin_down"), this); // Tooltip.addToWidget(beginTooltip, begin); back = new PushButton(icons.get("back"), icons.get("back_down"), this); Tooltip.addToWidget(backTooltip, back); if (homeButtonHandler != null) { home = new PushButton(icons.get("gallery"), icons.get("gallery_down"), homeButtonHandler); } else { home = new PushButton(icons.get("gallery"), icons.get("gallery_down")); } Tooltip.addToWidget(homeTooltip, home); play = new ToggleButton(icons.get("play"), icons.get("pause"), this); Tooltip.addToWidget(playPauseTooltip, play); if (slideshow.isRunning()) play.setDown(true); next = new PushButton(icons.get("next"), icons.get("next_down"), this); Tooltip.addToWidget(nextTooltip, next); // end = new PushButton(icons.get("end"), icons.get("end_down"), this); // Tooltip.addToWidget(endTooltip, end); // if ((buttonsShown & BEGIN) != 0) buttonPanel.add(begin); if ((buttonsShown & BACK) != 0) buttonPanel.add(back); if ((buttonsShown & HOME) != 0) buttonPanel.add(home); if (filmstrip != null) { filmstrip.setHeight(buttonSize * 2 + "px"); vpanel.add(filmstrip); vpanel.add(progress); vpanel.setWidth("100%"); buttonPanel.add(vpanel); buttonPanel.setCellWidth(vpanel, "100%"); buttonPanel.addStyleName("controlFilmstripBackground"); addButtonStyles("controlFilmstripButton"); } else { buttonPanel.addStyleName("controlPanelBackground"); addButtonStyles("controlPanelButton"); } if ((buttonsShown & PLAY) != 0) buttonPanel.add(play); if ((buttonsShown & NEXT) != 0) buttonPanel.add(next); // if ((buttonsShown & END) != 0) buttonPanel.add(end); enableOrDisableButtons(); if (filmstrip != null) { wrapper.setWidget(buttonPanel); } else { vpanel.add(buttonPanel); vpanel.add(progress); wrapper.setWidget(vpanel); } }
From source file:de.eckhartarnold.client.GalleryWidget.java
License:Apache License
@Override public void onResized() { Widget parent = getParent();// w w w. j a va2s . c om if (parent == null) return; int width = parent.getOffsetWidth(); HorizontalPanel row = null; int columns = (width - paddingH) / (edgeWidth + paddingH); if (columns <= 0) columns = 1; int rows = thumbnails.size() / columns; if (thumbnails.size() % columns != 0) rows++; if (imageRows != null) { if (rows == imageRows.length && imageRows[0].getWidgetCount() == columns) { return; // layout did not change! } for (HorizontalPanel p : imageRows) { panel.remove(p); } } imageRows = new HorizontalPanel[rows]; for (int i = 0; i < thumbnails.size(); i++) { if (i % columns == 0) { row = new HorizontalPanel(); row.setStyleName("galleryRow"); //row.setSpacing(paddingV); row.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); row.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); imageRows[i / columns] = row; } Image img = thumbnails.get(i); if (captions[i].asString().length() > 0) { Tooltip.addToWidget(new Tooltip(captions[i]), img); // sometimes wrong tooltip position!? } row.add(img); //int delta = 0; //if (paddingH > paddingV) delta = 2*(paddingH-paddingV); row.setCellWidth(img, edgeWidth + 2 * paddingH + "px"); row.setCellHeight(img, edgeHeight + 2 * paddingV + "px"); } for (HorizontalPanel r : imageRows) { panel.add(r); } }
From source file:de.eckhartarnold.client.TiledLayout.java
License:Apache License
private int createTiles(CellPanel parent, ImageCollectionInfo info, String config, int i) { while (i < config.length()) { switch (config.charAt(i)) { case ('C'): { parent.add(caption);/*from w w w . ja v a 2 s. c o m*/ caption.addStyleDependentName("tiled"); parent.setCellVerticalAlignment(caption, HasVerticalAlignment.ALIGN_MIDDLE); parent.setCellHorizontalAlignment(caption, HasHorizontalAlignment.ALIGN_CENTER); parent.setCellWidth(caption, "100%"); break; } case ('O'): { overlay = new CaptionOverlay(caption, imagePanel, slideshow, info.getInfo().get(CaptionOverlay.KEY_CAPTION_POSITION)); } case ('I'): { parent.add(imagePanel); parent.setCellVerticalAlignment(imagePanel, HasVerticalAlignment.ALIGN_MIDDLE); parent.setCellHorizontalAlignment(imagePanel, HasHorizontalAlignment.ALIGN_CENTER); parent.setCellWidth(imagePanel, "100%"); parent.setCellHeight(imagePanel, "100%"); break; } case ('P'): case ('F'): { assert control instanceof Widget; parent.add((Widget) control); ((Widget) control).addStyleDependentName("tiled"); parent.setCellVerticalAlignment(((Widget) control), HasVerticalAlignment.ALIGN_MIDDLE); if (parent instanceof HorizontalPanel && parent.getWidgetCount() == 1) { parent.setCellHorizontalAlignment(((Widget) control), HasHorizontalAlignment.ALIGN_RIGHT); } else { parent.setCellHorizontalAlignment(((Widget) control), HasHorizontalAlignment.ALIGN_CENTER); } break; } case ('-'): { HTML horizLine = new HTML("<hr class=\"tiledSeparator\" />"); panel.add(horizLine); break; } case (']'): { return i; } case ('['): { CellPanel panel; if (parent instanceof VerticalPanel) { panel = new HorizontalPanel(); panel.setStyleName("tiled"); } else { panel = new VerticalPanel(); panel.setStyleName("tiled"); } i = createTiles(panel, info, config, i + 1); parent.add(panel); break; } default: assert false : "Illegal token '" + config.charAt(i) + "' in config string"; } i++; } return i; }