1 29 30 package nextapp.echo2.webcontainer.syncpeer; 31 32 import nextapp.echo2.app.Alignment; 33 import nextapp.echo2.app.Component; 34 35 39 class TriCellTableConfigurator { 40 41 52 static int convertIconTextPositionToOrientation(Alignment textPosition, Component component) { 53 if (textPosition.getVertical() == Alignment.DEFAULT) { 54 switch (textPosition.getHorizontal()) { 55 case Alignment.LEFT: 56 return component.getRenderLayoutDirection().isLeftToRight() 57 ? TriCellTable.LEADING_TRAILING : TriCellTable.TRAILING_LEADING; 58 case Alignment.RIGHT: 59 return component.getRenderLayoutDirection().isLeftToRight() 60 ? TriCellTable.TRAILING_LEADING : TriCellTable.LEADING_TRAILING; 61 case Alignment.LEADING: 62 return TriCellTable.LEADING_TRAILING; 63 case Alignment.TRAILING: 64 return TriCellTable.TRAILING_LEADING; 65 default: 66 return TriCellTable.TRAILING_LEADING; 68 } 69 } else { 70 if (textPosition.getVertical() == Alignment.TOP) { 71 return TriCellTable.TOP_BOTTOM; 72 } else { 73 return TriCellTable.BOTTOM_TOP; 74 } 75 } 76 } 77 78 90 static int convertStatePositionToOrientation(Alignment statePosition, Component component) { 91 if (statePosition.getVertical() == Alignment.DEFAULT) { 92 switch (statePosition.getHorizontal()) { 93 case Alignment.LEFT: 94 return component.getRenderLayoutDirection().isLeftToRight() 95 ? TriCellTable.TRAILING_LEADING : TriCellTable.LEADING_TRAILING; 96 case Alignment.RIGHT: 97 return component.getRenderLayoutDirection().isLeftToRight() 98 ? TriCellTable.LEADING_TRAILING : TriCellTable.TRAILING_LEADING; 99 case Alignment.LEADING: 100 return TriCellTable.TRAILING_LEADING; 101 case Alignment.TRAILING: 102 return TriCellTable.LEADING_TRAILING; 103 default: 104 return TriCellTable.TRAILING_LEADING; 106 } 107 } else { 108 if (statePosition.getVertical() == Alignment.TOP) { 109 return TriCellTable.BOTTOM_TOP; 110 } else { 111 return TriCellTable.TOP_BOTTOM; 112 } 113 } 114 } 115 } 116 | Popular Tags |