//////////////////////////////////////////////////////////////////////////// // // Commands // //////////////////////////////////////////////////////////////////////////// public void test_CREATE() throws Exception { final DockLayoutPanelInfo panel = parse( "// filler filler filler filler filler", "// filler filler filler filler filler", "<ui:UiBinder>", " <g:DockLayoutPanel unit='PX'/>", "</ui:UiBinder>"); refresh(); // ExecutionUtils.run( panel, new RunnableEx() { public void run() throws Exception { WidgetInfo newButton = createButton(); panel.command_CREATE2(newButton, null); panel.setEdge(newButton, "NORTH"); panel.setReasonableSize(newButton); } }); assertXML( "// filler filler filler filler filler", "<ui:UiBinder>", " <g:DockLayoutPanel unit='PX'>", " <g:north size='100.0'>", " <g:Button/>", " </g:north>", " </g:DockLayoutPanel>", "</ui:UiBinder>"); }
/** @return margins for given child as insets. */ public Insets getMargins(final ViewInfo child) { return ExecutionUtils.runObjectLog( new RunnableObjectEx<Insets>() { public Insets runObject() throws Exception { int left = getMarginValue(child, IPositionConstants.WEST); int right = getMarginValue(child, IPositionConstants.EAST); int top = getMarginValue(child, IPositionConstants.NORTH); int bottom = getMarginValue(child, IPositionConstants.SOUTH); Insets insets = new Insets(top, left, bottom, right); if (Insets.ZERO_INSETS.equals(insets)) { // try 'margin' int margin = getMarginValue(child, IPositionConstants.NONE); return new Insets(margin); } else { return insets; } } }, Insets.ZERO_INSETS); }