[Bprocessor-commit] gui/src/net/sourceforge/bprocessor/gui/monitor package.html, NONE, 1.1 Monitor.
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2011-03-04 17:42:37
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/monitor In directory vz-cvs-2.sog:/tmp/cvs-serv32008/src/net/sourceforge/bprocessor/gui/monitor Added Files: package.html Monitor.java CommandMonitor.java Log Message: Implemented a mechanism for starting and stopping commands that repeat --- NEW FILE: CommandMonitor.java --- //--------------------------------------------------------------------------------- // $Id: CommandMonitor.java,v 1.1 2011/03/04 17:42:35 henryml Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gui.monitor; import java.util.LinkedList; import java.util.List; import net.sourceforge.bprocessor.gui.GUI; import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Command; import net.sourceforge.bprocessor.model.Operation; /** * */ public class CommandMonitor extends Monitor<Command> { private Operation doit; /** * Constructor * @param target Command */ public CommandMonitor(Command target) { super(target); doit = new CommandPerformer(target); } private class CommandPerformer extends Operation { private Command command; public CommandPerformer(Command command) { this.command = command; } public void perform() { command.evaluate(); } } /** {@inheritDoc} */ public List<Attribute> getAttributes() { List<Attribute> attributes = new LinkedList(target.getParameters().getAttributes()); attributes.add(new Attribute("Do", doit)); attributes.add(new Attribute("Start", new Operation() { public void perform() { GUI.getInstance().registerOperation(doit); } })); attributes.add(new Attribute("Stop", new Operation() { @Override public void perform() { GUI.getInstance().unregisterOperation(doit); } })); return attributes; } } --- NEW FILE: package.html --- <body> This package defines functionality to show attributes for an object </body> --- NEW FILE: Monitor.java --- //--------------------------------------------------------------------------------- // $Id: Monitor.java,v 1.1 2011/03/04 17:42:35 henryml Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gui.monitor; import java.util.List; import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Parametric; /** * @param <T> Target class */ public class Monitor<T extends Parametric> implements Parametric { protected T target; /** * * @param target Target */ public Monitor(T target) { this.target = target; } /** * Returns the target * @return Returns the target */ public T target() { return target; } /** {@inheritDoc} */ public List<Attribute> getAttributes() { return target.getAttributes(); } /** {@inheritDoc} */ public void setAttributes(List<Attribute> attributes) { target.setAttributes(attributes); } /** {@inheritDoc} */ public String title() { return target.title(); } } |