public void setVisible(final boolean visible) { if (this.visible == visible) { return; } if (visible) { // if it is setted on visible true move it to the end if (order == 0) { order = columnModel.autoIncOrder(); } } else { // if invisible is setting we have to remove a change order index of all other columns columnModel.autoDecOrder(); for (DLColumnUnitModel unit : columnModel.getColumnModels()) { unit.autodecrementOrder(order); } order = 0; } this.visible = visible; }
/** * Order starts at 1, 0 off - hidden * * @param order show order */ public void setOrder(final Integer order) { // move all columns which are behind me for (DLColumnUnitModel unit : columnModel.getColumnModels()) { unit.autodecrementOrder(this.order); } if (order > 0) { // if it is moving or inserting // move all which will be behind me for (DLColumnUnitModel unit : columnModel.getColumnModels()) { unit.autoincrementOrder(order); } // if it wasn't shown show it if (this.order == 0) { columnModel.autoIncOrder(); visible = true; } } else { visible = false; columnModel.autoDecOrder(); } this.order = order; }
public DLColumnUnitModel(final DLColumnModel columnModel) { this.columnModel = columnModel; this.order = columnModel.autoIncOrder(); }