001 /*
002 * Copyright (C) 2008-2009 Holger Arndt, A. Naegele and M. Bundschus
003 *
004 * This file is part of the Java Data Mining Package (JDMP).
005 * See the NOTICE file distributed with this work for additional
006 * information regarding copyright ownership and licensing.
007 *
008 * JDMP is free software; you can redistribute it and/or modify
009 * it under the terms of the GNU Lesser General Public License as
010 * published by the Free Software Foundation; either version 2
011 * of the License, or (at your option) any later version.
012 *
013 * JDMP is distributed in the hope that it will be useful,
014 * but WITHOUT ANY WARRANTY; without even the implied warranty of
015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
016 * GNU Lesser General Public License for more details.
017 *
018 * You should have received a copy of the GNU Lesser General Public
019 * License along with JDMP; if not, write to the
020 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
021 * Boston, MA 02110-1301 USA
022 */
023
024 package org.jdmp.gui.algorithm.actions;
025
026 import java.util.ArrayList;
027
028 import javax.swing.JComponent;
029 import javax.swing.JMenu;
030 import javax.swing.JMenuItem;
031 import javax.swing.JSeparator;
032
033 import org.jdmp.gui.algorithm.AlgorithmGUIObject;
034 import org.jdmp.gui.variable.actions.VariableListActions;
035 import org.ujmp.gui.actions.ExitAction;
036 import org.ujmp.gui.actions.ExportAction;
037 import org.ujmp.gui.actions.PrintAction;
038 import org.ujmp.gui.actions.SetLabelAction;
039
040 public class AlgorithmActions extends ArrayList<JComponent> {
041 private static final long serialVersionUID = -4508932056911168672L;
042
043 public AlgorithmActions(JComponent component, AlgorithmGUIObject algorithm) {
044
045 add(new JMenuItem(new ExportAction(component, algorithm)));
046
047 add(new JSeparator());
048
049 if (component != null) {
050 PrintAction printAction = new PrintAction(component, algorithm);
051 add(new JMenuItem(printAction));
052 }
053
054 add(new JSeparator());
055
056 add(new JMenuItem(new SetLabelAction(component, algorithm)));
057 add(new JSeparator());
058
059 JMenu variableActions = new JMenu("Variables");
060 for (JComponent c : new VariableListActions(component, algorithm.getAlgorithm())) {
061 variableActions.add(c);
062 }
063 add(variableActions);
064
065 JMenu algorithmActions = new JMenu("Algorithms");
066 for (JComponent c : new AlgorithmListActions(component, algorithm.getAlgorithm())) {
067 algorithmActions.add(c);
068 }
069 add(algorithmActions);
070
071 add(new JMenuItem(new CalculateOnceAction(component, algorithm)));
072
073 this.add(new JSeparator());
074 this.add(new JMenuItem(new ExitAction(component, algorithm)));
075 }
076 }