added quick help
This commit is contained in:
parent
bed44c8f55
commit
5a053d7d4e
2 changed files with 26 additions and 9 deletions
|
@ -26,13 +26,14 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: VisPlugin.java,v 1.9 2009/04/03 17:03:42 fros4943 Exp $
|
* $Id: VisPlugin.java,v 1.10 2009/06/30 12:46:26 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja;
|
package se.sics.cooja;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import javax.swing.JInternalFrame;
|
import javax.swing.JInternalFrame;
|
||||||
|
import javax.swing.event.InternalFrameAdapter;
|
||||||
import javax.swing.event.InternalFrameEvent;
|
import javax.swing.event.InternalFrameEvent;
|
||||||
import javax.swing.event.InternalFrameListener;
|
import javax.swing.event.InternalFrameListener;
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
|
@ -67,21 +68,17 @@ public abstract class VisPlugin extends JInternalFrame implements Plugin {
|
||||||
|
|
||||||
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
||||||
|
|
||||||
addInternalFrameListener(new InternalFrameListener() {
|
addInternalFrameListener(new InternalFrameAdapter() {
|
||||||
public void internalFrameClosing(InternalFrameEvent e) {
|
public void internalFrameClosing(InternalFrameEvent e) {
|
||||||
gui.removePlugin(VisPlugin.this, true);
|
gui.removePlugin(VisPlugin.this, true);
|
||||||
}
|
}
|
||||||
public void internalFrameClosed(InternalFrameEvent e) { }
|
|
||||||
public void internalFrameOpened(InternalFrameEvent e) { }
|
|
||||||
public void internalFrameIconified(InternalFrameEvent e) { }
|
|
||||||
public void internalFrameDeiconified(InternalFrameEvent e) { }
|
|
||||||
public void internalFrameActivated(InternalFrameEvent e) {
|
public void internalFrameActivated(InternalFrameEvent e) {
|
||||||
/* Highlight mote in COOJA */
|
/* Highlight mote in COOJA */
|
||||||
if (VisPlugin.this.tag != null && tag instanceof Mote) {
|
if (VisPlugin.this.tag != null && tag instanceof Mote) {
|
||||||
gui.signalMoteHighlight((Mote) tag);
|
gui.signalMoteHighlight((Mote) tag);
|
||||||
}
|
}
|
||||||
|
gui.loadQuickHelp(VisPlugin.this);
|
||||||
}
|
}
|
||||||
public void internalFrameDeactivated(InternalFrameEvent e) { }
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: MoteInterfaceViewer.java,v 1.6 2009/03/23 13:26:43 nifi Exp $
|
* $Id: MoteInterfaceViewer.java,v 1.7 2009/06/30 12:46:26 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja.plugins;
|
package se.sics.cooja.plugins;
|
||||||
|
@ -52,6 +52,7 @@ import se.sics.cooja.MoteInterface;
|
||||||
import se.sics.cooja.PluginType;
|
import se.sics.cooja.PluginType;
|
||||||
import se.sics.cooja.Simulation;
|
import se.sics.cooja.Simulation;
|
||||||
import se.sics.cooja.VisPlugin;
|
import se.sics.cooja.VisPlugin;
|
||||||
|
import se.sics.cooja.GUI.HasQuickHelp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mote Interface Viewer views information about a specific mote interface.
|
* Mote Interface Viewer views information about a specific mote interface.
|
||||||
|
@ -60,7 +61,7 @@ import se.sics.cooja.VisPlugin;
|
||||||
*/
|
*/
|
||||||
@ClassDescription("Mote Interface Viewer")
|
@ClassDescription("Mote Interface Viewer")
|
||||||
@PluginType(PluginType.MOTE_PLUGIN)
|
@PluginType(PluginType.MOTE_PLUGIN)
|
||||||
public class MoteInterfaceViewer extends VisPlugin {
|
public class MoteInterfaceViewer extends VisPlugin implements HasQuickHelp {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private Mote mote;
|
private Mote mote;
|
||||||
|
@ -114,6 +115,8 @@ public class MoteInterfaceViewer extends VisPlugin {
|
||||||
for (MoteInterface intf : intfs) {
|
for (MoteInterface intf : intfs) {
|
||||||
if (GUI.getDescriptionOf(intf).equals(interfaceDescription)) {
|
if (GUI.getDescriptionOf(intf).equals(interfaceDescription)) {
|
||||||
selectedMoteInterface = intf;
|
selectedMoteInterface = intf;
|
||||||
|
mote.getSimulation().getGUI().loadQuickHelp(MoteInterfaceViewer.this);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
currentInterfaceVisualizer = selectedMoteInterface.getInterfaceVisualizer();
|
currentInterfaceVisualizer = selectedMoteInterface.getInterfaceVisualizer();
|
||||||
|
@ -215,4 +218,21 @@ public class MoteInterfaceViewer extends VisPlugin {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getQuickHelp() {
|
||||||
|
String help = "<b>" + GUI.getDescriptionOf(this) + "</b>";
|
||||||
|
help += "<p>Lists mote interfaces, and allows mote inspection and interaction via mote interface visualizers.";
|
||||||
|
|
||||||
|
MoteInterface intf = selectedMoteInterface;
|
||||||
|
if (intf != null) {
|
||||||
|
if (intf instanceof HasQuickHelp) {
|
||||||
|
help += "<p>" + ((HasQuickHelp)intf).getQuickHelp();
|
||||||
|
} else {
|
||||||
|
help += "<p><b>" + GUI.getDescriptionOf(intf) + "</b>";
|
||||||
|
help += "<p>No help available";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return help;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue