Changeset 5496


Ignore:
Timestamp:
07/29/14 07:59:27 (10 years ago)
Author:
Twan Goosen
Message:

Improved usability of resource moving. Added an explicit 'cancel' action. Refs #597

Location:
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/gui/wizard/CreateVirtualCollectionWizard$ResourcesStep$MoveItemPanel.html

    r5495 r5496  
    11<?xml version="1.0" encoding="UTF-8"?>
    22<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    3                       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
     3    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    44<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org/">
    5 <head />
    6 <body>
    7 <wicket:panel>
    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>
    10 </wicket:panel>
    11 </body>
     5    <head />
     6    <body>
     7        <wicket:panel>
     8            <a wicket:id="move" href="#" class="move" title="Move reference"><span>[move]</span></a>
     9            <a wicket:id="cancel" href="#" class="cancelmove" title="Cancel move"><span>[cancel]</span></a>
     10            <a wicket:id="target" href="#" class="target" title="Drop reference here"><span>[insert]</span></a>
     11        </wicket:panel>
     12    </body>
    1213</html>
  • VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/gui/wizard/CreateVirtualCollectionWizard.java

    r5495 r5496  
    405405                            @Override
    406406                            public void onClick(AjaxRequestTarget target) {
    407                                 if (movingResource.getObject() == null) {
    408                                     // start moving this resource
    409407                                    movingResource.setObject(model.getObject());
    410                                 } else {
    411                                     // already moving, cancel
    412                                     movingResource.setObject(null);
    413                                 }
    414408                                target.addComponent(resourcesContainer);
    415409                            }
     
    418412                            protected void onConfigure() {
    419413                                // only allow to start moving when not moving
    420                                 setVisible(movingResource.getObject() == null
    421                                         || model.getObject().equals(movingResource.getObject())
    422                                 );
     414                                setVisible(movingResource.getObject() == null);
    423415                            }
    424416
    425417                        };
    426418                add(moveLink);
     419               
     420                final AjaxLink<Resource> cancelLink
     421                        = new AjaxLink<Resource>("cancel") {
     422
     423                            @Override
     424                            public void onClick(AjaxRequestTarget target) {
     425                                    movingResource.setObject(null);
     426                                target.addComponent(resourcesContainer);
     427                            }
     428
     429                            @Override
     430                            protected void onConfigure() {
     431                                    // only allow cancelling resource being moved
     432                                    setVisible(model.getObject().equals(movingResource.getObject())
     433                                );
     434                            }
     435
     436                        };
     437                add(cancelLink);
     438               
    427439                final AjaxLink<Resource> targetLink
    428440                        = new AjaxLink<Resource>("target") {
     
    634646        private IColumn<Resource>[] createColumns() {
    635647            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                 },
    649648                new AbstractColumn<Resource>(new Model<String>("Type")) {
    650649                    @Override
     
    688687                        return "action";
    689688                    }
     689                },
     690                new HeaderlessColumn<Resource>() {
     691
     692                    @Override
     693                    public void populateItem(Item<ICellPopulator<Resource>> item, String componentId, IModel<Resource> model) {
     694                        item.add(new MoveItemPanel(componentId, model));
     695                    }
     696
     697                    @Override
     698                    public String getCssClass() {
     699                        return "move";
     700                    }
     701
    690702                }
    691703            };
  • VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/webapp/css/vcr.css

    r5495 r5496  
    598598
    599599table td.action {
    600         width: 98px;
     600        width: 8em;
    601601        text-align: right;
    602602}
    603603
    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;
     604table.resourcesTable td.move {
     605    width: 5em;
    620606}
    621607
    622608table.resourcesTable tr.moving {
    623609    background: #ccc;
     610}
     611
     612table.moving tr:hover td {
     613    border-top: 6px solid #ccc;
     614}
     615
     616table.moving tr.moving:hover td {
     617    border-top: 0px;
    624618}
    625619
     
    665659table.resourcesTable {
    666660    width: 805px;
    667 }
    668 
    669 table.moving tr:hover td {
    670     border-top: 2px solid;
    671661}
    672662
Note: See TracChangeset for help on using the changeset viewer.