Search in sources :

Example 41 with HorizontalPanel

use of com.google.gwt.user.client.ui.HorizontalPanel in project drools-wb by kiegroup.

the class FactPatternWidget method renderSingleFieldConstraint.

/**
 * Applies a single field constraint to the given table, and start row.
 */
private void renderSingleFieldConstraint(final FlexTable inner, final int row, final SingleFieldConstraint constraint, final HasConstraints hasConstraints, boolean showBinding, final int tabs) {
    // for offsetting, just a slight indent
    final int col = 1;
    inner.setWidget(row, 0, new HTML("    "));
    if (constraint.getConstraintValueType() != SingleFieldConstraint.TYPE_PREDICATE) {
        HorizontalPanel ebContainer = null;
        if (constraint instanceof SingleFieldConstraintEBLeftSide) {
            ebContainer = expressionBuilderLS((SingleFieldConstraintEBLeftSide) constraint, showBinding);
            inner.setWidget(row, 0 + col, ebContainer);
        } else {
            inner.setWidget(row, 0 + col, fieldLabel(constraint, hasConstraints, showBinding, tabs * 20));
        }
        inner.setWidget(row, 1 + col, operatorDropDown(constraint, inner, row, 2 + col));
        // Get first part of constraint.fieldName? #1=Fact1, #2=SubFact1
        inner.setWidget(row, 2 + col, createValueEditor(constraint));
        inner.setWidget(row, 3 + col, getConnectives().connectives(constraint));
        if (ebContainer != null && ebContainer.getWidgetCount() > 0) {
            if (ebContainer.getWidget(0) instanceof ExpressionBuilder) {
                associateExpressionWithChangeHandler(inner, row, constraint, col, ebContainer);
            }
        }
    } else if (constraint.getConstraintValueType() == SingleFieldConstraint.TYPE_PREDICATE) {
        inner.setWidget(row, 1, predicateEditor(constraint));
        inner.getFlexCellFormatter().setColSpan(row, 1, 5);
    }
}
Also used : SingleFieldConstraintEBLeftSide(org.drools.workbench.models.datamodel.rule.SingleFieldConstraintEBLeftSide) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) HTML(com.google.gwt.user.client.ui.HTML) CompositeFieldConstraint(org.drools.workbench.models.datamodel.rule.CompositeFieldConstraint) FieldConstraint(org.drools.workbench.models.datamodel.rule.FieldConstraint) SingleFieldConstraint(org.drools.workbench.models.datamodel.rule.SingleFieldConstraint)

Example 42 with HorizontalPanel

use of com.google.gwt.user.client.ui.HorizontalPanel in project drools-wb by kiegroup.

the class FactPatternWidget method predicateEditor.

/**
 * This provides an inline formula editor, not unlike a spreadsheet does.
 */
private Widget predicateEditor(final SingleFieldConstraint c) {
    HorizontalPanel pred = new HorizontalPanel();
    pred.setWidth("100%");
    Image img = new Image(GuidedRuleEditorResources.INSTANCE.images().functionAssets());
    img.setTitle(GuidedRuleEditorResources.CONSTANTS.FormulaBooleanTip());
    pred.add(img);
    if (c.getValue() == null) {
        c.setValue("");
    }
    final TextBox box = new TextBox();
    box.setText(c.getValue());
    if (!this.readOnly) {
        box.addChangeHandler(new ChangeHandler() {

            public void onChange(ChangeEvent event) {
                setModified(true);
                c.setValue(box.getText());
            }
        });
        box.setWidth("100%");
        pred.add(box);
    } else {
        pred.add(new SmallLabel(c.getValue()));
    }
    return pred;
}
Also used : SmallLabel(org.uberfire.ext.widgets.common.client.common.SmallLabel) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ValueChangeEvent(com.google.gwt.event.logical.shared.ValueChangeEvent) ExpressionTypeChangeEvent(org.drools.workbench.screens.guided.rule.client.editor.ExpressionTypeChangeEvent) ValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) ExpressionTypeChangeHandler(org.drools.workbench.screens.guided.rule.client.editor.ExpressionTypeChangeHandler) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) TextBox(org.gwtbootstrap3.client.ui.TextBox) Image(com.google.gwt.user.client.ui.Image)

Example 43 with HorizontalPanel

use of com.google.gwt.user.client.ui.HorizontalPanel in project rstudio by rstudio.

the class MiniDialogPopupPanel method commonInit.

private void commonInit() {
    addStyleName(ThemeStyles.INSTANCE.miniDialogPopupPanel());
    verticalPanel_ = new VerticalPanel();
    verticalPanel_.setStyleName(ThemeStyles.INSTANCE.miniDialogContainer());
    // title bar
    HorizontalPanel titleBar = new HorizontalPanel();
    titleBar.setWidth("100%");
    captionLabel_ = new Label();
    captionLabel_.setStyleName(ThemeStyles.INSTANCE.miniDialogCaption());
    titleBar.add(captionLabel_);
    titleBar.setCellHorizontalAlignment(captionLabel_, HasHorizontalAlignment.ALIGN_LEFT);
    HorizontalPanel toolsPanel = new HorizontalPanel();
    toolsPanel.setStyleName(ThemeStyles.INSTANCE.miniDialogTools());
    ToolbarButton hideButton = new ToolbarButton(new ImageResource2x(ThemeResources.INSTANCE.closeChevron2x()), new ClickHandler() {

        public void onClick(ClickEvent event) {
            MiniDialogPopupPanel.this.hideMiniDialog();
        }
    });
    hideButton.setTitle("Close");
    toolsPanel.add(hideButton);
    titleBar.add(toolsPanel);
    titleBar.setCellHorizontalAlignment(toolsPanel, HasHorizontalAlignment.ALIGN_RIGHT);
    verticalPanel_.add(titleBar);
    // main widget
    verticalPanel_.add(createMainWidget());
    setWidget(verticalPanel_);
}
Also used : VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) Label(com.google.gwt.user.client.ui.Label) ImageResource2x(org.rstudio.core.client.resources.ImageResource2x)

Example 44 with HorizontalPanel

use of com.google.gwt.user.client.ui.HorizontalPanel in project rstudio by rstudio.

the class RPubsUploadDialog method showProgressPanel.

private void showProgressPanel() {
    // disable continue button
    continueButton_.setVisible(false);
    updateButton_.setVisible(false);
    createButton_.setVisible(false);
    if (previewButton_ != null)
        previewButton_.setVisible(false);
    enableOkButton(false);
    // add progress
    HorizontalPanel progressPanel = new HorizontalPanel();
    ProgressImage progressImage = new ProgressImage(CoreResources.INSTANCE.progress_gray());
    progressImage.addStyleName(RESOURCES.styles().progressImage());
    progressImage.show(true);
    progressPanel.add(progressImage);
    progressPanel.add(new Label(RPubsUploader.PROGRESS_MESSAGE));
    addLeftWidget(progressPanel);
}
Also used : HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) Label(com.google.gwt.user.client.ui.Label) ProgressImage(org.rstudio.core.client.widget.ProgressImage)

Example 45 with HorizontalPanel

use of com.google.gwt.user.client.ui.HorizontalPanel in project rstudio by rstudio.

the class NewDirectoryPage method onAddWidgets.

@Override
protected void onAddWidgets() {
    NewProjectResources.Styles styles = NewProjectResources.INSTANCE.styles();
    HorizontalPanel panel = new HorizontalPanel();
    panel.addStyleName(styles.wizardMainColumn());
    // create the dir name label
    dirNameLabel_ = new Label("Directory name:");
    dirNameLabel_.addStyleName(styles.wizardTextEntryLabel());
    // top panel widgets
    onAddTopPanelWidgets(panel);
    // dir name
    VerticalPanel namePanel = new VerticalPanel();
    namePanel.addStyleName(styles.newProjectDirectoryName());
    namePanel.add(dirNameLabel_);
    txtProjectName_ = new TextBox();
    txtProjectName_.setWidth("100%");
    txtProjectName_.getElement().setAttribute("spellcheck", "false");
    namePanel.add(txtProjectName_);
    panel.add(namePanel);
    addWidget(panel);
    onAddBodyWidgets();
    addSpacer();
    // project dir
    newProjectParent_ = new DirectoryChooserTextBox("Create project as subdirectory of:", txtProjectName_);
    addWidget(newProjectParent_);
    // if git is available then add git init
    UIPrefs uiPrefs = RStudioGinjector.INSTANCE.getUIPrefs();
    SessionInfo sessionInfo = RStudioGinjector.INSTANCE.getSession().getSessionInfo();
    HorizontalPanel optionsPanel = null;
    if (getOptionsSideBySide())
        optionsPanel = new HorizontalPanel();
    chkGitInit_ = new CheckBox("Create a git repository");
    chkGitInit_.addStyleName(styles.wizardCheckbox());
    if (sessionInfo.isVcsAvailable(VCSConstants.GIT_ID)) {
        chkGitInit_.setValue(uiPrefs.newProjGitInit().getValue());
        chkGitInit_.getElement().getStyle().setMarginRight(7, Unit.PX);
        if (optionsPanel != null) {
            optionsPanel.add(chkGitInit_);
        } else {
            addSpacer();
            addWidget(chkGitInit_);
        }
    }
    // Initialize project with packrat
    chkPackratInit_ = new CheckBox("Use packrat with this project");
    chkPackratInit_.setValue(uiPrefs.newProjUsePackrat().getValue());
    if (!sessionInfo.getPackratAvailable()) {
        chkPackratInit_.setValue(false);
        chkPackratInit_.setVisible(false);
    }
    if (optionsPanel != null) {
        optionsPanel.add(chkPackratInit_);
    } else {
        addSpacer();
        addWidget(chkPackratInit_);
    }
    if (optionsPanel != null) {
        addSpacer();
        addWidget(optionsPanel);
    }
}
Also used : VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) CheckBox(com.google.gwt.user.client.ui.CheckBox) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) Label(com.google.gwt.user.client.ui.Label) SessionInfo(org.rstudio.studio.client.workbench.model.SessionInfo) TextBox(com.google.gwt.user.client.ui.TextBox) DirectoryChooserTextBox(org.rstudio.core.client.widget.DirectoryChooserTextBox) DirectoryChooserTextBox(org.rstudio.core.client.widget.DirectoryChooserTextBox) UIPrefs(org.rstudio.studio.client.workbench.prefs.model.UIPrefs)

Aggregations

HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)75 Label (com.google.gwt.user.client.ui.Label)25 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)24 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)21 Image (com.google.gwt.user.client.ui.Image)15 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)14 SmallLabel (org.uberfire.ext.widgets.common.client.common.SmallLabel)11 HTML (com.google.gwt.user.client.ui.HTML)8 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)7 Widget (com.google.gwt.user.client.ui.Widget)7 NpTextBox (com.google.gwtexpui.globalkey.client.NpTextBox)7 Button (org.gwtbootstrap3.client.ui.Button)7 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)6 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)6 TextBox (com.google.gwt.user.client.ui.TextBox)6 KeyUpEvent (com.google.gwt.event.dom.client.KeyUpEvent)5 KeyUpHandler (com.google.gwt.event.dom.client.KeyUpHandler)5 TextBox (org.gwtbootstrap3.client.ui.TextBox)5 InfoPopup (org.uberfire.ext.widgets.common.client.common.InfoPopup)5 KeyPressEvent (com.google.gwt.event.dom.client.KeyPressEvent)4