creates a simple readonly table, that allows users to click on rows
 and also on the header. Header clicking is for column-sorting.
352868
def table config={}, &block
    #def tabular_widget config={}, &block
      require 'canis/core/widgets/table'
      events = [:PROPERTY_CHANGE, :LEAVE, :ENTER, :CHANGE, :ENTER_ROW, :PRESS ]
      block_event = nil
      # if no width given, expand to stack width
      #config.delete :title
      useform = nil

      w = Table.new useform, config # NO BLOCK GIVEN
      w.width ||= :expand 
      w.height ||= :expand # TODO This has to come before other in stack next one will overwrite.
      _position(w)
      if block_given?
        #@current_object << w
        yield_or_eval &block
        #@current_object.pop
      end
      return w
    end
201705
private WDataTable createTable() {
		WDataTable tbl = new WDataTable();
		tbl.addColumn(new WTableColumn("First name", new WText()));
		tbl.addColumn(new WTableColumn("Last name", new WText()));
		tbl.addColumn(new WTableColumn("DOB", new WText()));
		return tbl;
	}
521631
function(table,index,rowObj,createFlag,displayFlag){
			var row = table.insertRow(index + 1);
			row.setAttribute("role","row");
			if(!this.options.autoExpand && row.level > 0 && displayFlag != 'block'){
				row.style.display = 'none';
			}
			this.createContentOneRowTdForIE(row,rowObj,createFlag);
		}
231776
function addTbodyOrTheadIfNeed(tableData) {
  const [header] = tableData;
  const cellCount = header.length;
  let added = true;

  if (!cellCount && tableData[1]) {
    util.range(0, tableData[1].length).forEach(colIndex => {
      header.push(createBasicCell(0, colIndex, 'TH'));
    });
  } else if (tableData[0][0].nodeName !== 'TH') {
    const newHeader = util.range(0, cellCount).map(colIndex => createBasicCell(0, colIndex, 'TH'));

    [].concat(...tableData).forEach(cellData => {
      if (cellData.elementIndex) {
        cellData.elementIndex.rowIndex += 1;
      }
    });

    tableData.unshift(newHeader);
  } else if (tableData.length === 1) {
    const newRow = util.range(0, cellCount).map(colIndex => (
      createBasicCell(1, colIndex, 'TD')
    ));

    tableData.push(newRow);
  } else {
    added = false;
  }

  return added;
}
1084176
def row(self, columnnames=[], exclude=False):
        
        from .tablerow import tablerow
        return tablerow(self, columnnames, exclude)
241282
public static PdfPTable newPdfPTable(int numColumns, List<String> headerNames)
	{
		PdfPTable table = new PdfPTable(numColumns);
		headerNames.stream().forEach(columnHeaderName -> {
			PdfPCell header = new PdfPCell();
			header.setBackgroundColor(BaseColor.LIGHT_GRAY);
			header.setBorderWidth(2);
			header.setPhrase(new Phrase(columnHeaderName));
			table.addCell(header);
		});
		return table;
	}
452163
private void setUpTable() {
		setSizeFull();
		// expand the table
		table.setSizeFull();

		// Allow selecting items from the table.
		table.setSelectable(false);

		// Send changes in selection immediately to server.
		table.setImmediate(true);

		// set custom style
		table.addStyleName("example-queries-table");

		// put stripes to the table
		table.addStyleName(ChameleonTheme.TABLE_STRIPED);

		// configure columns
		table.addGeneratedColumn(COLUMN_OPEN_CORPUS_BROWSER, new ShowCorpusBrowser());

		table.addGeneratedColumn(COLUMN_EXAMPLE_QUERY, new QueryColumn());

		table.addGeneratedColumn(COLUMN_DESCRIPTION, new Table.ColumnGenerator() {
			@Override
			public Object generateCell(Table source, Object itemId, Object columnId) {
				ExampleQuery eQ = (ExampleQuery) itemId;
				Label l = new Label(eQ.getDescription());
				l.setContentMode(ContentMode.TEXT);
				l.addStyleName(Helper.CORPUS_FONT_FORCE);
				return l;
			}
		});

		table.setVisibleColumns(new Object[] { COLUMN_EXAMPLE_QUERY, COLUMN_DESCRIPTION, COLUMN_OPEN_CORPUS_BROWSER });

		table.setColumnExpandRatio(table.getVisibleColumns()[0], 0.40f);
		table.setColumnExpandRatio(table.getVisibleColumns()[1], 0.40f);

		table.setColumnHeader(table.getVisibleColumns()[0], "Example Query");
		table.setColumnHeader(table.getVisibleColumns()[1], "Description");
		table.setColumnHeader(table.getVisibleColumns()[2], "open corpus browser");

	}
854603
private void addReadOnlyExamples() {
		add(new WHeading(HeadingLevel.H3, "Read-only WCheckBoxSelect examples"));
		add(new ExplanatoryText("These examples all use the same list of options: the states and territories list from the editable examples above."
				+ " When the readOnly state is specified only those options which are selected are output."));

		// NOTE: when there are 0 or 1 selections the frame is not rendered.
		add(new WHeading(HeadingLevel.H4, "Read only with no selection"));
		WCheckBoxSelect select = new WCheckBoxSelect("australian_state");
		add(select);
		select.setReadOnly(true);
		select.setToolTip("Read only with no selection");
		add(new WText("end of unselected read only example"));

		add(new WHeading(HeadingLevel.H4, "Read only with one selection"));
		select = new SelectWithSingleSelected("australian_state");
		add(select);
		select.setReadOnly(true);
		select.setToolTip("Read only with one selection");

		add(new WHeading(HeadingLevel.H4, "Read only with many selections and no frame"));
		select = new SelectWithSingleSelected("australian_state");
		add(select);
		select.setReadOnly(true);
		select.setToolTip("Read only with many selections");
		select.setFrameless(true);

		add(new WHeading(HeadingLevel.H4, "Read only with many selections and COLUMN layout"));
		select = new SelectWithSingleSelected("australian_state");
		add(select);
		select.setReadOnly(true);
		select.setToolTip("Read only with many selections");
		select.setButtonLayout(WCheckBoxSelect.LAYOUT_COLUMNS);
		select.setButtonColumns(3);

		// read only in a WFieldLayout
		add(new WHeading(HeadingLevel.H4, "Read only in a WFieldLayout"));
		add(new ExplanatoryText("Each read only example is preceded by an editable example with the same options and selection. This is to ensure the"
				+ " CSS works properly."));
		WFieldLayout layout = new WFieldLayout();
		layout.setLabelWidth(25);
		add(layout);

		// no selections
		select = new WCheckBoxSelect("australian_state");
		select.setFrameless(true);
		layout.addField("No selections were made", select);

		select = new WCheckBoxSelect("australian_state");
		select.setFrameless(true);
		select.setReadOnly(true);
		layout.addField("No selections were made (read only)", select);

		// one selection
		select = new SelectWithSingleSelected("australian_state");
		select.setFrameless(true);
		layout.addField("One selection was made", select);

		select = new SelectWithSingleSelected("australian_state");
		select.setFrameless(true);
		select.setReadOnly(true);
		layout.addField("One selection was made (read only)", select);

		// many selections
		select = new SelectWithManySelected("australian_state");
		layout.addField("Many selections with frame", select);

		select = new SelectWithManySelected("australian_state");
		select.setReadOnly(true);
		layout.addField("Many selections with frame (read only)", select);

		// columns with selections
		select = new SelectWithSingleSelected("australian_state");
		select.setButtonLayout(WCheckBoxSelect.LAYOUT_COLUMNS);
		select.setButtonColumns(3);
		select.setFrameless(true);
		layout.addField("many selections, frameless, COLUMN layout (3 columns)", select);

		select = new SelectWithManySelected("australian_state");
		select.setReadOnly(true);
		select.setButtonLayout(WCheckBoxSelect.LAYOUT_COLUMNS);
		select.setButtonColumns(3);
		select.setFrameless(true);
		layout.addField("many selections, frameless, COLUMN layout (3 columns) (read only)", select);

		// flat with selections
		select = new SelectWithManySelected("australian_state");
		select.setButtonLayout(WCheckBoxSelect.LAYOUT_FLAT);
		select.setFrameless(true);
		layout.addField("Many selections, frameless, FLAT layout", select);

		select = new SelectWithManySelected("australian_state");
		select.setReadOnly(true);
		select.setButtonLayout(WCheckBoxSelect.LAYOUT_FLAT);
		select.setFrameless(true);
		layout.addField("Many selections, frameless, FLAT layout (read only)", select);
	}
1098378
private function constructColumnHeaders()
    {
        foreach ($this->columnHeaders as $column_name => $column_key) {
            $this->columnHeaderObjects[] = new TableColumnHeader(
                $this,
                $this->request,
                $column_key,
                $column_name
            );
        }
    }
627757
function(iIndex, bSelected) {
			var oTable = this.getTable();
			var oRow = oTable.getRows()[iIndex];

			if (oRow && bSelected != null) {
				TableUtils.toggleRowSelection(oTable, oRow.getIndex(), bSelected);
			}
		}
931362
protected TableColumnHeader createTableColumnHeader(TableColumnBase col) {
        return col.getColumns().isEmpty() ?
            new JFXTableColumnHeader(getTableViewSkin(), col) :
            new NestedTableColumnHeader(getTableViewSkin(), col);
    }
1247658
function(oEvent, $Cell, oTable) {
			TableUtils.toggleRowSelection(oTable, $Cell, null, function(iRowIndex) {
				// IE and Edge perform a text selection if holding shift while clicking. This is not desired for range selection of rows.
				if ((Device.browser.msie || Device.browser.edge) && oEvent.shiftKey) {
					oTable._clearTextSelection();
				}

				var oSelMode = oTable.getSelectionMode();

				// Single selection
				if (oSelMode === SelectionMode.Single) {
					if (!oTable.isIndexSelected(iRowIndex)) {
						oTable.setSelectedIndex(iRowIndex);
					} else {
						oTable.clearSelection();
					}

				// Multi selection (range)
				} else if (oEvent.shiftKey) {
					// If no row is selected, getSelectedIndex returns -1. Then we simply select the clicked row.
					var iSelectedIndex = oTable.getSelectedIndex();
					if (iSelectedIndex >= 0) {
						oTable.addSelectionInterval(iSelectedIndex, iRowIndex);
					} else {
						oTable.setSelectedIndex(iRowIndex);
					}

				// Multi selection (toggle)
				} else if (!oTable._legacyMultiSelection) {
					if (!oTable.isIndexSelected(iRowIndex)) {
						oTable.addSelectionInterval(iRowIndex, iRowIndex);
					} else {
						oTable.removeSelectionInterval(iRowIndex, iRowIndex);
					}

				// Multi selection (legacy)
				} else {
					oTable._legacyMultiSelection(iRowIndex, oEvent);
				}

				return true;
			});
		}
160853
def setTable( self, table ):
        
        self._table = table
        self.setEnabled(table is not None)
        self.clear()
677505
function ()
	{
		var aoColumns = this.s.dt.aoColumns;

		this.s.aoTargets.splice( 0, this.s.aoTargets.length );

		this.s.aoTargets.push( {
			"x":  $(this.s.dt.nTable).offset().left,
			"to": 0
		} );

		var iToPoint = 0;
		for ( var i=0, iLen=aoColumns.length ; i<iLen ; i++ )
		{
			/* For the column / header in question, we want it's position to remain the same if the
			 * position is just to it's immediate left or right, so we only incremement the counter for
			 * other columns
			 */
			if ( i != this.s.mouse.fromIndex )
			{
				iToPoint++;
			}

			if ( aoColumns[i].bVisible )
			{
				this.s.aoTargets.push( {
					"x":  $(aoColumns[i].nTh).offset().left + $(aoColumns[i].nTh).outerWidth(),
					"to": iToPoint
				} );
			}
		}

		/* Disallow columns for being reordered by drag and drop, counting right to left */
		if ( this.s.fixedRight !== 0 )
		{
			this.s.aoTargets.splice( this.s.aoTargets.length - this.s.fixedRight );
		}

		/* Disallow columns for being reordered by drag and drop, counting left to right */
		if ( this.s.fixed !== 0 )
		{
			this.s.aoTargets.splice( 0, this.s.fixed );
		}
	}
1036480
def toggle(self, rows):
        ''
        for r in Progress(rows, 'toggling', total=len(self.rows)):
            if not self.unselectRow(r):
                self.selectRow(r)
1345406
def create_table_level(self):
        """"""
        self.table_level = QTableView()
        self.table_level.setEditTriggers(QTableWidget.NoEditTriggers)
        self.table_level.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.table_level.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.table_level.setFrameStyle(QFrame.Plain)
        self.table_level.horizontalHeader().sectionResized.connect(
                                                        self._index_resized)
        self.table_level.verticalHeader().sectionResized.connect(
                                                        self._header_resized)
        self.table_level.setItemDelegate(QItemDelegate())
        self.layout.addWidget(self.table_level, 0, 0)
        self.table_level.setContentsMargins(0, 0, 0, 0)
        self.table_level.horizontalHeader().sectionClicked.connect(
                                                            self.sortByIndex)
970948
public void shuffleSelectedLeftRowToRightTable()
	{
		final int selectedRow = leftTable.getSelectedRow();
		final T row = leftTable.getGenericTableModel().removeAt(selectedRow);
		rightTable.getGenericTableModel().add(row);
	}