List of usage examples for com.google.gwt.user.client.ui HorizontalPanel setSpacing
public void setSpacing(int spacing)
From source file:com.sun.labs.aura.music.wsitm.client.WebLib.java
License:Open Source License
/** * Returns a populatiry histrogram. To get it wrapped with a title, use other * utility functions getSmallPopularityWidget() or getPopularityWidget() * @param normPopularity popularity as a number between 0 and 1 * @param log plot on log scale/*from w w w .j a v a2s . c o m*/ * @param height maximum size of 15 * @param maxWidth * @return */ public static HorizontalPanel getPopularityHisto(double normPopularity, boolean log, int height, int maxWidth) { if (log) { normPopularity = Math.log(normPopularity + 1) / Math.log(2); // get the base 2 log } int leftWidth = (int) (normPopularity * maxWidth); if (leftWidth < 1) { leftWidth = 1; } else if (leftWidth > maxWidth) { leftWidth = maxWidth; } int rightWidth = maxWidth - leftWidth; HorizontalPanel table = new HorizontalPanel(); table.setWidth(maxWidth + "px"); table.setBorderWidth(0); table.setSpacing(0); Widget left = new Label(""); left.setStyleName("popLeft"); left.setWidth(leftWidth + ""); left.setHeight(height + "px"); left.getElement().getStyle().setPropertyPx("fontSize", height - 2); Widget right = new Label(""); right.setStyleName("popRight"); right.setWidth(rightWidth + ""); right.setHeight(height + "px"); right.getElement().getStyle().setPropertyPx("fontSize", height - 2); table.add(left); table.add(right); return table; }
From source file:de.catma.ui.client.ui.tagger.menu.TagMenuPopup.java
License:Open Source License
public TagMenuPopup(TaggerEditor vTagger, String lastSelectedColor) { super(true);/* w w w . j a v a 2s .c o m*/ getElement().addClassName("tagmenu-popup"); this.setText("Annotations"); this.vTagger = vTagger; this.lastSelectedColor = lastSelectedColor; root = new TreeItem("Available annotations"); final Tree tree = new Tree(); tree.addItem(root); root.setState(true); root.setStyleName("tagger_menu_root"); final VerticalPanel vPanel = new VerticalPanel(); if (vTagger.hasSelection()) { final VerticalPanel annotationCreationPanel = new VerticalPanel(); annotationCreationPanel.setSpacing(5); annotationCreationPanel.setWidth("100%"); final TextArea annotationBodyInput = new TextArea(); annotationBodyInput.setWidth("90%"); annotationCreationPanel.add(annotationBodyInput); final HorizontalPanel annotationCreationButtonPanel = new HorizontalPanel(); annotationCreationButtonPanel.setSpacing(5); final Label colorLabel = new HTML(" "); final ColorPicker colorPicker = new ColorPicker() { @Override public void onChange(Widget sender) { super.onChange(sender); colorLabel.getElement().setAttribute("style", "background:#" + this.getHexColor() + ";"); } }; try { if (lastSelectedColor != null) { colorPicker.setHex(lastSelectedColor); } else { int[] randomColor = getRandomColor(); colorPicker.setRGB(randomColor[0], randomColor[1], randomColor[2]); } } catch (Exception e) { // well... } colorLabel.getElement().setAttribute("style", "background:#" + colorPicker.getHexColor() + ";"); HorizontalPanel colorPanel = new HorizontalPanel(); colorPanel.setSpacing(5); PushButton colorButton = new PushButton("Change color..."); colorPanel.add(colorButton); colorPanel.add(colorLabel); HandlerRegistration colorButtonReg = colorButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { annotationCreationPanel.insert(colorPicker, annotationCreationPanel.getWidgetIndex(annotationCreationButtonPanel)); TagMenuPopup.this.center(); } }); handlerRegistrations.add(colorButtonReg); annotationCreationPanel.add(colorPanel); PushButton saveButton = new PushButton("Save"); //saveButton.setStylePrimaryName("tagger-pushButton"); HandlerRegistration saveButtonReg = saveButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { // TagMenuPopup.this.vTagger.createAndAddTagIntance(colorPicker.getHexColor()); TagMenuPopup.this.lastSelectedColor = colorPicker.getHexColor(); hide(); } }); handlerRegistrations.add(saveButtonReg); PushButton cancelButton = new PushButton("Cancel"); //cancelButton.setStylePrimaryName("tagger-pushButton"); annotationCreationButtonPanel.add(saveButton); annotationCreationButtonPanel.add(cancelButton); annotationCreationPanel.add(annotationCreationButtonPanel); PushButton addAnnotationButton = new PushButton("Add annotation..."); //addAnnotationButton.setStylePrimaryName("tagger-pushButton"); HandlerRegistration addAnnotationBtReg = addAnnotationButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { vPanel.insert(annotationCreationPanel, vPanel.getWidgetIndex(tree)); } }); handlerRegistrations.add(addAnnotationBtReg); vPanel.add(addAnnotationButton); HandlerRegistration cancelButtonReg = cancelButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { annotationBodyInput.setText(""); vPanel.remove(annotationCreationPanel); } }); handlerRegistrations.add(cancelButtonReg); } vPanel.add(tree); vPanel.setStylePrimaryName("tagger_menu"); setWidget(vPanel); }
From source file:de.novanic.gwteventservice.demo.conversationapp.client.conversation.ui.GWTConversationChannelCreatorDialog.java
License:Open Source License
private Panel createContentPanel() { final Button theCreateChannelButton = new Button("Create"); final Button theCancelButton = new Button("Cancel"); final TextBox theChannelNameText = new TextBox(); theChannelNameText.setMaxLength(30); theChannelNameText.addKeyUpHandler(new KeyUpHandler() { public void onKeyUp(KeyUpEvent aKeyUpEvent) { switch (aKeyUpEvent.getNativeKeyCode()) { case 13: theCreateChannelButton.click(); break; case 27: theCancelButton.click(); }// ww w . j a va 2s. c o m } }); theChannelNameText.setFocus(true); theCreateChannelButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent aClickEvent) { String theChannelName = theChannelNameText.getText(); close(theChannelName); } }); theCancelButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent aClickEvent) { close(null); } }); HorizontalPanel theActionPanel = new HorizontalPanel(); theActionPanel.setSpacing(5); theActionPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); theActionPanel.add(theCreateChannelButton); theActionPanel.add(theCancelButton); VerticalPanel theContentPanel = new VerticalPanel(); theContentPanel.setSpacing(5); theContentPanel.add(theChannelNameText); theContentPanel.add(theActionPanel); return theContentPanel; }
From source file:de.novanic.gwteventservice.demo.conversationapp.client.conversation.ui.message.GWTMessageBox.java
License:Open Source License
private Panel createContent(MessageButtonListener.Button... aMessageButtons) { HorizontalPanel theButtonPanel = new HorizontalPanel(); theButtonPanel.setSpacing(5); theButtonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); myMessageButtons = new HashMap<MessageButtonListener.Button, Button>(aMessageButtons.length); for (MessageButtonListener.Button theMessageButton : aMessageButtons) { final Button theButton = new Button(theMessageButton.getDescription()); myMessageButtons.put(theMessageButton, theButton); theButtonPanel.add(theButton);//from w w w. j a v a2 s . c o m } return theButtonPanel; }
From source file:de.oose.taskboard.client.view.TaskListView.java
License:Open Source License
public TaskListView() { setSpacing(5);//from w ww . jav a 2 s .c o m setSize("800", "600"); HorizontalPanel horizontalPanel = new HorizontalPanel(); horizontalPanel.setSpacing(5); add(horizontalPanel); horizontalPanel.setWidth("100%"); setCellWidth(horizontalPanel, "100%"); lblUser = new Label("userlabel"); horizontalPanel.add(lblUser); horizontalPanel.setCellWidth(lblUser, "20%"); btnLogout = new Button("New button"); btnLogout.setText("Logout"); horizontalPanel.add(btnLogout); horizontalPanel.setCellWidth(btnLogout, "100%"); horizontalPanel.setCellHorizontalAlignment(btnLogout, HasHorizontalAlignment.ALIGN_RIGHT); taskboard = new Taskboard(); add(taskboard); btnTask = new Button("New button"); add(btnTask); btnTask.setText("New Task"); }
From source file:edu.caltech.ipac.firefly.ui.catalog.CatalogPanel.java
private void createTargetPanel() { HorizontalPanel hp = new HorizontalPanel(); Widget modTarget = GwtUtil.makeLinkButton(_prop.getTitle("modTarget"), _prop.getTip("modTarget"), new ClickHandler() { public void onClick(ClickEvent ev) { setTargetCard(TARGET_PANEL); }// w w w. j av a 2s . c om }); hp.add(_targetDesc); hp.setSpacing(5); hp.add(modTarget); updateTargetDesc(); _targetCards.add(_targetPanelHolder); _targetCards.add(hp); _targetCards.add(new Label()); setTargetCard(TARGET_DESC); _targetCards.addStyleName("image-select-target-area"); }
From source file:edu.caltech.ipac.firefly.ui.NaifTargetPanel.java
private void init() { helpWidget = getHelp();/*from www . j ava 2 s. c o m*/ // FieldDef fd= FieldDefCreator.makeFieldDef(NAIF_NAME_KEY); StringFieldDef fd = new NaifFieldDef(); FieldDefSource fds = new WebPropFieldDefSource(NAIF_NAME_KEY); FieldDefCreator.setStringFieldAttributes(fd, fds); // fd.setErrMsg("You must choose a name and ID pair"); // fd.setMaxWidth(0); // fd.setPreferWidth(0); // fd.setName("NaifTargetPanel.field.naifName"); // fd.setLabel("Object Name or ID"); // fd.setShortDesc("Enter the NAIF name or ID to look up"); naifField = new NaifInputField(fd, new NaifOracle()); posWrap = new SimpleInputField(naifField, true); addChangeListeners(); feedback.setSize("400px", "3em"); HorizontalPanel top = new HorizontalPanel(); top.add(posWrap); top.setSpacing(1); mainPanel = new VerticalPanel(); mainPanel.add(top); mainPanel.add(feedback); mainPanel.setCellVerticalAlignment(top, VerticalPanel.ALIGN_MIDDLE); mainPanel.setCellVerticalAlignment(feedback, VerticalPanel.ALIGN_TOP); updateFeedback(); }
From source file:edu.caltech.ipac.firefly.ui.NaifTargetPanel.java
private Widget getHelp() { HorizontalPanel hp = new HorizontalPanel(); VerticalPanel vp = new VerticalPanel(); hp.setSpacing(5); // vp.setSpacing(5); hp.add(new HTML("<i>Examples:</i>")); hp.add(vp);// w w w. ja va 2s .c o m vp.add(new HTML("\'pallas\' \'2008 yn2\' \'2024703\'")); // vp.add(new HTML("")); return GwtUtil.centerAlign(hp); }
From source file:edu.caltech.ipac.firefly.ui.searchui.LoadCatalogFromVOSearchUI.java
public Widget createLoadCatalogsContent() { keywordsFld = SimpleInputField.createByProp(_prop.makeBase("keywords")); /*/*from w w w .j a v a2 s . co m*/ KeyDownHandler keywordsHandler = new KeyDownHandler() { public void onKeyDown(KeyDownEvent ev) { int c = ev.getNativeKeyCode(); if (c == KeyCodes.KEY_TAB || c == KeyCodes.KEY_ENTER) { accessUrl.getField().getFocusWidget().setFocus(true); queryRegistryAsync(); } } }; keywordsFld.getField().getFocusWidget().addKeyDownHandler(keywordsHandler); */ final Widget registrySearchBtn = GwtUtil.makeFormButton("Search Registry", new ClickHandler() { @Override public void onClick(ClickEvent event) { queryRegistryAsync(); } }); GwtUtil.setStyle(registrySearchBtn, "fontSize", "9pt"); final Widget keywordsResetBtn = GwtUtil.makeFormButton("Clear", new ClickHandler() { @Override public void onClick(ClickEvent event) { clearKeywordSearchResults(); keywordsFld.getField().getFocusWidget().setFocus(true); } }); GwtUtil.setStyle(keywordsResetBtn, "fontSize", "9pt"); //Widget keywordsFldContainer = GwtUtil.leftRightAlign(new Widget[]{keywordsFld}, new Widget[]{keywordsResetBtn}); HorizontalPanel keywordsFldContainer = new HorizontalPanel(); keywordsFldContainer.setSpacing(3); keywordsFldContainer.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE); keywordsFldContainer.add(keywordsFld); keywordsFldContainer.add(registrySearchBtn); keywordsFldContainer.add(keywordsResetBtn); keywordQueryResults = new FlowPanel(); GwtUtil.setStyles(keywordQueryResults, "display", "inline-block", "minWidth", "600px", "minHeight", "50px", "maxHeight", "120px", "overflow", "auto", "verticalAlign", "top"); //keywordQueryResults.add(new HTML(KEYWORDS_HELP)); GwtUtil.setStyles(keywordQueryResults, "border", "1px solid lightgray", "background", "#F9F9F9", "padding", "5px", "margin", "5px"); accessUrl = SimpleInputField.createByProp(_prop.makeBase("accessUrl")); //GwtUtil.setStyles(accessUrl, // "paddingTop", "3px"); targetPanel = new SimpleTargetPanel(); cone = new SpacialBehaviorPanel.Cone(); Widget coneSearchPanel = cone.makePanel(); GwtUtil.setStyles(coneSearchPanel, "display", "inline-block", "verticalAlign", "top", "padding", "5px 0 10px 40px"); coneOps = new SpatialOps.Cone(cone.getField(), cone); FlowPanel container = new FlowPanel(); container.add(targetPanel); container.add(coneSearchPanel); GwtUtil.setStyles(container, "border", "4px solid lightgray", "background", "white", "padding", "5px"); VerticalPanel resourceIdContainer = new VerticalPanel(); resourceIdContainer.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); HTML titlehelp = new HTML(KEYWORDS_HELP); titlehelp.setHeight("15px"); resourceIdContainer.add(titlehelp); resourceIdContainer.add(keywordsFldContainer); resourceIdContainer.add(keywordQueryResults); resourceIdContainer.add(accessUrl); GwtUtil.setStyles(resourceIdContainer, "border", "4px solid lightgray", "background", "white", "padding", "5px"); FlexTable grid = new FlexTable(); grid.setCellSpacing(5); grid.setWidget(0, 0, container); //grid.setWidget(1, 0, new HTML(" ")); grid.setWidget(1, 0, resourceIdContainer); GwtUtil.setStyles(grid, "padding", "5px"); updateActiveTarget(); return grid; }
From source file:edu.caltech.ipac.firefly.ui.SimpleTargetPanel.java
private void init(String resolvers[]) { helpWidget = getHelp();/*from w w w .j a v a2 s . co m*/ SimpleInputField posWrap = SimpleInputField.createByProp(POSITION_KEY); posField = posWrap.getField(); posFd = (PositionFieldDef) posField.getFieldDef(); Resolver r; for (String rStr : resolvers) { r = Resolver.parse(rStr); if (r != Resolver.NONE) _supportedResolvers.add(r); } if (_supportedResolvers.size() == 0) { _supportedResolvers.add(Resolver.NED); _supportedResolvers.add(Resolver.Simbad); } resolveByField = createResolverField(_supportedResolvers); // resolveByField = FormBuilder.createField(RESOLVED_BY_KEY); String resolveByPref = Preferences.get(RESOLVE_BY_PREF); if (!StringUtils.isEmpty(resolveByPref)) { Resolver def = parseResolver(resolveByPref); if (def != Resolver.NONE) setResolver(def); } addChangeListeners(); feedback.setSize("400px", "3em"); // feedback.setWidth("400px"); GwtUtil.setStyle(resolveByField, "marginTop", "6px "); HorizontalPanel top = new HorizontalPanel(); top.add(posWrap); top.add(resolveByField); top.setSpacing(1); mainPanel = new VerticalPanel(); mainPanel.add(top); mainPanel.add(feedback); mainPanel.setCellVerticalAlignment(top, VerticalPanel.ALIGN_MIDDLE); mainPanel.setCellVerticalAlignment(feedback, VerticalPanel.ALIGN_TOP); updateFeedback(); }