Overview | Package | Class | Tree | Deprecated | Index | Help
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES

## Package com.tonbeller.wcf.changeorder

Generates buttons to change the order of elements in a list or tree.

See:
Description

Interface Summary
ChangeOrderModel | Model for ChangeOrderMgr

Class Summary
ChangeOrderMgr | generates buttons to move objects in a list or tree
ChangeOrderUtils |
DefaultChangeOrderModel | does nothing

## Package com.tonbeller.wcf.changeorder Description

Generates buttons to change the order of elements in a list or tree.

There are 2 user interfaces available: forward/backward buttons and cut/paste buttons. The UI is choosen by ChangeOrderMgr.setCutPasteMode(boolean), default is forward/backward.

#### Forward/Backward mode

Every node gets buttons for "move forward" and "move backward". Allows the user to move a node for one position with each click. This is easy for small amount of nodes, but requires many clicks for larger amount.

Appends "move-button" elements to the DOM with "style" attribute "fwd" or "bwd", e.g. <move-button id="wcf.e5f8fbfc" style="bwd"/>

#### Cut/Paste mode

Every node has a "cut" button. When the user selects a node by pressing that button, the ChangeOrderMgr goes into paste mode and renders paste buttons for those nodes that share the same parent (aka scope) with the selected node. If the user clicks on a paste button, the node is moved to that posision. If he clicks elsewhere (e.g. collapses a tree node), the ChangeOrderMgr goes back into cut mode.

Appends "move-button" elements to the DOM with "style" attribute "cut", "paste" or "uncut", e.g. <move-button id="wcf.e5f8fbfc" style="cut"/>

#### Usage pattern

    class MyComponent implements Component {

      public void initialize(RequestContext context, Environment env) {
        ...
        changeOrderMgr = new ChangeOrderMgr(dispatcher, env, model);
        changeOrderMgr.setCutPasteMode(true);
      }

      public Document render(RequestContext context) throws Exception {
        Document document = XmlUtils.createDocument();
        changeOrderMgr.startRendering(context);
        for (int nodeIndex = 0; nodeIndex < nodeCount; nodeIndex++) {
          Object node = ...
          Object parent = getParent(node);
          Element elem = renderElement(node);
          changeOrderMgr.renderButton(element, parent, node, nodeIndex, nodeCount);
        }
        changeOrderMgr.stopRendering();
        return document;
      }

    }

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES