Browse files

Fixed issue #29: remove obsolete SwingComponentUtils methods.

  • Loading branch information...
1 parent 1d52b7b commit d4d89b2d28ed312f32378ec518c16865c2320f03 @jawi committed Feb 18, 2011
View
30 api/ols.mediawiki
@@ -212,33 +212,3 @@ that multiple (exporter) classes can be defined by separating them with comma's,
'''NOTE:''' both mentioned lines are needed! If one of them is omitted from the resulting JAR file, it
will be considered an invalid extension and the results are not (well) defined!
-
-== To do ==
-
-# support easy/easier upgrade procedure;
-# VCD dump is ignoring the selected number of channels and always dumps all 32 channels. Also the VCD format allows to list for each sample only the channels that have change value; instead they are all listed (reported by zelea2);
-# With RLE enabled, the frequency appears to be changing with different sample rates (reported by nickandrew);
-# support OLS-device profiles for BP, regular OLS and SUMP;
-# make it easier to jump to another transition in a channel (in case you're zoomed in really close; jack.gassett);
-# make the "unused" option default in the UART analyzer, and place it on top (reported by miro);
-# make it possible to define any sampling speed (to support external clocks; reported by miro);
-# support zoom-window, and zoom-region functionality (reported by frankalicious);
-# Make it easier to remove set cursors (reported by pppd);
-# Make it possible to edit cursor labels (reported by pppd);
-# Allow cursors to snap to signal edges (reported by pppd);
-# Allow selecting two cursors and show timing information (reported by pppd);
-# "Mask" out unused channels to hide transients and ringing on unused signals (reported by miro);
-# real time acquisition. for e.g. trough named pipe or other resource (reported by arhi);
-# client side triggers for the real time acquisition stream (reported by arhi);
-# make the tools aware of the device capabilities (5 channels for BP iso 32, etc.);
-# show timing measurements between edges, or from rising to rising or falling to falling edges;
-# configurable colors would be nice, so that the user can set them to match the probes;
-# integrate analysis reports & annotations into one and make it configurable which one is shown/used;
-# make the annotated data configurable regarding the displayed text and colors;
-# make distinction between decoding tools and other tools;
-# provide easier access to analysis tools;
-# analysis protocol results synopsis (client: <bla bla>, master: <bla bla>, client ...);
-# support reordering of channels with DnD;
-# support overlay of signals, to view differences between two, or more signal captures;
-# add option to auto-center captured signal on trigger moment;
-
View
86 device.logicsniffer/src/main/java/org/sump/device/logicsniffer/LogicSnifferConfigDialog.java
@@ -21,30 +21,24 @@
package org.sump.device.logicsniffer;
+import static nl.lxtreme.ols.util.swing.SwingComponentUtils.*;
+
import java.awt.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
+import java.awt.event.*;
import javax.swing.*;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-import javax.swing.plaf.basic.BasicComboBoxRenderer;
-
-import nl.lxtreme.ols.api.Configurable;
-import nl.lxtreme.ols.api.UserSettings;
-import nl.lxtreme.ols.util.DisplayUtils;
-import nl.lxtreme.ols.util.NumberUtils;
+import javax.swing.event.*;
+import javax.swing.plaf.basic.*;
+
+import nl.lxtreme.ols.api.*;
+import nl.lxtreme.ols.util.*;
import nl.lxtreme.ols.util.NumberUtils.UnitDefinition;
-import nl.lxtreme.ols.util.swing.SpringLayoutUtils;
-import nl.lxtreme.ols.util.swing.StandardActionFactory;
+import nl.lxtreme.ols.util.swing.*;
import nl.lxtreme.ols.util.swing.StandardActionFactory.CloseAction.Closeable;
-import nl.lxtreme.ols.util.swing.SwingComponentUtils;
-import nl.lxtreme.ols.util.swing.component.JLazyComboBox;
-import nl.lxtreme.rxtx.CommPortUtils;
+import nl.lxtreme.ols.util.swing.component.*;
+import nl.lxtreme.rxtx.*;
+
import org.sump.device.logicsniffer.LogicSnifferConfig.ClockSource;
-import static nl.lxtreme.ols.util.swing.SwingComponentUtils.createRightAlignedLabel;
/**
@@ -240,7 +234,7 @@ private String updateLabel( final int aBeforeRatio, final int aAfterRatio )
/**
* Creates a new LogicSnifferConfigDialog instance.
- *
+ *
* @param aParent
* the parent window of this dialog;
* @param aConfig
@@ -338,7 +332,7 @@ else if ( l.equals( "Capture" ) )
/**
* Properly closes the dialog. This method makes sure timer and worker thread
* are stopped before the dialog is closed.
- *
+ *
* @see nl.lxtreme.ols.util.swing.StandardActionFactory.CloseAction.Closeable#close()
*/
public final void close()
@@ -355,50 +349,52 @@ public void readPreferences( final UserSettings aSettings )
this.listening = false;
try
{
- SwingComponentUtils.setSelectedItem( this.portSelect, aSettings.get( "port", null ) );
- SwingComponentUtils.setSelectedIndex( this.portRateSelect, aSettings.getInt( "portRate", -1 ) );
- SwingComponentUtils.setSelectedIndex( this.sourceSelect, aSettings.getInt( "source", -1 ) );
- SwingComponentUtils.setSelectedIndex( this.numberSchemeSelect, aSettings.getInt( "numberScheme", -1 ) );
- SwingComponentUtils.setSelectedIndex( this.speedSelect, aSettings.getInt( "speed", -1 ) );
- SwingComponentUtils.setSelectedIndex( this.sizeSelect, aSettings.getInt( "size", -1 ) );
- SwingComponentUtils
- .setSelected( this.maxSampleSize, Boolean.valueOf( aSettings.getBoolean( "autosize", false ) ) );
+ final String preferredPortName = aSettings.get( "port", null );
+ if ( ( preferredPortName != null ) && !"null".equals( preferredPortName ) )
+ {
+ this.portSelect.setSelectedItem( preferredPortName );
+ }
+ this.portRateSelect.setSelectedIndex( aSettings.getInt( "portRate", -1 ) );
+ this.sourceSelect.setSelectedIndex( aSettings.getInt( "source", -1 ) );
+ this.numberSchemeSelect.setSelectedIndex( aSettings.getInt( "numberScheme", -1 ) );
+ this.speedSelect.setSelectedIndex( aSettings.getInt( "speed", -1 ) );
+ this.sizeSelect.setSelectedIndex( aSettings.getInt( "size", -1 ) );
+ this.maxSampleSize.setSelected( aSettings.getBoolean( "autosize", false ) );
this.ratioSlider.setValue( aSettings.getInt( "ratio", TriggerRatioChangeListener.DEFAULT_RATIO ) );
- SwingComponentUtils.setSelected( this.filterEnable, Boolean.valueOf( aSettings.getBoolean( "filter", false ) ) );
- SwingComponentUtils.setSelected( this.rleEnable, Boolean.valueOf( aSettings.getBoolean( "rle", false ) ) );
- SwingComponentUtils.setSelected( this.triggerEnable, Boolean.valueOf( aSettings.getBoolean( "trigger", false ) ) );
- SwingComponentUtils.setSelectedIndex( this.triggerTypeSelect, aSettings.getInt( "triggerType", -1 ) );
+ this.filterEnable.setSelected( aSettings.getBoolean( "filter", false ) );
+ this.rleEnable.setSelected( aSettings.getBoolean( "rle", false ) );
+ this.triggerEnable.setSelected( aSettings.getBoolean( "trigger", false ) );
+ this.triggerTypeSelect.setSelectedIndex( aSettings.getInt( "triggerType", -1 ) );
for ( int stage = 0; stage < this.triggerStages; stage++ )
{
final String prefix = "triggerStage." + stage;
this.triggerDelay[stage].setText( aSettings.get( prefix + ".delay", "" ) );
- SwingComponentUtils.setSelectedIndex( this.triggerLevel[stage], aSettings.getInt( prefix + ".level", -1 ) );
- SwingComponentUtils.setSelectedIndex( this.triggerMode[stage], aSettings.getInt( prefix + ".mode", -1 ) );
- SwingComponentUtils.setSelectedIndex( this.triggerChannel[stage], aSettings.getInt( prefix + ".channel", -1 ) );
+ this.triggerLevel[stage].setSelectedIndex( aSettings.getInt( prefix + ".level", -1 ) );
+ this.triggerMode[stage].setSelectedIndex( aSettings.getInt( prefix + ".mode", -1 ) );
+ this.triggerChannel[stage].setSelectedIndex( aSettings.getInt( prefix + ".channel", -1 ) );
final String mask = aSettings.get( prefix + ".mask", "" );
for ( int i = 0; ( i < 32 ) && ( i < mask.length() ); i++ )
{
- SwingComponentUtils.setSelected( this.triggerMask[stage][i], Boolean.valueOf( mask.charAt( i ) == '1' ) );
+ this.triggerMask[stage][i].setSelected( mask.charAt( i ) == '1' );
}
final String value = aSettings.get( prefix + ".value", "" );
for ( int i = 0; ( i < 32 ) && ( i < value.length() ); i++ )
{
- SwingComponentUtils.setSelected( this.triggerValue[stage][i], Boolean.valueOf( value.charAt( i ) == '1' ) );
+ this.triggerValue[stage][i].setSelected( value.charAt( i ) == '1' );
}
- SwingComponentUtils.setSelected( this.triggerStart[stage],
- Boolean.valueOf( aSettings.getBoolean( prefix + ".startCapture", false ) ) );
+ this.triggerStart[stage].setSelected( aSettings.getBoolean( prefix + ".startCapture", false ) );
}
final String group = aSettings.get( "channelGroup", "" );
for ( int i = 0; ( i < 4 ) && ( i < group.length() ); i++ )
{
- SwingComponentUtils.setSelected( this.channelGroup[i], Boolean.valueOf( group.charAt( i ) == '1' ) );
+ this.channelGroup[i].setSelected( group.charAt( i ) == '1' );
}
updateConfig();
@@ -483,7 +479,7 @@ public void writePreferences( final UserSettings aSettings )
/**
* Updates the controls to a given device type.
- *
+ *
* @param aType
* the device type to update the controls for, cannot be
* <code>null</code>.
@@ -522,7 +518,7 @@ private void buildDialog()
/**
* Creates the "acquisition settings" pane.
- *
+ *
* @return a panel, never <code>null</code>.
*/
private JPanel createAcquisitionSettingsPane()
@@ -571,7 +567,7 @@ private JPanel createAcquisitionSettingsPane()
/**
* Creates the "connection settings" pane.
- *
+ *
* @return a panel, never <code>null</code>.
*/
private JPanel createConnectionSettingsPane()
@@ -688,7 +684,7 @@ private JPanel createTriggerPane()
/**
* Determines the maximum sample count that is supported by the OLS for a
* given number of channel groups.
- *
+ *
* @return a maximum sample count, or -1 if no maximum could be determined.
*/
private int determineMaxSampleCount()
@@ -883,7 +879,7 @@ public void itemStateChanged( final ItemEvent aEvent )
/**
* Sets the enabled state of all available trigger check boxes and the ratio
* select.
- *
+ *
* @param aEnable
* <code>true</code> to enable trigger configuration fields,
* <code>false</code> to disable them
View
8 device.test/src/main/java/nl/lxtreme/ols/device/test/TestDeviceDialog.java
@@ -115,14 +115,14 @@ public int getDataLength()
@Override
public void readPreferences( final UserSettings aSettings )
{
- SwingComponentUtils.setSelectedIndex( this.channelsCombo, aSettings.getInt( "channels", -1 ) );
- SwingComponentUtils.setSelectedIndex( this.dataFunctionCombo, aSettings.getInt( "dataFunction", -1 ) );
- SwingComponentUtils.setSelectedIndex( this.dataLengthCombo, aSettings.getInt( "dataLength", -1 ) );
+ this.channelsCombo.setSelectedIndex( aSettings.getInt( "channels", -1 ) );
+ this.dataFunctionCombo.setSelectedIndex( aSettings.getInt( "dataFunction", -1 ) );
+ this.dataLengthCombo.setSelectedIndex( aSettings.getInt( "dataLength", -1 ) );
}
/**
* Shows this dialog on screen.
- *
+ *
* @return <code>true</code> if this dialog is confirmed, <code>false</code>
* if it was cancelled.
*/
View
14 tool.1wire/src/main/java/nl/lxtreme/ols/tool/onewire/OneWireAnalyserDialog.java
@@ -121,8 +121,8 @@ public void onToolWorkerReady( final OneWireDataSet aAnalysisResult )
@Override
public void readPreferences( final UserSettings aSettings )
{
- SwingComponentUtils.setSelectedIndex( this.owMode, aSettings.getInt( "owMode", -1 ) );
- SwingComponentUtils.setSelectedIndex( this.owLine, aSettings.getInt( "owLine", -1 ) );
+ this.owMode.setSelectedIndex( aSettings.getInt( "owMode", -1 ) );
+ this.owLine.setSelectedIndex( aSettings.getInt( "owLine", -1 ) );
}
/**
@@ -144,7 +144,7 @@ public void reset()
/**
* set the controls of the dialog enabled/disabled
- *
+ *
* @param aEnabled
* status of the controls
*/
@@ -180,7 +180,7 @@ protected void setupToolWorker( final OneWireAnalyserWorker aToolWorker )
/**
* Creates the HTML template for exports to HTML.
- *
+ *
* @param aExporter
* the HTML exporter instance to use, cannot be <code>null</code>.
* @return a HTML exporter filled with the template, never <code>null</code>.
@@ -251,7 +251,7 @@ private JPanel createPreviewPane()
/**
* Creates the settings pane.
- *
+ *
* @return a settings pane, never <code>null</code>.
*/
private JComponent createSettingsPane()
@@ -285,7 +285,7 @@ private JComponent createSettingsPane()
/**
* Returns an "empty" HTML page.
- *
+ *
* @return an empty HTML page string, never <code>null</code>.
*/
private String getEmptyHtmlPage()
@@ -352,7 +352,7 @@ private void initDialog()
/**
* generate a HTML page
- *
+ *
* @param aEmpty
* if this is true an empty output is generated
* @return String with HTML data
View
22 tool.i2c/src/main/java/nl/lxtreme/ols/tool/i2c/I2CProtocolAnalysisDialog.java
@@ -47,7 +47,7 @@
/**
* Provides a main dialog for the I2C analyser.
- *
+ *
* @author Frank Kunz
* @author J.W. Janssen
*/
@@ -139,13 +139,13 @@ public void onToolWorkerReady( final I2CDataSet aAnalysisResult )
*/
public void readPreferences( final UserSettings aSettings )
{
- SwingComponentUtils.setSelectedIndex( this.lineA, aSettings.getInt( "lineA", -1 ) );
- SwingComponentUtils.setSelectedIndex( this.lineB, aSettings.getInt( "lineB", -1 ) );
+ this.lineA.setSelectedIndex( aSettings.getInt( "lineA", -1 ) );
+ this.lineB.setSelectedIndex( aSettings.getInt( "lineB", -1 ) );
- SwingComponentUtils.setSelected( this.detectSTART, Boolean.valueOf( aSettings.getBoolean( "detectStart", true ) ) );
- SwingComponentUtils.setSelected( this.detectSTOP, Boolean.valueOf( aSettings.getBoolean( "detectStop", true ) ) );
- SwingComponentUtils.setSelected( this.detectNACK, Boolean.valueOf( aSettings.getBoolean( "detectNack", true ) ) );
- SwingComponentUtils.setSelected( this.detectACK, Boolean.valueOf( aSettings.getBoolean( "detectAck", true ) ) );
+ this.detectSTART.setSelected( aSettings.getBoolean( "detectStart", true ) );
+ this.detectSTOP.setSelected( aSettings.getBoolean( "detectStop", true ) );
+ this.detectNACK.setSelected( aSettings.getBoolean( "detectNack", true ) );
+ this.detectACK.setSelected( aSettings.getBoolean( "detectAck", true ) );
}
/**
@@ -197,7 +197,7 @@ else if ( I2CAnalyserWorker.LINE_B.equals( aSDAValue ) )
/**
* set the controls of the dialog enabled/disabled
- *
+ *
* @param aEnabled
* status of the controls
*/
@@ -323,7 +323,7 @@ protected void storeToHtmlFile( final File aSelectedFile, final I2CDataSet aAnal
/**
* Creates the HTML template for exports to HTML.
- *
+ *
* @param aExporter
* the HTML exporter instance to use, cannot be <code>null</code>.
* @return a HTML exporter filled with the template, never <code>null</code>.
@@ -478,7 +478,7 @@ public void itemStateChanged( final ItemEvent aEvent )
/**
* Returns an "empty" HTML page.
- *
+ *
* @return an empty HTML page string, never <code>null</code>.
*/
private String getEmptyHtmlPage()
@@ -545,7 +545,7 @@ private void initDialog()
/**
* generate a HTML page
- *
+ *
* @param aEmpty
* if this is true an empty output is generated
* @return String with HTML data
View
22 tool.jtag/src/main/java/nl/lxtreme/ols/tool/jtag/JTAGProtocolAnalysisDialog.java
@@ -46,7 +46,7 @@
/**
* The Dialog Class
- *
+ *
* @author Frank Kunz The dialog class draws the basic dialog with a grid
* layout. The dialog consists of three main parts. A settings panel, a
* table panel and three buttons.
@@ -133,10 +133,10 @@ public void onToolWorkerReady( final JTAGDataSet aAnalysisResult )
*/
public void readPreferences( final UserSettings aSettings )
{
- SwingComponentUtils.setSelectedIndex( this.tck, aSettings.getInt( "TCK", -1 ) );
- SwingComponentUtils.setSelectedIndex( this.tms, aSettings.getInt( "TMS", -1 ) );
- SwingComponentUtils.setSelectedIndex( this.tdi, aSettings.getInt( "TDI", -1 ) );
- SwingComponentUtils.setSelectedIndex( this.tdo, aSettings.getInt( "TDO", -1 ) );
+ this.tck.setSelectedIndex( aSettings.getInt( "TCK", -1 ) );
+ this.tms.setSelectedIndex( aSettings.getInt( "TMS", -1 ) );
+ this.tdi.setSelectedIndex( aSettings.getInt( "TDI", -1 ) );
+ this.tdo.setSelectedIndex( aSettings.getInt( "TDO", -1 ) );
}
/**
@@ -168,7 +168,7 @@ public void writePreferences( final UserSettings aSettings )
/**
* set the controls of the dialog enabled/disabled
- *
+ *
* @param aEnable
* status of the controls
*/
@@ -197,7 +197,7 @@ protected void setupToolWorker( final JTAGAnalyserWorker aToolWorker )
/**
* exports the table data to a CSV file
- *
+ *
* @param aFile
* File object
*/
@@ -237,7 +237,7 @@ protected void storeToCsvFile( final File aFile, final JTAGDataSet aDataSet )
/**
* stores the data to a HTML file
- *
+ *
* @param aFile
* file object
*/
@@ -260,7 +260,7 @@ protected void storeToHtmlFile( final File aFile, final JTAGDataSet aDataSet )
/**
* Creates the HTML template for exports to HTML.
- *
+ *
* @param aExporter
* the HTML exporter instance to use, cannot be <code>null</code>.
* @return a HTML exporter filled with the template, never <code>null</code>.
@@ -382,7 +382,7 @@ private JPanel createSettingsPane()
/**
* Generates an empty HTML page.
- *
+ *
* @return String with HTML data.
*/
private String getEmptyHtmlPage()
@@ -508,7 +508,7 @@ else if ( value == 15 )
/**
* generate a HTML page
- *
+ *
* @param aDataSet
* the data set to create the HTML page for, cannot be
* <code>null</code>.
View
21 tool.measure/src/main/java/nl/lxtreme/ols/tool/measure/MeasurementDialog.java
@@ -22,20 +22,21 @@
import static nl.lxtreme.ols.util.swing.SwingComponentUtils.*;
+
import java.awt.*;
import java.awt.event.*;
import java.beans.*;
import java.util.concurrent.*;
import java.util.logging.*;
import javax.swing.*;
-import javax.swing.SwingWorker.*;
+import javax.swing.SwingWorker.StateValue;
import nl.lxtreme.ols.api.*;
import nl.lxtreme.ols.api.data.*;
import nl.lxtreme.ols.api.tools.*;
import nl.lxtreme.ols.tool.base.*;
-import nl.lxtreme.ols.tool.measure.ClockFrequencyMeasureWorker.*;
+import nl.lxtreme.ols.tool.measure.ClockFrequencyMeasureWorker.ClockStats;
import nl.lxtreme.ols.util.*;
import nl.lxtreme.ols.util.swing.*;
@@ -212,7 +213,7 @@ else if ( StateValue.DONE.equals( state ) )
/**
* Sets the channel on which the clock-frequency should be determined.
- *
+ *
* @param aChannel
*/
public void setChannel( final int aChannel )
@@ -271,7 +272,7 @@ public void actionPerformed( final ActionEvent aEvent )
/**
* Creates a new MeasurementDialog instance (non modal).
- *
+ *
* @param aOwner
* the owning window;
* @param aTitle
@@ -317,9 +318,9 @@ public void dispose()
*/
public void readPreferences( final UserSettings aSettings )
{
- SwingComponentUtils.setSelectedIndex( this.cursorA, aSettings.getInt( "selectedCursorA", -1 ) );
- SwingComponentUtils.setSelectedIndex( this.cursorB, aSettings.getInt( "selectedCursorB", -1 ) );
- SwingComponentUtils.setSelectedIndex( this.clockChannelChooser, aSettings.getInt( "selectedClockChannel", -1 ) );
+ this.cursorA.setSelectedIndex( aSettings.getInt( "selectedCursorA", -1 ) );
+ this.cursorB.setSelectedIndex( aSettings.getInt( "selectedCursorB", -1 ) );
+ this.clockChannelChooser.setSelectedIndex( aSettings.getInt( "selectedClockChannel", -1 ) );
}
/**
@@ -418,7 +419,7 @@ private JPanel createCursorListingPane( final String[] aCursorNames )
* <p>
* Should be called from the EDT!
* </p>
- *
+ *
* @return a dialog panel, never <code>null</code>.
*/
private JComponent createDialogContent()
@@ -443,7 +444,7 @@ private JComponent createDialogContent()
/**
* Creates the pane on which the measurement results are shown.
- *
+ *
* @return a measurement panel, never <code>null</code>.
*/
private Component createMeasurementPane( final String[] aCursorNames )
@@ -516,7 +517,7 @@ public void itemStateChanged( final ItemEvent aEvent )
/**
* Returns the time of a cursor with a given index as display value.
- *
+ *
* @param aIndex
* the cursor index to get the time for, >= 0 && < 10.
* @return a display value for the cursor time, can be "not set" if the cursor
View
34 tool.spi/src/main/java/nl/lxtreme/ols/tool/spi/SPIProtocolAnalysisDialog.java
@@ -48,7 +48,7 @@
/**
* The Dialog Class
- *
+ *
* @author Frank Kunz The dialog class draws the basic dialog with a grid
* layout. The dialog consists of three main parts. A settings panel, a
* table panel and three buttons.
@@ -212,15 +212,15 @@ public void onToolWorkerReady( final SPIDataSet aAnalysisResult )
@Override
public void readPreferences( final UserSettings aSettings )
{
- SwingComponentUtils.setSelected( this.reportCS, Boolean.valueOf( aSettings.getBoolean( "reportCS", true ) ) );
- SwingComponentUtils.setSelected( this.honourCS, Boolean.valueOf( aSettings.getBoolean( "honourCS", false ) ) );
- SwingComponentUtils.setSelectedIndex( this.sck, aSettings.getInt( "sck", -1 ) );
- SwingComponentUtils.setSelectedIndex( this.miso, aSettings.getInt( "miso", -1 ) );
- SwingComponentUtils.setSelectedIndex( this.mosi, aSettings.getInt( "mosi", -1 ) );
- SwingComponentUtils.setSelectedIndex( this.cs, aSettings.getInt( "cs", -1 ) );
- SwingComponentUtils.setSelectedIndex( this.mode, aSettings.getInt( "mode", -1 ) );
- SwingComponentUtils.setSelectedIndex( this.bits, aSettings.getInt( "bits", -1 ) );
- SwingComponentUtils.setSelectedIndex( this.order, aSettings.getInt( "order", -1 ) );
+ this.reportCS.setSelected( aSettings.getBoolean( "reportCS", true ) );
+ this.honourCS.setSelected( aSettings.getBoolean( "honourCS", false ) );
+ this.sck.setSelectedIndex( aSettings.getInt( "sck", -1 ) );
+ this.miso.setSelectedIndex( aSettings.getInt( "miso", -1 ) );
+ this.mosi.setSelectedIndex( aSettings.getInt( "mosi", -1 ) );
+ this.cs.setSelectedIndex( aSettings.getInt( "cs", -1 ) );
+ this.mode.setSelectedIndex( aSettings.getInt( "mode", -1 ) );
+ this.bits.setSelectedIndex( aSettings.getInt( "bits", -1 ) );
+ this.order.setSelectedIndex( aSettings.getInt( "order", -1 ) );
}
/**
@@ -241,7 +241,7 @@ public void reset()
/**
* Sets the auto detected SPI mode to the given value.
- *
+ *
* @param aMode
* the detected SPI mode, cannot be <code>null</code>.
*/
@@ -269,7 +269,7 @@ public void writePreferences( final UserSettings aSettings )
/**
* set the controls of the dialog enabled/disabled
- *
+ *
* @param aEnable
* status of the controls
*/
@@ -322,7 +322,7 @@ protected void setupToolWorker( final SPIAnalyserWorker aToolWorker )
/**
* exports the table data to a CSV file
- *
+ *
* @param aFile
* File object
*/
@@ -363,7 +363,7 @@ protected void storeToCsvFile( final File aFile, final SPIDataSet aDataSet )
/**
* stores the data to a HTML file
- *
+ *
* @param aFile
* file object
*/
@@ -386,7 +386,7 @@ protected void storeToHtmlFile( final File aFile, final SPIDataSet aDataSet )
/**
* Creates the HTML template for exports to HTML.
- *
+ *
* @param aExporter
* the HTML exporter instance to use, cannot be <code>null</code>.
* @return a HTML exporter filled with the template, never <code>null</code>.
@@ -542,7 +542,7 @@ private JPanel createSettingsPane()
/**
* Generates an empty HTML page.
- *
+ *
* @return String with HTML data.
*/
private String getEmptyHtmlPage()
@@ -596,7 +596,7 @@ private void initDialog()
/**
* generate a HTML page
- *
+ *
* @param aDataSet
* the data set to create the HTML page for, cannot be
* <code>null</code>.
View
5 tool.state/src/main/java/nl/lxtreme/ols/tool/state/StateAnalysisDialog.java
@@ -22,6 +22,7 @@
import java.awt.*;
+
import javax.swing.*;
import nl.lxtreme.ols.api.*;
@@ -68,8 +69,8 @@ public StateAnalysisDialog( final Window aOwner, final String aName )
@Override
public void readPreferences( final UserSettings aSettings )
{
- SwingComponentUtils.setSelectedIndex( this.edgeSelect, aSettings.getInt( "edge", -1 ) );
- SwingComponentUtils.setSelectedIndex( this.channelSelect, aSettings.getInt( "channel", -1 ) );
+ this.edgeSelect.setSelectedIndex( aSettings.getInt( "edge", -1 ) );
+ this.channelSelect.setSelectedIndex( aSettings.getInt( "channel", -1 ) );
}
/**
View
38 tool.uart/src/main/java/nl/lxtreme/ols/tool/uart/UARTProtocolAnalysisDialog.java
@@ -46,7 +46,7 @@
/**
* The Dialog Class
- *
+ *
* @author Frank Kunz The dialog class draws the basic dialog with a grid
* layout. The dialog consists of three main parts. A settings panel, a
* table panel and three buttons.
@@ -143,18 +143,18 @@ public void onToolWorkerReady( final UARTDataSet aAnalysisResult )
@Override
public void readPreferences( final UserSettings aSettings )
{
- SwingComponentUtils.setSelectedIndex( this.rxd, aSettings.getInt( "rxd", -1 ) );
- SwingComponentUtils.setSelectedIndex( this.txd, aSettings.getInt( "txd", -1 ) );
- SwingComponentUtils.setSelectedIndex( this.cts, aSettings.getInt( "cts", -1 ) );
- SwingComponentUtils.setSelectedIndex( this.rts, aSettings.getInt( "rts", -1 ) );
- SwingComponentUtils.setSelectedIndex( this.dtr, aSettings.getInt( "dtr", -1 ) );
- SwingComponentUtils.setSelectedIndex( this.dsr, aSettings.getInt( "dsr", -1 ) );
- SwingComponentUtils.setSelectedIndex( this.dcd, aSettings.getInt( "dcd", -1 ) );
- SwingComponentUtils.setSelectedIndex( this.ri, aSettings.getInt( "ri", -1 ) );
- SwingComponentUtils.setSelectedIndex( this.parity, aSettings.getInt( "parity", -1 ) );
- SwingComponentUtils.setSelectedIndex( this.bits, aSettings.getInt( "bits", -1 ) );
- SwingComponentUtils.setSelectedIndex( this.stop, aSettings.getInt( "stop", -1 ) );
- SwingComponentUtils.setSelected( this.inv, Boolean.valueOf( aSettings.getBoolean( "inverted", false ) ) );
+ this.rxd.setSelectedIndex( aSettings.getInt( "rxd", -1 ) );
+ this.txd.setSelectedIndex( aSettings.getInt( "txd", -1 ) );
+ this.cts.setSelectedIndex( aSettings.getInt( "cts", -1 ) );
+ this.rts.setSelectedIndex( aSettings.getInt( "rts", -1 ) );
+ this.dtr.setSelectedIndex( aSettings.getInt( "dtr", -1 ) );
+ this.dsr.setSelectedIndex( aSettings.getInt( "dsr", -1 ) );
+ this.dcd.setSelectedIndex( aSettings.getInt( "dcd", -1 ) );
+ this.ri.setSelectedIndex( aSettings.getInt( "ri", -1 ) );
+ this.parity.setSelectedIndex( aSettings.getInt( "parity", -1 ) );
+ this.bits.setSelectedIndex( aSettings.getInt( "bits", -1 ) );
+ this.stop.setSelectedIndex( aSettings.getInt( "stop", -1 ) );
+ this.inv.setSelected( aSettings.getBoolean( "inverted", false ) );
}
/**
@@ -195,7 +195,7 @@ public void writePreferences( final UserSettings aSettings )
/**
* set the controls of the dialog enabled/disabled
- *
+ *
* @param aEnable
* status of the controls
*/
@@ -245,7 +245,7 @@ protected void setupToolWorker( final UARTAnalyserWorker aToolWorker )
/**
* exports the data to a CSV file
- *
+ *
* @param aFile
* File object
*/
@@ -317,7 +317,7 @@ protected void storeToCsvFile( final File aFile, final UARTDataSet aDataSet )
/**
* stores the data to a HTML file
- *
+ *
* @param aFile
* file object
*/
@@ -340,7 +340,7 @@ protected void storeToHtmlFile( final File aFile, final UARTDataSet aDataSet )
/**
* Creates the HTML template for exports to HTML.
- *
+ *
* @param aExporter
* the HTML exporter instance to use, cannot be <code>null</code>.
* @return a HTML exporter filled with the template, never <code>null</code>.
@@ -510,7 +510,7 @@ private JPanel createSettingsPane()
/**
* generate a HTML page
- *
+ *
* @param empty
* if this is true an empty output is generated
* @return String with HTML data
@@ -575,7 +575,7 @@ private void initDialog()
/**
* generate a HTML page
- *
+ *
* @param empty
* if this is true an empty output is generated
* @return String with HTML data
View
3 util/src/main/java/nl/lxtreme/ols/util/swing/StandardActionFactory.java
@@ -161,7 +161,8 @@ private StandardActionFactory()
/**
* Creates a new close action instance.
* <p>
- * The close action will have a default shortcut key of CTRL/CMD + W.
+ * The close action will have a default shortcut key of CTRL/CMD + W on Mac OS
+ * platforms, and ESC on other platforms.
* </p>
*
* @return a close action instance, never <code>null</code>.
View
108 util/src/main/java/nl/lxtreme/ols/util/swing/SwingComponentUtils.java
@@ -554,114 +554,6 @@ public static void saveWindowState( final Preferences aProperties, final Window
}
/**
- * Sets the selected item of the given checkbox to the value given, unless
- * this value is <code>null</code>.
- *
- * @param aCheckBox
- * the checkbox to set, cannot be <code>null</code>;
- * @param aValue
- * the value to set, may be <code>null</code>.
- */
- public static void setSelected( final JCheckBox aCheckBox, final Object aValue )
- {
- if ( aCheckBox == null )
- {
- throw new IllegalArgumentException( "CheckBox cannot be null!" );
- }
-
- if ( aValue != null )
- {
- boolean value = false;
- if ( aValue instanceof Boolean )
- {
- value = ( ( Boolean )aValue ).booleanValue();
- }
- else
- {
- value = "true".equalsIgnoreCase( String.valueOf( aValue ) );
- }
- aCheckBox.setSelected( value );
- }
- }
-
- /**
- * Sets the selected item of the given combobox to the value given, unless
- * this index is <code>null</code>.
- *
- * @param aComboBox
- * the combobox to set, cannot be <code>null</code>;
- * @param aIndex
- * the index to set, may be <code>null</code>.
- */
- public static void setSelectedIndex( final JComboBox aComboBox, final int aIndex )
- {
- if ( aComboBox == null )
- {
- throw new IllegalArgumentException( "Combobox cannot be null!" );
- }
-
- if ( aIndex >= 0 )
- {
- aComboBox.setSelectedIndex( aIndex );
- }
- }
-
- /**
- * Sets the selected item of the given combobox to the value given, unless
- * this value is <code>null</code>.
- *
- * @param aComboBox
- * the combobox to set, cannot be <code>null</code>;
- * @param aValue
- * the value to set, may be <code>null</code>.
- */
- public static void setSelectedItem( final JComboBox aComboBox, final Object aValue )
- {
- if ( aComboBox == null )
- {
- throw new IllegalArgumentException( "Combobox cannot be null!" );
- }
-
- if ( ( aValue != null ) && !"null".equals( aValue ) )
- {
- aComboBox.setSelectedItem( aValue );
- }
- }
-
- /**
- * Sets the selected item of the given combobox to the value given, unless
- * this value is <code>null</code> in which case a default value is set.
- *
- * @param aComboBox
- * the combobox to set, cannot be <code>null</code>;
- * @param aValue
- * the value to set, may be <code>null</code>;
- * @param aDefault
- * the default value to set in case the given value was
- * <code>null</code>.
- */
- public static void setSelectedItem( final JComboBox aComboBox, final Object aValue, final Object aDefault )
- {
- if ( aComboBox == null )
- {
- throw new IllegalArgumentException( "Combobox cannot be null!" );
- }
- if ( aDefault == null )
- {
- throw new IllegalArgumentException( "Default value cannot be null!" );
- }
-
- if ( ( aValue != null ) && !"null".equals( aValue ) )
- {
- aComboBox.setSelectedItem( aValue );
- }
- else
- {
- aComboBox.setSelectedItem( aDefault );
- }
- }
-
- /**
* Sets up the given dialog's content pane by setting its border to provide a
* good default spacer, and setting the content pane to the given components.
*

0 comments on commit d4d89b2

Please sign in to comment.