Search in sources :

Example 1 with GuidedDecisionTableView

use of org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView in project drools-wb by kiegroup.

the class EnumLoaderUtilities method getEnumsFromServer.

private void getEnumsFromServer(final DropDownData enumDefinition, final Callback<Map<String, String>> callback, final GuidedDecisionTablePresenter presenter, final Command onFetchCommand, final Command onFetchCompleteCommand) {
    final String key = buildKey(enumDefinition);
    if (enumCache.containsKey(key)) {
        callback.callback(enumCache.get(key));
        return;
    }
    // Cache empty value to prevent recurrent calls to the server for the same data.
    // The View will be redrawn once by the batch() command in the success callback.
    enumCache.put(key, Collections.emptyMap());
    final GuidedDecisionTableView view = presenter.getView();
    final ObservablePath currentPath = presenter.getCurrentPath();
    onFetchCommand.execute();
    enumDropdownService.call(new RemoteCallback<String[]>() {

        @Override
        public void callback(final String[] items) {
            onFetchCompleteCommand.execute();
            final Map<String, String> convertedDropDownData = convertDropDownData(items);
            enumCache.put(key, convertedDropDownData);
            callback.callback(convertedDropDownData);
            view.batch();
        }
    }, new HasBusyIndicatorDefaultErrorCallback(view)).loadDropDownExpression(currentPath, enumDefinition.getValuePairs(), enumDefinition.getQueryExpression());
}
Also used : HasBusyIndicatorDefaultErrorCallback(org.uberfire.ext.widgets.common.client.callbacks.HasBusyIndicatorDefaultErrorCallback) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback) ObservablePath(org.uberfire.backend.vfs.ObservablePath)

Example 2 with GuidedDecisionTableView

use of org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView 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);
}
Also used : GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView)

Example 3 with GuidedDecisionTableView

use of org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView 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;
}
Also used : GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView)

Example 4 with GuidedDecisionTableView

use of org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView 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;
}
Also used : GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView)

Example 5 with GuidedDecisionTableView

use of org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView in project drools-wb by kiegroup.

the class RadarMenuViewImpl method setAvailableDecisionTables.

@Override
public void setAvailableDecisionTables(final Set<GuidedDecisionTableView.Presenter> dtPresenters) {
    for (GuidedDecisionTableView.Presenter dtPresenter : dtPresenters) {
        final GuidedDecisionTableView view = dtPresenter.getView();
        radarLayer.add(makeDecisionTableGlyph(view));
    }
    radarLayer.batch();
}
Also used : GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView)

Aggregations

GuidedDecisionTableView (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView)8 GridData (org.uberfire.ext.wires.core.grids.client.model.GridData)5 Point2D (com.ait.lienzo.client.core.types.Point2D)1 RemoteCallback (org.jboss.errai.common.client.api.RemoteCallback)1 ObservablePath (org.uberfire.backend.vfs.ObservablePath)1 HasBusyIndicatorDefaultErrorCallback (org.uberfire.ext.widgets.common.client.callbacks.HasBusyIndicatorDefaultErrorCallback)1