org.jasig.portal.layout.dlm
Class MovementRules

java.lang.Object
  extended by org.jasig.portal.layout.dlm.MovementRules

public class MovementRules
extends java.lang.Object

A class that embodies the logic for determining if a node can be moved to the left or right of another node based on getMovedAllowed() and getPrecedence().

Since:
uPortal 2.5
Version:
$Revision: 1.3 $ $Date: 2005/05/02 03:08:21 $

Field Summary
static java.lang.String RCS_ID
           
 
Constructor Summary
MovementRules()
           
 
Method Summary
static boolean canHopLeft(IUserLayoutNodeDescription hopper, IUserLayoutNodeDescription nbh)
          Returns true if hopper is allowed to hop in the leftward, lower- sibling direction over the node being hopped; nbh.
static boolean canHopRight(IUserLayoutNodeDescription hopper, IUserLayoutNodeDescription nbh)
          Returns true if hopper is allowed to hop in the rightward, higher- sibling direction over the node being hopped; nbh.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RCS_ID

public static final java.lang.String RCS_ID
See Also:
Constant Field Values
Constructor Detail

MovementRules

public MovementRules()
Method Detail

canHopRight

public static boolean canHopRight(IUserLayoutNodeDescription hopper,
                                  IUserLayoutNodeDescription nbh)
Returns true if hopper is allowed to hop in the rightward, higher- sibling direction over the node being hopped; nbh. This is determined from the following tables. See notes from canHopLeft for details. In the tables below a zero equates to false and a one equates to true. Since moveAllowed is an attribute on a node a value of false equates to a string value of 'false'. The non-existence of a moveAllowed attribute defaults to making that node moveable. In otherwords the attribute is only included (asserted) when movement is being restricted.
       Scenario  |    NBH      |   hopper    |
                 | moveAllowed | moveAllowed |
       ----------+-------------+-------------+   
          A      |     0       |     0       |
          B      |     0       |     1       |
          C      |     1       |     0       |
          D      |     1       |     1       |
       ----------+-------------+-------------+
       
In the table below Ph is the precedence of the hopper node. Pnbh is the precedence of the node being hopped. The values in the table indicate what values should be returned from this method. The scenarios A through D are as defined above for the moveAllowed values.
       Scenario --> | A | B | C | D |
       -------------+---+---+---+---+
        Pnbh = Ph   | 0 | 0 | 0 | 1 |
        Pnbh > Ph   | 0 | 1 | 1 | 1 |
        Pnbh < Ph   | 0 | 1 | 0 | 1 |
       -------------+---+---+---+---+
       


canHopLeft

public static boolean canHopLeft(IUserLayoutNodeDescription hopper,
                                 IUserLayoutNodeDescription nbh)
Returns true if hopper is allowed to hop in the leftward, lower- sibling direction over the node being hopped; nbh. This is determined from the following tables. Since lower sibling order is tied to left or top most viewing locations on the screen these positions are considered to be superior in real-estate value. Hence to protect viewability as much as possible within a precedence a fragment owner can movement restrict a node, lets say a tab for example, to prevent users from placing nodes with equal or lesser precedence to its left and ultimately force that tab off of the right side of the screen. Sibling nodes are mapped left to right on the screen for lowest to highest child node index in the parent node for tabs and columns and from top to bottom on the screen for lowest to highest child node index in the parent node for channels. In the tables below a zero equates to false and a one equates to true.
       Scenario  |    NBH      |   hopper    |
                 | moveAllowed | moveAllowed |
       ----------+-------------+-------------+   
          A      |     0       |     0       |
          B      |     0       |     1       |
          C      |     1       |     0       |
          D      |     1       |     1       |
       ----------+-------------+-------------+
       
In the table below Ph is the precedence of the hopper node. Pnbh is the precedence of the node being hopped. The values in the table indicate what values should be returned from this method. The scenarios are A through D are as defined above for the moveAllowed values. These return values were determined by setting up each scenario on paper with tabs as the nodes and determining what expected and reasonable behavior should be. A higher precedence value takes precedence over movement restrictions imposed by a node from a fragment with lesser precedence.
       Scenario --> | A | B | C | D |
       -------------+---+---+---+---+
        Pnbh = Ph   | 0 | 0 | 0 | 1 |
        Pnbh > Ph   | 0 | 0 | 1 | 1 |
        Pnbh < Ph   | 0 | 1 | 1 | 1 |
       -------------+---+---+---+---+
       
Patterns in these tables were used to simplify checks needed to return the appropriate values. For example when the moveAllowed values are the same the returned value matches the moveAllowed value.