Search in sources :

Example 1 with XulButton

use of org.pentaho.ui.xul.components.XulButton in project data-access by pentaho.

the class EmbeddedWizard method showDialog.

/**
 * Specified by <code>DialogController</code>.
 */
public void showDialog() {
    this.modelerDialogListener = null;
    if (connectionController != null) {
        connectionController.reloadConnections();
    }
    if (datasourceModel.getGuiStateModel().getConnections() == null || datasourceModel.getGuiStateModel().getConnections().size() <= 0) {
        checkInitialized();
    }
    wizardModel.setEditing(false);
    wizardController.setActiveStep(0);
    wizardModel.reset();
    wizardController.resetSelectedDatasource();
    wizardModel.setReportingOnlyValid(this.reportingOnlyValid);
    /*
     * BISERVER-5153: Work around where XulGwtButton is getting its disabled state and style confused. The only way to
     * get the train on the track is to flip-flop it.
     */
    XulButton nextButton = // $NON-NLS-1$
    (XulButton) mainWizardContainer.getDocumentRoot().getElementById("main_wizard_window_extra2");
    nextButton.setDisabled(false);
    nextButton.setDisabled(true);
    /* end of work around */
    dialog.show();
    // BISERVER-6473
    // $NON-NLS-1$
    XulTextbox datasourceName = (XulTextbox) mainWizardContainer.getDocumentRoot().getElementById("datasourceName");
    datasourceName.setFocus();
}
Also used : XulTextbox(org.pentaho.ui.xul.components.XulTextbox) XulButton(org.pentaho.ui.xul.components.XulButton)

Example 2 with XulButton

use of org.pentaho.ui.xul.components.XulButton in project pentaho-kettle by pentaho.

the class PartitionsController method enableButtons.

public void enableButtons(boolean enableNew, boolean enableEdit, boolean enableRemove) {
    XulButton bNew = (XulButton) document.getElementById("partitions-new");
    XulButton bEdit = (XulButton) document.getElementById("partitions-edit");
    XulButton bRemove = (XulButton) document.getElementById("partitions-remove");
    bNew.setDisabled(!enableNew);
    bEdit.setDisabled(!enableEdit);
    bRemove.setDisabled(!enableRemove);
}
Also used : XulButton(org.pentaho.ui.xul.components.XulButton)

Example 3 with XulButton

use of org.pentaho.ui.xul.components.XulButton in project pentaho-kettle by pentaho.

the class SlavesController method enableButtons.

public void enableButtons(boolean enableNew, boolean enableEdit, boolean enableRemove) {
    XulButton bNew = (XulButton) document.getElementById("slaves-new");
    XulButton bEdit = (XulButton) document.getElementById("slaves-edit");
    XulButton bRemove = (XulButton) document.getElementById("slaves-remove");
    bNew.setDisabled(!enableNew);
    bEdit.setDisabled(!enableEdit);
    bRemove.setDisabled(!enableRemove);
}
Also used : XulButton(org.pentaho.ui.xul.components.XulButton)

Example 4 with XulButton

use of org.pentaho.ui.xul.components.XulButton in project data-access by pentaho.

the class DatasourceSelectionDialogController method internalInit.

private void internalInit() {
    try {
        // $NON-NLS-1$
        datasourceListbox = (XulListbox) safeGetElementById(document, "datasourceListbox");
        // $NON-NLS-1$
        datasourceSelectionDialog = (XulDialog) safeGetElementById(document, "datasourceSelectionDialog");
        removeDatasourceConfirmationDialog = (XulDialog) safeGetElementById(document, // $NON-NLS-1$
        "removeDatasourceConfirmationDialog");
        XulButton acceptButton = null;
        try {
            // $NON-NLS-1$
            acceptButton = (XulButton) safeGetElementById(document, "datasourceSelectionDialog_accept");
        } catch (Exception e) {
        // this might not be available
        }
        // $NON-NLS-1$
        addDatasourceButton = (XulButton) safeGetElementById(document, "addDatasource");
        // $NON-NLS-1$
        editDatasourceButton = (XulButton) safeGetElementById(document, "editDatasource");
        // $NON-NLS-1$
        removeDatasourceButton = (XulButton) safeGetElementById(document, "removeDatasource");
        manager = UIDatasourceServiceManager.getInstance();
        manager.getIds(new XulServiceCallback<List<IDatasourceInfo>>() {

            @Override
            public void success(List<IDatasourceInfo> infoList) {
                DatasourceSelectionDialogController.this.datasourceInfos = infoList;
            }

            @Override
            public void error(String message, Throwable error) {
            }
        });
        bf.setBindingType(Binding.Type.ONE_WAY);
        bf.createBinding(DatasourceSelectionDialogController.this.datasourceSelectionDialogModel, "logicalModelSummaries", datasourceListbox, // $NON-NLS-1$ //$NON-NLS-2$
        "elements");
        bf.setBindingType(Binding.Type.ONE_WAY);
        // $NON-NLS-1$
        bf.createBinding(// $NON-NLS-1$
        datasourceListbox, // $NON-NLS-1$
        "selectedIndex", DatasourceSelectionDialogController.this.datasourceSelectionDialogModel, // $NON-NLS-1$
        "selectedIndex");
        // setup binding to disable accept button until user selects a datasource
        bf.setBindingType(Binding.Type.ONE_WAY);
        if (acceptButton != null) {
            BindingConvertor<Integer, Boolean> acceptButtonConvertor = new BindingConvertor<Integer, Boolean>() {

                @Override
                public Boolean sourceToTarget(final Integer value) {
                    return value > -1;
                }

                @Override
                public Integer targetToSource(final Boolean value) {
                    throw new UnsupportedOperationException();
                }
            };
            bf.createBinding(DatasourceSelectionDialogController.this.datasourceSelectionDialogModel, "selectedIndex", // $NON-NLS-1$
            acceptButton, "!disabled", // $NON-NLS-1$
            acceptButtonConvertor);
        }
        // setup binding to disable remove datasource button until user selects a datasource
        bf.setBindingType(Binding.Type.ONE_WAY);
        BindingConvertor<Integer, Boolean> removeDatasourceButtonConvertor = new BindingConvertor<Integer, Boolean>() {

            @Override
            public Boolean sourceToTarget(final Integer value) {
                boolean active = false;
                if (value > -1) {
                    LogicalModelSummary summary = (LogicalModelSummary) datasourceListbox.getSelectedItem();
                    if (datasourceInfos.size() > 0) {
                        for (int i = 0; i < datasourceInfos.size(); i++) {
                            IDatasourceInfo datasourceInfo = datasourceInfos.get(i);
                            if (datasourceInfo.getId().equals(summary.getDomainId())) {
                                active = datasourceInfo.isEditable();
                                break;
                            }
                        }
                    }
                }
                return active && administrator;
            }

            @Override
            public Integer targetToSource(final Boolean value) {
                throw new UnsupportedOperationException();
            }
        };
        removeDatasourceButtonBinding = bf.createBinding(DatasourceSelectionDialogController.this.datasourceSelectionDialogModel, "selectedIndex", // $NON-NLS-1$
        removeDatasourceButton, "!disabled", // $NON-NLS-1$
        removeDatasourceButtonConvertor);
        BindingConvertor<Integer, Boolean> editDatasourceButtonConvertor = new BindingConvertor<Integer, Boolean>() {

            @Override
            public Boolean sourceToTarget(final Integer value) {
                boolean active = false;
                if (value > -1) {
                    LogicalModelSummary summary = (LogicalModelSummary) datasourceListbox.getSelectedItem();
                    if (datasourceInfos.size() > 0) {
                        for (int i = 0; i < datasourceInfos.size(); i++) {
                            IDatasourceInfo datasourceInfo = datasourceInfos.get(i);
                            if (datasourceInfo.getId().equals(summary.getDomainId())) {
                                active = datasourceInfo.isEditable();
                                break;
                            }
                        }
                    }
                }
                return active && administrator;
            }

            @Override
            public Integer targetToSource(final Boolean value) {
                throw new UnsupportedOperationException();
            }
        };
        editDatasourceButtonBinding = bf.createBinding(DatasourceSelectionDialogController.this.datasourceSelectionDialogModel, "selectedIndex", // $NON-NLS-1$
        editDatasourceButton, "!disabled", // $NON-NLS-1$
        editDatasourceButtonConvertor);
        datasourceListbox.setSelectedIndex(-1);
        // workaround for bug in some XulListbox implementations (doesn't fire event on setSelectedIndex call)
        DatasourceSelectionDialogController.this.datasourceSelectionDialogModel.setSelectedIndex(-1);
    } catch (Exception e) {
        e.printStackTrace();
        // $NON-NLS-1$
        showMessagebox("Error", e.getLocalizedMessage());
    }
}
Also used : BindingConvertor(org.pentaho.ui.xul.binding.BindingConvertor) XulException(org.pentaho.ui.xul.XulException) RequestException(com.google.gwt.http.client.RequestException) LogicalModelSummary(org.pentaho.platform.dataaccess.datasource.beans.LogicalModelSummary) XulButton(org.pentaho.ui.xul.components.XulButton) ArrayList(java.util.ArrayList) List(java.util.List) IDatasourceInfo(org.pentaho.platform.dataaccess.datasource.IDatasourceInfo)

Example 5 with XulButton

use of org.pentaho.ui.xul.components.XulButton in project pentaho-kettle by pentaho.

the class ClustersController method enableButtons.

public void enableButtons(boolean enableNew, boolean enableEdit, boolean enableRemove) {
    XulButton bNew = (XulButton) document.getElementById("clusters-new");
    XulButton bEdit = (XulButton) document.getElementById("clusters-edit");
    XulButton bRemove = (XulButton) document.getElementById("clusters-remove");
    bNew.setDisabled(!enableNew);
    bEdit.setDisabled(!enableEdit);
    bRemove.setDisabled(!enableRemove);
}
Also used : XulButton(org.pentaho.ui.xul.components.XulButton)

Aggregations

XulButton (org.pentaho.ui.xul.components.XulButton)6 RequestException (com.google.gwt.http.client.RequestException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 IDatasourceInfo (org.pentaho.platform.dataaccess.datasource.IDatasourceInfo)1 LogicalModelSummary (org.pentaho.platform.dataaccess.datasource.beans.LogicalModelSummary)1 XulException (org.pentaho.ui.xul.XulException)1 BindingConvertor (org.pentaho.ui.xul.binding.BindingConvertor)1 XulTextbox (org.pentaho.ui.xul.components.XulTextbox)1