use of org.uberfire.ext.wires.core.grids.client.model.GridData in project drools-wb by kiegroup.
the class DeleteAndEditCell method perform.
@Override
public boolean perform(final GridWidget gridWidget, final boolean isShiftKeyDown, final boolean isControlKeyDown) {
final GridData gridModel = gridWidget.getModel();
final GridData.SelectedCell origin = gridModel.getSelectedCellsOrigin();
if (origin == null) {
return false;
}
if (!(gridWidget instanceof GuidedDecisionTableView)) {
return false;
}
final GuidedDecisionTableView view = (GuidedDecisionTableView) gridWidget;
final GuidedDecisionTableView.Presenter dtPresenter = view.getPresenter();
dtPresenter.onDeleteSelectedCells();
return super.perform(gridWidget, isShiftKeyDown, isControlKeyDown);
}
use of org.uberfire.ext.wires.core.grids.client.model.GridData in project drools-wb by kiegroup.
the class GotoEndOfRow method selectRightMostCell.
protected boolean selectRightMostCell(final GridWidget gridWidget) {
final GridData gridModel = gridWidget.getModel();
final int rowCount = gridModel.getRowCount();
final int columnCount = gridModel.getColumnCount();
if (rowCount == 0 || columnCount == 0) {
return false;
}
final GridData.SelectedCell origin = gridModel.getSelectedCellsOrigin();
if (origin == null) {
return false;
}
return gridWidget.selectCell(origin.getRowIndex(), columnCount - 1, false, false);
}
use of org.uberfire.ext.wires.core.grids.client.model.GridData in project drools-wb by kiegroup.
the class SelectionCut method perform.
@Override
public boolean perform(final GridWidget gridWidget, final boolean isShiftKeyDown, final boolean isControlKeyDown) {
final GridData gridModel = gridWidget.getModel();
final GridData.SelectedCell origin = gridModel.getSelectedCellsOrigin();
if (origin == null) {
return false;
}
if (!(gridWidget instanceof GuidedDecisionTableView)) {
return false;
}
final GuidedDecisionTableView view = (GuidedDecisionTableView) gridWidget;
final GuidedDecisionTableView.Presenter dtPresenter = view.getPresenter();
dtPresenter.onCut();
return false;
}
use of org.uberfire.ext.wires.core.grids.client.model.GridData in project drools-wb by kiegroup.
the class SelectionPaste method perform.
@Override
public boolean perform(final GridWidget gridWidget, final boolean isShiftKeyDown, final boolean isControlKeyDown) {
final GridData gridModel = gridWidget.getModel();
final GridData.SelectedCell origin = gridModel.getSelectedCellsOrigin();
if (origin == null) {
return false;
}
if (!(gridWidget instanceof GuidedDecisionTableView)) {
return false;
}
final GuidedDecisionTableView view = (GuidedDecisionTableView) gridWidget;
final GuidedDecisionTableView.Presenter dtPresenter = view.getPresenter();
dtPresenter.onPaste();
return false;
}
use of org.uberfire.ext.wires.core.grids.client.model.GridData in project drools-wb by kiegroup.
the class GuidedDecisionTableModellerContextMenuSupportTest method onContextMenuWithMultipleTables.
@Test
@SuppressWarnings("unchecked")
public void onContextMenuWithMultipleTables() {
final GuidedDecisionTableView.Presenter dtPresenter1 = makeDecisionTable(0, 0);
final GuidedDecisionTableView.Presenter dtPresenter2 = makeDecisionTable(200, 200);
when(modellerPresenter.getAvailableDecisionTables()).thenReturn(new HashSet<GuidedDecisionTableView.Presenter>() {
{
add(dtPresenter1);
add(dtPresenter2);
}
});
final GridData uiModel1 = dtPresenter1.getView().getModel();
final GridData uiModel2 = dtPresenter2.getView().getModel();
final GridColumn uiColumn = new BaseGridColumn(mock(GridColumn.HeaderMetaData.class), mock(GridColumnRenderer.class), 100.0);
uiModel1.appendColumn(uiColumn);
uiModel2.appendColumn(uiColumn);
when(uiModel1.getCell(any(Integer.class), any(Integer.class))).thenReturn(uiCell);
when(uiModel2.getCell(any(Integer.class), any(Integer.class))).thenReturn(uiCell);
when(columnInformation.getColumn()).thenReturn(uiColumn);
final ContextMenuHandler handler = contextMenuSupport.getContextMenuHandler(modellerPresenter);
when(nativeEvent.getClientX()).thenReturn(50);
when(nativeEvent.getClientY()).thenReturn(50);
handler.onContextMenu(event);
verify(cellSelectionStrategy, times(1)).handleSelection(uiModelCaptor.capture(), any(Integer.class), any(Integer.class), any(Boolean.class), any(Boolean.class));
assertEquals(uiModel1, uiModelCaptor.getValue());
when(nativeEvent.getClientX()).thenReturn(250);
when(nativeEvent.getClientY()).thenReturn(250);
handler.onContextMenu(event);
verify(cellSelectionStrategy, times(2)).handleSelection(uiModelCaptor.capture(), any(Integer.class), any(Integer.class), any(Boolean.class), any(Boolean.class));
assertEquals(uiModel2, uiModelCaptor.getValue());
}
Aggregations