org.relayirc.swingui
Class CustomAction

java.lang.Object
  |
  +--org.relayirc.swingui.CustomAction
All Implemented Interfaces:
IChatAction, java.io.Serializable

public class CustomAction
extends java.lang.Object
implements IChatAction, java.io.Serializable

An IChatAction implementation that executes a JPython script, a Java class that implements IRelayRunnable or an IRC command.

Version:
$Revision: 1.4.2.4 $

The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/

Original Code: Relay-JFC Chat Client
Initial Developer: David M. Johnson
Contributor(s): No contributors to this file
Copyright (C) 1997-2000 by David M. Johnson
All Rights Reserved.
Author:
David M. Johnson
See Also:
Serialized Form

Field Summary
static int IRC_COMMAND
           
static int JAVA_CLASS
           
static int JPYTHON_SCRIPT
           
 
Constructor Summary
CustomAction(java.lang.String title, int type, java.lang.String action)
          Construct CustomAction by specifying its title, type and action string.
 
Method Summary
 java.lang.String getAction()
           
 javax.swing.AbstractAction getActionObject()
          Get the actual action object.
 java.lang.Object getContext()
          Get context for action.
 java.lang.String getTitle()
           
 int getType()
           
 void setAction(java.lang.String a)
           
 void setContext(java.lang.Object context)
          Set context for action.
 void setTitle(java.lang.String t)
           
 void setType(int t)
           
 void update()
          If action is an IRC command and we are disconnected, then disable action, otherwise enable it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JPYTHON_SCRIPT

public static final int JPYTHON_SCRIPT

JAVA_CLASS

public static final int JAVA_CLASS

IRC_COMMAND

public static final int IRC_COMMAND
Constructor Detail

CustomAction

public CustomAction(java.lang.String title,
                    int type,
                    java.lang.String action)
Construct CustomAction by specifying its title, type and action string.
If type is JPYTHON_SCRIPT, then action must be the full path to a JPython script to be run.
If type is JAVA_CLASS, then action must be the fully qualified Java class name of a class that implements IRelayPlugin.
If the type is IRC_COMMAND, then action must be an IRC command. The command can contains a %1 to substitute the name of the channel, server or user that is the context of the command.
Parameters:
title - Name to be displayed on menus, lists, etc.
type - Type of command, see static final int fields.
action - Action to be performed (see above).
Method Detail

getTitle

public java.lang.String getTitle()

setTitle

public void setTitle(java.lang.String t)

getAction

public java.lang.String getAction()

setAction

public void setAction(java.lang.String a)

getType

public int getType()

setType

public void setType(int t)

getContext

public java.lang.Object getContext()
Description copied from interface: IChatAction
Get context for action.
Specified by:
getContext in interface IChatAction

setContext

public void setContext(java.lang.Object context)
Description copied from interface: IChatAction
Set context for action.
Specified by:
setContext in interface IChatAction

update

public void update()
If action is an IRC command and we are disconnected, then disable action, otherwise enable it.
Specified by:
update in interface IChatAction

getActionObject

public javax.swing.AbstractAction getActionObject()
Get the actual action object.
Specified by:
getActionObject in interface IChatAction