Example usage for com.google.gwt.user.client.ui TabPanel selectTab

List of usage examples for com.google.gwt.user.client.ui TabPanel selectTab

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui TabPanel selectTab.

Prototype

public void selectTab(int index) 

Source Link

Document

Programmatically selects the specified tab and fires events.

Usage

From source file:org.drools.brms.client.ruleeditor.EditorLauncher.java

License:Apache License

/**
 * This will show the rule viewer. If it was previously opened, it will show that dialog instead
 * of opening it again./* w w w . java2s. c  o m*/
 */
public static void showLoadEditor(final Map openedViewers, final TabPanel tab, final String uuid,
        final boolean readonly) {

    if (openedViewers.containsKey(uuid)) {
        if (tab.getWidgetIndex((Widget) openedViewers.get(uuid)) == -1) {
            String featurename = tab.getWidget(0) instanceof PackageExplorerWidget ? "Rule Viewer"
                    : "Package Manager";
            Window.alert("Asset already opened in " + featurename);
        } else {
            tab.selectTab(tab.getWidgetIndex((Widget) openedViewers.get(uuid)));
        }
        LoadingPopup.close();
        return;
    }

    RepositoryServiceFactory.getService().loadRuleAsset(uuid, new GenericCallback() {

        public void onSuccess(Object o) {
            final RuleAsset asset = (RuleAsset) o;

            SuggestionCompletionCache cache = SuggestionCompletionCache.getInstance();
            cache.doAction(asset.metaData.packageName, new Command() {
                public void execute() {
                    openRuleViewer(openedViewers, tab, uuid, readonly, asset);
                }

            });
        }

    });

}

From source file:org.drools.brms.client.ruleeditor.EditorLauncher.java

License:Apache License

/**
 * This will actually show the viewer once everything is loaded and ready.
 * @param openedViewers//from  ww w .ja  v a 2s. c o  m
 * @param tab
 * @param uuid
 * @param readonly
 * @param asset
 */
private static void openRuleViewer(final Map openedViewers, final TabPanel tab, final String uuid,
        final boolean readonly, RuleAsset asset) {
    final RuleViewer view = new RuleViewer(asset, readonly);

    String displayName = asset.metaData.name;
    if (displayName.length() > 10) {
        displayName = displayName.substring(0, 7) + "...";
    }
    String icon = getAssetFormatIcon(asset.metaData.format);

    tab.add(view, "<img src='images/" + icon + "'>" + displayName, true);

    if (openedViewers != Collections.EMPTY_MAP) {
        openedViewers.put(uuid, view);
    }

    view.setCloseCommand(new Command() {
        public void execute() {
            tab.remove(tab.getWidgetIndex(view));
            tab.selectTab(0);
            if (openedViewers != Collections.EMPTY_MAP) {
                openedViewers.remove(uuid);
            }

        }
    });
    tab.selectTab(tab.getWidgetIndex(view));
}

From source file:org.drools.guvnor.client.asseteditor.drools.modeldriven.ui.FromAccumulateCompositeFactPatternWidget.java

License:Apache License

@Override
protected Widget getCompositeLabel() {
    ClickHandler leftPatternclick = new ClickHandler() {

        public void onClick(ClickEvent event) {
            Widget w = (Widget) event.getSource();
            showFactTypeSelector(w);// w w  w .  j  av a2s  . com
        }
    };
    ClickHandler sourcePatternClick = new ClickHandler() {

        public void onClick(ClickEvent event) {
            Widget w = (Widget) event.getSource();
            showSourcePatternSelector(w);
        }
    };

    String lbl = "<div class='form-field'>" + HumanReadable.getCEDisplayName("from accumulate") + "</div>";

    DirtyableFlexTable panel = new DirtyableFlexTable();

    int r = 0;

    if (pattern.getFactPattern() == null) {
        panel.setWidget(r++, 0,
                new ClickableLabel(
                        "<br> <font color='red'>" + Constants.INSTANCE.clickToAddPattern() + "</font>",
                        leftPatternclick, !this.readOnly));
    }

    panel.setWidget(r++, 0, new HTML(lbl));

    if (this.getFromAccumulatePattern().getSourcePattern() == null) {
        panel.setWidget(r++, 0,
                new ClickableLabel(
                        "<br> <font color='red'>" + Constants.INSTANCE.clickToAddPattern() + "</font>",
                        sourcePatternClick, !this.readOnly));
    } else {
        IPattern rPattern = this.getFromAccumulatePattern().getSourcePattern();

        RuleModellerWidget sourcePatternWidget;
        if (rPattern instanceof FactPattern) {
            sourcePatternWidget = new FactPatternWidget(this.getModeller(), getEventBus(), rPattern, true, true,
                    this.readOnly);

        } else if (rPattern instanceof FromAccumulateCompositeFactPattern) {
            sourcePatternWidget = new FromAccumulateCompositeFactPatternWidget(this.getModeller(),
                    this.getEventBus(), (FromAccumulateCompositeFactPattern) rPattern, this.readOnly);

        } else if (rPattern instanceof FromCollectCompositeFactPattern) {
            sourcePatternWidget = new FromCollectCompositeFactPatternWidget(this.getModeller(),
                    this.getEventBus(), (FromCollectCompositeFactPattern) rPattern, this.readOnly);

        } else if (rPattern instanceof FromEntryPointFactPattern) {
            sourcePatternWidget = new FromEntryPointFactPatternWidget(this.getModeller(), this.getEventBus(),
                    (FromEntryPointFactPattern) rPattern, this.readOnly);

        } else if (rPattern instanceof FromCompositeFactPattern) {
            sourcePatternWidget = new FromCompositeFactPatternWidget(this.getModeller(), this.getEventBus(),
                    (FromCompositeFactPattern) rPattern, this.readOnly);
        } else {
            throw new IllegalArgumentException(
                    "Unsupported pattern " + rPattern + " for right side of FROM ACCUMULATE");
        }

        sourcePatternWidget.addOnModifiedCommand(new Command() {
            public void execute() {
                setModified(true);
            }
        });

        panel.setWidget(r++, 0, addRemoveButton(sourcePatternWidget, new ClickHandler() {

            public void onClick(ClickEvent event) {
                if (Window.confirm(Constants.INSTANCE.RemoveThisBlockOfData())) {
                    setModified(true);
                    getFromAccumulatePattern().setSourcePattern(null);
                    getModeller().refreshWidget();
                }

            }
        }));
    }

    //REVISIT: Nested TabLayoutPanel does not work, its content is truncated. 
    //TabLayoutPanel tPanel = new TabLayoutPanel(2, Unit.EM);
    TabPanel tPanel = new TabPanel();

    DirtyableFlexTable codeTable = new DirtyableFlexTable();
    int codeTableRow = 0;
    int codeTableCol = 0;

    codeTable.setWidget(codeTableRow, codeTableCol++, new HTML("<div class='form-field'>Init:</div>"));

    final TextBox initField = new TextBox();
    initField.setTitle("init code");
    initField.setText(getFromAccumulatePattern().getInitCode());
    initField.setEnabled(!this.readOnly);
    codeTable.setWidget(codeTableRow++, codeTableCol--, initField);

    codeTable.setWidget(codeTableRow, codeTableCol++, new HTML("<div class='form-field'>Action:</div>"));
    final TextBox actionField = new TextBox();
    actionField.setTitle("action code");
    actionField.setText(getFromAccumulatePattern().getActionCode());
    actionField.setEnabled(!this.readOnly);
    codeTable.setWidget(codeTableRow++, codeTableCol--, actionField);

    codeTable.setWidget(codeTableRow, codeTableCol++, new HTML("<div class='form-field'>Reverse:</div>"));
    final TextBox reverseField = new TextBox();
    reverseField.setTitle("reverse code.");
    reverseField.setText(getFromAccumulatePattern().getReverseCode());
    reverseField.setEnabled(!this.readOnly);
    codeTable.setWidget(codeTableRow++, codeTableCol--, reverseField);

    codeTable.setWidget(codeTableRow, codeTableCol++, new HTML("<div class='form-field'>Result:</div>"));
    final TextBox resultField = new TextBox();
    resultField.setTitle("result code");
    resultField.setText(getFromAccumulatePattern().getResultCode());
    resultField.setEnabled(!this.readOnly);
    codeTable.setWidget(codeTableRow++, codeTableCol--, resultField);

    //panel.setWidget(r++, 0, codeTable);
    ScrollPanel codePanel = new ScrollPanel();
    codePanel.add(codeTable);

    tPanel.add(codePanel, "Custom Code");

    DirtyableFlexTable functionTable = new DirtyableFlexTable();

    functionTable.setWidget(0, 0, new HTML("<div class='form-field'>Function:</div>"));
    final TextBox functionField = new TextBox();
    functionField.setTitle("function code");
    functionField.setText(getFromAccumulatePattern().getFunction());
    functionField.setEnabled(!this.readOnly);
    functionTable.setWidget(0, 1, functionField);

    //        panel.setWidget(r++, 0, functionTable);

    ScrollPanel functionPanel = new ScrollPanel();
    functionPanel.add(functionTable);

    tPanel.add(functionPanel, "Function");
    ChangeHandler changehandler = new ChangeHandler() {

        public void onChange(ChangeEvent event) {
            Widget sender = (Widget) event.getSource();
            TextBox senderTB = (TextBox) event.getSource();
            String code = senderTB.getText();
            setModified(true);
            if (sender == initField) {
                getFromAccumulatePattern().setFunction(null);
                functionField.setText("");
                getFromAccumulatePattern().setInitCode(code);
            } else if (sender == actionField) {
                getFromAccumulatePattern().setFunction(null);
                functionField.setText("");
                getFromAccumulatePattern().setActionCode(code);
            } else if (sender == reverseField) {
                getFromAccumulatePattern().setFunction(null);
                functionField.setText("");
                getFromAccumulatePattern().setReverseCode(code);
            } else if (sender == resultField) {
                getFromAccumulatePattern().setFunction(null);
                functionField.setText("");
                getFromAccumulatePattern().setResultCode(code);
            } else if (sender == functionField) {
                getFromAccumulatePattern().clearCodeFields();
                initField.setText("");
                actionField.setText("");
                reverseField.setText("");
                resultField.setText("");
                getFromAccumulatePattern().setFunction(code);
            }
        }
    };

    initField.addChangeHandler(changehandler);
    actionField.addChangeHandler(changehandler);
    reverseField.addChangeHandler(changehandler);
    resultField.addChangeHandler(changehandler);
    functionField.addChangeHandler(changehandler);

    boolean useFunction = getFromAccumulatePattern().useFunctionOrCode()
            .equals(FromAccumulateCompositeFactPattern.USE_FUNCTION);

    tPanel.selectTab(useFunction ? 1 : 0);

    panel.setWidget(r++, 0, tPanel);

    return panel;
}

From source file:org.drools.guvnor.client.asseteditor.drools.WorkingSetEditor.java

License:Apache License

private void refreshWidgets() {
    WorkingSetConfigData wsData = (WorkingSetConfigData) workingSet.getContent();

    TabPanel tPanel = new TabPanel();
    //tPanel.setWidth(800);
    ScrollPanel pnl = new ScrollPanel();
    //        pnl.setAutoWidth(true);
    //pnl.setClosable(false);
    pnl.setTitle("WS Definition"); //TODO {bauna} i18n
    //        pnl.setAutoHeight(true);
    pnl.add(buildDoubleList(wsData));//from  w  ww  .  ja va  2  s  . c om
    tPanel.add(pnl, "WS Definition");

    pnl = new ScrollPanel();
    //        pnl.setAutoWidth(true);
    //pnl.setClosable(false);
    //pnl.setTitle("WS Constraints"); //TODO {bauna} i18n
    //        pnl.setAutoHeight(true);
    this.factsConstraintsgEditorPanel = new FactsConstraintsEditorPanel(this);
    pnl.add(this.factsConstraintsgEditorPanel);
    tPanel.add(pnl, "WS Constraints");

    pnl = new ScrollPanel();
    //        pnl.setAutoWidth(true);
    //pnl.setClosable(false);
    pnl.setTitle("WS Custom Forms"); //TODO {bauna} i18n
    //        pnl.setAutoHeight(true);
    this.customFormsEditorPanel = new CustomFormsEditorPanel(this);
    pnl.add(this.customFormsEditorPanel);
    tPanel.add(pnl, "WS Custom Forms");
    tPanel.addBeforeSelectionHandler(new BeforeSelectionHandler<java.lang.Integer>() {

        public void onBeforeSelection(BeforeSelectionEvent<java.lang.Integer> arg0) {
            factsConstraintsgEditorPanel.fillSelectedFacts();
            customFormsEditorPanel.fillSelectedFacts();
        }

    });

    tPanel.selectTab(0);
    initWidget(tPanel);
}

From source file:org.drools.guvnor.client.asseteditor.RuleViewerWrapper.java

License:Apache License

private void render() {
    ArtifactEditor artifactEditor = new ArtifactEditor(asset, clientFactory, eventBus,
            this.isHistoricalReadOnly);

    RuleViewer ruleViewer = new RuleViewer(asset, clientFactory, eventBus, ruleViewerSettings);

    boolean readOnly = isHistoricalReadOnly || asset.isReadonly() || asset.isArchived()
            || (this.ruleViewerSettings != null && this.ruleViewerSettings.isStandalone());
    Widget actionToolBar = clientFactory.getPerspectiveFactory().getAssetEditorActionToolbar("author", asset,
            ruleViewer.getAssetEditor(), clientFactory, eventBus, readOnly);

    layout.clear();/*from  w ww.j a  v  a2s  .c om*/
    layout.add(actionToolBar);
    layout.add(messageWidget);

    TabPanel tabPanel = new TabPanel();
    tabPanel.setWidth("100%");

    ScrollPanel scrollPanel = new ScrollPanel();
    scrollPanel.add(artifactEditor);
    tabPanel.add(scrollPanel, constants.Attributes());

    scrollPanel = new ScrollPanel();
    scrollPanel.add(ruleViewer);
    tabPanel.add(scrollPanel, constants.Edit());
    tabPanel.selectTab(1);

    layout.add(tabPanel);
}

From source file:org.drools.guvnor.client.modeldriven.ui.FromAccumulateCompositeFactPatternWidget.java

License:Apache License

@Override
protected Widget getCompositeLabel() {
    ClickHandler leftPatternclick = new ClickHandler() {

        public void onClick(ClickEvent event) {
            Widget w = (Widget) event.getSource();
            showFactTypeSelector(w);/*from  w ww . j  a  va  2s  . c om*/
        }
    };
    ClickHandler sourcePatternClick = new ClickHandler() {

        public void onClick(ClickEvent event) {
            Widget w = (Widget) event.getSource();
            showSourcePatternSelector(w);
        }
    };

    String lbl = "<div class='x-form-field'>" + HumanReadable.getCEDisplayName("from accumulate") + "</div>";

    DirtyableFlexTable panel = new DirtyableFlexTable();

    int r = 0;

    if (pattern.getFactPattern() == null) {
        panel.setWidget(r++, 0,
                new ClickableLabel("<br> <font color='red'>" + constants.clickToAddPattern() + "</font>",
                        leftPatternclick, !this.readOnly));
    }

    panel.setWidget(r++, 0, new HTML(lbl));

    if (this.getFromAccumulatePattern().getSourcePattern() == null) {
        panel.setWidget(r++, 0,
                new ClickableLabel("<br> <font color='red'>" + constants.clickToAddPattern() + "</font>",
                        sourcePatternClick, !this.readOnly));
    } else {
        IPattern rPattern = this.getFromAccumulatePattern().getSourcePattern();

        if (rPattern instanceof FactPattern) {
            this.sourcePatternWidget = new FactPatternWidget(this.getModeller(), rPattern, constants.All0with(),
                    true, this.readOnly);
        } else if (rPattern instanceof FromAccumulateCompositeFactPattern) {
            this.sourcePatternWidget = new FromAccumulateCompositeFactPatternWidget(this.getModeller(),
                    (FromAccumulateCompositeFactPattern) rPattern, this.readOnly);
        } else if (rPattern instanceof FromCollectCompositeFactPattern) {
            this.sourcePatternWidget = new FromCollectCompositeFactPatternWidget(this.getModeller(),
                    (FromCollectCompositeFactPattern) rPattern, this.readOnly);
        } else if (rPattern instanceof FromCompositeFactPattern) {
            this.sourcePatternWidget = new FromCompositeFactPatternWidget(this.getModeller(),
                    (FromCompositeFactPattern) rPattern, this.readOnly);
        } else {
            throw new IllegalArgumentException(
                    "Unsuported pattern " + rPattern + " for right side of FROM ACCUMULATE");
        }

        this.sourcePatternWidget.addOnModifiedCommand(new Command() {
            public void execute() {
                setModified(true);
            }
        });

        panel.setWidget(r++, 0, addRemoveButton(this.sourcePatternWidget, new ClickHandler() {

            public void onClick(ClickEvent event) {
                if (Window.confirm(constants.RemoveThisBlockOfData())) {
                    setModified(true);
                    getFromAccumulatePattern().setSourcePattern(null);
                    getModeller().refreshWidget();
                }

            }
        }));
    }

    //REVISIT: Nested TabLayoutPanel does not work, its content is truncated. 
    //TabLayoutPanel tPanel = new TabLayoutPanel(2, Unit.EM);
    TabPanel tPanel = new TabPanel();

    DirtyableFlexTable codeTable = new DirtyableFlexTable();
    int codeTableRow = 0;
    int codeTableCol = 0;

    codeTable.setWidget(codeTableRow, codeTableCol++, new HTML("<div class='x-form-field'>Init:</div>"));
    final TextBox initField = new TextBox();
    initField.setTitle("init code");
    initField.setText(getFromAccumulatePattern().getInitCode());
    codeTable.setWidget(codeTableRow++, codeTableCol--, initField);

    codeTable.setWidget(codeTableRow, codeTableCol++, new HTML("<div class='x-form-field'>Action:</div>"));
    final TextBox actionField = new TextBox();
    actionField.setTitle("action code");
    actionField.setText(getFromAccumulatePattern().getActionCode());
    codeTable.setWidget(codeTableRow++, codeTableCol--, actionField);

    codeTable.setWidget(codeTableRow, codeTableCol++, new HTML("<div class='x-form-field'>Reverse:</div>"));
    final TextBox reverseField = new TextBox();
    reverseField.setTitle("reverse code.");
    reverseField.setText(getFromAccumulatePattern().getReverseCode());
    codeTable.setWidget(codeTableRow++, codeTableCol--, reverseField);

    codeTable.setWidget(codeTableRow, codeTableCol++, new HTML("<div class='x-form-field'>Result:</div>"));
    final TextBox resultField = new TextBox();
    resultField.setTitle("result code");
    resultField.setText(getFromAccumulatePattern().getResultCode());
    codeTable.setWidget(codeTableRow++, codeTableCol--, resultField);

    //panel.setWidget(r++, 0, codeTable);
    ScrollPanel codePanel = new ScrollPanel();
    codePanel.add(codeTable);
    //TODO:
    //codePanel.setDisabled(this.readOnly);

    tPanel.add(codePanel, "Custom Code");

    DirtyableFlexTable functionTable = new DirtyableFlexTable();

    functionTable.setWidget(0, 0, new HTML("<div class='x-form-field'>Function:</div>"));
    final TextBox functionField = new TextBox();
    functionField.setTitle("function code");
    functionField.setText(getFromAccumulatePattern().getFunction());
    functionTable.setWidget(0, 1, functionField);

    //        panel.setWidget(r++, 0, functionTable);

    ScrollPanel functionPanel = new ScrollPanel();
    functionPanel.add(functionTable);
    //TODO:
    //functionPanel.setDisabled(this.readOnly);
    tPanel.add(functionPanel, "Function");
    ChangeHandler changehandler = new ChangeHandler() {

        public void onChange(ChangeEvent event) {
            Widget sender = (Widget) event.getSource();
            TextBox senderTB = (TextBox) event.getSource();
            String code = senderTB.getText();
            setModified(true);
            if (sender == initField) {
                getFromAccumulatePattern().setFunction(null);
                functionField.setText("");
                getFromAccumulatePattern().setInitCode(code);
            } else if (sender == actionField) {
                getFromAccumulatePattern().setFunction(null);
                functionField.setText("");
                getFromAccumulatePattern().setActionCode(code);
            } else if (sender == reverseField) {
                getFromAccumulatePattern().setFunction(null);
                functionField.setText("");
                getFromAccumulatePattern().setReverseCode(code);
            } else if (sender == resultField) {
                getFromAccumulatePattern().setFunction(null);
                functionField.setText("");
                getFromAccumulatePattern().setResultCode(code);
            } else if (sender == functionField) {
                getFromAccumulatePattern().clearCodeFields();
                initField.setText("");
                actionField.setText("");
                reverseField.setText("");
                resultField.setText("");
                getFromAccumulatePattern().setFunction(code);
            }
        }
    };

    initField.addChangeHandler(changehandler);
    actionField.addChangeHandler(changehandler);
    reverseField.addChangeHandler(changehandler);
    resultField.addChangeHandler(changehandler);
    functionField.addChangeHandler(changehandler);

    boolean useFunction = getFromAccumulatePattern().useFunctionOrCode()
            .equals(FromAccumulateCompositeFactPattern.USE_FUNCTION);

    tPanel.selectTab(useFunction ? 1 : 0);

    //tPanel.setBorder(false);
    //tPanel.setBodyBorder(false);
    //tPanel.setWidth(200);

    //tPanel.setDisabled(this.readOnly);

    //        functionTable.setVisible(useFunction);
    //        codeTable.setVisible(!useFunction);

    panel.setWidget(r++, 0, tPanel);

    return panel;
}

From source file:org.drools.guvnor.client.moduleeditor.ModuleEditorWrapper.java

License:Apache License

private void render() {
    final TabPanel tPanel = new TabPanel();
    tPanel.setWidth("100%");

    ArtifactEditor artifactEditor = new ArtifactEditor(packageConfigData, clientFactory, eventBus,
            this.isHistoricalReadOnly);

    Command refreshCommand = new Command() {
        public void execute() {
            refresh();/* w w w  .  j  ava  2 s .  c om*/
        }
    };
    AbstractModuleEditor moduleEditor = clientFactory.getPerspectiveFactory().getModuleEditor(packageConfigData,
            clientFactory, eventBus, this.isHistoricalReadOnly, refreshCommand);

    layout.clear();

    Widget actionToolBar = clientFactory.getPerspectiveFactory().getModuleEditorActionToolbar(packageConfigData,
            clientFactory, eventBus, this.isHistoricalReadOnly, refreshCommand);
    layout.add(actionToolBar);

    AssetViewerActivity assetViewerActivity = new AssetViewerActivity(packageConfigData.getUuid(),
            clientFactory);
    assetViewerActivity.start(new AcceptItem() {
        public void add(String tabTitle, IsWidget widget) {
            ScrollPanel pnl = new ScrollPanel();
            pnl.setWidth("100%");
            pnl.add(widget);
            tPanel.add(pnl, constants.Assets());
        }
    }, null);

    ScrollPanel pnl = new ScrollPanel();
    pnl.setWidth("100%");
    pnl.add(artifactEditor);
    tPanel.add(pnl, constants.AttributeForModuleEditor());
    tPanel.selectTab(0);

    pnl = new ScrollPanel();
    pnl.setWidth("100%");
    pnl.add(moduleEditor);
    tPanel.add(pnl, constants.Edit());
    tPanel.selectTab(0);

    tPanel.setHeight("100%");
    layout.add(tPanel);
    layout.setHeight("100%");
}

From source file:org.drools.guvnor.client.packages.PackageEditorWrapper.java

License:Apache License

private void render() {
    this.artifactEditor = new ArtifactEditor(conf, this.isHistoricalReadOnly);
    this.packageEditor = new PackageEditor(conf, this.isHistoricalReadOnly, this.closeCommand,
            this.refreshPackageListCommand, this.openPackageCommand, new Command() {
                public void execute() {
                    refresh();//from ww  w.j a v  a 2 s  . c  o m
                }
            });
    this.actionToolBar = this.packageEditor.getActionToolbar();

    layout.clear();
    layout.add(this.actionToolBar);

    TabPanel tPanel = new TabPanel();
    tPanel.setWidth("100%");

    ScrollPanel pnl = new ScrollPanel();
    pnl.setWidth("100%");
    pnl.add(this.artifactEditor);
    tPanel.add(pnl, "Attributes");
    tPanel.selectTab(0);

    pnl = new ScrollPanel();
    pnl.setWidth("100%");
    pnl.add(this.packageEditor);
    tPanel.add(pnl, "Edit");
    tPanel.selectTab(0);

    tPanel.setHeight("100%");
    layout.add(tPanel);
    layout.setHeight("100%");
}

From source file:org.drools.guvnor.client.ruleeditor.RuleViewerWrapper.java

License:Apache License

private void render() {
    this.artifactEditor = new ArtifactEditor(asset, this.isHistoricalReadOnly, new Command() {
        public void execute() {
            refresh();/*from   w ww. j  ava2s  . co  m*/
        }
    }, this.openItemCommand, this.closeCommand);

    this.ruleViewer = new RuleViewer(asset, this.openItemCommand, this.closeCommand, this.checkedInCommand,
            this.archiveCommand, new Command() {
                public void execute() {
                    refresh();
                }
            }, this.isHistoricalReadOnly, actionToolbarButtonsConfigurationProvider, ruleViewerSettings);
    this.actionToolBar = this.ruleViewer.getActionToolbar();

    layout.clear();
    layout.add(this.actionToolBar);

    TabPanel tPanel = new TabPanel();
    tPanel.setWidth("100%");

    ScrollPanel pnl = new ScrollPanel();
    pnl.add(this.artifactEditor);
    tPanel.add(pnl, "Attributes");
    // tPanel.selectTab(0);

    pnl = new ScrollPanel();
    // pnl1.setWidth("100%");
    pnl.add(this.ruleViewer);
    tPanel.add(pnl, "Edit");
    tPanel.selectTab(1);

    layout.add(tPanel);
}

From source file:org.drools.guvnor.client.ruleeditor.WorkingSetEditor.java

License:Apache License

private void refreshWidgets() {
    WorkingSetConfigData wsData = (WorkingSetConfigData) workingSet.content;

    TabPanel tPanel = new TabPanel();
    //tPanel.setWidth(800);
    ScrollPanel pnl = new ScrollPanel();
    //        pnl.setAutoWidth(true);
    //pnl.setClosable(false);
    pnl.setTitle("WS Definition"); //TODO {bauna} i18n
    //        pnl.setAutoHeight(true);
    pnl.add(buildDoubleList(wsData));/*w w w.  j  a v a 2s .  c o  m*/
    tPanel.add(pnl, "WS Definition");

    pnl = new ScrollPanel();
    //        pnl.setAutoWidth(true);
    //pnl.setClosable(false);
    //pnl.setTitle("WS Constraints"); //TODO {bauna} i18n
    //        pnl.setAutoHeight(true);
    this.factsConstraintsgEditorPanel = new FactsConstraintsEditorPanel(this);
    pnl.add(this.factsConstraintsgEditorPanel);
    tPanel.add(pnl, "WS Constraints");

    pnl = new ScrollPanel();
    //        pnl.setAutoWidth(true);
    //pnl.setClosable(false);
    pnl.setTitle("WS Custom Forms"); //TODO {bauna} i18n
    //        pnl.setAutoHeight(true);
    this.customFormsEditorPanel = new CustomFormsEditorPanel(this);
    pnl.add(this.customFormsEditorPanel);
    tPanel.add(pnl, "WS Custom Forms");
    tPanel.addBeforeSelectionHandler(new BeforeSelectionHandler<java.lang.Integer>() {

        public void onBeforeSelection(BeforeSelectionEvent<java.lang.Integer> arg0) {
            factsConstraintsgEditorPanel.fillSelectedFacts();
            customFormsEditorPanel.fillSelectedFacts();
        }

    });

    tPanel.selectTab(0);
    initWidget(tPanel);
}