List of usage examples for com.google.gwt.user.client.ui TabPanel TabPanel
public TabPanel()
From source file:gov.nist.spectrumbrowser.admin.AdminScreen.java
License:Open Source License
public void draw() { try {//from w w w. j a v a2 s. c o m verticalPanel.clear(); HTML html = new HTML("<h2>CAC Measured Spectrum Occupancy Database Administrator Interface (BETA)</h> ", true); verticalPanel.add(html); tabPanel = new TabPanel(); int counter = 0; SystemConfig systemConfig = new SystemConfig(adminEntryPoint); screens[counter++] = systemConfig; tabPanel.add(systemConfig, systemConfig.getEndLabel()); ScreenConfig screenConfig = new ScreenConfig(adminEntryPoint); screens[counter++] = screenConfig; tabPanel.add(screenConfig, screenConfig.getEndLabel()); OutboundPeers peers = new OutboundPeers(adminEntryPoint); screens[counter++] = peers; tabPanel.add(peers, peers.getEndLabel()); InboundPeers inboundPeers = new InboundPeers(adminEntryPoint); screens[counter++] = inboundPeers; tabPanel.add(inboundPeers, inboundPeers.getEndLabel()); SensorConfig sensorConfig = new SensorConfig(adminEntryPoint); screens[counter++] = sensorConfig; tabPanel.add(sensorConfig, sensorConfig.getEndLabel()); AccountManagement accountMgmt = new AccountManagement(adminEntryPoint); screens[counter++] = accountMgmt; tabPanel.add(accountMgmt, accountMgmt.getEndLabel()); SessionManagement sessionManagement = new SessionManagement(adminEntryPoint); ESAgents esAgents = new ESAgents(adminEntryPoint); screens[counter++] = esAgents; tabPanel.add(esAgents, esAgents.getEndLabel()); screens[counter++] = sessionManagement; this.sessionManagement = sessionManagement; tabPanel.add(sessionManagement, sessionManagement.getEndLabel()); SystemMonitor monitor = new SystemMonitor(adminEntryPoint); screens[counter++] = monitor; tabPanel.add(monitor, monitor.getEndLabel()); DebugConfiguration debugConfig = new DebugConfiguration(adminEntryPoint); screens[counter++] = debugConfig; tabPanel.add(debugConfig, debugConfig.getEndLabel()); ServiceControl serviceControl = new ServiceControl(adminEntryPoint); screens[counter++] = serviceControl; tabPanel.add(serviceControl, serviceControl.getEndLabel()); tabPanel.addSelectionHandler(new SelectionHandler<Integer>() { @Override public void onSelection(SelectionEvent<Integer> event) { int selection = event.getSelectedItem(); screens[selection].draw(); } }); verticalPanel.add(tabPanel); Timer timer = new Timer() { @Override public void run() { tabPanel.selectTab(0); } }; timer.schedule(1000); } catch (Throwable th) { logger.log(Level.SEVERE, "Problem drawing Admin Screen", th); adminEntryPoint.logoff(); } }
From source file:gov.nist.spectrumbrowser.client.FftPowerOneAcquisitionSpectrogramChart.java
License:Open Source License
public void draw() { try {/*from ww w.j a v a 2s.c om*/ vpanel.clear(); super.drawNavigation(); HTML pageTitle = new HTML("<h2>" + getEndLabel() + "</h2>"); vpanel.add(pageTitle); title = new HTML("<H3>Acquisition Start Time : " + localDateOfAcquisition + "; Occupancy Threshold : " + cutoff + " dBm; Measurements Per Acquisition = " + measurementsPerAcquisition + "</H3>"); vpanel.add(title); double timeResolution = (double) (timeDelta + 1) / (double) measurementCount; int freqResolution = (int) round((this.mMaxFreq - this.mMinFreq) / this.binsPerMesurement); HTML subTitle = new HTML("<h3>Time Resolution= " + round3(timeResolution) + " s; Resolution BW = " + freqResolution + " Hz; Measurements = " + measurementCount + "; Max Occupancy = " + maxOccupancy + "%; Median Occupancy = " + medianOccupancy + "%; Mean Occupancy = " + meanOccupancy + "%; Min Occupancy = " + minOccupancy + "%</h3>"); vpanel.add(subTitle); help = new Label("Single click for detail. Double click to zoom"); vpanel.add(help); spectrogramVerticalPanel = new VerticalPanel(); hpanel = new HorizontalPanel(); commands = new Grid(1, 7); commands.setStyleName("selectionGrid"); for (int i = 0; i < commands.getRowCount(); i++) { for (int j = 0; j < commands.getColumnCount(); j++) { commands.getCellFormatter().setHorizontalAlignment(i, j, HasHorizontalAlignment.ALIGN_CENTER); commands.getCellFormatter().setVerticalAlignment(i, j, HasVerticalAlignment.ALIGN_MIDDLE); } } hpanel.setSpacing(10); hpanel.setStyleName("spectrogram"); xaxisPanel = new HorizontalPanel(); xaxisPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); HorizontalPanel xaxis = new HorizontalPanel(); xaxis.setWidth(canvasPixelWidth + 30 + "px"); xaxis.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); NumberFormat numberFormat = NumberFormat.getFormat("00.00"); xaxis.add(new Label(numberFormat.format(minTime))); xaxis.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); xaxis.add(new Label("Time (sec)")); xaxis.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); xaxis.add(new Label(numberFormat.format(minTime + timeDelta))); xaxisPanel.add(xaxis); // Attach the previous reading button. if (prevAcquisitionTime != mSelectionTime) { final Button prevDayButton = new Button(); prevDayButton.setEnabled(true); prevDayButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { mSelectionTime = prevAcquisitionTime; prevDayButton.setEnabled(false); acquisitionDuration = 0; leftBound = 0; rightBound = 0; window = measurementsPerAcquisition; help.setText(COMPUTING_PLEASE_WAIT); mSpectrumBrowser.showWaitImage(); mSpectrumBrowser.getSpectrumBrowserService() .generateSingleAcquisitionSpectrogramAndOccupancy(mSensorId, prevAcquisitionTime, mSys2detect, mMinFreq, mMaxFreq, cutoff, FftPowerOneAcquisitionSpectrogramChart.this); } }); prevDayButton.setText("<< Prev. Acquisition"); commands.setWidget(0, 0, prevDayButton); } // Attach button for panning within the acquisition if (leftBound > 0) { Button panLeftButton = new Button(); panLeftButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (leftBound - window >= 0) { leftBound = (int) (leftBound - window); rightBound = rightBound + window; } else { rightBound = rightBound + leftBound; leftBound = 0; } help.setText(COMPUTING_PLEASE_WAIT); mSpectrumBrowser.getSpectrumBrowserService() .generateSingleAcquisitionSpectrogramAndOccupancy(mSensorId, mSelectionTime, mSys2detect, mMinFreq, mMaxFreq, (int) leftBound, (int) rightBound, cutoff, FftPowerOneAcquisitionSpectrogramChart.this); } }); panLeftButton.setText("< Pan Left"); panLeftButton.setTitle("Click to pan left"); commands.setWidget(0, 1, panLeftButton); } // Attach the labels for the spectrogram power VerticalPanel powerLevelPanel = new VerticalPanel(); powerLevelPanel.setWidth(100 + "px"); this.maxPowerLabel = new Label(); this.minPowerLabel = new Label(); powerLevelPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); powerLevelPanel.add(maxPowerLabel); powerLevelPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); powerLevelPanel.add(new Label("Power (dBm) ")); powerLevelPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM); powerLevelPanel.add(minPowerLabel); // Attach labels for the frequency. freqPanel = new VerticalPanel(); freqPanel.setWidth(100 + "px"); powerLevelPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); freqPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); freqPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); freqPanel.add(new Label(Double.toString(maxFreqMhz))); freqPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); freqPanel.add(new Label("Frequency (MHz)")); freqPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM); freqPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); freqPanel.add(new Label(Double.toString(minFreqMhz))); powerMapPanel = new HorizontalPanel(); powerMapPanel.setWidth(30 + "px"); hpanel.add(freqPanel); spectrogramPanel = new VerticalPanel(); HorizontalPanel spectrogramAndPowerMapPanel = new HorizontalPanel(); spectrogramAndPowerMapPanel.add(spectrogramPanel); spectrogramAndPowerMapPanel.add(powerMapPanel); hpanel.add(spectrogramAndPowerMapPanel); currentValue = new Label("Click for power spectrum and power at selected time. Double click to zoom."); spectrogramVerticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); spectrogramVerticalPanel.add(commands); if (maxTime - minTime < acquisitionDuration) { Button unzoom = new Button("Zoom Out"); unzoom.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { zoomOut(); } }); commands.setWidget(0, 2, unzoom); } spectrogramVerticalPanel.add(currentValue); spectrogramVerticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); spectrogramVerticalPanel.add(hpanel); String helpString = "Single click for power spectrum. Double click to zoom."; // Add the slider bar for min occupancy selection. occupancyMinPowerVpanel = new VerticalPanel(); occupancyMinPowerVpanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); occupancyMinPowerVpanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); occupancyMinPowerSliderBar = new SliderBarSimpleVertical(100, canvasPixelHeight + "px", true); occupancyMinPowerVpanel.add(occupancyMinPowerSliderBar); occupancyMinPowerSliderBar.setMaxValue(100); this.occupancyMinPowerLabel = new Label(); occupancyMinPowerVpanel.add(occupancyMinPowerLabel); final Button clearTabsButton = new Button("Close Tabs"); commands.setWidget(0, 3, clearTabsButton); clearTabsButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { tabPanel.clear(); tabPanel.add(spectrogramVerticalPanel, "[Spectrogram]"); tabPanel.add(occupancyPanel, "[Occupancy]"); tabPanel.selectTab(0); } }); final Button cutoffAndRedrawButton = new Button("Cutoff and Redraw"); commands.setWidget(0, 4, cutoffAndRedrawButton); cutoffAndRedrawButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { mSpectrumBrowser.showWaitImage(); cutoffAndRedrawButton.setEnabled(false); help.setText(COMPUTING_PLEASE_WAIT); mSpectrumBrowser.getSpectrumBrowserService().generateSingleAcquisitionSpectrogramAndOccupancy( mSensorId, mSelectionTime, mSys2detect, mMinFreq, mMaxFreq, leftBound, rightBound, cutoffPower, FftPowerOneAcquisitionSpectrogramChart.this); } }); occupancyMinPowerSliderBar .addBarValueChangedHandler(new OccupancyMinPowerSliderHandler(occupancyMinPowerLabel)); int initialValue = (int) ((double) (maxPower - cutoff) / (double) (maxPower - minPower) * 100); occupancyMinPowerSliderBar.setValue(initialValue); hpanel.add(occupancyMinPowerVpanel); spectrogramPanel.setTitle(helpString); spectrumAndOccupancyPanel = new VerticalPanel(); spectrumAndOccupancyPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); spectrogramVerticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); spectrogramVerticalPanel.add(spectrumAndOccupancyPanel); occupancyPanel = new VerticalPanel(); occupancyPanel.setWidth(canvasPixelWidth + "px"); occupancyPanel.setHeight(canvasPixelHeight + "px"); occupancyPanel.setPixelSize(canvasPixelWidth, canvasPixelHeight); // Fine pan to the right. if (rightBound > 0) { Button rightPanButton = new Button(); rightPanButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { logger.finest("rightBound = " + rightBound + " leftBound = " + leftBound + " window = " + window + " aquisitionDuration = " + measurementsPerAcquisition); if (rightBound - window > 0) { rightBound = rightBound - window; leftBound = leftBound + window; } else { leftBound = leftBound + rightBound; rightBound = 0; } help.setText(COMPUTING_PLEASE_WAIT); mSpectrumBrowser.showWaitImage(); mSpectrumBrowser.getSpectrumBrowserService() .generateSingleAcquisitionSpectrogramAndOccupancy(mSensorId, mSelectionTime, mSys2detect, mMinFreq, mMaxFreq, (int) leftBound, (int) rightBound, cutoff, FftPowerOneAcquisitionSpectrogramChart.this); } }); commands.setWidget(0, 5, rightPanButton); rightPanButton.setTitle("Click to pan right"); rightPanButton.setText("Pan Right >"); } // Attach the next spectrogram panel. if (nextAcquisitionTime != mSelectionTime) { final Button nextAquisitionButton = new Button(); nextAquisitionButton.setEnabled(true); nextAquisitionButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { logger.finer("getting next spectrogram"); try { mSelectionTime = nextAcquisitionTime; nextAquisitionButton.setEnabled(false); acquisitionDuration = 0; leftBound = 0; rightBound = 0; window = measurementsPerAcquisition; mSpectrumBrowser.showWaitImage(); help.setText(COMPUTING_PLEASE_WAIT); mSpectrumBrowser.getSpectrumBrowserService() .generateSingleAcquisitionSpectrogramAndOccupancy(mSensorId, nextAcquisitionTime, mSys2detect, mMinFreq, mMaxFreq, cutoff, FftPowerOneAcquisitionSpectrogramChart.this); } catch (Throwable th) { logger.log(Level.SEVERE, "Error calling spectrum browser service", th); } } }); nextAquisitionButton.setText("Next Acquisition >>"); // .setHTML("<img border='0' src='myicons/right-arrow.png' />"); commands.setWidget(0, 6, nextAquisitionButton); } setSpectrogramImage(); drawOccupancyChart(); tabPanel = new TabPanel(); tabPanel.add(spectrogramVerticalPanel, "[Spectrogram]"); tabPanel.add(occupancyPanel, "[Occupancy]"); tabPanel.selectTab(0); vpanel.add(tabPanel); tabPanel.addSelectionHandler(new SelectionHandler<Integer>() { @Override public void onSelection(SelectionEvent<Integer> event) { int item = event.getSelectedItem(); if (item == 0) { help.setText("Single click for detail. Double click to zoom"); } else if (item == 1) { help.setText("Single click for spectrum"); } else { help.setText(""); } } }); } catch (Throwable ex) { logger.log(Level.SEVERE, "Problem drawing specgtrogram", ex); } }
From source file:gov.nist.spectrumbrowser.client.SweptFrequencyOneDaySpectrogramChart.java
License:Open Source License
public void draw() { try {/*from w ww . j a v a 2 s. c om*/ vpanel.clear(); drawNavigation(); HTML pageTitle = new HTML("<h2>" + END_LABEL + "</h2>"); vpanel.add(pageTitle); HTML title = new HTML("<H3>Detected System = " + mSys2detect + "; Start Time = " + localDateOfAcquisition + "; Occupancy Threshold = " + cutoff + " dBm; minPower = " + minPower + " dBm; maxPower = " + maxPower + " dBm</H3>"); vpanel.add(title); HTML title1 = new HTML("<h3>Aquisition Count = " + acquisitionCount + "; max occupancy = " + maxOccupancy + "%; min occupancy = " + minOccupancy + "%; mean occupancy = " + meanOccupancy + "%; median occupancy = " + medianOccupancy + "%</h3>"); vpanel.add(title1); HTML title3 = new HTML("<h3> Equiv. Noise BW = " + enbw + " Hz; Resolution BW = " + rbw + " Hz. </h3>"); vpanel.add(title3); HTML help = new HTML("<p>Click on spectrogram or occupancy plot for detail. " + "Move slider and and click on redraw button to change threshold and redraw.</p>"); vpanel.add(help); grid = new Grid(1, 4); vpanel.add(grid); grid.setStyleName("selectionGrid"); for (int i = 0; i < grid.getRowCount(); i++) { for (int j = 0; j < grid.getColumnCount(); j++) { grid.getCellFormatter().setHorizontalAlignment(i, j, HasHorizontalAlignment.ALIGN_CENTER); grid.getCellFormatter().setVerticalAlignment(i, j, HasVerticalAlignment.ALIGN_MIDDLE); } } spectrogramVerticalPanel = new VerticalPanel(); hpanel = new HorizontalPanel(); hpanel.setSpacing(10); hpanel.setStyleName("spectrogram"); xaxisPanel = new HorizontalPanel(); xaxisPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); HorizontalPanel xaxis = new HorizontalPanel(); xaxis.setWidth(canvasPixelWidth + 30 + "px"); xaxis.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); xaxis.add(new Label("0")); xaxis.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); xaxis.add(new Label("Time (hours) since start of day")); xaxis.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); xaxis.add(new Label(Double.toString(timeDelta))); xaxisPanel.add(xaxis); // Attach the previous reading button. if (prevAcquisitionTime != tStartTimeUtc) { final Button prevDayButton = new Button(); prevDayButton.setEnabled(true); prevDayButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { mSelectionTime = prevAcquisitionTime; mSpectrumBrowser.showWaitImage(); infoLabel.setText(COMPUTING_PLEASE_WAIT); mSpectrumBrowser.getSpectrumBrowserService().generateSingleDaySpectrogramAndOccupancy( mSensorId, mLat, mLon, mAlt, prevAcquisitionTime, mSys2detect, mMinFreq, mMaxFreq, mSubBandMinFreq, mSubBandMaxFreq, cutoff, SweptFrequencyOneDaySpectrogramChart.this); } }); prevDayButton.setText("< Previous Day"); grid.setWidget(0, 0, prevDayButton); } // Attach the labels for the spectrogram power VerticalPanel powerLevelPanel = new VerticalPanel(); powerLevelPanel.setWidth(100 + "px"); this.maxPowerLabel = new Label(); this.minPowerLabel = new Label(); powerLevelPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); powerLevelPanel.add(maxPowerLabel); powerLevelPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); powerLevelPanel.add(new Label("Power (dBm) ")); powerLevelPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM); powerLevelPanel.add(minPowerLabel); // Attach labels for the frequency. freqPanel = new VerticalPanel(); freqPanel.setWidth(100 + "px"); powerLevelPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); freqPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); freqPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); freqPanel.add(new Label(Double.toString(maxFreqMhz))); freqPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); freqPanel.add(new Label("Frequency (MHz)")); freqPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM); freqPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); freqPanel.add(new Label(Double.toString(minFreqMhz))); logger.finest("minFreq = " + minFreqMhz); powerMapPanel = new HorizontalPanel(); powerMapPanel.setWidth(30 + "px"); hpanel.add(freqPanel); spectrogramPanel = new VerticalPanel(); HorizontalPanel spectrogramAndPowerMapPanel = new HorizontalPanel(); spectrogramAndPowerMapPanel.add(spectrogramPanel); spectrogramAndPowerMapPanel.add(powerMapPanel); hpanel.add(spectrogramAndPowerMapPanel); infoLabel = new Label("Click on spectrogram for power spectrum at selected time."); spectrogramVerticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); spectrogramVerticalPanel.add(infoLabel); spectrogramVerticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); spectrogramVerticalPanel.add(hpanel); String helpString = "Single click for power spectrum."; String powerString = "Single click for power occupancy."; // Add the slider bar for min occupancy selection. occupancyMinPowerVpanel = new VerticalPanel(); occupancyMinPowerVpanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); occupancyMinPowerVpanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); occupancyMinPowerSliderBar = new SliderBarSimpleVertical(100, canvasPixelHeight + "px", true); occupancyMinPowerVpanel.add(occupancyMinPowerSliderBar); occupancyMinPowerSliderBar.setMaxValue(100); this.occupancyMinPowerLabel = new Label(); occupancyMinPowerVpanel.add(occupancyMinPowerLabel); final Button generateSpectrogramButton = new Button("Cutoff and Redraw"); grid.setWidget(0, 1, generateSpectrogramButton); generateSpectrogramButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { generateSpectrogramButton.setEnabled(false); mSpectrumBrowser.showWaitImage(); mSpectrumBrowser.getSpectrumBrowserService().generateSingleDaySpectrogramAndOccupancy(mSensorId, mLat, mLon, mAlt, mSelectionTime, mSys2detect, mMinFreq, mMaxFreq, mSubBandMinFreq, mSubBandMaxFreq, occupancyMinPower, SweptFrequencyOneDaySpectrogramChart.this); } }); // Close all the tabs. final Button closeTabsButton = new Button("Close Tabs"); closeTabsButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { tabPanel.clear(); tabPanel.add(spectrogramVerticalPanel, "[Spectrogram]"); tabPanel.add(occupancyPanel, "[Occupancy]"); tabPanel.selectTab(0); } }); grid.setWidget(0, 2, closeTabsButton); occupancyMinPowerSliderBar .addBarValueChangedHandler(new OccupancyMinPowerSliderHandler(occupancyMinPowerLabel, cutoff)); int initialValue = (int) ((double) (maxPower - cutoff) / (double) (maxPower - minPower) * 100 + 0.5); occupancyMinPowerSliderBar.setValue(initialValue); hpanel.add(occupancyMinPowerVpanel); spectrogramPanel.setTitle(helpString); //powerMapPanel.setTitle(helpString); spectrumAndOccupancyPanel = new VerticalPanel(); spectrumAndOccupancyPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); spectrogramVerticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); spectrogramVerticalPanel.add(spectrumAndOccupancyPanel); occupancyPanel = new VerticalPanel(); occupancyPanel.setWidth(canvasPixelWidth + "px"); occupancyPanel.setHeight(canvasPixelHeight + "px"); occupancyPanel.setPixelSize(canvasPixelWidth, canvasPixelHeight); occupancyPanel.setTitle(powerString); // Attach the next spectrogram panel. if (nextAcquisitionTime != tStartTimeUtc) { final Button nextDayButton = new Button(); nextDayButton.setEnabled(true); nextDayButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { logger.finer("getting next spectrogram"); try { mSelectionTime = nextAcquisitionTime; nextDayButton.setEnabled(false); mSpectrumBrowser.showWaitImage(); infoLabel.setText(COMPUTING_PLEASE_WAIT); mSpectrumBrowser.getSpectrumBrowserService().generateSingleDaySpectrogramAndOccupancy( mSensorId, mLat, mLon, mAlt, nextAcquisitionTime, mSys2detect, mMinFreq, mMaxFreq, mSubBandMinFreq, mSubBandMaxFreq, cutoff, SweptFrequencyOneDaySpectrogramChart.this); } catch (Throwable th) { logger.log(Level.SEVERE, "Error calling spectrum browser service", th); } } }); nextDayButton.setText("Next Day >"); grid.setWidget(0, 3, nextDayButton); } setSpectrogramImage(); drawOccupancyChart(); tabPanel = new TabPanel(); tabPanel.add(spectrogramVerticalPanel, "[Spectrogram]"); tabPanel.add(occupancyPanel, "[Occupancy]"); tabPanel.selectTab(0); vpanel.add(tabPanel); } catch (Throwable ex) { logger.log(Level.SEVERE, "Problem drawing specgtrogram", ex); } }
From source file:gwtquery.plugins.enhance.client.gwt.TabPanelWidgetFactory.java
License:Apache License
public TabPanel create(Element e) { TabPanel tabPanel = new TabPanel(); GQuery tabs = $(options.getTabSelector(), e); GQuery titles = $(options.getTitleSelector(), e); for (int i = 0; i < tabs.length(); i++) { GQuery tab = tabs.eq(i);/*from ww w . j a va2s. co m*/ GQuery title = titles.eq(i); Widget tabWidget = tab.widget(); if (tabWidget == null) { tabWidget = new WidgetsHtmlPanel(tab.get(0)); } tabPanel.add(tabWidget, title.get(0) != null ? title.text() : "Tab " + (i + 1)); } if (tabs.length() > 0) { tabPanel.selectTab(0); } WidgetsUtils.replaceOrAppend(e, tabPanel); return tabPanel; }
From source file:io.pelle.mango.client.gwt.modules.property.PropertyModuleUI.java
License:Open Source License
public PropertyModuleUI(PropertyModule module) { super(module, PropertyModule.UI_MODULE_ID); title = new HTML(MangoClientWeb.getInstance().getMessages().properties()); title.addStyleName(GwtStyles.TITLE); container.add(title);//from w w w . java 2 s . c om TabPanel categories = new TabPanel(); categories.setWidth("70%"); for (IPropertyCategory category : getModule().getRootCategory().getCategories()) { FlowPanel categoryPanel = new FlowPanel(); categoryPanel.getElement().getStyle().setMarginTop(1, Unit.EM); categories.add(categoryPanel, category.getName()); createProperties(categoryPanel, category); } if (categories.getWidgetCount() > 0) { categories.selectTab(0); container.add(categories); } }
From source file:net.officefloor.demo.stocks.client.StockGraphWidget.java
License:Open Source License
/** * Initiate.//from w ww . ja v a 2 s. com * * @param historyPeriod * Time in milliseconds to display history of prices. * @param redrawPeriod * Time in milliseconds to allow before complete redraw of the * graph. * @param width * Width. * @param height * Height. * @param stocks * {@link Stock} instances to graph. */ public StockGraphWidget(final long historyPeriod, final long redrawPeriod, final String width, final String height, Stock... stocks) { // Create sorted copy of stocks final Stock[] orderedStocks = new Stock[stocks.length]; for (int i = 0; i < orderedStocks.length; i++) { orderedStocks[i] = stocks[i]; } Arrays.sort(orderedStocks, new Comparator<Stock>() { @Override public int compare(Stock a, Stock b) { return String.CASE_INSENSITIVE_ORDER.compare(a.getName(), b.getName()); } }); // Load the chart visualisation Runnable loadGraph = new Runnable() { @Override public void run() { // Provide tab panel for graphs TabPanel tab = new TabPanel(); tab.setWidth(width); tab.getTabBar().setWidth(width); tab.getDeckPanel().setWidth(width); StockGraphWidget.this.add(tab); // Load each graph onto a tab final StockGraph[] graphs = new StockGraph[orderedStocks.length]; for (int i = 0; i < orderedStocks.length; i++) { Stock stock = orderedStocks[i]; // Create the stock graph StockGraph graph = new StockGraph(stock, historyPeriod, redrawPeriod, width, height); graphs[i] = graph; // Add the stock graph tab.add(graph.getChart(), stock.getName()); } // Provide the selection handler tab.addSelectionHandler(new SelectionHandler<Integer>() { @Override public void onSelection(SelectionEvent<Integer> event) { // Unselect all graphs for (StockGraph graph : graphs) { graph.setSelected(false); } // Select the graph for the tab Integer tabIndex = event.getSelectedItem(); graphs[tabIndex.intValue()].setSelected(true); } }); // Display first tab selected (also sets up graph) tab.selectTab(0); } }; VisualizationUtils.loadVisualizationApi(loadGraph, AnnotatedTimeLine.PACKAGE); }
From source file:net.sf.mmm.client.ui.impl.gwt.widget.panel.adapter.UiWidgetAdapterGwtTabLayoutPanel.java
License:Apache License
/** * {@inheritDoc}/* w w w . j a v a 2 s. c o m*/ */ @Override protected TabPanel createToplevelWidget() { TabPanel tabLayoutPanel = new TabPanel(); // new TabLayoutPanel(1.5, Unit.EM); // tabLayoutPanel.setWidth("100%"); return tabLayoutPanel; }
From source file:org.apache.luke.client.LukeInspector.java
License:Apache License
public void onModuleLoad() { final RootPanel rootPanel = RootPanel.get(); CaptionPanel cptnpnlNewPanel = new CaptionPanel("New panel"); cptnpnlNewPanel.setCaptionHTML("Luke version 5.0"); rootPanel.add(cptnpnlNewPanel, 10, 10); cptnpnlNewPanel.setSize("959px", "652px"); TabPanel tabPanel = new TabPanel(); cptnpnlNewPanel.setContentWidget(tabPanel); tabPanel.setSize("5cm", "636px"); //LuceneIndexLoader.loadIndex(pName, this); SplitLayoutPanel splitLayoutPanel = new SplitLayoutPanel(); tabPanel.add(splitLayoutPanel, "Index overview", false); tabPanel.setVisible(true);/*w w w . j a va 2 s . c o m*/ splitLayoutPanel.setSize("652px", "590px"); SplitLayoutPanel splitLayoutPanel_1 = new SplitLayoutPanel(); splitLayoutPanel.addNorth(splitLayoutPanel_1, 288.0); Label lblIndexStatistics = new Label("Index statistics"); lblIndexStatistics.setDirectionEstimator(true); lblIndexStatistics.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); splitLayoutPanel_1.addNorth(lblIndexStatistics, 26.0); VerticalPanel verticalPanel = new VerticalPanel(); splitLayoutPanel_1.addWest(verticalPanel, 125.0); Label lblTest = new Label("Index name:"); verticalPanel.add(lblTest); lblTest.setWidth("109px"); Label lblTest_1 = new Label("# fields:"); verticalPanel.add(lblTest_1); Label lblNumber = new Label("# documents:"); verticalPanel.add(lblNumber); lblNumber.setWidth("101px"); Label lblTerms = new Label("# terms:"); verticalPanel.add(lblTerms); Label lblHasDeletions = new Label("Has deletions?"); verticalPanel.add(lblHasDeletions); Label lblNewLabel = new Label("Optimised?"); verticalPanel.add(lblNewLabel); Label lblIndexVersion = new Label("Index version:"); verticalPanel.add(lblIndexVersion); SplitLayoutPanel splitLayoutPanel_2 = new SplitLayoutPanel(); splitLayoutPanel.addWest(splitLayoutPanel_2, 240.0); // Create name column. TextColumn<Field> nameColumn = new TextColumn<Field>() { @Override public String getValue(Field field) { return field.getName(); } }; // Make the name column sortable. nameColumn.setSortable(true); // Create termCount column. TextColumn<Field> termCountColumn = new TextColumn<Field>() { @Override public String getValue(Field contact) { return contact.getTermCount(); } }; // Create decoder column. TextColumn<Field> decoderColumn = new TextColumn<Field>() { @Override public String getValue(Field contact) { return contact.getDecoder(); } }; final CellTable<Field> cellTable = new CellTable<Field>(); cellTable.addColumn(nameColumn, "Name"); cellTable.addColumn(termCountColumn, "Term count"); cellTable.addColumn(decoderColumn, "Decoder"); cellTable.setRowCount(FieldsDummyData.Fields.size(), true); // Set the range to display. In this case, our visible range is smaller than // the data set. cellTable.setVisibleRange(0, 3); // Create a data provider. AsyncDataProvider<Field> dataProvider = new AsyncDataProvider<Field>() { @Override protected void onRangeChanged(HasData<Field> display) { final Range range = display.getVisibleRange(); // Get the ColumnSortInfo from the table. final ColumnSortList sortList = cellTable.getColumnSortList(); // This timer is here to illustrate the asynchronous nature of this data // provider. In practice, you would use an asynchronous RPC call to // request data in the specified range. new Timer() { @Override public void run() { int start = range.getStart(); int end = start + range.getLength(); // This sorting code is here so the example works. In practice, you // would sort on the server. Collections.sort(FieldsDummyData.Fields, new Comparator<Field>() { public int compare(Field o1, Field o2) { if (o1 == o2) { return 0; } // Compare the name columns. int diff = -1; if (o1 != null) { diff = (o2 != null) ? o1.getName().compareTo(o2.getName()) : 1; } return sortList.get(0).isAscending() ? diff : -diff; } }); List<Field> dataInRange = FieldsDummyData.Fields.subList(start, end); // Push the data back into the list. cellTable.setRowData(start, dataInRange); } }.schedule(2000); } }; // Connect the list to the data provider. dataProvider.addDataDisplay(cellTable); // Add a ColumnSortEvent.AsyncHandler to connect sorting to the // AsyncDataPRrovider. AsyncHandler columnSortHandler = new AsyncHandler(cellTable); cellTable.addColumnSortHandler(columnSortHandler); // We know that the data is sorted alphabetically by default. cellTable.getColumnSortList().push(nameColumn); splitLayoutPanel_2.add(cellTable); SplitLayoutPanel splitLayoutPanel_3 = new SplitLayoutPanel(); splitLayoutPanel.addEast(splitLayoutPanel_3, 215.0); StackPanel stackPanel = new StackPanel(); rootPanel.add(stackPanel, 714, 184); stackPanel.setSize("259px", "239px"); FlowPanel flowPanel = new FlowPanel(); stackPanel.add(flowPanel, "Open index", false); flowPanel.setSize("100%", "100%"); TextBox textBox = new TextBox(); flowPanel.add(textBox); Button btnNewButton = new Button("..."); btnNewButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { DirectoryLister directoryLister = new DirectoryLister(); directoryLister.setPopupPosition(rootPanel.getAbsoluteLeft() + rootPanel.getOffsetWidth() / 2, rootPanel.getAbsoluteTop() + rootPanel.getOffsetHeight() / 2); directoryLister.show(); } }); flowPanel.add(btnNewButton); // exception handling // credits: http://code.google.com/p/mgwt/source/browse/src/main/java/com/googlecode/mgwt/examples/showcase/client/ShowCaseEntryPoint.java?repo=showcase GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() { @Override public void onUncaughtException(Throwable e) { Window.alert("uncaught: " + e.getMessage()); String s = buildStackTrace(e, "RuntimeExceotion:\n"); Window.alert(s); e.printStackTrace(); } }); }
From source file:org.datacleaner.monitor.dashboard.widgets.CustomizeTimelineHandler.java
License:Open Source License
private Widget createPopupContent() { _customizeMetricsPanel = new CustomizeMetricsPanel(_service, _timelinePanel.getTenantIdentifier(), _timelinePanel.getTimelineDefinition()) { @Override/*from www. jav a 2 s . co m*/ protected void onMetricsLoaded() { super.onMetricsLoaded(); _popup.center(); } }; _customizeChartOptionsPanel = new CustomizeChartOptionsPanel( _timelinePanel.getTimelineDefinition().getChartOptions()); final TabPanel tabPanel = new TabPanel(); tabPanel.add(_customizeMetricsPanel, "Metrics"); tabPanel.add(_customizeChartOptionsPanel, "Chart options"); tabPanel.selectTab(0); return tabPanel; }
From source file:org.dataconservancy.dcs.access.client.SeadApp.java
License:Apache License
public void onModuleLoad() { mainHorz = new FlowPanel(); accessurl_tb = new TextBox(); main = new DockLayoutPanel(Unit.PX); main.setStylePrimaryName("Main"); mainHorz.add(main);/*from w w w. j a v a 2 s. c om*/ //header parameters header = new VerticalPanel(); header.setStylePrimaryName("TopHeader"); HTML footer = new HTML(); //Standard SEAD footer (see http://sead-data.net/) footer.setHTML("<footer id=\"colophon\" class=\"um-scope clearfix\">\n" + "<div class=\"footer-socket-wrapper clearfix\">\n" + "<div class=\"inner-wrap\">\n" + "<div class=\"footer-socket-area\">\n" + "<div class=\"copyright\"><img id=\"nsf\" src=\"http://sead-data.net/wp-content/uploads/2014/06/nsf2.png\" alt=\"NSF\" height=\"30px\" width=\"30px\">SEAD is funded by the National Science Foundation under cooperative agreement #OCI0940824.</div>\n" + "<nav class=\"small-menu\">\n" + "<div class=\"menu-footer-menu-container\"> <ul id=\"menu-footer-menu\" class=\"menu\">\n" + "<a href=\"http://sead-data.net/contactus/\">Contact Us</a></ul></div>" + "</nav>\n" + "</div>\n" + "</div>\n" + "</div>\n" + "</footer>"); outerMoreLinks = new HorizontalPanel(); outerMoreLinks.setStyleName("MoreLinkStyle"); final Grid moreLinks = new Grid(1, 4); moreLinks.setCellPadding(7); Button browseButton = new Button("Browse Data"); Button uploadButton = new Button("Publish Data"); browseButton.setStyleName("OptionButtons"); uploadButton.setStyleName("OptionButtons"); ClickHandler goUploadData1 = new ClickHandler() { public void onClick(ClickEvent event) { History.newItem(SeadState.AUTH.toToken()); } }; ClickHandler browseDataHandler = new ClickHandler() { public void onClick(ClickEvent event) { History.newItem("browse"); } }; uploadButton.addClickHandler(goUploadData1); browseButton.addClickHandler(browseDataHandler); moreLinks.setWidget(0, 1, browseButton); moreLinks.setWidget(0, 2, uploadButton); outerMoreLinks.add(moreLinks); facetOuterPanel = new FlowPanel(); facetContent = new ScrollPanel(); facetContent.setHeight("80%"); facetContent.setStyleName("CurvedPanel"); facetOuterPanel.setStyleName("FacetPanel"); facetOuterPanel.add(facetContent); loginPanel = new FlowPanel(); loginButton = new Button("LOG IN"); loginButton.setStyleName("LoginButton"); loginPanel.add(loginButton); loginButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { History.newItem("login"); } }); final Panel headerOuterPanel = new FlowPanel(); headerOuterPanel.setStyleName("HeaderOuter"); HorizontalPanel middlePanel = new HorizontalPanel(); middlePanel.setStyleName("Menu"); optionsHorz = new HorizontalPanel(); dataSearch = Util.label("Data Search", "Option"); // OptionsHorz.add(dataSearch); uploadData = Util.label("Upload Data", "Option"); // OptionsHorz.add(uploadData); home = Util.label("Home", "Option"); home.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { History.newItem(SeadState.HOME.toToken()); } }); optionsHorz.add(home); middlePanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); middlePanel.add(optionsHorz); middlePanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); headerOuterPanel.add(middlePanel); headerOuterPanel.setStyleName("Gradient"); ClickHandler goDataSearch = new ClickHandler() { public void onClick(ClickEvent event) { History.newItem(SeadState.HOME.toToken()); } }; dataSearch.addClickHandler(goDataSearch); ClickHandler goUploadData = new ClickHandler() { public void onClick(ClickEvent event) { History.newItem(SeadState.AUTH.toToken()); } }; uploadData.addClickHandler(goUploadData); adminPage = Util.label("Administration", "Option"); ClickHandler goAdminPage = new ClickHandler() { public void onClick(ClickEvent event) { History.newItem(SeadState.ADMIN.toToken()); } }; adminPage.addClickHandler(goAdminPage); curatorPage = Util.label("Curate", "Option"); ClickHandler goCuratorPage = new ClickHandler() { public void onClick(ClickEvent event) { History.newItem(SeadState.CURATOR.toToken()); } }; curatorPage.addClickHandler(goCuratorPage); activityPage = Util.label("Activity", "Option"); ClickHandler goActivityPage = new ClickHandler() { public void onClick(ClickEvent event) { History.newItem(SeadState.ACTIVITY.toToken()); } }; activityPage.addClickHandler(goActivityPage); dataHistory = Util.label("Data Ingest Monitor", "Option"); ClickHandler dataHistoryPage = new ClickHandler() { public void onClick(ClickEvent event) { History.newItem(SeadState.MONITOR.toToken()); } }; dataHistory.addClickHandler(dataHistoryPage); centerPanel = new ScrollPanel(); main.addNorth(header, 200); //Note order of insertion is important - adding south after west (and then changing the size of the west widget) // shifts the south widget to the right. If it is added first, it stays fixed. main.addSouth(footer, 51); main.addWest(facetOuterPanel, 250); main.addEast(loginPanel, 200); main.add(centerPanel); centerPanel.setStylePrimaryName("centerPanel"); uploadPanel = new TabPanel(); uploadPanel.setStylePrimaryName("UploadTabPanel"); localUpload = new FlowPanel(); mediciUpload = new FlowPanel(); bagUpload = new FlowPanel(); uploadPanel.add(localUpload, "Local Upload"); uploadPanel.add(mediciUpload, "Project Upload"); uploadPanel.selectTab(1); publishData = new FlowPanel(); publishData.addStyleName("publishPanel"); //Main SEAD menu (see http://sead-data.net/) header.add(getSeadMenu()); //The VA tab panes/menu header.add(headerOuterPanel); RootLayoutPanel.get().add(mainHorz); final AsyncCallback<UserSession> cb = new AsyncCallback<UserSession>() { public void onSuccess(UserSession result) { if (result.isSession()) { if (result.getRole() == Role.ROLE_ADMIN) { initAdminLogin(); } else if (result.getRole() == Role.ROLE_CURATOR) { initCuratorLogin(); } else { initUserLogin(); } initLogoutButton(); String displayName = ""; if (result.getfName() != null) displayName = result.getfName(); if (result.getlName() != null) displayName += " " + result.getlName(); Label displayNameLabel = new Label(); displayNameLabel.setStyleName("welcomeFont"); displayNameLabel.setText("Welcome " + displayName); loginPanel.clear(); loginPanel.add(displayNameLabel); if (!logoutButton.isAttached()) loginPanel.add(logoutButton); activityPage.setStyleName("Option"); adminPage.setStyleName("Option"); home.setStyleName("OptionSelected"); uploadData.setStyleName("Option"); curatorPage.setStyleName("Option"); } else loginPanel.add(loginButton); } public void onFailure(Throwable error) { new ErrorPopupPanel("Failed to login: " + error.getMessage()).show(); } }; History.addValueChangeHandler(new ValueChangeHandler<String>() { public void onValueChange(ValueChangeEvent<String> event) { historyChanged(event.getValue()); } }); // load config HttpGet.request(GWT.getModuleBaseURL() + "Config.properties", new HttpGet.Callback<String>() { public void failure(String error) { Window.alert("Failed to load config: " + error); } public void success(String result) { String[] pairs = result.trim().split( //"\\w*(\n|\\=)\\w*"); "\\w*\n|\\=\\w*"); for (int i = 0; i + 1 < pairs.length;) { String name = pairs[i++].trim(); String value = pairs[i++].trim(); if (name.equals("accessServiceURL")) { accessurl = value; updateAccessServiceUrl(); deposit_endpoint = accessurl + "deposit/"; } if (name.equals("datastreamServletUrl")) { datastreamUrl = value; } if (name.equals("bagItServiceURL")) { bagIturl = value; } if (name.equals("registryUrl")) { registryUrl = value; } if (name.equals("roUrl")) { roUrl = value; } if (name.equals("queryPath")) { queryPath = value; } if (name.equals("tmp")) { tmpHome = value; } if (name.equals("admins")) { String adminStr = value; admins = adminStr.split(";"); } } userService.checkSession(null, cb); History.fireCurrentHistoryState(); } }); if (Constants.predicateViewMap == null) { Constants.predicateViewMap = new HashMap<String, String>(); Constants.viewPredicateMap = new HashMap<String, String>(); HttpGet.request(GWT.getModuleBaseURL() + "CuratorDisplayConfig.properties", new HttpGet.Callback<String>() { public void failure(String error) { new ErrorPopupPanel("Failed to load config: " + error).show(); } public void success(String result) { String[] pairs = result.trim().split( //"\\w*(\n|\\=)\\w*"); "\n|\\="); for (int i = 0; i + 1 < pairs.length;) { String name = pairs[i++].trim(); String value = pairs[i++].trim(); Constants.predicateViewMap.put(name, value); Constants.viewPredicateMap.put(value, name); } } }); } //Init DB }