1 14 package org.wings.event; 15 16 import org.wings.SComponent; 17 import org.wings.SDimension; 18 19 48 public class SComponentEvent 49 extends java.awt.AWTEvent { 50 53 public static final int COMPONENT_FIRST = 10000; 54 55 58 public static final int COMPONENT_HIDDEN = COMPONENT_FIRST; 59 60 63 public static final int COMPONENT_MOVED = COMPONENT_FIRST + 1; 64 65 68 public static final int COMPONENT_RESIZED = COMPONENT_FIRST + 2; 69 70 73 public static final int COMPONENT_SHOWN = COMPONENT_FIRST + 3; 74 75 78 public static final int COMPONENT_LAST = COMPONENT_SHOWN; 80 86 public SComponentEvent(SComponent aSource, int anId) { 87 super(aSource, anId); 88 } 89 90 95 public SComponent getComponent() { 96 return (SComponent) source; 97 } 98 99 106 public String paramString() { 107 if (source == null) 108 return "no source"; 109 110 String typeStr; 111 SDimension d = ((SComponent) source).getPreferredSize(); 112 113 switch (id) { 114 case COMPONENT_SHOWN: 115 typeStr = "COMPONENT_SHOWN"; 116 break; 117 case COMPONENT_HIDDEN: 118 typeStr = "COMPONENT_HIDDEN"; 119 break; 120 case COMPONENT_MOVED: 121 typeStr = "COMPONENT_MOVED (" + d.getIntWidth() + "x" + d.getIntHeight()+ ")"; 122 break; 123 case COMPONENT_RESIZED: 124 typeStr = "COMPONENT_RESIZED (" + d.getIntWidth() + "x" + d.getIntHeight() + ")"; 125 break; 126 default: 127 typeStr = "unknown type"; 128 } 129 return typeStr; 130 } 131 132 public String toString() { 133 return "ComponentEvent[source=" + source + "; " + paramString() + "]"; 134 } 135 } 136 | Popular Tags |