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:edu.caltech.ipac.firefly.visualize.graph.XYPlotOptionsPanel.java
private void layout(final XYPlotData data) { // Plot Error plotError = GwtUtil.makeCheckBox("XYPlotOptionsDialog.plotError"); plotError.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { if (plotError.getValue() && !plotError.isEnabled()) { // should not happen } else { XYPlotMeta meta = _xyPlotWidget.getPlotMeta(); meta.setPlotError(plotError.getValue()); _xyPlotWidget.updateMeta(meta, true); // preserve zoom }// ww w.ja v a2 s .c o m } }); // Plot Specific Points plotSpecificPoints = GwtUtil.makeCheckBox("XYPlotOptionsDialog.plotSpecificPoints"); plotSpecificPoints.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { if (plotSpecificPoints.getValue() && !plotSpecificPoints.isEnabled()) { //should not happen } else { XYPlotMeta meta = _xyPlotWidget.getPlotMeta(); meta.setPlotSpecificPoints(plotSpecificPoints.getValue()); _xyPlotWidget.updateMeta(meta, true); // preserve zoom } } }); // Alternative Columns HTML colPanelDesc = GwtUtil.makeFaddedHelp( "For X and Y, enter a column or an expression<br>" + "ex. log(col); 100*col1/col2; col1-col2"); ColExpressionOracle oracle = new ColExpressionOracle(); FieldDef xColFD = FieldDefCreator.makeFieldDef("XYPlotOptionsDialog.x.col"); xColFld = new ValidationInputField(new SuggestBoxInputField(xColFD, oracle)); FieldDef yColFD = FieldDefCreator.makeFieldDef("XYPlotOptionsDialog.y.col"); yColFld = new ValidationInputField(new SuggestBoxInputField(yColFD, oracle)); // column selection Widget xColSelection = GwtUtil.makeLinkButton("Cols", "Select X column", new ClickHandler() { public void onClick(ClickEvent clickEvent) { if (xColDialog == null) xColDialog = new ShowColumnsDialog("Choose X", "Set X", _xyPlotWidget.getColumns(), xColFld); xColDialog.show(); //showChooseColumnPopup("Choose X", xColFld); } }); Widget yColSelection = GwtUtil.makeLinkButton("Cols", "Select Y column", new ClickHandler() { public void onClick(ClickEvent clickEvent) { if (yColDialog == null) yColDialog = new ShowColumnsDialog("Choose Y", "Set Y", _xyPlotWidget.getColumns(), yColFld); yColDialog.show(); //showChooseColumnPopup("Choose Y", yColFld); } }); FormBuilder.Config config = new FormBuilder.Config(FormBuilder.Config.Direction.VERTICAL, 50, 0, HorizontalPanel.ALIGN_LEFT); xNameFld = FormBuilder.createField("XYPlotOptionsDialog.x.name"); xUnitFld = FormBuilder.createField("XYPlotOptionsDialog.x.unit"); Widget xNameUnit = FormBuilder.createPanel(config, xNameFld, xUnitFld); CollapsiblePanel xNameUnitCP = new CollapsiblePanel("X Label/Unit", xNameUnit, false); yNameFld = FormBuilder.createField("XYPlotOptionsDialog.y.name"); yUnitFld = FormBuilder.createField("XYPlotOptionsDialog.y.unit"); Widget yNameUnit = FormBuilder.createPanel(config, yNameFld, yUnitFld); CollapsiblePanel yNameUnitCP = new CollapsiblePanel("Y Label/Unit", yNameUnit, false); FlexTable colPanel = new FlexTable(); DOM.setStyleAttribute(colPanel.getElement(), "padding", "5px"); colPanel.setCellSpacing(8); colPanel.setHTML(0, 0, "X: "); colPanel.setWidget(0, 1, xColFld); colPanel.setWidget(0, 2, xColSelection); xLogScale = GwtUtil.makeCheckBox("XYPlotOptionsDialog.xLogScale"); xLogScale.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { if (!suspendEvents) { if (xLogScale.getValue() && !xLogScale.isEnabled()) { // should not happen } else { XYPlotMeta meta = _xyPlotWidget.getPlotMeta(); meta.setXScale(xLogScale.getValue() ? XYPlotMeta.LOG_SCALE : XYPlotMeta.LINEAR_SCALE); _xyPlotWidget.updateMeta(meta, true); // preserve zoom } } } }); colPanel.setWidget(0, 3, xLogScale); colPanel.setWidget(1, 1, xNameUnitCP); colPanel.setHTML(2, 0, "Y: "); colPanel.setWidget(2, 1, yColFld); colPanel.setWidget(2, 2, yColSelection); colPanel.setWidget(3, 1, yNameUnitCP); yLogScale = GwtUtil.makeCheckBox("XYPlotOptionsDialog.yLogScale"); yLogScale.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { if (!suspendEvents) { if (yLogScale.getValue() && !yLogScale.isEnabled()) { // should not happen } else { XYPlotMeta meta = _xyPlotWidget.getPlotMeta(); meta.setYScale(yLogScale.getValue() ? XYPlotMeta.LOG_SCALE : XYPlotMeta.LINEAR_SCALE); _xyPlotWidget.updateMeta(meta, true); // preserve zoom } } } }); colPanel.setWidget(2, 3, yLogScale); // Plot Style plotStyle = SimpleInputField.createByProp("XYPlotOptionsDialog.plotStyle"); plotStyle.getField().addValueChangeHandler(new ValueChangeHandler<String>() { public void onValueChange(ValueChangeEvent<String> ev) { if (!suspendEvents) { String value = plotStyle.getValue(); if (value != null) { XYPlotMeta meta = _xyPlotWidget.getPlotMeta(); meta.setPlotStyle(XYPlotMeta.PlotStyle.getPlotStyle(value)); _xyPlotWidget.updateMeta(meta, true); // preserve zoom } } } }); // Gridlines plotGrid = GwtUtil.makeCheckBox("XYPlotOptionsDialog.grid"); plotGrid.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { if (!suspendEvents) { XYPlotMeta meta = _xyPlotWidget.getPlotMeta(); meta.setNoGrid(!plotGrid.getValue()); _xyPlotWidget.setGridlines(); } } }); // Y MIN and MAX xMinMaxPanelDesc = GwtUtil .makeFaddedHelp(getXMinMaxDescHTML(data == null ? null : data.getXDatasetMinMax())); yMinMaxPanelDesc = GwtUtil .makeFaddedHelp(getYMinMaxDescHTML(data == null ? null : data.getYDatasetMinMax())); FormBuilder.Config cX = new FormBuilder.Config(FormBuilder.Config.Direction.HORIZONTAL, 50, 5, HorizontalPanel.ALIGN_LEFT); xMinMaxPanel = new MinMaxPanel("XYPlotOptionsDialog.x.min", "XYPlotOptionsDialog.x.max", cX); xColFld.addValueChangeHandler(new ValueChangeHandler<String>() { public void onValueChange(ValueChangeEvent<String> stringValueChangeEvent) { suspendEvents = true; // reset scale to linear xLogScale.setValue(false); //xLogScale.setEnabled(false); xNameFld.reset(); xUnitFld.reset(); // clear xMinMaxPanel xMinMaxPanel.getMinField().reset(); xMinMaxPanel.getMaxField().reset(); } }); FormBuilder.Config cY = new FormBuilder.Config(FormBuilder.Config.Direction.HORIZONTAL, 50, 5, HorizontalPanel.ALIGN_LEFT); yMinMaxPanel = new MinMaxPanel("XYPlotOptionsDialog.y.min", "XYPlotOptionsDialog.y.max", cY); yColFld.addValueChangeHandler(new ValueChangeHandler<String>() { public void onValueChange(ValueChangeEvent<String> stringValueChangeEvent) { suspendEvents = true; // reset scale to linear yLogScale.setValue(false); //yLogScale.setEnabled(false); yNameFld.reset(); yUnitFld.reset(); // clear xMinMaxPanel yMinMaxPanel.getMinField().reset(); yMinMaxPanel.getMaxField().reset(); } }); //maxPoints = SimpleInputField.createByProp("XYPlotOptionsDialog.maxPoints"); String bprop = _prop.makeBase("apply"); String bname = WebProp.getName(bprop); String btip = WebProp.getTip(bprop); Button apply = new Button(bname, new ClickHandler() { public void onClick(ClickEvent ev) { if (xMinMaxPanel.validate() && yMinMaxPanel.validate() && validateColumns() && validateDensityPlotParams() && xyRatioFld.validate()) { // current list of column names List<TableDataView.Column> columnLst = _xyPlotWidget.getColumns(); List<String> cols = new ArrayList<String>(columnLst.size()); for (TableDataView.Column c : columnLst) { cols.add(c.getName()); } XYPlotMeta meta = _xyPlotWidget.getPlotMeta(); meta.setXScale(xLogScale.getValue() ? XYPlotMeta.LOG_SCALE : XYPlotMeta.LINEAR_SCALE); meta.setYScale(yLogScale.getValue() ? XYPlotMeta.LOG_SCALE : XYPlotMeta.LINEAR_SCALE); meta.setPlotStyle(XYPlotMeta.PlotStyle.getPlotStyle(plotStyle.getValue())); meta.setNoGrid(!plotGrid.getValue()); meta.userMeta.setXLimits(getMinMaxValues(xMinMaxPanel)); meta.userMeta.setYLimits(getMinMaxValues(yMinMaxPanel)); // Columns if (xColExpr != null) { meta.userMeta.xColExpr = xColExpr; meta.userMeta.setXCol(null); } else { String xCol = xColFld.getValue(); if (StringUtils.isEmpty(xCol) || xCol.equals(meta.findDefaultXColName(cols))) { xCol = null; } meta.userMeta.setXCol(xCol); meta.userMeta.xColExpr = null; } if (yColExpr != null) { meta.userMeta.yColExpr = yColExpr; meta.userMeta.setYCol(null); nonDefaultYColumn(meta, true); } else { String yCol = yColFld.getValue(); String errorCol; boolean defaultYCol = yCol.equals(meta.findDefaultYColName(cols)); if (StringUtils.isEmpty(yCol) || defaultYCol) { yCol = null; errorCol = null; plotError.setEnabled(true); plotSpecificPoints.setEnabled(true); } else { nonDefaultYColumn(meta, false); errorCol = "_"; // no error column for non-default y column } meta.userMeta.setYCol(yCol); meta.userMeta.yColExpr = null; meta.userMeta.setErrorCol(errorCol); } if (!StringUtils.isEmpty(xNameFld.getValue())) { meta.userMeta.xName = xNameFld.getValue(); } else { meta.userMeta.xName = null; } if (!StringUtils.isEmpty(xUnitFld.getValue())) { meta.userMeta.xUnit = xUnitFld.getValue(); } else { meta.userMeta.xUnit = null; } if (!StringUtils.isEmpty(yNameFld.getValue())) { meta.userMeta.yName = yNameFld.getValue(); } else { meta.userMeta.yName = null; } if (!StringUtils.isEmpty(yUnitFld.getValue())) { meta.userMeta.yUnit = yUnitFld.getValue(); } else { meta.userMeta.yUnit = null; } // aspect ratio fields meta.userMeta.stretchToFill = stretchFld.getValue().equals("fill"); if (StringUtils.isEmpty(xyRatioFld.getValue())) { if (meta.userMeta.aspectRatio > 0) { meta.userMeta.aspectRatio = -1; } } else { meta.userMeta.aspectRatio = ((DoubleFieldDef) xyRatioFld.getFieldDef()) .getDoubleValue(xyRatioFld.getValue()); } // density plot parameters if (binning.getValue().equals("user")) { meta.userMeta.samplingXBins = Integer.parseInt(xBinsFld.getValue()); meta.userMeta.samplingYBins = Integer.parseInt(yBinsFld.getValue()); } else { meta.userMeta.samplingXBins = 0; meta.userMeta.samplingYBins = 0; } meta.userMeta.logShading = shading.getValue().equals("log"); //meta.setMaxPoints(Integer.parseInt(maxPoints.getValue())); try { _xyPlotWidget.updateMeta(meta, false); } catch (Exception e) { PopupUtil.showError("Update failed", e.getMessage()); } } } }); apply.setTitle(btip); Button cancel = new Button("Reset", new ClickHandler() { public void onClick(ClickEvent ev) { restoreDefault(); } }); cancel.setTitle("Restore default values"); VerticalPanel vbox = new VerticalPanel(); vbox.setSpacing(5); vbox.add(plotError); vbox.add(plotSpecificPoints); vbox.add(colPanelDesc); vbox.add(colPanel); HorizontalPanel hp = new HorizontalPanel(); hp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); hp.add(plotGrid); GwtUtil.setStyles(plotGrid, "paddingLeft", "15px", "paddingBottom", "5px"); hp.add(plotStyle); GwtUtil.setStyle(plotStyle, "paddingLeft", "20px"); vbox.add(hp); //vbox.add(plotStyle); //vbox.add(plotGrid); // aspect ratio FormBuilder.Config configAR = new FormBuilder.Config(FormBuilder.Config.Direction.VERTICAL, 70, 0, HorizontalPanel.ALIGN_LEFT); xyRatioFld = FormBuilder.createField("XYPlotOptionsDialog.xyratio"); stretchFld = FormBuilder.createField("XYPlotOptionsDialog.stretch"); stretchFld.addValueChangeHandler(new ValueChangeHandler() { @Override public void onValueChange(ValueChangeEvent event) { if (stretchFld.getValue().equals("fill") && StringUtils.isEmpty(xyRatioFld.getValue())) { xyRatioFld.setValue("1"); } } }); VerticalPanel arParams = new VerticalPanel(); DOM.setStyleAttribute(arParams.getElement(), "paddingLeft", "10px"); arParams.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER); arParams.setSpacing(5); arParams.add(GwtUtil.makeFaddedHelp("Fix display aspect ratio by setting the field below.<br>" + "Leave it blank to use all available space.")); arParams.add(FormBuilder.createPanel(configAR, xyRatioFld, stretchFld)); //Widget aspectRatioPanel = new CollapsiblePanel("Aspect Ratio", arParams, false); //vbox.add(aspectRatioPanel); // density plot parameters binning = FormBuilder.createField("XYPlotOptionsDialog.binning"); binning.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent event) { xBinsFld.reset(); yBinsFld.reset(); boolean enabled = binning.getValue().equals("user"); xBinsFld.getFocusWidget().setEnabled(enabled); yBinsFld.getFocusWidget().setEnabled(enabled); } }); shading = FormBuilder.createField("XYPlotOptionsDialog.shading"); xBinsFld = FormBuilder.createField("XYPlotOptionsDialog.x.bins"); yBinsFld = FormBuilder.createField("XYPlotOptionsDialog.y.bins"); boolean enabled = binning.getValue().equals("user"); xBinsFld.getFocusWidget().setEnabled(enabled); yBinsFld.getFocusWidget().setEnabled(enabled); VerticalPanel binningParams = new VerticalPanel(); FormBuilder.Config configDP1 = new FormBuilder.Config(FormBuilder.Config.Direction.VERTICAL, 50, 0, HorizontalPanel.ALIGN_LEFT); FormBuilder.Config configDP2 = new FormBuilder.Config(FormBuilder.Config.Direction.VERTICAL, 110, 0, HorizontalPanel.ALIGN_LEFT); binningParams.add(FormBuilder.createPanel(configDP1, binning)); binningParams.add(FormBuilder.createPanel(configDP2, xBinsFld, yBinsFld)); binningParams.add(FormBuilder.createPanel(configDP1, shading)); densityPlotPanel = new CollapsiblePanel("Binning Options", binningParams, false); vbox.add(densityPlotPanel); VerticalPanel vbox1 = new VerticalPanel(); vbox1.add(xMinMaxPanelDesc); vbox1.add(xMinMaxPanel); vbox1.add(yMinMaxPanelDesc); vbox1.add(yMinMaxPanel); vbox1.add(arParams); //if (_xyPlotWidget instanceof XYPlotWidget) { // tableInfo = GwtUtil.makeFaddedHelp(((XYPlotWidget)_xyPlotWidget).getTableInfo()); // vbox1.add(tableInfo); // vbox1.add(maxPoints); //} else { // vbox1.add(maxPoints); // maxPoints.setVisible(false); //} CollapsiblePanel cpanel = new CollapsiblePanel("More Options", vbox1, false); vbox.add(cpanel); //vbox.add(addToDefault); Widget buttons = GwtUtil.leftRightAlign(new Widget[] { cancel }, new Widget[] { apply, HelpManager.makeHelpIcon("visualization.chartoptions") }); buttons.addStyleName("base-dialog-buttons"); vbox.add(buttons); _mainPanel.setWidget(vbox); }
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 ww w. j a v a 2s . c o m * @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.DroplistPanel.java
License:Open Source License
/** * Defines a DroplistPanel populated with a set of input items. * /*from w w w . j a v a 2s . c o m*/ * @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.// w w w . jav a 2s . c o m * * @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); }
From source file:edu.du.penrose.systems.fedoraApp.web.gwt.batchIngest.client.BatchIngestStatus.java
License:Open Source License
protected Panel getIngestCompletePanel(String batch_set) { final String myBatch_set = batch_set; final Button viewIngestReportBtn = new Button("View Ingest Report"); // TBD magic# final Button viewPidReportBtn = new Button("View PID Report"); final Button enableNewBatchBtn = new Button("Enable New Batch"); viewIngestReportBtn.addClickListener(new ClickListener() { public void onClick(Widget sender) { displayStatusBar("Opening Batch Ingest Report"); Window.open(CONTEXT_URL + "batchIngestReport.htm?" + BATCH_SET_REQUEST_PARAM + "=" + myBatch_set, "_blank", null); }//w ww . j a v a 2 s . c o m }); viewPidReportBtn.addClickListener(new ClickListener() { public void onClick(Widget sender) { displayStatusBar("Opening Batch PID Report"); Window.open(CONTEXT_URL + "batchIngestPidReport.htm?" + BATCH_SET_REQUEST_PARAM + "=" + myBatch_set, "_blank", null); } }); enableNewBatchBtn.addClickListener(new ClickListener() { public void onClick(Widget sender) { displayStatusBar("Enabling new Batch Ingest for " + myBatch_set); enableNewBatch(myBatch_set); } }); VerticalPanel statusBtnPanel = new VerticalPanel(); statusBtnPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); statusBtnPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); statusBtnPanel.add(viewIngestReportBtn); statusBtnPanel.add(viewPidReportBtn); statusBtnPanel.add(new HTML("<br>")); /* * Normally we don't want to display the enable new batch button for remote or background tasks, since they will be re-enabled * automatically UNLESS they were stopped by the user, in which case the user has to re-enable them. */ if (!(myBatch_set.contains(REMOTE_TASK_NAME_SUFFIX) || myBatch_set.contains(BACKGROUND_TASK_NAME_SUFFIX))) { statusBtnPanel.add(enableNewBatchBtn); } else { if (userStopptedStatus) { statusBtnPanel.add(enableNewBatchBtn); } } statusBtnPanel.setStyleName("statusBtnPanel"); return statusBtnPanel; }
From source file:edu.du.penrose.systems.fedoraApp.web.gwt.batchIngest.client.BatchIngestStatus.java
License:Open Source License
protected Panel getIngestRunningPanel(String batch_set) { final Button stopIngestBtn = new Button("Stop Ingest"); // TBD magic# final String myBatch_set = batch_set; stopIngestBtn.addClickListener(new ClickListener() { public void onClick(Widget sender) { DateTimeFormat dateFormat = DateTimeFormat.getFormat(timeHourMinuteFormat); Date startTime = new Date(); String stopString = dateFormat.format(startTime).toLowerCase(); appendToStatusBox("Stopping Batch Ingest: " + stopString); stopBatchIngest(myBatch_set); }// ww w .ja v a2s . com }); VerticalPanel statusBtnPanel = new VerticalPanel(); statusBtnPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); statusBtnPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); statusBtnPanel.add(stopIngestBtn); statusBtnPanel.setStyleName("statusBtnPanel"); return statusBtnPanel; }
From source file:edu.du.penrose.systems.fedoraApp.web.gwt.batchIngest.client.BatchIngestStatus.java
License:Open Source License
protected Panel getTryingToStopPanel(String batch_set) { final Button forceStopIngestBtn = new Button("FORCE STOP"); // TBD magic# final String myBatch_set = batch_set; forceStopIngestBtn.addClickListener(new ClickListener() { public void onClick(Widget sender) { DateTimeFormat dateFormat = DateTimeFormat.getFormat(timeHourMinuteFormat); Date startTime = new Date(); String haltString = dateFormat.format(startTime).toLowerCase(); appendToStatusBox("Forcing Batch Ingest STOP!: " + haltString); forceImediateStopOfBatchIngest(myBatch_set); }//from ww w . j a v a 2 s. c om }); VerticalPanel statusBtnPanel = new VerticalPanel(); statusBtnPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); statusBtnPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); if ((new Date()).getTime() > stopBtnPushedTime + DELAY_BEFRE_ABORT_BTN_IN_MILLISECONDS) { statusBtnPanel.add(forceStopIngestBtn); } statusBtnPanel.setStyleName("statusBtnPanel"); return statusBtnPanel; }
From source file:edu.kit.ipd.sonar.client.LoginScreen.java
License:Open Source License
/** Constructor. Registers independently for events. */ public LoginScreen() { // Set up structure FlexTable loginMenu = new FlexTable(); loginMenu.setStyleName("loginMenu"); loginMenu.setWidget(0, 0, new Label(messages.userNameLabel())); loginMenu.setWidget(0, 1, userNameBox); userNameBox.setStyleName("loginBox"); loginMenu.setWidget(0, 2, adminButton); adminButton.setStyleName("adminButton"); loginMenu.setWidget(1, 0, new Label(messages.passwordLabel())); loginMenu.setWidget(1, 1, passwordBox); passwordBox.setStyleName("loginPasswordBox"); Button loginButton = new Button(messages.loginButtonText()); loginMenu.setWidget(2, 1, loginButton); loginMenu.getCellFormatter().setHorizontalAlignment(2, 1, HasHorizontalAlignment.ALIGN_RIGHT); loginMenu.getFlexCellFormatter().setColSpan(1, 1, 2); loginMenu.getFlexCellFormatter().setColSpan(2, 1, 2); HorizontalPanel hPanel = new HorizontalPanel(); hPanel.setStyleName("loginScreen"); hPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); hPanel.add(loginMenu);/*from ww w .j a v a2s. c o m*/ Image loginLogo = new Image(GWT.getModuleBaseURL() + "images/logo_login.png"); loginLogo.setStyleName("loginLogo"); hPanel.add(loginLogo); SimplePanel workaround = new SimplePanel(); workaround.add(hPanel); initWidget(workaround); // Set various stuff int index = 1; userNameBox.setTabIndex(index++); passwordBox.setTabIndex(index++); loginButton.setTabIndex(index++); DeferredCommand.addCommand(setFocusCommand); // Event Handlers userNameBox.addKeyDownHandler(new KeyDownHandler() { public void onKeyDown(final KeyDownEvent e) { if (e.getNativeKeyCode() == KEY_ENTER) { passwordBox.setFocus(true); passwordBox.selectAll(); } } }); passwordBox.addKeyDownHandler(new KeyDownHandler() { public void onKeyDown(final KeyDownEvent e) { if (e.getNativeKeyCode() == KEY_ENTER) { attemptAuth(); } } }); loginButton.addClickHandler(new ClickHandler() { public void onClick(final ClickEvent e) { attemptAuth(); } }); adminButton.addClickHandler(new ClickHandler() { public void onClick(final ClickEvent e) { if (adminButton.isDown()) { userNameBox.setText(messages.administratorName()); userNameBox.setEnabled(false); } else { userNameBox.setText(""); userNameBox.setEnabled(true); } passwordBox.setText(""); DeferredCommand.addCommand(setFocusCommand); } }); EventBus.getHandlerManager().addHandler(FailedAuthenticationEvent.TYPE, new FailedAuthenticationEventHandler() { public void onFailedAuthentication(final FailedAuthenticationEvent e) { failedAuth(); } }); EventBus.getHandlerManager().addHandler(SuccessfulAuthenticationEvent.TYPE, new SuccessfulAuthenticationEventHandler() { public void onSuccessfulAuthentication(final SuccessfulAuthenticationEvent e) { successfulAuth(); } }); EventBus.getHandlerManager().addHandler(SuccessfulLogoutEvent.TYPE, new SuccessfulLogoutEventHandler() { public void onSuccessfulLogout(final SuccessfulLogoutEvent e) { DeferredCommand.addCommand(setFocusCommand); } }); }
From source file:edu.kit.ipd.sonar.client.Menu.java
License:Open Source License
/** * initializes the menu's components./*from w w w .jav a 2s . c o m*/ */ private void initComponents() { GWT.log("Menu: initializing gui-objects...", null); VerticalPanel vpanel = new VerticalPanel(); Image showImage = new Image(GWT.getModuleBaseURL() + "images/menushowbutton.png"); showImage.addClickHandler(new ClickHandler() { public void onClick(final ClickEvent e) { showMenu(); } }); showImage.setStyleName("menuShowImage"); SimplePanel sp = new SimplePanel(); sp.setWidget(showImage); // This is needed so the menu doesn't maximize vertically, which // would cause it to pull the components apart. SimplePanel outer = new SimplePanel(); outer.setWidget(vpanel); // Do _not_ change this order or add anything before 'outer' deckPanel.add(sp); deckPanel.add(outer); showMenu(); initWidget(deckPanel); // Top bar HorizontalPanel topPanel = new HorizontalPanel(); topPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); topPanel.add(new Image(GWT.getModuleBaseURL() + "images/logo.png")); topPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); Image hideImage = new Image(GWT.getModuleBaseURL() + "images/menuhidebutton.png"); hideImage.addClickHandler(new ClickHandler() { public void onClick(final ClickEvent e) { hideMenu(); } }); topPanel.add(hideImage); topPanel.setWidth("100%"); vpanel.add(topPanel); // Centrality chooser table vpanel.add(centralityTable); //init admin-panel vpanel.add(adminPanel); //cutoff: Grid cutoffGrid = new Grid(1, 2); cutoffGrid.setWidth("100%"); cutoffGrid.setWidget(0, 0, cutoffLabel); cutoffTextBox.setText("1"); cutoffTextBox.setTextAlignment(TextBoxBase.ALIGN_RIGHT); cutoffTextBox.setStyleName("menuCutoffTextBox"); cutoffGrid.setWidget(0, 1, cutoffTextBox); cutoffGrid.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_RIGHT); vpanel.add(cutoffGrid); //init buttons HorizontalPanel buttonPanel = new HorizontalPanel(); buttonPanel.setWidth("100%"); //logout-button: buttonPanel.add(new Button(messages.logout(), new ClickHandler() { public void onClick(final ClickEvent e) { EventBus.getHandlerManager().fireEvent(new AttemptLogoutEvent()); } })); buttonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); //Submit-button: buttonPanel.add(new Button(messages.confirm(), new ClickHandler() { public void onClick(final ClickEvent e) { requestGraph(); } })); vpanel.add(buttonPanel); CaptionPanel infobox = new CaptionPanel(messages.infoBoxHeader()); infobox.setStyleName("infobox"); VerticalPanel infovpanel = new VerticalPanel(); Label nodeInfoContent = new Label(""); Label edgeInfoContent = new Label(""); nodeInfoContent.getElement().setId(JSXGraphDrawer.NODE_TOOLTIP_ID); edgeInfoContent.getElement().setId(JSXGraphDrawer.EDGE_TOOLTIP_ID); infovpanel.add(nodeInfoContent); infovpanel.add(edgeInfoContent); infobox.setContentWidget(infovpanel); vpanel.add(infobox); }
From source file:edu.ucsb.eucalyptus.admin.client.ClusterInfoTable.java
License:Open Source License
public ClusterInfoTable(String sessionId) { this.sessionId = sessionId; this.setStyleName("euca-config-component"); this.setSpacing(2); this.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); // this.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); Label clustersHeader = new Label("Clusters:"); clustersHeader.setStyleName("euca-section-header"); this.add(clustersHeader); this.noClusterLabel.setText("No clusters registered"); this.noClusterLabel.setStyleName("euca-greeting-disabled"); HorizontalPanel grid_and_hint = new HorizontalPanel(); grid_and_hint.add(this.grid); grid_and_hint.add(this.hint); this.hint.setWidth("100"); this.add(grid_and_hint); HorizontalPanel hpanel = new HorizontalPanel(); hpanel.setSpacing(2);/*from ww w . j a v a 2 s. co m*/ hpanel.add(add_button); hpanel.add(new Button("Save cluster configuration", new SaveCallback(this))); hpanel.add(this.statusLabel); // this.statusLabel.setWidth ("250"); this.statusLabel.setText(""); this.statusLabel.setStyleName("euca-greeting-pending"); this.add(hpanel); rebuildTable(); EucalyptusWebBackend.App.getInstance().getClusterList(this.sessionId, new GetClusterListCallback(this)); EucalyptusWebBackend.App.getInstance().getSystemConfig(this.sessionId, new GetSystemConfigCallback(this)); EucalyptusWebBackend.App.getInstance().getStorageList(this.sessionId, new GetStorageListCallback(this)); }