home *** CD-ROM | disk | FTP | other *** search
- package netscape.constructor;
-
- import netscape.application.Target;
- import netscape.util.ClassInfo;
- import netscape.util.Codable;
- import netscape.util.CodingException;
- import netscape.util.Decoder;
- import netscape.util.Encoder;
- import netscape.util.Vector;
-
- public class TargetProxy implements Target, Codable {
- Vector commands;
- TargetProxyManager manager;
- String name;
- int type;
- Target _realTarget;
- static final String COMMANDS_VECTOR_KEY = "commands";
- static final String TP_MANAGER_KEY = "manager";
- static final String NAME_KEY = "name";
- static final String TYPE_KEY = "type";
- public static final int APPLICATION_TYPE = 0;
- public static final int TARGET_CHAIN_TYPE = 1;
- public static final int CUSTOM_TYPE = 2;
-
- public TargetProxy() {
- this.type = 2;
- }
-
- public TargetProxy(TargetProxyManager var1) {
- this.setTargetProxyManager(var1);
- this.type = 2;
- }
-
- public Vector commands() {
- if (this.commands == null) {
- this.commands = new Vector();
- }
-
- return this.commands;
- }
-
- public void setCommands(Vector var1) {
- this.commands = var1;
- }
-
- public TargetProxyManager targetProxyManager() {
- return this.manager;
- }
-
- public void setTargetProxyManager(TargetProxyManager var1) {
- this.manager = var1;
- }
-
- public String name() {
- return this.name;
- }
-
- public void setName(String var1) {
- if (this.type == 0) {
- this.name = "__APPLICATION__";
- } else if (this.type == 1) {
- this.name = "__TARGETCHAIN__";
- } else {
- this.name = var1;
- }
- }
-
- public int type() {
- return this.type;
- }
-
- public void setType(int var1) {
- this.type = var1;
- if (this.type == 0) {
- this.setName("__APPLICATION__");
- } else {
- if (this.type == 1) {
- this.setName("__TARGETCHAIN__");
- }
-
- }
- }
-
- public void performCommand(String var1, Object var2) {
- System.err.println(this + " named: " + this.name + "\n performCommand( " + var1 + " ,\n " + var2 + " )");
- }
-
- public void describeClassInfo(ClassInfo var1) {
- var1.addClass("netscape.constructor.TargetProxy", 2);
- var1.addField("name", (byte)16);
- var1.addField("manager", (byte)18);
- var1.addField("commands", (byte)18);
- var1.addField("type", (byte)8);
- }
-
- public void encode(Encoder var1) throws CodingException {
- var1.encodeString("name", this.name);
- var1.encodeObject("manager", this.manager);
- var1.encodeObject("commands", this.commands);
- var1.encodeInt("type", this.type);
- }
-
- public void decode(Decoder var1) throws CodingException {
- this.setName(var1.decodeString("name"));
- this.setTargetProxyManager((TargetProxyManager)var1.decodeObject("manager"));
- if (this.targetProxyManager() != null) {
- this._realTarget = this.manager.targetNamed(this.name);
- if (this._realTarget != null) {
- var1.replaceObject(this._realTarget);
- return;
- }
- }
-
- this.setCommands((Vector)var1.decodeObject("commands"));
- if (var1.versionForClassName("netscape.constructor.TargetProxy") > 1) {
- this.setType(var1.decodeInt("type"));
- } else {
- this.setType(2);
- }
- }
-
- public void finishDecoding() throws CodingException {
- if (this._realTarget != null) {
- this.setAttributesToReplacingTarget(this._realTarget);
- }
-
- this._realTarget = null;
- }
-
- public void setAttributesToReplacingTarget(Target var1) {
- }
- }
-