jadex.rules.tools.reteviewer.AgendaPanel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jadex-rules-tools Show documentation
Show all versions of jadex-rules-tools Show documentation
The Jadex rules tools package contains tools for the Jadex rule engine.
package jadex.rules.tools.reteviewer;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;
import javax.swing.AbstractListModel;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.ListSelectionModel;
import javax.swing.SwingUtilities;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import jadex.rules.rulesystem.Activation;
import jadex.rules.rulesystem.IAgenda;
import jadex.rules.rulesystem.IAgendaListener;
/**
* Panel for showing / manipulating the Rete agenda.
*/
public class AgendaPanel extends JSplitPane
{
//------- attributes --------
/** The agenda. */
protected IAgenda agenda;
/** The agenda listener. */
protected IAgendaListener listener;
/** Local copy of activations. */
protected Object[] activations_clone;
/** Local copy of agenda history. */
protected Object[] history_clone;
/** Local copy of next agenda action. */
protected Object next;
/** The list model for the activations. */
protected ActivationsModel amodel;
/** The list model for the history. */
protected HistoryModel hmodel;
/** The list for the activations. */
protected JList activations;
/** The list for the history. */
protected JList history;
//------- constructors --------
/**
* Create an agenda panel.
*/
public AgendaPanel(final IAgenda agenda)
{
super(VERTICAL_SPLIT);
this.agenda = agenda;
this.setOneTouchExpandable(true);
this.amodel = new ActivationsModel();
this.hmodel = new HistoryModel();
this.activations = new JList(amodel);
activations.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
activations.addListSelectionListener(new ListSelectionListener()
{
public void valueChanged(ListSelectionEvent e)
{
if(!e.getValueIsAdjusting())
{
int i = -1;
if(next!=null)
{
for(i=0;i
© 2015 - 2024 Weber Informatics LLC | Privacy Policy