mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 16:47:31 -05:00
wip #34 - reformatting the channel configuration editors.
This commit is contained in:
25
src/gui/editor/EditorValidationException.java
Normal file
25
src/gui/editor/EditorValidationException.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package gui.editor;
|
||||
|
||||
public class EditorValidationException extends Exception
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Editor<?> mEditor;
|
||||
private String mReason;
|
||||
|
||||
public EditorValidationException( Editor<?> editor, String reason )
|
||||
{
|
||||
mEditor = editor;
|
||||
mReason = reason;
|
||||
}
|
||||
|
||||
public Editor<?> getEditor()
|
||||
{
|
||||
return mEditor;
|
||||
}
|
||||
|
||||
public String getReason()
|
||||
{
|
||||
return mReason;
|
||||
}
|
||||
}
|
||||
37
src/gui/editor/EmptyValidatingEditor.java
Normal file
37
src/gui/editor/EmptyValidatingEditor.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package gui.editor;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
public class EmptyValidatingEditor<T> extends ValidatingEditor<T>
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public EmptyValidatingEditor( String descriptor )
|
||||
{
|
||||
setLayout( new MigLayout( "insets 0 0 0 0", "[center]", "[grow]" ) );
|
||||
add( new JLabel( "Please select " + descriptor ), "wrap" );
|
||||
}
|
||||
|
||||
public EmptyValidatingEditor()
|
||||
{
|
||||
this( "an item" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid( Editor<T> editor ) throws EditorValidationException
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
15
src/gui/editor/ValidatingEditor.java
Normal file
15
src/gui/editor/ValidatingEditor.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package gui.editor;
|
||||
|
||||
|
||||
/**
|
||||
* Editor class that allows other editors to be validated for configuration with this editor
|
||||
*/
|
||||
public abstract class ValidatingEditor<T> extends Editor<T>
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Indicates if the editor argument is valid according to the settings of this editor
|
||||
*/
|
||||
public abstract boolean isValid( Editor<T> editor ) throws EditorValidationException;
|
||||
}
|
||||
Reference in New Issue
Block a user