Switch focus to the specified widget.

        :param layout: The layout that owns the widget.
        :param column: The column the widget is in.
        :param widget: The index of the widget to take the focus.
559477
def switch_focus(self, layout, column, widget):
        
        # Find the layout to own the focus.
        for i, l in enumerate(self._layouts):
            if l is layout:
                break
        else:
            # No matching layout - give up now
            return

        self._layouts[self._focus].blur()
        self._focus = i
        self._layouts[self._focus].focus(force_column=column,
                                         force_widget=widget)
417951
public Cell<C, T> add(C widget) {
        Cell<C, T> cell = toolkit.obtainCell(this);
        cell.widget = widget;

        if (cells.size() > 0) {
            // Set cell column and row.
            Cell<C, T> lastCell = cells.get(cells.size() - 1);
            if (!lastCell.endRow) {
                cell.column = lastCell.column + lastCell.colspan;
                cell.row = lastCell.row;
            } else {
                cell.column = 0;
                cell.row = lastCell.row + 1;
            }
            // Set the index of the cell above.
            if (cell.row > 0) {
                outer: for (int i = cells.size() - 1; i >= 0; i--) {
                    Cell<C, T> other = cells.get(i);
                    for (int column = other.column, nn = column + other.colspan; column < nn; column++) {
                        if (column == cell.column) {
                            cell.cellAboveIndex = i;
                            break outer;
                        }
                    }
                }
            }
        } else {
            cell.column = 0;
            cell.row = 0;
        }
        cells.add(cell);

        cell.set(cellDefaults);
        if (cell.column < columnDefaults.size()) {
            Cell<C, T> columnCell = columnDefaults.get(cell.column);
            if (columnCell != null)
                cell.merge(columnCell);
        }
        cell.merge(rowDefaults);

        if (widget != null)
            toolkit.addChild(table, widget);

        return cell;
    }
100198
public void setButtonLayout(final Layout layout) {
		RadioButtonSelectModel model = getOrCreateComponentModel();
		model.layout = layout;
		model.numColumns = 0;
	}
69148
def set_widgets(self):
        """"""
        clear_layout(self.gridLayoutThreshold)

        # Set text in the label
        layer_purpose = self.parent.step_kw_purpose.selected_purpose()
        layer_subcategory = self.parent.step_kw_subcategory.\
            selected_subcategory()
        classification = self.parent.step_kw_classification. \
            selected_classification()

        if is_raster_layer(self.parent.layer):
            statistics = self.parent.layer.dataProvider().bandStatistics(
                1, QgsRasterBandStats.All, self.parent.layer.extent(), 0)
            text = continuous_raster_question % (
                layer_purpose['name'],
                layer_subcategory['name'],
                classification['name'],
                statistics.minimumValue,
                statistics.maximumValue)
        else:
            field_name = self.parent.step_kw_field.selected_fields()
            field_index = self.parent.layer.fields().lookupField(field_name)
            min_value_layer = self.parent.layer.minimumValue(field_index)
            max_value_layer = self.parent.layer.maximumValue(field_index)
            text = continuous_vector_question % (
                layer_purpose['name'],
                layer_subcategory['name'],
                field_name,
                classification['name'],
                min_value_layer,
                max_value_layer)
        self.lblThreshold.setText(text)

        thresholds = self.parent.get_existing_keyword('thresholds')
        selected_unit = self.parent.step_kw_unit.selected_unit()['key']

        self.classes = OrderedDict()
        classes = classification.get('classes')
        # Sort by value, put the lowest first
        classes = sorted(classes, key=lambda k: k['value'])

        for i, the_class in enumerate(classes):
            class_layout = QHBoxLayout()

            # Class label
            class_label = QLabel(the_class['name'])

            # Min label
            min_label = QLabel(tr('Min >'))

            # Min value as double spin
            min_value_input = QDoubleSpinBox()
            # TODO(IS) We can set the min and max depends on the unit, later
            min_value_input.setMinimum(0)
            min_value_input.setMaximum(999999)
            if thresholds.get(the_class['key']):
                min_value_input.setValue(thresholds[the_class['key']][0])
            else:
                default_min = the_class['numeric_default_min']
                if isinstance(default_min, dict):
                    default_min = the_class[
                        'numeric_default_min'][selected_unit]
                min_value_input.setValue(default_min)
            min_value_input.setSingleStep(0.1)

            # Max label
            max_label = QLabel(tr('Max <='))

            # Max value as double spin
            max_value_input = QDoubleSpinBox()
            # TODO(IS) We can set the min and max depends on the unit, later
            max_value_input.setMinimum(0)
            max_value_input.setMaximum(999999)
            if thresholds.get(the_class['key']):
                max_value_input.setValue(thresholds[the_class['key']][1])
            else:
                default_max = the_class['numeric_default_max']
                if isinstance(default_max, dict):
                    default_max = the_class[
                        'numeric_default_max'][selected_unit]
                max_value_input.setValue(default_max)
            max_value_input.setSingleStep(0.1)

            # Add to class_layout
            class_layout.addWidget(min_label)
            class_layout.addWidget(min_value_input)
            # class_layout.addStretch(1)
            class_layout.addWidget(max_label)
            class_layout.addWidget(max_value_input)

            # Add to grid_layout
            self.gridLayoutThreshold.addWidget(class_label, i, 0)
            self.gridLayoutThreshold.addLayout(class_layout, i, 1)

            self.classes[the_class['key']] = [min_value_input, max_value_input]

        self.gridLayoutThreshold.setSpacing(0)

        def min_max_changed(index, the_string):
            """Slot when min or max value change.

            :param index: The index of the double spin.
            :type index: int

            :param the_string: The flag to indicate the min or max value.
            :type the_string: str
            """
            if the_string == 'Max value':
                current_max_value = list(self.classes.values())[index][1]
                target_min_value = list(self.classes.values())[index + 1][0]
                if current_max_value.value() != target_min_value.value():
                    target_min_value.setValue(current_max_value.value())
            elif the_string == 'Min value':
                current_min_value = list(self.classes.values())[index][0]
                target_max_value = list(self.classes.values())[index - 1][1]
                if current_min_value.value() != target_max_value.value():
                    target_max_value.setValue(current_min_value.value())

        # Set behaviour
        for k, v in list(self.classes.items()):
            index = list(self.classes.keys()).index(k)
            if index < len(self.classes) - 1:
                # Max value changed
                v[1].valueChanged.connect(partial(
                    min_max_changed, index=index, the_string='Max value'))
            if index > 0:
                # Min value
                v[0].valueChanged.connect(partial(
                    min_max_changed, index=index, the_string='Min value'))
629977
def focusInEvent(self, event):
        
        widget = self.widget
        type(widget).focusInEvent(widget, event)
        self.declaration.focus_gained()
1245999
void switchTwoColumns(int columnIndex, int columnToIndex) {
        checkForInit();
        int cellData = mColumnWidths[columnToIndex];
        mColumnWidths[columnToIndex] = mColumnWidths[columnIndex];
        mColumnWidths[columnIndex] = cellData;
    }
1370836
def select_by_widget(self, widget):
        
        for a, li, holder in self._tabs.values():
            if holder.children['content'] == widget:
                self._on_tab_pressed(a, li, holder)
                return
289679
def apply_layout(self, child, layout):
        
        params = self.create_layout_params(child, layout)
        w = child.widget
        if w:
            # padding
            if layout.get('padding'):
                dp = self.dp
                l, t, r, b = layout['padding']
                w.setPadding(int(l*dp), int(t*dp),
                             int(r*dp), int(b*dp))
        child.layout_params = params
412977
void switchTwoColumns(int columnIndex, int columnToIndex) {
        for (int i = 0; i < getRowCount() - 1; i++) {
            Object cellData = getItems()[i][columnToIndex];
            getItems()[i][columnToIndex] = getItems()[i][columnIndex];
            getItems()[i][columnIndex] = cellData;
        }
    }
296513
def setColumnHidden( self, column, state ):
        
        super(XTreeWidget, self).setColumnHidden(column, state)
        
        if ( not self.signalsBlocked() ):
            self.columnHiddenChanged.emit(column, state)
            self.executeDelayedItemsLayout()
1094975
def setIconOverlay(self, column, icon):
        
        self._iconOverlays[column] = QtGui.QIcon(icon)
473244
def select_next_layout(self, count=1):
        
        # List of all layouts. (When we have just two panes, only toggle
        # between horizontal/vertical.)
        if len(self.panes) == 2:
            all_layouts = [LayoutTypes.EVEN_HORIZONTAL, LayoutTypes.EVEN_VERTICAL]
        else:
            all_layouts = LayoutTypes._ALL

        # Get index of current layout.
        layout = self.previous_selected_layout or LayoutTypes._ALL[-1]
        try:
            index = all_layouts.index(layout)
        except ValueError:
            index = 0

        # Switch to new layout.
        new_layout = all_layouts[(index + count) % len(all_layouts)]
        self.select_layout(new_layout)
864216
def create_widget(self):
        
        d = self.declaration
        self.widget = TabLayout(self.get_context(), None, d.style)
730574
def setFocus(self, reason=None):
        """"""
        self.formLayout.itemAt(0, QFormLayout.FieldRole).widget().setFocus()
1189107
def focusIn(self, event=None):
        """"""
        try:
            # doScroll returns false if the call was ignored because the
            # last call also came from this widget.  That avoids unwanted
            # scrolls and text selection when the focus moves in and out
            # of the window.
            if self.doScroll(event):
                self.entry.selection_range(0, END) # select all text in widget
            else:
                # restore selection to what it was on the last FocusOut
                if self.lastSelection:
                    self.entry.selection_range(*self.lastSelection)
        except AttributeError:
            pass
722940
public void setLayout(FormLayout layout, JPanel panel)
    {
        this.panel = panel;
        this.layout = layout;
        panel.setLayout(layout);
        cc = new CellConstraints();
        row = -1;
    }
733046
def setLayout(self, value):
        
        new_layout = sorted(value, key=lambda k: k['position'])
        self.getField('Layout').set(self, new_layout)