1 14 package org.wings; 15 16 17 24 public class SClickable 25 extends SAbstractClickable { 26 27 31 private String event; 32 33 37 private LowLevelEventListener requestTarget; 38 39 45 public SClickable(String text) { 46 this(text, null, SConstants.LEFT); 47 } 48 49 52 public SClickable() { 53 this((String ) null); 54 } 55 56 62 public SClickable(SIcon icon) { 63 this(icon, SConstants.LEFT); 64 } 65 66 76 public SClickable(SIcon icon, int horizontalAlignment) { 77 this(null, icon, horizontalAlignment); 78 } 79 80 87 public SClickable(String text, SIcon icon) { 88 setText(text); 89 setIcon(icon); 90 setHorizontalAlignment(SConstants.LEFT); 91 } 92 93 104 public SClickable(String text, SIcon icon, int horizontalAlignment) { 105 setText(text); 106 setIcon(icon); 107 setHorizontalAlignment(horizontalAlignment); 108 } 109 110 120 public SClickable(String text, int horizontalAlignment) { 121 this(text, null, horizontalAlignment); 122 } 123 124 public boolean isEpochCheckEnabled() { 125 return requestTarget == null ? true : requestTarget.isEpochCheckEnabled(); 126 } 127 128 132 public final void setEvent(String event, LowLevelEventListener requestTarget) { 133 setEvent(event); 134 setEventTarget(requestTarget); 135 } 136 137 141 public void setEvent(String e) { 142 if (isDifferent(event, e)) { 143 event = e; 144 reload(); 145 } 146 } 147 148 152 public final String getEvent() { 153 return event; 154 } 155 156 159 public void setEventTarget(LowLevelEventListener t) { 160 if (isDifferent(requestTarget, t)) { 161 requestTarget = t; 162 reload(); 163 } 164 } 165 166 170 public final LowLevelEventListener getEventTarget() { 171 return requestTarget; 172 } 173 174 public SimpleURL getURL() { 175 if (getEvent() != null && getEventTarget() != null) { 176 RequestURL u = getRequestURL(); 177 if (!isEpochCheckEnabled()) { 178 u.setEpoch(null); 179 u.setResource(null); 180 } 181 182 u.addParameter(getEventTarget(), 183 getEvent()); 184 return u; 185 } else { 186 return null; 187 } 188 } 189 190 191 } 192 193 194 | Popular Tags |