Changeset 1577
- Timestamp:
- 10/17/11 14:33:09 (13 years ago)
- Location:
- ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/CMDComponentXMLEditor.as
r1264 r1577 237 237 link.enabled = false; 238 238 addChild(link); 239 240 addChild(new AttributeListEdit(_firstComponent.attributeList, this)) 239 241 } 240 242 -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/ComponentEdit.as
r873 r1577 27 27 import mx.events.DragEvent; 28 28 import mx.managers.DragManager; 29 29 30 30 [Event(name="removeComponent", type="flash.events.Event")] 31 31 public class ComponentEdit extends Form { 32 32 public static const REMOVE_COMPONENT_EVENT:String = "removeComponent"; 33 33 private static const DRAG_ITEMS:String = "items"; 34 34 35 35 private var _parent:UIComponent; 36 36 private var _component:CMDComponent; … … 38 38 private var addComponentLabel:Label 39 39 private var addElementLabel:Label 40 41 40 41 42 42 public function ComponentEdit(component:CMDComponent, parent:UIComponent, parentComponent:CMDComponent) { 43 43 super(); … … 52 52 } 53 53 } 54 54 55 55 public function get component():CMDComponent { 56 56 return _component; … … 58 58 59 59 public function get parentComponent():CMDComponent { 60 60 return _parentComponent; 61 61 } 62 62 … … 65 65 UIComponent(event.currentTarget).drawFocus(true); 66 66 } 67 68 67 68 69 69 private function dragOverHandler(event:DragEvent):void { 70 70 if (event.dragSource.hasFormat(DRAG_ITEMS)) { … … 74 74 } 75 75 } 76 76 77 77 private function dragDropHandler(event:DragEvent):void { 78 78 if (event.dragSource.hasFormat(DRAG_ITEMS)) { … … 86 86 } 87 87 } 88 88 89 89 private function fireRemoveComponent(mouseEvent:MouseEvent):void { 90 90 drawFocus(false); … … 92 92 dispatchEvent(event); 93 93 } 94 94 95 95 protected override function createChildren():void { 96 96 super.createChildren(); 97 97 addRuler(); 98 98 createComponentEditBar(); 99 99 100 100 var componentLink:FormItem = createComponentLink(_component); 101 101 if (componentLink != null) { … … 113 113 } 114 114 } 115 115 116 116 private function addComponentAddButton():void { 117 117 addComponentLabel = new AddComponentLabelButton(); 118 118 addComponentLabel.addEventListener(MouseEvent.CLICK, function(event:MouseEvent):void { 119 120 121 122 119 var comp:CMDComponent = CMDComponent.createEmptyComponent(); 120 _component.cmdComponents.addItem(comp); 121 addComponent(comp); 122 }); 123 123 addComponentLabel.addEventListener(MouseEvent.MOUSE_OVER, function(event:MouseEvent):void { 124 125 124 drawFocus(true); 125 }); 126 126 addComponentLabel.addEventListener(MouseEvent.MOUSE_OUT, function(event:MouseEvent):void { 127 128 127 drawFocus(false); 128 }); 129 129 addChild(addComponentLabel); 130 130 } 131 131 132 132 private function addElementAddButton():void { 133 133 addElementLabel = new AddElementLabelButton(); 134 134 addElementLabel.addEventListener(MouseEvent.CLICK, function(event:MouseEvent):void { 135 136 137 138 139 135 var element:CMDComponentElement = CMDComponentElement.createEmptyElement(); 136 _component.cmdElements.addItem(element); 137 addElement(element); 138 139 }); 140 140 addElementLabel.addEventListener(MouseEvent.MOUSE_OVER, function(event:MouseEvent):void { 141 142 141 drawFocus(true); 142 }); 143 143 addElementLabel.addEventListener(MouseEvent.MOUSE_OUT, function(event:MouseEvent):void { 144 145 144 drawFocus(false); 145 }); 146 146 addChild(addElementLabel); 147 147 } 148 148 149 149 private function addConceptLink():void { 150 150 addChild(new ConceptLinkInput(LabelConstants.CONCEPTLINK, _component.conceptLink, function(val:String):void { 151 152 153 } 154 151 _component.conceptLink = val; 152 })); 153 } 154 155 155 private function addRuler():void { 156 156 var ruler:HRule = new HRule(); … … 158 158 addChild(ruler); 159 159 } 160 160 161 161 private function addNameInput():void { 162 162 var nameInput:FormItemInputLine = new NameInputLine(_component.name, function(val:String):void { 163 164 163 _component.name = val; 164 }); 165 165 addChild(nameInput); 166 166 } 167 167 168 168 private function addCardinalityInput():void { 169 169 addChild(new CardinalityInput(LabelConstants.CARDINALITY_MIN, _component.cardinalityMin, function(val:String):void { 170 171 170 _component.cardinalityMin = val; 171 })); 172 172 addChild(new CardinalityInput(LabelConstants.CARDINALITY_MAX, _component.cardinalityMax, function(val:String):void { 173 174 175 } 176 173 _component.cardinalityMax = val; 174 })); 175 } 176 177 177 private function createComponentEditBar():void { 178 178 var editBar:HBox = new HBox(); … … 181 181 addFocusListeners(removeButton).addEventListener(MouseEvent.CLICK, fireRemoveComponent); 182 182 editBar.addChild(removeButton); 183 183 184 184 var downButton:Button = new DownIconButton(); 185 185 addFocusListeners(downButton).addEventListener(MouseEvent.CLICK, moveDownComponent); 186 186 editBar.addChild(downButton); 187 187 188 188 var upButton:Button = new UpIconButton(); 189 189 addFocusListeners(upButton).addEventListener(MouseEvent.CLICK, moveUpComponent); … … 202 202 } 203 203 } 204 204 205 205 private function moveUpComponent(event:Event):void { 206 206 var comp:CMDComponent = component; … … 213 213 } 214 214 } 215 215 216 216 private function addFocusListeners(comp:UIComponent):UIComponent { 217 217 comp.addEventListener(MouseEvent.MOUSE_OVER, function(event:MouseEvent):void { 218 219 218 drawFocus(true); 219 }); 220 220 comp.addEventListener(MouseEvent.MOUSE_OUT, function(event:MouseEvent):void { 221 222 221 drawFocus(false); 222 }); 223 223 return comp; 224 224 } 225 225 226 226 private function createComponentLink(component:CMDComponent):FormItem { 227 227 if (component.componentId != "" && component.componentId != null) { … … 234 234 return null; 235 235 } 236 236 237 237 private function handleCMDAttributeList():void { 238 if (_component.attributeList.length > 0) 239 addChild(new AttributeListEdit(_component.attributeList, this)); 240 } 241 238 addChild(new AttributeListEdit(_component.attributeList, this)); 239 } 240 242 241 private function handleComponents(components:ArrayCollection):void { 243 242 for each (var component:CMDComponent in components) { … … 245 244 } 246 245 } 247 246 248 247 public function addComponent(component:CMDComponent):void { 249 248 var comp:Container = new ComponentEdit(component, this, _component); … … 256 255 } 257 256 } 258 257 259 258 private function removeComponent(event:Event):void { 260 259 var comp:CMDComponent = ComponentEdit(event.currentTarget).component; … … 262 261 removeChild(event.currentTarget as DisplayObject); 263 262 } 264 263 265 264 private function handleElements(elements:ArrayCollection):void { 266 265 for each (var element:CMDComponentElement in elements) { … … 268 267 } 269 268 } 270 269 271 270 public function addElement(element:CMDComponentElement):void { 272 271 var elem:Container = new ElementEdit(element, this, _component); … … 279 278 } 280 279 } 281 280 282 281 private function removeElement(event:Event):void { 283 282 var elem:CMDComponentElement = ElementEdit(event.currentTarget).element; … … 285 284 removeChild(event.currentTarget as DisplayObject); 286 285 } 287 286 288 287 private function createHeading():FormItem { 289 288 var heading:FormItem = new FormItem(); … … 292 291 return heading; 293 292 } 294 295 293 294 296 295 } 297 296 }
Note: See TracChangeset
for help on using the changeset viewer.