List of usage examples for com.google.gwt.user.client.ui HorizontalPanel setHorizontalAlignment
public void setHorizontalAlignment(HorizontalAlignmentConstant align)
From source file:se.esss.litterbox.linaclego.webapp.client.panels.PbsLevelPanel.java
License:Open Source License
private VerticalPanel setupElementPanel() { HorizontalPanel expandButtonPanel = new HorizontalPanel(); HorizontalPanel collapseButtonPanel = new HorizontalPanel(); expandButtonPanel.add(expandButton); collapseButtonPanel.add(collapseButton); arrowLine1Image = new Image("images/blueLine.png"); arrowLine1Image.setHeight(arrowHeight + "px"); arrowLine1Image.setWidth(arrowLine1Width + "px"); arrowLine1Panel = new HorizontalPanel(); arrowLine1Panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); arrowLine1Panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); arrowLine1Panel.setWidth(arrowLine1Width + "px"); arrowLine1Panel.setHeight("100%"); arrowLine1Panel.add(arrowLine1Image); Image arrowLine2Image = new Image("images/blueLine.png"); arrowLine2Image.setHeight(arrowHeight + "px"); arrowLine2Image.setWidth("100%"); arrowLine2Panel = new HorizontalPanel(); arrowLine2Panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); arrowLine2Panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); arrowLine2Panel.setWidth("100%"); arrowLine2Panel.setHeight("100%"); arrowLine2Panel.add(arrowLine2Image); iconImage = new Image(textTree.getIconImageLocation()); iconImage.addClickHandler(new IconImageClickHandler(this)); iconImage.setSize(iconWidth + "px", iconHeight + "px"); Image arrowHeadImage = new Image("images/blueArrowHead.png"); arrowHeadImage.setSize(arrowHeight + "px", arrowHeight + "px"); HorizontalPanel iconAndArrowHeadPanel = new HorizontalPanel(); iconAndArrowHeadPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); iconAndArrowHeadPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); iconAndArrowHeadPanel.setWidth(iconWidth + arrowHeight + "px"); iconAndArrowHeadPanel.add(arrowHeadImage); iconAndArrowHeadPanel.add(iconImage); HorizontalPanel allIconPanel = new HorizontalPanel(); allIconPanel.setWidth("100%"); allIconPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LOCALE_START); allIconPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); allIconPanel.add(arrowLine1Panel); allIconPanel.add(iconAndArrowHeadPanel); allIconPanel.add(arrowLine2Panel); HorizontalPanel tagAndButtonPanel = new HorizontalPanel(); tagAndButtonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); tagAndButtonPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); tagAndButtonPanel.add(expandButtonPanel); tagAndButtonPanel.add(new InlineHTML("<html>" + textTree.getAttribute(0).getAttributeValue() + "</html>")); // tagAndButtonPanel.add(new InlineHTML("<html>" + textTree.getTag() + "</html>")); tagAndButtonPanel.add(collapseButtonPanel); tagAndButtonWrapperPanel = new HorizontalPanel(); tagAndButtonWrapperPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); tagAndButtonWrapperPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); tagAndButtonWrapperPanel.setWidth("100%"); tagAndButtonWrapperPanel.setHeight("40px"); tagAndButtonWrapperPanel.add(tagAndButtonPanel); if (odd)//from w w w. j a v a2 s . c o m tagAndButtonWrapperPanel.setStyleName("pbsBackGroundOdd" + ilevel); if (!odd) tagAndButtonWrapperPanel.setStyleName("pbsBackGroundEven" + ilevel); FocusPanel tagAndButtonWrapperFocusPanel = new FocusPanel(); tagAndButtonWrapperFocusPanel.addClickHandler(new CenterClickHandler(this)); tagAndButtonWrapperFocusPanel.add(tagAndButtonWrapperPanel); VerticalPanel iconAndTag = new VerticalPanel(); iconAndTag.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); iconAndTag.setWidth("100%"); iconAndTag.add(tagAndButtonWrapperFocusPanel); iconAndTag.add(allIconPanel); VerticalPanel wrapperPanel = new VerticalPanel(); wrapperPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); wrapperPanel.add(iconAndTag); if (textTree.hasChildren()) { expandButton.addClickHandler(new ExpandButtonClickHandler(this)); expandButton.setVisible(true); collapseButton.addClickHandler(new CollapseButtonClickHandler(this)); collapseButton.setVisible(false); } else { expandButton.setVisible(false); collapseButton.setVisible(false); } Grid attributePanel = new Grid(textTree.numAttributes(), 1); for (int ia = 0; ia < textTree.numAttributes(); ++ia) { attributePanel.setWidget(ia, 0, new InlineHTML(textTree.getAttribute(ia).getInlineHtmlString(false, false))); } Grid idPanel = new Grid(1, 1); idPanel.setWidget(0, 0, new Label(" ")); wrapperPanel.add(idPanel); if (textTree.hasDataFolder()) { dataPanel = new Grid(textTree.getDataFolder().numChildren(), 1); for (int ia = 0; ia < textTree.getDataFolder().numChildren(); ++ia) { String html = textTree.getDataFolder().getTextTreeArrayList().get(ia).getInlineHtmlString(false, false); dataPanel.setWidget(ia, 0, new InlineHTML(html)); } } pbsInfoDialogBox = new PbsInfoDialogBox(textTree.getAttribute(1).getAttributeValue(), attributePanel, dataPanel); return wrapperPanel; }
From source file:uk.ac.ebi.fg.annotare2.web.gwt.editor.client.view.experiment.design.ProtocolAssignmentDialog.java
License:Apache License
private void createDialog1(final ProtocolAssignmentProfile profile) { if (!profile.isDefault()) { createDialog2(profile);/*from w w w.j a va2 s . c om*/ return; } Button changeButton = new Button("Change"); changeButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { createDialog2(profile); } }); Button cancelButton = new Button("Cancel"); cancelButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { hide(); } }); HorizontalPanel buttonPanel = new HorizontalPanel(); buttonPanel.setSpacing(5); buttonPanel.add(cancelButton); buttonPanel.add(changeButton); HorizontalPanel hPanel = new HorizontalPanel(); hPanel.setWidth("100%"); hPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); hPanel.add(buttonPanel); hPanel.getElement().getStyle().setMarginTop(5, Style.Unit.PX); VerticalPanel panel = new VerticalPanel(); panel.setWidth("100%"); panel.add(new Label("Protocol '" + profile.getProtocolName() + "' is assigned to all " + profile.getProtocolSubjectType() + "s by default. Do you want to change this behavior?")); panel.add(hPanel); setWidget(panel); center(); }
From source file:us.asciiroth.editor.client.InstanceEditor.java
License:Apache License
private void createPanelContents(String template) { Grid grid = new Grid(1, 5); grid.setWidth("100%"); grid.setCellPadding(0);//from w w w . ja v a 2s.c om grid.setCellSpacing(0); grid.getCellFormatter().setWidth(0, 0, "25px"); grid.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER); grid.getCellFormatter().setWidth(0, 1, "25px"); grid.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_CENTER); grid.getCellFormatter().setWidth(0, 2, "25px"); grid.getCellFormatter().setHorizontalAlignment(0, 2, HasHorizontalAlignment.ALIGN_CENTER); grid.getCellFormatter().setWidth(0, 4, "120px"); grid.getCellFormatter().setHorizontalAlignment(0, 4, HasHorizontalAlignment.ALIGN_RIGHT); HorizontalPanel hpanel = new HorizontalPanel(); hpanel.setWidth("100%"); hpanel.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER); hpanel.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE); // panel.add(hpanel); panel.add(grid); // The symbol itself symbol = new HTML(EMPTY); // hpanel.add(symbol); grid.setWidget(0, 0, symbol); color = new HTML(EMPTY); // hpanel.add(color); grid.setWidget(0, 1, color); // status status = new Image("icons/bullet_delete.png"); // hpanel.add(status); grid.setWidget(0, 2, status); field = new TextArea(); field.setWidth("400px"); field.setVisibleLines(1); field.setText(template); field.addFocusHandler(this); field.addKeyUpHandler(this); // hpanel.add(field); grid.setWidget(0, 3, field); final InstanceEditor that = this; Hyperlink hyperlink = new Hyperlink("Remove", "remove"); hyperlink.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { BoardEditor boardEditor = Editor.get().getBoardEditor(); boardEditor.removePiece(piece); Editor.get().getInstancePalette().remove(that); } }); // hpanel.add(hyperlink); grid.setWidget(0, 4, hyperlink); }