Changeset 5495
- Timestamp:
- 07/28/14 15:34:59 (10 years ago)
- Location:
- VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main
- Files:
-
- 3 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/gui/wizard/CreateVirtualCollectionWizard$ResourcesStep$ActionsPanel.html
r5494 r5495 8 8 <a wicket:id="edit" href="#" class="edit"><span>[edit]</span></a> 9 9 <a wicket:id="delete" href="#" class="delete"><span>[delete]</span></a> 10 <a wicket:id="move" href="#" class="move"><span>[move]</span></a>11 <a wicket:id="target" href="#" class="target"><span>[insert before]</span></a>12 10 </wicket:panel> 13 11 </body> -
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/gui/wizard/CreateVirtualCollectionWizard$ResourcesStep$MoveItemPanel.html
r5494 r5495 6 6 <body> 7 7 <wicket:panel> 8 <a wicket:id="edit" href="#" class="edit"><span>[edit]</span></a> 9 <a wicket:id="delete" href="#" class="delete"><span>[delete]</span></a> 10 <a wicket:id="move" href="#" class="move"><span>[move]</span></a> 11 <a wicket:id="target" href="#" class="target"><span>[insert before]</span></a> 8 <a wicket:id="move" href="#" class="move" title="Move reference"><span>â</span></a> 9 <a wicket:id="target" href="#" class="target" title="Drop reference here"><span>â</span></a> 12 10 </wicket:panel> 13 11 </body> -
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/gui/wizard/CreateVirtualCollectionWizard.java
r5494 r5495 10 10 import java.util.Iterator; 11 11 import java.util.List; 12 import org.apache.wicket.AttributeModifier; 12 13 import org.apache.wicket.Component; 13 14 import org.apache.wicket.Session; 14 15 import org.apache.wicket.ajax.AjaxRequestTarget; 15 16 import org.apache.wicket.ajax.markup.html.AjaxLink; 17 import org.apache.wicket.behavior.AttributeAppender; 16 18 import org.apache.wicket.extensions.ajax.markup.html.repeater.data.table.AjaxFallbackDefaultDataTable; 17 19 import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator; … … 41 43 import org.apache.wicket.markup.html.panel.Panel; 42 44 import org.apache.wicket.markup.repeater.Item; 45 import org.apache.wicket.model.AbstractReadOnlyModel; 43 46 import org.apache.wicket.model.CompoundPropertyModel; 44 47 import org.apache.wicket.model.IModel; … … 337 340 new HeaderlessColumn<Creator>() { 338 341 @Override 339 public void populateItem( 340 Item<ICellPopulator<Creator>> item, 341 String compontentId, IModel<Creator> model) { 342 public void populateItem(Item<ICellPopulator<Creator>> item, String compontentId, IModel<Creator> model) { 342 343 item.add(new ActionsPanel(compontentId, model)); 343 344 } … … 390 391 }; 391 392 add(deleteLink); 393 } 394 395 } 396 397 private final class MoveItemPanel extends Panel { 398 399 public MoveItemPanel(String id, final IModel<Resource> model) { 400 super(id, model); 401 392 402 final AjaxLink<Resource> moveLink 393 403 = new AjaxLink<Resource>("move") { … … 395 405 @Override 396 406 public void onClick(AjaxRequestTarget target) { 397 movingResource.setObject(model.getObject()); 407 if (movingResource.getObject() == null) { 408 // start moving this resource 409 movingResource.setObject(model.getObject()); 410 } else { 411 // already moving, cancel 412 movingResource.setObject(null); 413 } 398 414 target.addComponent(resourcesContainer); 399 415 } … … 402 418 protected void onConfigure() { 403 419 // only allow to start moving when not moving 404 setVisible(movingResource.getObject() == null); 420 setVisible(movingResource.getObject() == null 421 || model.getObject().equals(movingResource.getObject()) 422 ); 405 423 } 406 424 … … 440 458 441 459 }; 460 442 461 add(targetLink); 443 462 } … … 499 518 } 500 519 }, 501 64); 520 64) { 521 522 @Override 523 protected Item<Resource> newRowItem(String id, int index, final IModel<Resource> model) { 524 final Item<Resource> item = super.newRowItem(id, index, model); 525 // mark the row that is being moved 526 item.add(new AttributeAppender("class", new AbstractReadOnlyModel<String>() { 527 528 @Override 529 public String getObject() { 530 if (model.getObject().equals(movingResource.getObject())) { 531 return "moving"; 532 } else { 533 return ""; 534 } 535 } 536 }, " ")); 537 return item; 538 } 539 540 }; 502 541 resourcesTable.setOutputMarkupId(true); 542 543 // add 'moving' class if table is in moving mode 544 resourcesTable.add(new AttributeAppender("class", new AbstractReadOnlyModel<String>() { 545 546 @Override 547 public String getObject() { 548 return movingResource.getObject() == null ? "" : "moving"; 549 } 550 }, " ")); 503 551 resourcesContainer.add(resourcesTable); 504 552 … … 586 634 private IColumn<Resource>[] createColumns() { 587 635 final IColumn<?>[] columns = new IColumn<?>[]{ 636 new AbstractColumn<Resource>(Model.of("\u2195")) { 637 638 @Override 639 public void populateItem(Item<ICellPopulator<Resource>> item, String componentId, IModel<Resource> model) { 640 item.add(new MoveItemPanel(componentId, model)); 641 } 642 643 @Override 644 public String getCssClass() { 645 return "move"; 646 } 647 648 }, 588 649 new AbstractColumn<Resource>(new Model<String>("Type")) { 589 650 @Override -
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/webapp/css/vcr.css
r5416 r5495 602 602 } 603 603 604 table.resourcesTable tr td.move { 605 width: 2em; 606 } 607 608 table.resourcesTable tr td.move a { 609 display: none; 610 } 611 612 table.resourcesTable th.move { 613 text-align: center; 614 } 615 616 table.resourcesTable tr:hover td.move a, table.resourcesTable tr.moving td.move a { 617 display: inline-block; 618 width: 100%; 619 text-align: center; 620 } 621 622 table.resourcesTable tr.moving { 623 background: #ccc; 624 } 625 626 table.resourcesTable tr.moving td, table.resourcesTable tr.moving td a { 627 color: #333; 628 } 629 604 630 a { 605 631 color: #AE0000; … … 639 665 table.resourcesTable { 640 666 width: 805px; 667 } 668 669 table.moving tr:hover td { 670 border-top: 2px solid; 641 671 } 642 672
Note: See TracChangeset
for help on using the changeset viewer.