List of usage examples for com.google.gwt.i18n.client NumberFormat getDecimalFormat
public static NumberFormat getDecimalFormat()
From source file:de.uni_koeln.spinfo.maalr.webapp.ui.admin.client.general.dbsettings.DatabaseSettings.java
License:Apache License
public DatabaseSettings() { service = GWT.create(BackendService.class); initWidget(uiBinder.createAndBindUi(this)); busyIndicator.setType(Style.ANIMATED); busyIndicator.setPercent(100);/*from w w w. j a v a 2 s .c om*/ leftGroup.getElement().getStyle().setFloat(Float.LEFT); rightGroup.getElement().getStyle().setFloat(Float.RIGHT); nf = NumberFormat.getDecimalFormat(); initHandlers(); updateDatabaseStatistics(); }
From source file:de.uni_koeln.spinfo.maalr.webapp.ui.admin.client.general.indexsettings.IndexSettings.java
License:Apache License
public IndexSettings() { service = GWT.create(BackendService.class); nf = NumberFormat.getDecimalFormat(); initWidget(uiBinder.createAndBindUi(this)); leftGroup.getElement().getStyle().setFloat(Float.LEFT); rightGroup.getElement().getStyle().setFloat(Float.RIGHT); busyIndicator.setPercent(100);/*from w ww . j a v a 2 s . c o m*/ busyIndicator.setType(Style.ANIMATED); initHandlers(); updateIndexStatistics(); }
From source file:edu.colorado.csdms.wmt.client.ui.cell.DoubleCellParser.java
License:Open Source License
public Double parse(CharSequence object) throws ParseException { if ("".equals(object.toString())) { return null; }/* w w w . ja v a2 s. c o m*/ try { return NumberFormat.getDecimalFormat().parse(object.toString()); } catch (NumberFormatException e) { throw new ParseException(e.getMessage(), 0); } }
From source file:eml.studio.client.ui.widget.BaseWidget.java
License:Open Source License
public void printMessage(String eventName, int code, boolean modifier, boolean control) { final NumberFormat formatter = NumberFormat.getDecimalFormat(); String message = eventName + " - Char Code: " + formatter.format(code) + ". "; if (code == KeyCodes.KEY_ENTER) { message += "Key is ENTER. "; }// w ww .jav a 2s. c o m if (modifier) message += "Modifier is down. "; if (control) message += "CTRL is down. "; logger.info("message" + message); }
From source file:eu.optimis.ip.gui.client.userwidget.graph.GraphicReportOutputDiagramPanel.java
License:Open Source License
public GraphicReportOutputDiagramPanel() { timer = new Timer() { public void run() { if (isUpdateNecessary()) { updateLogContent();// w w w .ja v a2s .c o m } } }; setHeading(Constants.MENU_COMPONENTS_NAME); setLayout(new FitLayout()); ToolBar toolBarSelection = new ToolBar(); LabelToolItem labelComponents = new LabelToolItem("Component: "); toolBarSelection.add(labelComponents); labelComponents.setVisible(true); setTopComponent(toolBarSelection); listComponents = new SimpleComboBox<String>(); listComponents.setForceSelection(true); listComponents.setEditable(false); listComponents.setTriggerAction(ComboBox.TriggerAction.ALL); listComponents.setEmptyText("-Choose a component-"); listComponents.setFieldLabel("Component"); listComponents.setWidth(300); listComponents.addSelectionChangedListener(new SelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent se) { timer.cancel(); selectedComponent = listComponents.getSimpleValue(); output.setEmptyText("Select a component and log file to display and press \"Load\""); getLogList(); } }); getComponentLogList(); toolBarSelection.add(listComponents); LabelToolItem labelFiles = new LabelToolItem(" File: "); toolBarSelection.add(labelFiles); labelFiles.setVisible(true); listLogs = new SimpleComboBox<String>(); listLogs.setForceSelection(true); listLogs.setEditable(false); listLogs.setTriggerAction(ComboBox.TriggerAction.ALL); listLogs.setEmptyText("-Choose a log file-"); listLogs.setFieldLabel("Log"); listLogs.setWidth(300); listLogs.addSelectionChangedListener(new SelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent se) { timer.cancel(); output.setEmptyText("Select a component and log file to display and press \"Load\""); output.clear(); } }); toolBarSelection.add(listLogs); LabelToolItem labelLines = new LabelToolItem(" Number of lines: "); toolBarSelection.add(labelLines); labelLines.setVisible(true); numberOfLines = new SpinnerField(); //numberOfLines.setFieldLabel(FeedbackAuthoringStrings.MAX_NUM_MSGS_PROV_LABEL); numberOfLines.setIncrement(1); numberOfLines.getPropertyEditor().setType(Integer.class); numberOfLines.getPropertyEditor().setFormat(NumberFormat.getDecimalFormat()); numberOfLines.setMinValue(30); numberOfLines.setValue(40); numberOfLines.setMaxValue(500); // numberOfLines = new NumberField(); // numberOfLines.setMaxValue(500); // numberOfLines.setMinValue(10); // numberOfLines.setValue(30); toolBarSelection.add(numberOfLines); Button loadButton = new Button("Load"); toolBarSelection.add(loadButton); loadButton.addSelectionListener(new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { updateLogContent(); timer.scheduleRepeating(5000); } }); labelStatus = new LabelToolItem(""); toolBarSelection.add(labelStatus); labelStatus.setVisible(true); currentOutput = "Select a component and log file to display and press \"Load\""; output = new TextArea(); output.addStyleName("demo-TextArea"); output.setWidth("800px"); output.setHeight("400px"); output.setReadOnly(true); output.setEmptyText("Select a component and log file to display and press \"Load\""); output.setVisible(true); output.sinkEvents(Event.ONCLICK); output.addHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (logBeingDisplayed == true) { if (updateLogTextArea == true) { updateLogTextArea = false; labelStatus.setLabel("Status: LOCKED"); } else { updateLogTextArea = true; labelStatus.setLabel("Status: DISPLAYING"); } } } }, ClickEvent.getType()); add(output); }
From source file:eu.optimis.sm.gui.client.userwidget.RightLogsPanel.java
License:Apache License
public RightLogsPanel() { timer = new Timer() { public void run() { if (isUpdateNecessary()) { updateLogContent();//from w w w. ja v a2s .c o m } } }; setHeading(Constants.MENU_LOGS); setLayout(new FitLayout()); ToolBar toolBarSelection = new ToolBar(); LabelToolItem labelComponents = new LabelToolItem("Component: "); toolBarSelection.add(labelComponents); labelComponents.setVisible(true); setTopComponent(toolBarSelection); listComponents = new SimpleComboBox<String>(); listComponents.setForceSelection(true); listComponents.setEditable(false); listComponents.setTriggerAction(ComboBox.TriggerAction.ALL); listComponents.setEmptyText("-Choose a component-"); listComponents.setFieldLabel("Component"); listComponents.setWidth(200); listComponents.addSelectionChangedListener(new SelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent se) { timer.cancel(); selectedComponent = listComponents.getSimpleValue(); output.setEmptyText("Select a component and log file to display and press \"Load\""); getLogList(); } }); getComponentLogList(); toolBarSelection.add(listComponents); LabelToolItem labelFiles = new LabelToolItem(" File: "); toolBarSelection.add(labelFiles); labelFiles.setVisible(true); listLogs = new SimpleComboBox<String>(); listLogs.setForceSelection(true); listLogs.setEditable(false); listLogs.setTriggerAction(ComboBox.TriggerAction.ALL); listLogs.setEmptyText("-Choose a log file-"); listLogs.setFieldLabel("Log"); listLogs.setWidth(200); listLogs.addSelectionChangedListener(new SelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent se) { timer.cancel(); output.setEmptyText("Select a component and log file to display and press \"Load\""); output.clear(); } }); toolBarSelection.add(listLogs); LabelToolItem labelLines = new LabelToolItem(" Number of lines: "); toolBarSelection.add(labelLines); labelLines.setVisible(true); numberOfLines = new SpinnerField(); numberOfLines.setIncrement(1); numberOfLines.getPropertyEditor().setType(Integer.class); numberOfLines.getPropertyEditor().setFormat(NumberFormat.getDecimalFormat()); numberOfLines.setMinValue(1); numberOfLines.setValue(500); numberOfLines.setMaxValue(5000); toolBarSelection.add(numberOfLines); Button loadButton = new Button("Load"); toolBarSelection.add(loadButton); loadButton.addSelectionListener(new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { updateLogContent(); timer.scheduleRepeating(5000); } }); labelStatus = new LabelToolItem(""); toolBarSelection.add(labelStatus); labelStatus.setVisible(true); currentOutput = "Select a component and log file to display and press \"Load\""; output = new TextArea(); output.addStyleName("demo-TextArea"); output.setWidth("800px"); output.setHeight("400px"); output.setReadOnly(true); output.setEmptyText("Select a component and log file to display and press \"Load\""); output.setVisible(true); output.sinkEvents(Event.ONCLICK); output.addHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (logBeingDisplayed == true) { if (updateLogTextArea == true) { updateLogTextArea = false; labelStatus.setLabel("Status: LOCKED"); } else { updateLogTextArea = true; labelStatus.setLabel("Status: DISPLAYING"); } } } }, ClickEvent.getType()); add(output); }
From source file:examples.client.Main.java
License:Apache License
public void onModuleLoad() { // Like opening a browser Workspace w = new GWTWorkspace(); // Enables WebSocket connections w.addURIHandler(new WebSocket()); // Get array of long and stay connected through WebSocket String uri = "ws://test.objectfabric.org/array"; w.openAsync(uri, new AsyncCallback<Resource>() { @Override//from www . j a va2 s . c o m public void onSuccess(Resource result) { final TArrayLong array = (TArrayLong) result.get(); final NumberFormat format = NumberFormat.getDecimalFormat(); // Called when an array element is set array.addListener(new IndexListener() { @Override public void onSet(int i) { Element div = Document.get().getElementById("div" + i); div.setInnerHTML(format.format(array.get(i))); } }); } @Override public void onFailure(Exception e) { } }); }
From source file:fr.insalyon.creatis.vip.application.client.view.monitor.chart.JobStatsChart.java
License:Open Source License
public void build() { chartLayout.removeMembers(chartLayout.getMembers()); int completedJobs = 0; int cancelledJobs = 0; int failedJobs = 0; int stalledJobs = 0; int totalJobs = 0; long completedJobsExec = 0, cancelledJobsExec = 0, failedJobsExec = 0, stalledJobsExec = 0, totalJobsExec = 0;/* www .j a v a2 s . c o m*/ // add data /* grid.setData(new PropertyRecord[]{ new PropertyRecord("Completed Jobs", data.get(0) + ""), new PropertyRecord("completed WaitingTime", data.get(1) + ""), new PropertyRecord("completed ExecutionTime", data.get(2) + ""), new PropertyRecord("completed InputTime", data.get(3) + ""), new PropertyRecord("completed OutputTime", data.get(4) + ""), new PropertyRecord("Cancelled Jobs", data.get(5) + ""), new PropertyRecord("Cancelled WaitingTime", data.get(6) + ""), new PropertyRecord("Cancelled ExecutionTime", data.get(7) + ""), new PropertyRecord("Cancelled InputTime", data.get(8) + ""), new PropertyRecord("Cancelled OutputTime", data.get(9) + ""), new PropertyRecord("failedApplication Jobs", data.get(10) + ""), new PropertyRecord("failedApplication WaitingTime", data.get(11) + ""), new PropertyRecord("failedApplication ExecutionTime", data.get(12) + ""), new PropertyRecord("failedApplication InputTime", data.get(13) + ""), new PropertyRecord("failedApplication OutputTime", data.get(14) + ""), new PropertyRecord("failedInput Jobs", data.get(15) + ""), new PropertyRecord("failedInput WaitingTime", data.get(16) + ""), new PropertyRecord("failedInput ExecutionTime", data.get(17) + ""), new PropertyRecord("failedInput InputTime", data.get(18) + ""), new PropertyRecord("failedInput OutputTime", data.get(19) + ""), new PropertyRecord("failedInput Jobs", data.get(15) + ""), new PropertyRecord("failedInput WaitingTime", data.get(16) + ""), new PropertyRecord("failedInput ExecutionTime", data.get(17) + ""), new PropertyRecord("failedInput InputTime", data.get(18) + ""), new PropertyRecord("failedInput OutputTime", data.get(19) + ""), new PropertyRecord("failedOutput Jobs", data.get(20) + ""), new PropertyRecord("failedOutput WaitingTime", data.get(21) + ""), new PropertyRecord("failedOutput ExecutionTime", data.get(22) + ""), new PropertyRecord("failedOutput InputTime", data.get(23) + ""), new PropertyRecord("failedOutput OutputTime", data.get(24) + ""), new PropertyRecord("failedStalled Jobs", data.get(25) + ""), new PropertyRecord("failedStalled WaitingTime", data.get(26) + ""), new PropertyRecord("failedStalled ExecutionTime", data.get(27) + ""), new PropertyRecord("failedStalled InputTime", data.get(28) + ""), new PropertyRecord("failedStalled OutputTime", data.get(29) + "") }); * */ //PropertyRecord[] p = new PropertyRecord[data.size()]; for (int i = 0; i < data.size(); i++) { if (data.get(i) != null) { addRowData(data.get(i)); String[] v = data.get(i).split("##"); //p[i] = new PropertyRecord(v[0], v[1]); switch (i) { case 0: completedJobs = completedJobs + Integer.parseInt(v[1]); break; case 2: completedJobsExec = completedJobsExec + Integer.parseInt(v[1]); break; case 5: cancelledJobs = cancelledJobs + Integer.parseInt(v[1]); break; case 7: cancelledJobsExec = cancelledJobsExec + Integer.parseInt(v[1]); break; case 10: failedJobs = failedJobs + Integer.parseInt(v[1]); break; case 12: failedJobsExec = failedJobsExec + Integer.parseInt(v[1]); break; case 15: failedJobs = failedJobs + Integer.parseInt(v[1]); break; case 17: failedJobsExec = failedJobsExec + Integer.parseInt(v[1]); break; case 20: failedJobs = failedJobs + Integer.parseInt(v[1]); break; case 22: failedJobsExec = failedJobsExec + Integer.parseInt(v[1]); break; case 25: stalledJobs = stalledJobs + Integer.parseInt(v[1]); case 27: stalledJobsExec = stalledJobsExec + Integer.parseInt(v[1]); } } } totalJobs = completedJobs + cancelledJobs + failedJobs + stalledJobs; grid.setData(new PropertyRecord[] { new PropertyRecord("Completed Jobs", completedJobs + ""), new PropertyRecord("Cancelled Jobs", cancelledJobs + ""), new PropertyRecord("Failed Jobs", failedJobs + ""), new PropertyRecord("Stalled Jobs", stalledJobs + ""), new PropertyRecord("Total Jobs", totalJobs + "") }); //grid.setCursor(Cursor.TEXT); ListGrid gridExecution = new ListGrid(); gridExecution.setWidth(280); gridExecution.setHeight(145); gridExecution.setShowAllRecords(true); ListGridField propertyField = new ListGridField("property", "Job Types"); ListGridField valueField = new ListGridField("value", "Execution Times (sec)"); valueField.setAlign(Alignment.RIGHT); valueField.setCellFormatter(new CellFormatter() { @Override public String format(Object value, ListGridRecord record, int rowNum, int colNum) { if (value == null) { return null; } try { NumberFormat nf = NumberFormat.getDecimalFormat(); return nf.format(Double.parseDouble((String) value)); } catch (Exception e) { return value.toString(); } } }); gridExecution.setFields(propertyField, valueField); totalJobsExec = completedJobsExec + cancelledJobsExec + failedJobsExec + stalledJobsExec; gridExecution.setData( new PropertyRecord[] { new PropertyRecord("Completed-jobs execution time", completedJobsExec + ""), new PropertyRecord("Cancelled-jobs execution time", cancelledJobsExec + ""), new PropertyRecord("Failed-jobs execution time", failedJobsExec + ""), new PropertyRecord("Stalled-jobs execution time", stalledJobsExec + ""), new PropertyRecord("Total execution time", totalJobsExec + "") }); chartLayout.addMember(gridExecution); gridExecution.setCanSelectCells(true); gridExecution.setCanSelectText(true); gridExecution.setCanEdit(true); chartLayout.addMember(getRowDataImg()); }
From source file:fr.insalyon.creatis.vip.application.client.view.monitor.ChartsTab.java
License:Open Source License
private void configureGrid() { grid = new ListGrid(); grid.setWidth(280);/*from ww w . j a v a 2 s.c om*/ grid.setHeight(145); grid.setShowAllRecords(true); grid.setShowEmptyMessage(true); grid.setEmptyMessage("<br>No data available."); ListGridField propertyField = new ListGridField("property", "Properties"); ListGridField valueField = new ListGridField("value", "Value"); valueField.setAlign(Alignment.RIGHT); valueField.setCellFormatter(new CellFormatter() { @Override public String format(Object value, ListGridRecord record, int rowNum, int colNum) { if (value == null) { return null; } try { NumberFormat nf = NumberFormat.getDecimalFormat(); return nf.format(Double.parseDouble((String) value)); } catch (Exception e) { return value.toString(); } } }); grid.setFields(propertyField, valueField); leftVLayout.addMember(grid); }
From source file:fr.insalyon.creatis.vip.application.client.view.monitor.StatsTab.java
License:Open Source License
private void configureGrid() { grid = new ListGrid(); grid.setWidth(280);//ww w . j av a 2 s . c o m grid.setHeight(145); grid.setShowAllRecords(true); grid.setShowEmptyMessage(true); grid.setEmptyMessage("<br>No data available."); ListGridField propertyField = new ListGridField("property", "Properties"); ListGridField valueField = new ListGridField("value", "Value"); valueField.setAlign(Alignment.RIGHT); valueField.setCellFormatter(new CellFormatter() { @Override public String format(Object value, ListGridRecord record, int rowNum, int colNum) { if (value == null) { return null; } try { NumberFormat nf = NumberFormat.getDecimalFormat(); return nf.format(Double.parseDouble((String) value)); } catch (Exception e) { return value.toString(); } } }); grid.setFields(propertyField, valueField); grid.setCanSelectCells(true); grid.setCanEdit(true); //grid.setAutoFetchData(true); //grid.setCanDragSelect(true); grid.setCanSelectText(true); grid.setCursor(Cursor.TEXT); leftVLayout.addMember(grid); }