1 2 23 24 package net.fenyo.gnetwatch.actions; 25 26 import net.fenyo.gnetwatch.Config; 27 import net.fenyo.gnetwatch.GeneralException; 28 import net.fenyo.gnetwatch.activities.Background; 29 import net.fenyo.gnetwatch.targets.*; 30 import net.fenyo.gnetwatch.GUI.*; 31 32 import java.io.*; 33 import java.util.Date ; 34 35 import org.apache.commons.logging.Log; 36 import org.apache.commons.logging.LogFactory; 37 import org.eclipse.swt.graphics.Image; 38 39 46 47 public class Action extends VisualElement { 48 private static Log log = LogFactory.getLog(Action.class); 49 50 private Target target; 53 private Background background; 54 55 public enum InterruptCause { timeout, exiting, removed }; 56 57 62 protected Action(final Target target, final Background background) { 64 this.target = target; 65 this.background = background; 66 setType("action"); 67 } 68 69 73 protected Action() { 75 setType("action"); 76 target = null; 77 background = null; 78 } 79 80 85 public void setTarget(final Target target) { 86 this.target = target; 87 } 88 89 94 public void setBackground(final Background background) { 95 this.background = background; 96 } 97 98 103 protected void initialize(final GUI gui) { 104 super.initialize(gui); 105 if (gui != null) setImageExec(); 106 } 107 108 113 protected Target getTarget() { 115 return target; 116 } 117 118 123 public String getQueueName() { 125 return "standard"; 126 } 127 128 133 public long getMaxDelay() { 135 return 0; 136 } 137 138 144 public void interrupt(final InterruptCause cause) throws IOException {} 146 147 154 public void invoke() throws IOException, InterruptedException {} 156 157 162 public boolean canManageThisChild(final VisualElement visual_element) { 163 return false; 164 } 165 166 171 protected void disposed() { 172 super.disposed(); 173 try { 174 background.removeActionQueue(this); 176 } catch (final GeneralException ex) { 177 log.error("Exception", ex); 178 } 179 } 180 } 181 | Popular Tags |