Package org.opt4j.viewer
Class ArchiveWidget
- java.lang.Object
-
- org.opt4j.viewer.ArchiveWidget
-
- All Implemented Interfaces:
IndividualSetListener
,OptimizerIterationListener
,ObjectivesMonitor.ObjectivesListener
,Widget
public class ArchiveWidget extends Object implements OptimizerIterationListener, IndividualSetListener, Widget, ObjectivesMonitor.ObjectivesListener
A widget that monitors the archive.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
ArchiveWidget.Comp
protected class
ArchiveWidget.Model
The model of the table.
-
Field Summary
Fields Modifier and Type Field Description protected org.opt4j.viewer.SynchronizedIndividualSet
archive
protected JCheckBox
autoUpdate
protected boolean
changed
protected static String
INDEX
protected List<IndividualMouseListener>
individualMouseListeners
protected List<Objective>
objectives
protected static int
OFFSET
protected List<Objective>
order
protected JPanel
panel
protected JLabel
sizeLabel
protected List<Individual>
swtIndividuals
protected JTable
table
protected DelayTask
task
-
Constructor Summary
Constructors Constructor Description ArchiveWidget(Archive archive, Optimizer optimizer, Set<IndividualMouseListener> mouseListeners, ObjectivesMonitor objectivesMonitor)
Constructs anArchiveWidget
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addIndividualMouseListener(IndividualMouseListener listener)
Adds aIndividualMouseListener
.JPanel
getPanel()
Returns the panel with the content.protected JTable
getTable()
void
individualAdded(IndividualSet collection, Individual individual)
Invoked if theIndividual
is added to theIndividualSet
.void
individualRemoved(IndividualSet collection, Individual individual)
Invoked if theIndividual
is removed from theIndividualSet
.void
init(Viewport viewport)
Called once after the widget is added to theViewport
.void
iterationComplete(Optimizer optimizer, int iteration)
Invoked if theOptimizer
completes an iteration.void
objectives(Collection<Objective> obj)
Callback method that passes the objectives of the optimization problem.protected void
paint()
Repaints the table.void
removeIndivdiualMouseListener(IndividualMouseListener listener)
Removes aIndividualMouseListener
.protected void
sortIndividiualMouseListeners()
protected boolean
updateOrder()
-
-
-
Field Detail
-
OFFSET
protected static final int OFFSET
- See Also:
- Constant Field Values
-
archive
protected final org.opt4j.viewer.SynchronizedIndividualSet archive
-
swtIndividuals
protected List<Individual> swtIndividuals
-
panel
protected final JPanel panel
-
table
protected final JTable table
-
autoUpdate
protected final JCheckBox autoUpdate
-
sizeLabel
protected final JLabel sizeLabel
-
changed
protected boolean changed
-
individualMouseListeners
protected final List<IndividualMouseListener> individualMouseListeners
-
task
protected final DelayTask task
-
INDEX
protected static final String INDEX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ArchiveWidget
@Inject public ArchiveWidget(Archive archive, Optimizer optimizer, Set<IndividualMouseListener> mouseListeners, ObjectivesMonitor objectivesMonitor)
Constructs anArchiveWidget
.- Parameters:
archive
- the archiveoptimizer
- the optimizermouseListeners
- listeners for mouse events on IndividualsobjectivesMonitor
- the objective monitor that determine the objective of the optimization problem
-
-
Method Detail
-
getTable
protected final JTable getTable()
-
sortIndividiualMouseListeners
protected void sortIndividiualMouseListeners()
-
init
public void init(Viewport viewport)
Description copied from interface:Widget
Called once after the widget is added to theViewport
.
-
updateOrder
protected boolean updateOrder()
-
paint
protected void paint()
Repaints the table.
-
addIndividualMouseListener
public void addIndividualMouseListener(IndividualMouseListener listener)
Adds aIndividualMouseListener
.- Parameters:
listener
- the individual mouse listener to be added
-
removeIndivdiualMouseListener
public void removeIndivdiualMouseListener(IndividualMouseListener listener)
Removes aIndividualMouseListener
.- Parameters:
listener
- the individual mouse listener to be removed
-
iterationComplete
public void iterationComplete(Optimizer optimizer, int iteration)
Description copied from interface:OptimizerIterationListener
Invoked if theOptimizer
completes an iteration.- Specified by:
iterationComplete
in interfaceOptimizerIterationListener
- Parameters:
optimizer
- the optimizeriteration
- the completed iteration
-
individualAdded
public void individualAdded(IndividualSet collection, Individual individual)
Description copied from interface:IndividualSetListener
Invoked if theIndividual
is added to theIndividualSet
.- Specified by:
individualAdded
in interfaceIndividualSetListener
- Parameters:
collection
- the observed collectionindividual
- the added individual
-
individualRemoved
public void individualRemoved(IndividualSet collection, Individual individual)
Description copied from interface:IndividualSetListener
Invoked if theIndividual
is removed from theIndividualSet
.- Specified by:
individualRemoved
in interfaceIndividualSetListener
- Parameters:
collection
- the observed collectionindividual
- the removed individual
-
getPanel
public JPanel getPanel()
Description copied from interface:Widget
Returns the panel with the content.
-
objectives
public void objectives(Collection<Objective> obj)
Description copied from interface:ObjectivesMonitor.ObjectivesListener
Callback method that passes the objectives of the optimization problem.- Specified by:
objectives
in interfaceObjectivesMonitor.ObjectivesListener
- Parameters:
obj
- the objectives
-
-