Changeset 841
- Timestamp:
- 11/03/10 18:33:18 (14 years ago)
- Location:
- VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/gui/wizard/CreateVirtualCollectionWizard$GeneralStep.html
r820 r841 6 6 <body> 7 7 <wicket:panel> 8 <div style="display: none" wicket:id="addKeywordDialog"></div> 9 <div style="display: none" wicket:id="deleteKeywordDialog"></div> 8 10 <fieldset> 9 11 <div class="notes"> … … 41 43 </div> 42 44 <div class="optional"> 43 <label for="gen_vc_reproducibility_keywords">Keywords</label> 44 <textarea id="gen_vc_reproducibility_keywords" 45 cols="40" rows="5"></textarea> 45 <label>Keywords<br /><a href="#" 46 wicket:id="keywordsAdd" class="add"><span>[add]</span></a></label> 47 <div wicket:id="keywordsList" class="keywordsList"> 48 <ul> 49 <li wicket:id="keywords"> 50 <span wicket:id="itemText">item text</span> 51 <a wicket:id="itemRemove" href="#"><span class="remove">[remove]</span></a> 52 </li> 53 </ul> 54 </div> 46 55 </div> 47 56 </fieldset> -
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/gui/wizard/CreateVirtualCollectionWizard.java
r824 r841 3 3 import java.util.Arrays; 4 4 import java.util.Iterator; 5 import java.util.List; 5 6 6 7 import org.apache.wicket.ajax.AjaxRequestTarget; 7 8 import org.apache.wicket.ajax.markup.html.AjaxLink; 9 import org.apache.wicket.behavior.AttributeAppender; 8 10 import org.apache.wicket.extensions.ajax.markup.html.repeater.data.table.AjaxFallbackDefaultDataTable; 9 11 import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator; … … 17 19 import org.apache.wicket.extensions.wizard.dynamic.DynamicWizardStep; 18 20 import org.apache.wicket.extensions.wizard.dynamic.IDynamicWizardStep; 21 import org.apache.wicket.markup.html.WebMarkupContainer; 19 22 import org.apache.wicket.markup.html.basic.Label; 20 23 import org.apache.wicket.markup.html.form.DropDownChoice; … … 26 29 import org.apache.wicket.markup.html.form.TextField; 27 30 import org.apache.wicket.markup.html.form.validation.AbstractFormValidator; 31 import org.apache.wicket.markup.html.list.ListItem; 32 import org.apache.wicket.markup.html.list.ListView; 28 33 import org.apache.wicket.markup.html.panel.Panel; 29 34 import org.apache.wicket.markup.repeater.Item; 35 import org.apache.wicket.model.AbstractReadOnlyModel; 30 36 import org.apache.wicket.model.CompoundPropertyModel; 31 37 import org.apache.wicket.model.IModel; … … 43 49 public class CreateVirtualCollectionWizard extends WizardBase { 44 50 private final class GeneralStep extends DynamicWizardStep { 51 private final class DeleteKeywordDialog extends ConfirmationDialog { 52 private transient KeywordsList keywordList; 53 private String keyword; 54 55 public DeleteKeywordDialog(String id, KeywordsList keywordList) { 56 super(id); 57 this.keywordList = keywordList; 58 } 59 60 @Override 61 public void onConfirm(AjaxRequestTarget target) { 62 vc.getKeywords().remove(keyword); 63 target.addComponent(keywordList); 64 } 65 66 public void show(AjaxRequestTarget target, String keyword) { 67 this.keyword = keyword; 68 super.show(target, new StringResourceModel("keywords.deleteconfirm", null, new Object[] { keyword })); 69 } 70 } // class CreateVirtualCollectionWizard.GeneralStep.DeleteKeywordDialog 71 72 private final class KeywordsList extends WebMarkupContainer { 73 private final ListView<String> itemsView; 74 75 public KeywordsList(String id, final List<String> items) { 76 super(id); 77 setOutputMarkupId(true); 78 79 itemsView = new ListView<String>("keywords", items) { 80 @Override 81 protected void populateItem(final ListItem<String> item) { 82 final IModel<String> model = item.getModel(); 83 item.add(new Label("itemText", model.getObject())); 84 item.add(new AjaxLink<String>("itemRemove", 85 new Model<String>("[remove]")) { 86 @Override 87 public void onClick(AjaxRequestTarget target) { 88 deleteKeywordDialog.show(target, 89 model.getObject()); 90 } 91 }); 92 item.add(new AttributeAppender("class", 93 new AbstractReadOnlyModel<String>() { 94 public String getObject() { 95 if (item.getIndex() == 0) { 96 return "first odd"; 97 } 98 return (item.getIndex() % 2 == 1) ? 99 "even" : "odd"; 100 } 101 }, " ")); 102 } 103 }; 104 add(itemsView); 105 } 106 } // class CreateVirtualCollectionWizard.GeneralStep.KeywordsList 107 108 private final AddKeywordDialog addKeywordDialog; 109 private final DeleteKeywordDialog deleteKeywordDialog; 110 45 111 public GeneralStep() { 46 112 super(null, "General", "Yada yada yada ..."); … … 64 130 add(reproducibilityChoice); 65 131 add(new TextArea<String>("vc.reproducibilityNotice")); 132 133 final KeywordsList keywordList = 134 new KeywordsList("keywordsList", vc.getKeywords()); 135 add(keywordList); 136 add(new AjaxLink<String>("keywordsAdd") { 137 @Override 138 public void onClick(AjaxRequestTarget target) { 139 addKeywordDialog.show(target); 140 } 141 }); 142 143 addKeywordDialog = new AddKeywordDialog("addKeywordDialog") { 144 @Override 145 public void onSubmit(AjaxRequestTarget target, String keyword) { 146 if (!vc.getKeywords().contains(keyword)) { 147 vc.getKeywords().add(keyword); 148 } 149 target.addComponent(keywordList); 150 } 151 }; 152 add(addKeywordDialog); 153 154 deleteKeywordDialog = 155 new DeleteKeywordDialog("deleteKeywordDialog", keywordList); 156 add(deleteKeywordDialog); 66 157 } 67 158 … … 505 596 System.err.println("Rep: " + vc.getReproducibility()); 506 597 System.err.println("RepNot: " + vc.getReproducibilityNotice()); 598 for (String kw : vc.getKeywords()) { 599 System.err.println("KW: " + kw); 600 } 507 601 for (Creator c : vc.getCreators()) { 508 602 System.err.println("C: " + c.getName() + ", " + c.getEMail()); -
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/gui/wizard/CreateVirtualCollectionWizard.properties
r817 r841 10 10 Type.METADATA: Metadata 11 11 Type.RESOURCE: Resource 12 keywords.deleteconfirm: Do you really want to delete "{0}"? 12 13 creators.deleteconfirm: Do you really want to delete "${name}"? 13 14 resources.deleteconfirm: Do you really want to delete "${ref}"? -
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/model/Creator.java
r804 r841 104 104 } 105 105 106 @Override 107 public String toString() { 108 StringBuilder sb = new StringBuilder("Creator@"); 109 sb.append(Integer.toHexString(hashCode())); 110 sb.append("["); 111 sb.append("name="); 112 sb.append(name); 113 if (email != null) { 114 sb.append(",email="); 115 sb.append(email); 116 } 117 if (organisation != null) { 118 sb.append(",organisation="); 119 sb.append(organisation); 120 } 121 sb.append("]"); 122 return sb.toString(); 123 } 124 106 125 } // class Creator -
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/webapp/css/vcr.css
r824 r841 307 307 } 308 308 309 /* 309 310 div.optional label:after { 310 311 content: ':'; … … 314 315 content: ':'; 315 316 } 317 */ 316 318 317 319 form.wizard textarea { … … 458 460 } 459 461 462 /* 460 463 form.wizard .buttonbar input.button, 461 div.modalDialog div.modalDialogButtons input.button { 464 div.modalDialog div.modalDialogButtons input.button 465 */ 466 input.button { 462 467 padding: 1px 4px; 463 468 margin: 0 2px; … … 483 488 } 484 489 485 /* modal dialog */ 490 491 /* 492 * modal dialog 493 */ 486 494 div.modalDialog { 487 495 margin: 0; … … 519 527 } 520 528 529 521 530 /* 522 531 * dialog customizations … … 547 556 div.addResourcesDialog fieldset textarea { 548 557 width: 460px; 558 } 559 560 div.addKeywordDialog fieldset input { 561 width: 285px; 549 562 } 550 563 … … 580 593 } 581 594 582 div.wizard a.add, 583 div.wizard a.addMore, 584 div.wizard table td.action a { 595 a { 585 596 color: #AE0000; 586 597 background-color: inherit; … … 614 625 width: 60px; 615 626 } 627 628 div.keywordsList { 629 clear: none !important; 630 width: 602px; 631 margin-left: 160px; 632 padding: 3px 0; 633 } 634 635 div.keywordsList div { 636 clear: none; 637 } 638 639 div.keywordsList ul { 640 list-style-type: square; 641 margin: 0; 642 padding: 0 0 0 16px; 643 } 644 645 div.keywordsList ul li { 646 margin-top: 2px; 647 } 648 649 div.keywordsList ul li.first { 650 margin-top: 0; 651 }
Note: See TracChangeset
for help on using the changeset viewer.