Search in sources :

Example 6 with AlwaysRowSelectedSelectionModel

use of com.servoy.j2db.util.model.AlwaysRowSelectedSelectionModel in project servoy-client by Servoy.

the class SwingRelatedFoundSet method createSelectionModel.

private void createSelectionModel() {
    if (selectionModel == null) {
        selectionModel = new AlwaysRowSelectedSelectionModel(this);
        addListDataListener(selectionModel);
    }
}
Also used : AlwaysRowSelectedSelectionModel(com.servoy.j2db.util.model.AlwaysRowSelectedSelectionModel)

Example 7 with AlwaysRowSelectedSelectionModel

use of com.servoy.j2db.util.model.AlwaysRowSelectedSelectionModel in project servoy-client by Servoy.

the class SwingRelatedFoundSet method copyCurrentRecordFoundSet.

@Override
public // used for printing current record
IFoundSetInternal copyCurrentRecordFoundSet() throws // used for printing current record
ServoyException {
    SwingRelatedFoundSet sfs = (SwingRelatedFoundSet) super.copyCurrentRecordFoundSet();
    if (sfs != null) {
        sfs.selectionModel = new AlwaysRowSelectedSelectionModel(this);
        sfs.addListDataListener(sfs.selectionModel);
    }
    return sfs;
}
Also used : AlwaysRowSelectedSelectionModel(com.servoy.j2db.util.model.AlwaysRowSelectedSelectionModel)

Example 8 with AlwaysRowSelectedSelectionModel

use of com.servoy.j2db.util.model.AlwaysRowSelectedSelectionModel in project servoy-client by Servoy.

the class SwingFoundSet method createSelectionModel.

private void createSelectionModel() {
    if (selectionModel == null) {
        selectionModel = new AlwaysRowSelectedSelectionModel(this);
        addListDataListener(selectionModel);
    }
}
Also used : AlwaysRowSelectedSelectionModel(com.servoy.j2db.util.model.AlwaysRowSelectedSelectionModel)

Example 9 with AlwaysRowSelectedSelectionModel

use of com.servoy.j2db.util.model.AlwaysRowSelectedSelectionModel in project servoy-client by Servoy.

the class FixedJTable method changeSelection.

/**
 * @see javax.swing.JTable#changeSelection(int, int, boolean, boolean)
 */
@Override
public void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend) {
    if (cellEditor != null && getEditingRow() != rowIndex && !cellEditor.stopCellEditing()) {
        // don't change selection if there is a celleditor hanging around.
        return;
    }
    ListSelectionModel rsm = getSelectionModel();
    boolean isSelected = false;
    for (int index : getSelectedRows()) if (index == rowIndex)
        isSelected = true;
    if (!isSelected && rsm instanceof AlwaysRowSelectedSelectionModel && !((AlwaysRowSelectedSelectionModel) rsm).canChangeSelection())
        return;
    ListSelectionModel csm = getColumnModel().getSelectionModel();
    // get the value so it will be loaded first.
    TableModel model = getModel();
    if (model instanceof FoundSet)
        ((FoundSet) model).getRecord(rowIndex);
    changeSelectionModel(csm, columnIndex, toggle, extend, false, false);
    changeSelectionModel(rsm, rowIndex, toggle, extend, rsm.getSelectionMode() != ListSelectionModel.SINGLE_SELECTION ? rsm.isSelectedIndex(rowIndex) : false, true);
    // everything!
    if (getAutoscrolls()) {
        Rectangle cellRect = getCellRect(rowIndex, columnIndex, false);
        if (cellRect != null) {
            scrollRectToVisible(cellRect);
        }
    }
}
Also used : Rectangle(java.awt.Rectangle) ListSelectionModel(javax.swing.ListSelectionModel) FoundSet(com.servoy.j2db.dataprocessing.FoundSet) Point(java.awt.Point) TableModel(javax.swing.table.TableModel) AlwaysRowSelectedSelectionModel(com.servoy.j2db.util.model.AlwaysRowSelectedSelectionModel)

Aggregations

AlwaysRowSelectedSelectionModel (com.servoy.j2db.util.model.AlwaysRowSelectedSelectionModel)9 ListSelectionModel (javax.swing.ListSelectionModel)3 Point (java.awt.Point)2 MouseEvent (java.awt.event.MouseEvent)2 FoundSet (com.servoy.j2db.dataprocessing.FoundSet)1 Rectangle (java.awt.Rectangle)1 TableModel (javax.swing.table.TableModel)1