List of usage examples for com.google.gwt.user.client.ui HorizontalPanel setSpacing
public void setSpacing(int spacing)
From source file:edu.caltech.ipac.firefly.ui.SimpleTargetPanel.java
private Widget getHelp() { HorizontalPanel hp = new HorizontalPanel(); GwtUtil.setStyle(hp, "fontSize", "13px"); VerticalPanel vp = new VerticalPanel(); hp.setSpacing(5); // vp.setSpacing(5); hp.add(new HTML("<i>Examples:</i>")); hp.add(vp);/*w w w .java 2s . co m*/ vp.add(new HTML("\'m81\' \'ngc 13\' \'12.34 34.89\'" + " \'46.53, -0.251 gal\'")); // vp.add(new HTML("")); HTML line2 = new HTML("\'19h17m32s 11d58m02s equ j2000\' \'12.3, 8.5 b1950\'"); GwtUtil.setStyle(line2, "paddingTop", "4px"); vp.add(line2); return GwtUtil.centerAlign(hp); }
From source file:edu.caltech.ipac.firefly.visualize.FloatingStatusBar.java
public FloatingStatusBar(PlotWidgetGroup group, Widget alignWidget) { this.group = group; IconCreator _ic = IconCreator.Creator.getInstance(); HorizontalPanel panel = new HorizontalPanel(); popup = new PopupPane("", panel, PopupType.LOW_PROFILE, false, false, false, PopupPane.HeaderType.NONE); updateAlignWidget(alignWidget);// w ww. j a v a 2 s. c om popup.setDoRegionChangeHide(false); panel.setSpacing(3); panel.add(status); WebEventManager.getAppEvManager().addListener(Name.DROPDOWN_CLOSE, new WebEventListener() { public void eventNotify(WebEvent ev) { DeferredCommand.add(new Command() { public void execute() { dropClosed = true; if (showing) popup.show(); } }); } }); WebEventManager.getAppEvManager().addListener(Name.DROPDOWN_OPEN, new WebEventListener() { public void eventNotify(WebEvent ev) { DeferredCommand.add(new Command() { public void execute() { dropClosed = false; if (showing) popup.hide(); } }); } }); }
From source file:edu.caltech.ipac.firefly.visualize.graph.XYPlotBasicWidget.java
protected Widget getMenuBar() { FlowPanel menuBar = new FlowPanel(); //GwtUtil.setStyle(menuBar, "borderBottom", "1px solid #bbbbbb"); menuBar.setWidth("100%"); HorizontalPanel left = new HorizontalPanel(); left.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE); left.setSpacing(10); GwtUtil.setStyle(left, "align", "left"); HorizontalPanel right = new HorizontalPanel(); right.setSpacing(10);/*from ww w . j av a2 s . co m*/ GwtUtil.setStyle(right, "align", "center"); GwtUtil.setStyle(right, "paddingRight", "20px"); VisIconCreator ic = VisIconCreator.Creator.getInstance(); right.add(GwtUtil.makeImageButton(new Image(ic.getZoomOriginalSmall()), "Zoom out to original chart", new ClickHandler() { public void onClick(ClickEvent clickEvent) { if (_data != null) { _savedZoomSelection = null; _actionHelp.setHTML(ZOOM_IN_HELP); if (XYPlotData.shouldSample(_dataSet.getSize())) { _meta.userMeta.setXLimits(null); _meta.userMeta.setYLimits(null); updateMeta(_meta, false); } else { setChartAxes(); _chart.update(); } } } })); left.add(GwtUtil.makeImageButton(new Image(ic.getSettings()), "Plot options and tools", new ClickHandler() { public void onClick(ClickEvent clickEvent) { showOptions(); } })); left.add(_chartTitle); menuBar.add(GwtUtil.leftRightAlign(new Widget[] { left }, new Widget[] { right })); return menuBar; }
From source file:edu.caltech.ipac.firefly.visualize.graph.XYPlotWidget.java
@Override protected Widget getMenuBar() { FlowPanel menuBar = new FlowPanel(); //GwtUtil.setStyle(menuBar, "borderBottom", "1px solid #bbbbbb"); menuBar.setWidth("100%"); HorizontalPanel left = new HorizontalPanel(); left.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE); left.setSpacing(10); GwtUtil.setStyle(left, "align", "left"); HorizontalPanel rightBtnsPanel;//from w ww . ja v a 2s. c o m rightBtnsPanel = new HorizontalPanel(); rightBtnsPanel.setSpacing(10); GwtUtil.setStyle(rightBtnsPanel, "align", "center"); GwtUtil.setStyle(rightBtnsPanel, "paddingRight", "20px"); VisIconCreator ic = VisIconCreator.Creator.getInstance(); left.add(GwtUtil.makeImageButton(new Image(ic.getSettings()), "Plot options and tools", new ClickHandler() { public void onClick(ClickEvent clickEvent) { showOptions(); } })); Widget saveBtn = GwtUtil.makeImageButton(new Image(TableImages.Creator.getInstance().getSaveImage()), "Download data in IPAC table format", new ClickHandler() { public void onClick(ClickEvent clickEvent) { Frame f = Application.getInstance().getNullFrame(); String url; if (_sourceFile.contains("://")) { url = _sourceFile; } else { Param[] params = new Param[2]; //if (_suggestedName != null) { // params = new Param[3]; // params[2] = new Param("return", _suggestedName); //} else { // params = new Param[2]; //} params[0] = new Param("file", _sourceFile); params[1] = new Param("log", "true"); url = WebUtil.encodeUrl(GWT.getModuleBaseURL() + "servlet/Download", params); } f.setUrl(url); } }); if (plotMode.equals(PlotMode.TABLE_VIEW)) { // no save button in table view mode - user should use "Save" button on table // left.add(saveBtn); _filters = new FilterToggle(this); left.add(_filters); left.add(_loading); _loading.setVisible(false); zoomToggle = new DeckPanel(); zoomToggle.setVisible(false); zoomToggle.add(GwtUtil.makeImageButton(new Image(ic.getZoomUpSmall()), "Zoom in the enclosed points", new ClickHandler() { public void onClick(ClickEvent clickEvent) { if (_data != null) { if (_currentSelection != null) { _selectionCurve.setVisible(false); int numPoints = _data.getNPoints(_currentSelection.xMinMax, _currentSelection.yMinMax); if (numPoints < 1) { _currentSelection = null; updateOnSelectionBtns(); return; } _savedZoomSelection = new Selection(_currentSelection.xMinMax, _currentSelection.yMinMax); updateOnSelectionBtns(); if (_data.isSampled()) { _meta.userMeta.setXLimits(_currentSelection.xMinMax); _meta.userMeta.setYLimits(_currentSelection.yMinMax); updateMeta(_meta, true); } else { setChartAxesForSelection(_currentSelection.xMinMax, _currentSelection.yMinMax); // clear previous limits, if any _meta.userMeta.setXLimits(null); _meta.userMeta.setYLimits(null); } _chart.update(); } } } })); zoomToggle.add(GwtUtil.makeImageButton(new Image(ic.getZoomOriginalSmall()), "Zoom out to original chart", new ClickHandler() { public void onClick(ClickEvent clickEvent) { if (_data != null) { _savedZoomSelection = null; if (XYPlotData.shouldSample(_dataSet.getSize()) || _tableModel.getTotalRows() >= MIN_ROWS_FOR_DECIMATION) { _meta.userMeta.setXLimits(null); _meta.userMeta.setYLimits(null); updateMeta(_meta, false); } else { setChartAxes(); } updateOnSelectionBtns(); _chart.update(); } } })); zoomToggle.showWidget(1); rightBtnsPanel.add(zoomToggle); selectToggle = new DeckPanel(); selectToggle.setVisible(false); selectToggle.add(GwtUtil.makeImageButton(new Image(ic.getSelectRows()), "Select enclosed points", new ClickHandler() { public void onClick(ClickEvent clickEvent) { if (_currentSelection != null) { _selectionCurve.setVisible(false); setSelected(_currentSelection.xMinMax, _currentSelection.yMinMax); updateOnSelectionBtns(); } } })); selectToggle.add(GwtUtil.makeImageButton(new Image(ic.getUnselectRows()), "Unselect all selected points", new ClickHandler() { public void onClick(ClickEvent clickEvent) { if (_data != null) { if (_selectedPoints != null) { _selectedPoints.clearPoints(); _selectedPoints.setCurveData(null); } if (_tableModel.getCurrentData() != null) { _suspendEvents = true; _tableModel.getCurrentData().deselectAll(); _suspendEvents = false; } updateOnSelectionBtns(); _chart.update(); } } })); selectToggle.showWidget(0); rightBtnsPanel.add(selectToggle); _filterSelectedLink = GwtUtil.makeImageButton(new Image(ic.getFilterIn()), "Filter in the selected points", new ClickHandler() { public void onClick(ClickEvent clickEvent) { if (_currentSelection != null) { _selectionCurve.setVisible(false); setSelected(_currentSelection.xMinMax, _currentSelection.yMinMax); filterSelected(); updateOnSelectionBtns(); } } }); _filterSelectedLink.setVisible(false); rightBtnsPanel.add(_filterSelectedLink); } else { // no selection or filter options left.add(_loading); _loading.setVisible(false); rightBtnsPanel.add(saveBtn); rightBtnsPanel.add(GwtUtil.makeImageButton(new Image(ic.getZoomOriginalSmall()), "Zoom out to original chart", new ClickHandler() { public void onClick(ClickEvent clickEvent) { if (_data != null) { _savedZoomSelection = null; setChartAxes(); _chart.update(); _actionHelp.setHTML(ZOOM_IN_HELP); } } })); } left.add(_chartTitle); rightBtnsPanel.add(super.getPopoutToolbar()); enableExpansionToolbarHiding(); menuBar.add(GwtUtil.leftRightAlign(new Widget[] { left }, new Widget[] { rightBtnsPanel })); return menuBar; }
From source file:edu.caltech.ipac.firefly.visualize.ui.ImageSelectPanel.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); }/*from w ww. java 2 s .com*/ }); hp.add(_targetDesc); hp.setSpacing(5); hp.add(modTarget); updateTargetDesc(); _targetPanelHolder.setWidget(_targetPanel); _targetCards.add(_targetPanelHolder); _targetCards.add(hp); _targetCards.add(hideTargetLabel); setTargetCard(TARGET_DESC); _targetCards.addStyleName("image-select-target-area"); }
From source file:edu.caltech.ipac.firefly.visualize.WebMouseReadout.java
public WebMouseReadout(boolean wide) { super();// w w w. java 2 s . c o m this.wide = wide; HorizontalPanel hp = new HorizontalPanel(); _popupPanel = new PopupPane(null, hp, PopupType.STANDARD, false, false, false, PopupPane.HeaderType.NONE); _popupPanel.alignTo(null, PopupPane.Align.DISABLE); _popupPanel.setRolldownAnimation(true); _popupPanel.setAnimateDown(true); _popupPanel.setAnimationEnabled(true); _lockIcon = new Image(VisIconCreator.Creator.getInstance().getLocked()); _unlockIcon = new Image(VisIconCreator.Creator.getInstance().getUnlocked()); hp.addDomHandler(new TouchStartHandler() { public void onTouchStart(TouchStartEvent event) { lockDialogOnce(); } }, TouchStartEvent.getType()); _lockButton = GwtUtil.makeImageButton(_unlockIcon, "Lock readout area to stay showing", new ClickHandler() { public void onClick(ClickEvent event) { if (_dialogLockedUp) unlockDialog(); else lockDialog(); } }); _lockButton.setSize("20px", "20px"); _lockMouCheckBox.setTitle("Click on an image to lock the display at that point."); _lockMouCheckBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() { public void onValueChange(ValueChangeEvent<Boolean> lock) { setClickLock(lock.getValue()); } }); VerticalPanel fixedDisplay = new VerticalPanel(); fixedDisplay.setSpacing(2); GwtUtil.setStyle(titleLabel, "whiteSpace", "nowrap"); VerticalPanel wideControlArea = null; addMouseHandlers(_popupPanel.getPopupPanel(), true); addMouseHandlers(hp, true); addMouseHandlers(_grid, true); addMouseHandlers(gridWide, true); addMouseHandlers(fixedDisplay, true); if (wide) { wideControlArea = new VerticalPanel(); wideControlArea.add(_lockButton); wideControlArea.add(titleLabel); GwtUtil.setStyles(titleLabel, "padding", "13px 0 10px 0", "width", "160px"); if (!BrowserUtil.isTouchInput()) { wideControlArea.add(_lockMouCheckBox); GwtUtil.setStyles(_lockMouCheckBox, "paddingTop", "15px"); } fixedDisplay.add(_filePix); fixedDisplay.add(_screenPix); fixedDisplay.add(_zoomLevel); GwtUtil.setStyles(fixedDisplay, "width", "100px"); } else { fixedDisplay.add(_lockButton); fixedDisplay.add(_filePix); fixedDisplay.add(_screenPix); fixedDisplay.add(_zoomLevel); if (!BrowserUtil.isTouchInput()) fixedDisplay.add(_lockMouCheckBox); GwtUtil.setStyles(_lockMouCheckBox, "paddingRight", "10px"); } if (wide) { GwtUtil.setStyles(_filePix, "marginTop", "3px", "paddingLeft", "1px", "fontSize", "10px", "textAlign", "left"); GwtUtil.setStyles(_screenPix, "padding", "1px 12px 0px 1px", "fontSize", "10px", "textAlign", "left"); GwtUtil.setStyles(_zoomLevel, "padding", "12px 0 3px 0", "textAlign", "center", "color", "green", "fontSize", "9pt"); } else { GwtUtil.setStyles(_filePix, "marginTop", "-7px", "fontSize", "10px", "textAlign", "center"); GwtUtil.setStyles(_screenPix, "paddingTop", "5px", "fontSize", "10px", "textAlign", "center"); GwtUtil.setStyles(_zoomLevel, "padding", "2px 0 3px 0", "textAlign", "center", "color", "green", "fontSize", "9pt"); } _lockMouCheckBox.addStyleName("lock-click"); _filePix.addStyleName("title-font-family"); _screenPix.addStyleName("title-font-family"); _zoomLevel.addStyleName("title-font-family"); GwtUtil.setStyles(_grid, "lineHeight", "1", "marginLeft", "-8px"); if (wide) { GwtUtil.setStyles(gridWide, "lineHeight", "1"); } VerticalPanel imagePanel = new VerticalPanel(); if (wide) hp.add(wideControlArea); hp.add(fixedDisplay); hp.add(_grid); hp.add(imagePanel); HorizontalPanel decPanel = new HorizontalPanel(); decPanel.add(_thumbDeck); decPanel.setSpacing(2); decPanel.add(_magDeck); imagePanel.add(decPanel); if (wide) { hp.add(gridWide); } else { arrowDesc.addStyleName("title-font-family"); GwtUtil.setStyles(arrowDesc, "fontSize", "10px", "padding", "0 0 0 35px"); imagePanel.add(arrowDesc); } GwtUtil.setStyle(_magDeck, "paddingLeft", "5px"); if (wide) { _magDeck.setSize("70px", "70px"); } else { _magDeck.setSize("100px", "100px"); } WebEventManager.getAppEvManager().addListener(Name.REGION_CHANGE, new WebEventListener() { public void eventNotify(WebEvent ev) { hideMouseReadout(); } }); Window.addResizeHandler(new ResizeHandler() { public void onResize(ResizeEvent event) { if (BrowserUtil.isTouchInput()) hideMouseReadout(); // tablet resizing only } }); }
From source file:edu.colorado.csdms.wmt.client.ui.dialog.SaveDialogBox.java
License:Open Source License
/** * Makes a SaveDialogBox with a user-supplied name. * /*from w w w .j a v a2 s .c om*/ * @param data the DataManager object for the WMT session * @param modelName a descriptive name for the model */ public SaveDialogBox(DataManager data, String modelName) { super(false); // autohide this.setModal(true); this.setText("Save Model As..."); this.setStyleName("wmt-DialogBox"); this.data = data; namePanel = new FieldPanel(modelName); final Button labelsButton = new Button(Constants.FA_TAGS + "Labels"); labelsButton.setStyleName("wmt-Button"); labelsMenu = new LabelsSaveModelMenu(data); labelsButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { labelsMenu.setPopupPositionAndShow(new PositionCallback() { final Integer x = labelsButton.getElement().getAbsoluteRight(); final Integer y = labelsButton.getAbsoluteTop(); @Override public void setPosition(int offsetWidth, int offsetHeight) { labelsMenu.setPopupPosition(x, y); } }); } }); HorizontalPanel row = new HorizontalPanel(); row.setSpacing(5); // px row.add(namePanel); row.add(labelsButton); row.setCellVerticalAlignment(labelsButton, HasVerticalAlignment.ALIGN_MIDDLE); choicePanel = new ChoicePanel(); choicePanel.getOkButton().setHTML(Constants.FA_SAVE + "Save"); VerticalPanel contents = new VerticalPanel(); contents.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); contents.add(row); contents.add(choicePanel); this.setWidget(contents); }
From source file:edu.colorado.csdms.wmt.client.ui.panel.ChoicePanel.java
License:Open Source License
/** * Makes a new ChoicePanel with the default "OK" and "Cancel" buttons. *///from w w w .j a v a 2s . c o m public ChoicePanel() { okButton = new Button(Constants.FA_OK + "OK"); cancelButton = new Button(Constants.FA_CANCEL + "Cancel"); HorizontalPanel buttonPanel = new HorizontalPanel(); buttonPanel.setSpacing(5); // px buttonPanel.add(okButton); buttonPanel.add(cancelButton); HorizontalPanel choicePanel = new HorizontalPanel(); choicePanel.setWidth("100%"); choicePanel.add(buttonPanel); VerticalPanel contents = new VerticalPanel(); contents.add(choicePanel); okButton.setStyleName("wmt-Button"); cancelButton.setStyleName("wmt-Button"); okButton.getElement().getStyle().setMarginRight(3, Unit.PX); initWidget(contents); }
From source file:edu.colorado.csdms.wmt.client.ui.panel.DroplistPanel.java
License:Open Source License
/** * Defines a DroplistPanel populated with a set of input items. * /* ww w.j av a2s . com*/ * @param items a String[] of items to display in the droplist */ public DroplistPanel(String[] items) { dropLabel = new Label("Available models:"); droplist = new ListBox(false); // multiselect off if (items != null) { for (int i = 0; i < items.length; i++) { droplist.addItem(items[i]); } } droplist.setVisibleItemCount(1); // show 1 item = a droplist // Styles! droplist.setStyleName("wmt-DroplistBox"); dropLabel.setStyleName("wmt-Label"); dropLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); HorizontalPanel contents = new HorizontalPanel(); contents.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); contents.setSpacing(5); // px contents.add(dropLabel); contents.add(droplist); initWidget(contents); }
From source file:edu.colorado.csdms.wmt.client.ui.panel.FieldPanel.java
License:Open Source License
/** * Defines a FieldPanel with user-supplied text displayed in the field, * optionally obscured.//www . j a v a 2 s . c om * * @param text the String to display in the field * @param secure set to true to obscure text */ public FieldPanel(String text, Boolean secure) { fieldLabel = new Label("Name:"); fieldBox = secure ? new PasswordTextBox() : new TextBox(); fieldBox.setText(text); // Styles! fieldBox.setStyleName("wmt-TextBoxen"); fieldLabel.setStyleName("wmt-Label"); fieldLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); HorizontalPanel contents = new HorizontalPanel(); contents.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); contents.setSpacing(5); // px contents.add(fieldLabel); contents.add(fieldBox); initWidget(contents); }