Changeset 5494
- Timestamp:
- 07/28/14 14:06:51 (10 years ago)
- Location:
- VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/gui/wizard/CreateVirtualCollectionWizard$ResourcesStep$ActionsPanel.html
r932 r5494 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> 10 12 </wicket:panel> 11 13 </body> -
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/gui/wizard/CreateVirtualCollectionWizard$ResourcesStep.html
r906 r5494 10 10 <div style="display: none" wicket:id="deleteResourceDialog"></div> 11 11 <div style="display: none" wicket:id="addResourcesDialog"></div> 12 <div class="fieldset">12 <div wicket:id="resourcesContainer" class="fieldset"> 13 13 <label class="required">Resources<br /><a wicket:id="add" href="#" class="add"><span>[add]</span></a><br /><a wicket:id="addMore" href="#" class="addMore"><span>[add more]</span></a></label> 14 14 <table wicket:id="resourcesTable" class="resourcesTable"></table> -
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/gui/wizard/CreateVirtualCollectionWizard.java
r5490 r5494 11 11 import java.util.List; 12 12 import org.apache.wicket.Component; 13 import org.apache.wicket.Session; 13 14 import org.apache.wicket.ajax.AjaxRequestTarget; 14 15 import org.apache.wicket.ajax.markup.html.AjaxLink; … … 141 142 new EnumChoiceRenderer<VirtualCollection.Reproducibility>(this)); 142 143 add(reproducibilityChoice); 143 144 final TextArea<String> reproducibilityNoticeArea 144 145 = new TextArea<String>("reproducibilityNotice"); 145 146 add(reproducibilityNoticeArea); 146 147 147 148 final KeywordsList keywordList 148 = new KeywordsList("keywordsList", 149 = new KeywordsList("keywordsList", 149 150 new PropertyModel<List<String>>(vc, "keywords")); 150 151 add(keywordList); … … 168 169 add(addKeywordDialog); 169 170 170 deleteKeywordDialog =171 new DeleteKeywordDialog("deleteKeywordDialog", keywordList);171 deleteKeywordDialog 172 = new DeleteKeywordDialog("deleteKeywordDialog", keywordList); 172 173 add(deleteKeywordDialog); 173 174 } … … 198 199 199 200 private final class CreatorsStep extends DynamicWizardStep { 201 200 202 private final class ActionsPanel extends Panel { 203 201 204 public ActionsPanel(String id, final IModel<Creator> model) { 202 205 super(id, model); 203 206 setRenderBodyOnly(true); 204 final AjaxLink<Creator> editLink =205 new AjaxLink<Creator>("edit") {207 final AjaxLink<Creator> editLink 208 = new AjaxLink<Creator>("edit") { 206 209 @Override 207 210 public void onClick(AjaxRequestTarget target) { … … 210 213 }; 211 214 add(editLink); 212 final AjaxLink<Creator> deleteLink =213 new AjaxLink<Creator>("delete") {215 final AjaxLink<Creator> deleteLink 216 = new AjaxLink<Creator>("delete") { 214 217 @Override 215 218 public void onClick(AjaxRequestTarget target) { … … 222 225 223 226 private final class DeleteCreatorDialog extends ConfirmationDialog { 227 224 228 private IModel<Creator> creator; 225 229 … … 264 268 return new VolatileEntityModel<Creator>(creator); 265 269 } 270 266 271 @Override 267 272 public int size() { … … 349 354 350 355 private final class ResourcesStep extends DynamicWizardStep { 356 357 private final WebMarkupContainer resourcesContainer; 358 351 359 private final class ActionsPanel extends Panel { 360 352 361 public ActionsPanel(String id, final IModel<Resource> model) { 353 362 super(id, model); 354 363 setRenderBodyOnly(true); 355 final AjaxLink<Resource> editLink =356 new AjaxLink<Resource>("edit") {364 final AjaxLink<Resource> editLink 365 = new AjaxLink<Resource>("edit") { 357 366 @Override 358 367 public void onClick(AjaxRequestTarget target) { 359 368 editResourceDialog.show(target, model); 360 369 } 370 371 @Override 372 protected void onConfigure() { 373 // only allow when not moving 374 setVisible(movingResource.getObject() == null); 375 } 361 376 }; 362 377 add(editLink); 363 final AjaxLink<Resource> deleteLink =364 new AjaxLink<Resource>("delete") {378 final AjaxLink<Resource> deleteLink 379 = new AjaxLink<Resource>("delete") { 365 380 @Override 366 381 public void onClick(AjaxRequestTarget target) { 367 382 deleteResourceDialog.showResource(target, model); 368 383 } 384 385 @Override 386 protected void onConfigure() { 387 // only allow when not moving 388 setVisible(movingResource.getObject() == null); 389 } 369 390 }; 370 391 add(deleteLink); 392 final AjaxLink<Resource> moveLink 393 = new AjaxLink<Resource>("move") { 394 395 @Override 396 public void onClick(AjaxRequestTarget target) { 397 movingResource.setObject(model.getObject()); 398 target.addComponent(resourcesContainer); 399 } 400 401 @Override 402 protected void onConfigure() { 403 // only allow to start moving when not moving 404 setVisible(movingResource.getObject() == null); 405 } 406 407 }; 408 add(moveLink); 409 final AjaxLink<Resource> targetLink 410 = new AjaxLink<Resource>("target") { 411 412 @Override 413 public void onClick(AjaxRequestTarget target) { 414 final List<Resource> resources = vc.getObject().getResources(); 415 final Resource toMove = movingResource.getObject(); 416 try { 417 if (resources.remove(toMove)) { 418 final int targetIndex = resources.indexOf(model.getObject()); 419 if (targetIndex >= 0) { 420 resources.add(targetIndex, toMove); 421 return; 422 } 423 } 424 Session.get().warn("Could not move reference"); 425 426 } finally { 427 movingResource.setObject(null); 428 target.addComponent(resourcesContainer); 429 } 430 } 431 432 @Override 433 protected void onConfigure() { 434 final Resource toMove = movingResource.getObject(); 435 // only allow to drop when moving 436 setVisible(toMove != null 437 && !toMove.equals(model.getObject()) 438 ); 439 } 440 441 }; 442 add(targetLink); 371 443 } 372 444 } // class CreateVirtualCollectionWizard.ResourcesStep.ActionsPanel 373 445 374 446 private final class DeleteResourceDialog extends ConfirmationDialog { 447 375 448 private IModel<Resource> resource; 376 449 … … 399 472 private final DeleteResourceDialog deleteResourceDialog; 400 473 474 private IModel<Resource> movingResource = new Model<>(); 475 401 476 public ResourcesStep(IDynamicWizardStep previousStep) { 402 477 super(previousStep, "Resources", null, vc); 403 final DataTable<Resource> resourcesTable = 404 new AjaxFallbackDefaultDataTable<Resource>("resourcesTable", 478 resourcesContainer = new WebMarkupContainer("resourcesContainer"); 479 resourcesContainer.setOutputMarkupId(true); 480 add(resourcesContainer); 481 final DataTable<Resource> resourcesTable 482 = new AjaxFallbackDefaultDataTable<Resource>("resourcesTable", 405 483 createColumns(), 406 484 new SortableDataProvider<Resource>() { … … 423 501 64); 424 502 resourcesTable.setOutputMarkupId(true); 425 add(resourcesTable);503 resourcesContainer.add(resourcesTable); 426 504 427 505 editResourceDialog = new EditResourceDialog("editResourceDialog") { … … 449 527 add(deleteResourceDialog); 450 528 451 final AddResourcesDialog addResourcesDialog =452 new AddResourcesDialog("addResourcesDialog") {529 final AddResourcesDialog addResourcesDialog 530 = new AddResourcesDialog("addResourcesDialog") { 453 531 @Override 454 532 public void onSubmit(AjaxRequestTarget target, … … 465 543 add(addResourcesDialog); 466 544 467 add(new AjaxLink<Object>("add") {545 resourcesContainer.add(new AjaxLink<Object>("add") { 468 546 @Override 469 547 public void onClick(AjaxRequestTarget target) { … … 472 550 }); 473 551 474 add(new AjaxLink<Object>("addMore") {552 resourcesContainer.add(new AjaxLink<Object>("addMore") { 475 553 @Override 476 554 public void onClick(AjaxRequestTarget target) { … … 529 607 }, 530 608 new PropertyColumn<Resource>( 531 532 533 534 535 536 537 538 609 new Model<String>("Reference"), "ref") { 610 611 @Override 612 public void populateItem(Item<ICellPopulator<Resource>> item, String componentId, IModel<Resource> rowModel) { 613 item.add(new ReferenceLinkPanel(componentId, rowModel)); 614 } 615 616 }, 539 617 new HeaderlessColumn<Resource>() { 540 618 @Override … … 556 634 557 635 private final class GeneratedByStep extends DynamicWizardStep { 636 558 637 public GeneratedByStep(IDynamicWizardStep previousStep) { 559 638 super(previousStep, "Intensional Collection Query", null, vc); 560 639 setDefaultModel(new CompoundPropertyModel<VirtualCollection>(vc)); 561 final TextArea<String> descriptionArea =562 new TextArea<String>("generatedBy.description");640 final TextArea<String> descriptionArea 641 = new TextArea<String>("generatedBy.description"); 563 642 descriptionArea.setRequired(true); 564 643 add(descriptionArea); 565 final TextField<String> uriField =566 new TextField<String>("generatedBy.uri");644 final TextField<String> uriField 645 = new TextField<String>("generatedBy.uri"); 567 646 uriField.add(new StringValidator.MaximumLengthValidator(255)); 568 647 uriField.add(new UrlValidator(UrlValidator.NO_FRAGMENTS)); 569 648 add(uriField); 570 final TextField<String> queryProfileField =571 new TextField<String>("generatedBy.query.profile");649 final TextField<String> queryProfileField 650 = new TextField<String>("generatedBy.query.profile"); 572 651 add(queryProfileField); 573 final TextArea<String> queryValueArea =574 new TextArea<String>("generatedBy.query.value");652 final TextArea<String> queryValueArea 653 = new TextArea<String>("generatedBy.query.value"); 575 654 add(queryValueArea); 576 655 -
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/model/VirtualCollection.java
r5446 r5494 30 30 import javax.persistence.OneToOne; 31 31 import javax.persistence.OrderBy; 32 import javax.persistence.OrderColumn; 32 33 import javax.persistence.Table; 33 34 import javax.persistence.Temporal; … … 159 160 fetch = FetchType.LAZY, 160 161 orphanRemoval = true) 161 @JoinColumn(name = "vc_id", nullable = false) 162 @Order By("id")162 @JoinColumn(name = "vc_id", nullable = false) 163 @OrderColumn(nullable = false) 163 164 private List<Resource> resources; 164 165
Note: See TracChangeset
for help on using the changeset viewer.