Row implements LayoutEditorElement { public void resizeColumns(@Observes ColumnResizeEvent resize) { if (resizeEventIsinThisRow(resize)) { Column resizedColumn = getColumn(resize); if (resizedColumn != null) { Column affectedColumn = null; if (resize.isLeft()) { affectedColumn = lookUpForLeftNeighbor(resizedColumn); } else { affectedColumn = lookUpForRightNeighbor(resizedColumn); } if (affectedColumn != null) { resizedColumn.incrementWidth(); affectedColumn.reduceWidth(); } } updateView(); } } @Inject  Row(View view,
               Instance<ComponentColumn> columnInstance,
               Instance<ColumnWithComponents> columnWithComponentsInstance,
               DnDManager dndManager,
               LayoutDragComponentHelper layoutDragComponentHelper,
               LayoutEditorCssHelper layoutCssHelper,
               Event<ComponentDropEvent> componentDropEvent,
               Event<ComponentRemovedEvent> componentRemovedEvent,
               Event<RowResizeEvent> rowResizeEvent,
               Event<LayoutEditorElementSelectEvent> rowSelectEvent,
               Event<LayoutEditorElementUnselectEvent> rowUnselectEvent,
               LayoutEditorFocusController layoutEditorFocusController); void init(ParameterizedCommand<RowDrop> dropOnRowCommand,
                     ParameterizedCommand<Row> removeCommand,
                     ParameterizedCommand<ColumnDrop> removeComponentCommand,
                     Supplier<LayoutTemplate> currentLayoutTemplateSupplier,
                     Supplier<Boolean> lockSupplier,
                     Integer height); void init(ParameterizedCommand<RowDrop> dropOnRowCommand,
                     ParameterizedCommand<Row> removeCommand,
                     ParameterizedCommand<ColumnDrop> removeComponentCommand,
                     ColumnWithComponents parentColumnWithComponents,
                     Supplier<LayoutTemplate> currentLayoutTemplateSupplier,
                     Supplier<Boolean> lockSupplier,
                     Integer height); void load(ParameterizedCommand<RowDrop> dropOnRowCommand,
                     LayoutRow layoutRow,
                     ParameterizedCommand<Row> removeCommand,
                     ParameterizedCommand<ColumnDrop> removeComponentCommand,
                     Supplier<LayoutTemplate> currentLayoutTemplateSupplier,
                     Supplier<Boolean> lockSupplier); Column hasComponent(Column targetColumn); void dragStart(); boolean canDrag(); void dragEndMove(); void addColumns(ComponentColumn... _columns); void withOneColumn(LayoutComponent layoutComponent,
                              boolean newComponent); ParameterizedCommand<ColumnDrop> dropCommand(); void removeColumn(Column targetColumn); void removeChildColumn(Column targetColumn); boolean cointainsColumn(Column targetColumn); boolean rowIsEmpty(); void disableDrop(); void drop(String dropData,
                     RowDrop.Orientation orientation); @PostConstruct void post(); @PreDestroy void preDestroy(); void resizeColumns(@Observes ColumnResizeEvent resize); void updateView(); @Override Map<String, String> getProperties(); @Override void setProperty(String property, String value); @Override void removeProperty(String property); @Override void clearProperties(); @Override List<PropertyEditorCategory> getPropertyCategories(); UberElement<Row> getView(); List<Column> getColumns(); boolean isDropEnable(); @Override void setSelectable(boolean selectable); boolean isSelectable(); boolean isSelected(); void setSelected(boolean selected); void calculateSizeChilds(); @Override String getId(); @Override LayoutEditorElementType geElementType(); @Override LayoutEditorElement getParentElement(); void setup(LayoutEditorElement parent,
                      String id,
                      LayoutTemplate.Style pageStyle); Integer getHeight(); void setHeight(Integer height); boolean canResizeUp(); boolean canResizeDown(); void resizeUp(); void resizeDown(); void incrementHeight(); void reduceHeight(); void setupResize(boolean canResizeUp,
                            boolean canResizeDown); ColumnWithComponents getParentColumnWithComponents(); void onSelected(); List<Column> getChildElements(); static final Integer ROW_DEFAULT_HEIGHT; static final int ROW_MIN_HEIGHT; }
@Test public void resizeEventTest() throws Exception { loadLayout(SINGLE_ROW_TWO_COMPONENTS_LAYOUT); Row row = getRowByIndex(FIRST_ROW); Column first = getColumnByIndex(row, FIRST_COLUMN); Column second = getColumnByIndex(getRowByIndex(FIRST_ROW), SECOND_COLUMN); Integer originalFirstSize = first.getColumnWidth(); Integer originalSecondSize = second.getColumnWidth(); row.resizeColumns(new ColumnResizeEvent(second.hashCode(), row.hashCode()).left()); assertEquals(originalFirstSize - 1, first.getColumnWidth()); assertEquals(originalSecondSize + 1, second.getColumnWidth()); row.resizeColumns(new ColumnResizeEvent(second.hashCode(), row.hashCode()).left()); assertEquals(originalFirstSize - 2, first.getColumnWidth()); assertEquals(originalSecondSize + 2, second.getColumnWidth()); row.resizeColumns(new ColumnResizeEvent(first.hashCode(), row.hashCode()).right()); assertEquals(originalFirstSize - 1, first.getColumnWidth()); assertEquals(originalSecondSize + 1, second.getColumnWidth()); }