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 classArchiveWidget.Compprotected classArchiveWidget.ModelThe model of the table.
-
Field Summary
Fields Modifier and Type Field Description protected org.opt4j.viewer.SynchronizedIndividualSetarchiveprotected JCheckBoxautoUpdateprotected booleanchangedprotected static StringINDEXprotected List<IndividualMouseListener>individualMouseListenersprotected List<Objective>objectivesprotected static intOFFSETprotected List<Objective>orderprotected JPanelpanelprotected JLabelsizeLabelprotected List<Individual>swtIndividualsprotected JTabletableprotected DelayTasktask
-
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 voidaddIndividualMouseListener(IndividualMouseListener listener)Adds aIndividualMouseListener.JPanelgetPanel()Returns the panel with the content.protected JTablegetTable()voidindividualAdded(IndividualSet collection, Individual individual)Invoked if theIndividualis added to theIndividualSet.voidindividualRemoved(IndividualSet collection, Individual individual)Invoked if theIndividualis removed from theIndividualSet.voidinit(Viewport viewport)Called once after the widget is added to theViewport.voiditerationComplete(Optimizer optimizer, int iteration)Invoked if theOptimizercompletes an iteration.voidobjectives(Collection<Objective> obj)Callback method that passes the objectives of the optimization problem.protected voidpaint()Repaints the table.voidremoveIndivdiualMouseListener(IndividualMouseListener listener)Removes aIndividualMouseListener.protected voidsortIndividiualMouseListeners()protected booleanupdateOrder()
-
-
-
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:WidgetCalled 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:OptimizerIterationListenerInvoked if theOptimizercompletes an iteration.- Specified by:
iterationCompletein interfaceOptimizerIterationListener- Parameters:
optimizer- the optimizeriteration- the completed iteration
-
individualAdded
public void individualAdded(IndividualSet collection, Individual individual)
Description copied from interface:IndividualSetListenerInvoked if theIndividualis added to theIndividualSet.- Specified by:
individualAddedin interfaceIndividualSetListener- Parameters:
collection- the observed collectionindividual- the added individual
-
individualRemoved
public void individualRemoved(IndividualSet collection, Individual individual)
Description copied from interface:IndividualSetListenerInvoked if theIndividualis removed from theIndividualSet.- Specified by:
individualRemovedin interfaceIndividualSetListener- Parameters:
collection- the observed collectionindividual- the removed individual
-
getPanel
public JPanel getPanel()
Description copied from interface:WidgetReturns the panel with the content.
-
objectives
public void objectives(Collection<Objective> obj)
Description copied from interface:ObjectivesMonitor.ObjectivesListenerCallback method that passes the objectives of the optimization problem.- Specified by:
objectivesin interfaceObjectivesMonitor.ObjectivesListener- Parameters:
obj- the objectives
-
-