/** * Adds a layout item to the grid. * * <p>Adds the <i>item</i> at (<i>row</i>, <code>column</code>). If an item was already added to * that location, it is replaced (but not deleted). * * <p>An item may span several more rows or columns, which is controlled by <i>rowSpan</i> and * <code>columnSpan</code>. * * <p>The <code>alignment</code> specifies the vertical and horizontal alignment of the item. The * default value 0 indicates that the item is stretched to fill the entire grid cell. The * alignment can be specified as a logical combination of a horizontal alignment ( {@link * AlignmentFlag#AlignLeft}, {@link AlignmentFlag#AlignCenter}, or {@link * AlignmentFlag#AlignRight}) and a vertical alignment ( {@link AlignmentFlag#AlignTop}, {@link * AlignmentFlag#AlignMiddle}, or {@link AlignmentFlag#AlignBottom}). * * <p> * * @see WGridLayout#addLayout(WLayout layout, int row, int column, EnumSet alignment) * @see WGridLayout#addWidget(WWidget widget, int row, int column, EnumSet alignment) */ public void addItem( WLayoutItem item, int row, int column, int rowSpan, int columnSpan, EnumSet<AlignmentFlag> alignment) { columnSpan = Math.max(1, columnSpan); rowSpan = Math.max(1, rowSpan); this.expand(row, column, rowSpan, columnSpan); final Grid.Item gridItem = this.grid_.items_.get(row).get(column); if (gridItem.item_ != null) { WLayoutItem oldItem = gridItem.item_; gridItem.item_ = null; this.updateRemoveItem(oldItem); } gridItem.item_ = item; gridItem.rowSpan_ = rowSpan; gridItem.colSpan_ = columnSpan; gridItem.alignment_ = EnumSet.copyOf(alignment); this.updateAddItem(item); }
/** * Set the media element options. * * <p> * * @see WAbstractMedia.Options */ public void setOptions(EnumSet<WAbstractMedia.Options> flags) { this.flags_ = EnumSet.copyOf(flags); this.flagsChanged_ = true; this.repaint(EnumSet.of(RepaintFlag.RepaintPropertyAttribute)); }