Changeset 817
- Timestamp:
- 09/02/11 07:58:42 (14 years ago)
- Location:
- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlSpace.java ¶
r800 r817 2 2 3 3 import java.util.ArrayList; 4 5 4 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct; 6 5 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic; … … 40 39 // has no effect on this element 41 40 } 41 42 43 @Override 44 public void validate() throws ExecutionException { 45 // this element has no editable content and is always valid 46 return; 47 } 42 48 } -
TabularUnified branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java ¶
r816 r817 2298 2298 return result; 2299 2299 } 2300 2301 2302 // validates the entered user data, if it is invalid a ExecutionException is thrown 2303 public void validate() throws ExecutionException{ 2304 // TODO: implement 2305 } 2300 2306 } -
TabularUnified branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlActionButton.java ¶
r816 r817 271 271 // has no effect on this element 272 272 } 273 274 275 @Override 276 public void validate() throws ExecutionException { 277 // this element has no editable content and is always valid 278 return; 279 } 273 280 } -
TabularUnified branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.java ¶
r800 r817 211 211 } 212 212 } 213 214 215 // Wraps a ul an ol element as a widget based on a SimplePanel 216 protected class ListWidget extends Composite implements HasMouseDownHandlers, HasMouseUpHandlers, HasFocusHandlers, HasBlurHandlers, HasMouseOutHandlers, HasMouseOverHandlers{ 217 private AbsolutePanel basePanel = new AbsolutePanel(); 218 private Element listElement = null; 219 // note: index is not the actual index of the item in the array list, 220 // it is the user's passed index when inserting this element 221 private ArrayList<Pair<ListItem, Integer>> itemsAndIndexes = new ArrayList<Pair<ListItem, Integer>>(); 222 223 public ListWidget(){ 224 initWidget(this.basePanel); 225 DOM.setStyleAttribute(this.basePanel.getElement(), "overflow", "visible"); 226 this.listElement = DOM.createElement("ul"); 227 this.basePanel.getElement().insertFirst(this.listElement); 228 } 229 230 231 public ListWidget(boolean ordered){ 232 initWidget(this.basePanel); 233 DOM.setStyleAttribute(this.basePanel.getElement(), "overflow", "visible"); 234 if(ordered) this.listElement = DOM.createElement("ol"); 235 else this.listElement = DOM.createElement("ul"); 236 this.basePanel.getElement().insertFirst(this.listElement); 237 } 238 239 240 // inserts the passed list item as the last child to this list element 241 public void appendListItem(ListItem item){ 242 if(item == null) return; 243 item.appendToList(this.listElement); 244 } 245 246 247 // inserts the passed instance item to this list directly after the intance previous 248 public void appendListItem(ListItem item, ListItem previous){ 249 if(item == null) return; 250 item.appendToList(this.listElement, previous); 251 } 252 253 254 // inserts the passed widget directly before the first item that 255 // has a greater position index 256 public void insertWidget(Widget widget, int position){ 257 ListItem previosItem = this.getItemBeforeIndex(position); 258 ListItem item = new ListItem(this.listElement); 259 item.appendContentToListItem(widget.getElement()); 260 this.appendListItem(item, previosItem); 261 } 262 263 264 // returns the first item that has a smaller position index 265 public ListItem getItemBeforeIndex(int idx){ 266 Pair<ListItem, Integer> result = null; 267 for (Pair<ListItem, Integer> item : this.itemsAndIndexes) { 268 if(item.getSecond() < idx && (result == null || result.getSecond() < item.getSecond()))result = item; 269 } 270 271 if(result != null) result.getFirst(); 272 return null; 273 } 274 275 276 // returns the acutal DOM element 277 public Element getListElement(){ 278 return this.listElement; 279 } 280 281 // returns all ListItems 282 public ArrayList<ListItem> getItems(){ 283 ArrayList<ListItem> items = new ArrayList<GdlList.ListItem>(); 284 for (Pair<ListItem, Integer> pair : this.itemsAndIndexes) { 285 items.add(pair.getFirst()); 286 } 287 return items; 288 } 289 290 291 // returns the position index of the item, that was specified when 292 // inserting the passed ListItem 293 public int indexOfItem(ListItem item){ 294 for (Pair<ListItem, Integer> pair : this.itemsAndIndexes) { 295 if(pair.getFirst().equals(item)) return pair.getSecond(); 296 } 297 298 return -1; 299 } 300 301 302 public void setId(String id){ 303 DOM.setElementAttribute(this.basePanel.getElement(), "id", id); 304 } 305 306 307 @Override 308 public HandlerRegistration addMouseOverHandler(MouseOverHandler handler) { 309 return this.addDomHandler(handler, MouseOverEvent.getType()); 310 } 311 312 313 @Override 314 public HandlerRegistration addMouseOutHandler(MouseOutHandler handler) { 315 return this.addDomHandler(handler, MouseOutEvent.getType()); 316 } 317 318 319 @Override 320 public HandlerRegistration addBlurHandler(BlurHandler handler) { 321 return this.addDomHandler(handler, BlurEvent.getType()); 322 } 323 324 325 @Override 326 public HandlerRegistration addFocusHandler(FocusHandler handler) { 327 return this.addDomHandler(handler, FocusEvent.getType()); 328 } 329 330 331 @Override 332 public HandlerRegistration addMouseUpHandler(MouseUpHandler handler) { 333 return this.addDomHandler(handler, MouseUpEvent.getType()); 334 } 335 336 337 @Override 338 public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) { 339 return this.addDomHandler(handler, MouseDownEvent.getType()); 340 } 341 } 342 213 343 214 344 215 // this class wraps a list item, i.e. a div element within a li element … … 346 217 private Element liElement = null; 347 218 private Element divElement = null; 219 private ArrayList<GdlVisibleObject> contents = new ArrayList<GdlVisibleObject>(); 220 348 221 349 222 public ListItem(){ … … 391 264 392 265 // appends the content element to the inner div item 393 public void appendContentToListItem( Element content){266 public void appendContentToListItem(GdlVisibleObject content){ 394 267 if(content != null){ 395 268 Node lastChild = this.divElement.getLastChild(); 396 269 if(lastChild != null){ 397 this.divElement.insertAfter(content , lastChild);270 this.divElement.insertAfter(content.getElement(), lastChild); 398 271 } else { 399 this.divElement.insertFirst(content );272 this.divElement.insertFirst(content.getElement()); 400 273 } 401 } 274 275 contents.add(content); 276 } 277 } 278 279 280 public void validate() throws ExecutionException { 281 for (GdlVisibleObject content : this.contents) content.validate(); 282 } 283 } 284 285 286 @Override 287 public void validate() throws ExecutionException { 288 for (Widget ctrl : this.subElements) { 289 ((ListWidget)((ButtonableObject)ctrl).getMainObject()).validate(); 402 290 } 403 291 } … … 453 341 // has no effect on this element 454 342 } 343 344 345 // Wraps a ul an ol element as a widget based on a SimplePanel 346 protected class ListWidget extends Composite implements HasMouseDownHandlers, HasMouseUpHandlers, HasFocusHandlers, HasBlurHandlers, HasMouseOutHandlers, HasMouseOverHandlers{ 347 private AbsolutePanel basePanel = new AbsolutePanel(); 348 private Element listElement = null; 349 // note: index is not the actual index of the item in the array list, 350 // it is the user's passed index when inserting this element 351 private ArrayList<Pair<ListItem, Integer>> itemsAndIndexes = new ArrayList<Pair<ListItem, Integer>>(); 352 353 public ListWidget(){ 354 initWidget(this.basePanel); 355 DOM.setStyleAttribute(this.basePanel.getElement(), "overflow", "visible"); 356 this.listElement = DOM.createElement("ul"); 357 this.basePanel.getElement().insertFirst(this.listElement); 358 } 359 360 361 public ListWidget(boolean ordered){ 362 initWidget(this.basePanel); 363 DOM.setStyleAttribute(this.basePanel.getElement(), "overflow", "visible"); 364 if(ordered) this.listElement = DOM.createElement("ol"); 365 else this.listElement = DOM.createElement("ul"); 366 this.basePanel.getElement().insertFirst(this.listElement); 367 } 368 369 370 // inserts the passed list item as the last child to this list element 371 public void appendListItem(ListItem item){ 372 if(item == null) return; 373 item.appendToList(this.listElement); 374 } 375 376 377 // inserts the passed instance item to this list directly after the intance previous 378 public void appendListItem(ListItem item, ListItem previous){ 379 if(item == null) return; 380 item.appendToList(this.listElement, previous); 381 } 382 383 384 // inserts the passed widget directly before the first item that 385 // has a greater position index 386 public void insertWidget(GdlVisibleObject widget, int position){ 387 ListItem previosItem = this.getItemBeforeIndex(position); 388 ListItem item = new ListItem(this.listElement); 389 item.appendContentToListItem(widget); 390 this.appendListItem(item, previosItem); 391 } 392 393 394 // returns the first item that has a smaller position index 395 public ListItem getItemBeforeIndex(int idx){ 396 Pair<ListItem, Integer> result = null; 397 for (Pair<ListItem, Integer> item : this.itemsAndIndexes) { 398 if(item.getSecond() < idx && (result == null || result.getSecond() < item.getSecond()))result = item; 399 } 400 401 if(result != null) result.getFirst(); 402 return null; 403 } 404 405 406 // returns the acutal DOM element 407 public Element getListElement(){ 408 return this.listElement; 409 } 410 411 // returns all ListItems 412 public ArrayList<ListItem> getItems(){ 413 ArrayList<ListItem> items = new ArrayList<GdlList.ListItem>(); 414 for (Pair<ListItem, Integer> pair : this.itemsAndIndexes) { 415 items.add(pair.getFirst()); 416 } 417 return items; 418 } 419 420 421 // returns the position index of the item, that was specified when 422 // inserting the passed ListItem 423 public int indexOfItem(ListItem item){ 424 for (Pair<ListItem, Integer> pair : this.itemsAndIndexes) { 425 if(pair.getFirst().equals(item)) return pair.getSecond(); 426 } 427 428 return -1; 429 } 430 431 432 public void validate() throws ExecutionException { 433 for (Pair<ListItem, Integer> item: this.itemsAndIndexes) { 434 item.getFirst().validate(); 435 } 436 } 437 438 439 public void setId(String id){ 440 DOM.setElementAttribute(this.basePanel.getElement(), "id", id); 441 } 442 443 444 @Override 445 public HandlerRegistration addMouseOverHandler(MouseOverHandler handler) { 446 return this.addDomHandler(handler, MouseOverEvent.getType()); 447 } 448 449 450 @Override 451 public HandlerRegistration addMouseOutHandler(MouseOutHandler handler) { 452 return this.addDomHandler(handler, MouseOutEvent.getType()); 453 } 454 455 456 @Override 457 public HandlerRegistration addBlurHandler(BlurHandler handler) { 458 return this.addDomHandler(handler, BlurEvent.getType()); 459 } 460 461 462 @Override 463 public HandlerRegistration addFocusHandler(FocusHandler handler) { 464 return this.addDomHandler(handler, FocusEvent.getType()); 465 } 466 467 468 @Override 469 public HandlerRegistration addMouseUpHandler(MouseUpHandler handler) { 470 return this.addDomHandler(handler, MouseUpEvent.getType()); 471 } 472 473 474 @Override 475 public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) { 476 return this.addDomHandler(handler, MouseDownEvent.getType()); 477 } 478 } 455 479 } -
TabularUnified branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlUnit.java ¶
r800 r817 245 245 246 246 247 @Override 248 public void validate() throws ExecutionException { 249 for (Widget ctrl : this.subElements) { 250 ((UnitWidget)((ButtonableObject)ctrl).getMainObject()).validate(); 251 } 252 } 253 254 247 255 protected class UnitWidget extends Composite implements HasFocusHandlers, HasBlurHandlers, HasMouseOutHandlers, HasMouseOverHandlers, HasMouseDownHandlers, HasMouseUpHandlers{ 248 256 private CaptionPanel basePanel = new CaptionPanel(); … … 371 379 } 372 380 } 381 382 383 public void validate() throws ExecutionException{ 384 for (Widget ctrl : this.subElements) { 385 if(ctrl instanceof GdlVisibleObject){ 386 ((GdlVisibleObject)ctrl).validate(); 387 } 388 } 389 } 373 390 } 374 391 } -
TabularUnified branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlInfo.java ¶
r800 r817 109 109 return new ArrayList<String>(); 110 110 } 111 112 113 @Override 114 public void validate() throws ExecutionException { 115 // this element has no editable content and is always valid 116 return; 117 } 111 118 } -
TabularUnified branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlReference.java ¶
r800 r817 59 59 60 60 61 @Override 62 public void validate() throws ExecutionException { 63 // this element has no editable content and is always valid 64 return; 65 } 66 67 61 68 private ReferenceWidget createReference() throws InvalidGdlSchemaException, ExecutionException { 62 69 ReferenceWidget reference = new ReferenceWidget(); -
TabularUnified branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTitle.java ¶
r800 r817 450 450 451 451 452 @Override 453 public void validate() throws ExecutionException { 454 // this element has no editable content and is always valid 455 return; 456 } 457 458 452 459 // this class represents the acutal content of this widget, i.e. 453 460 // it wraps a h1, h2, h3 or h4 element -
TabularUnified branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlAssociationView.java ¶
r816 r817 224 224 return result; 225 225 } 226 227 228 @Override 229 public void validate() throws ExecutionException { 230 for (Widget ctrl : this.subElements) 231 if(ctrl instanceof AssociationItem) ((AssociationItem)ctrl).validate(); 232 } 226 233 227 234 -
TabularUnified branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlDefaultTopicView.java ¶
r801 r817 16 16 // TODO: implement 17 17 18 18 19 } -
TabularUnified branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlView.java ¶
r809 r817 126 126 } 127 127 } 128 129 130 @Override 131 public void validate() throws ExecutionException { 132 for (Widget ctrl : this.subElements) { 133 if(ctrl instanceof GdlVisibleObject){ 134 ((GdlVisibleObject)ctrl).validate(); 135 } 136 } 137 } 128 138 }
Note: See TracChangeset
for help on using the changeset viewer.