Search in sources :

Example 1 with IButton

use of org.eclipse.scout.rt.client.ui.form.fields.button.IButton in project scout.rt by eclipse.

the class GroupBoxProcessButtonGrid method layoutStatic.

private void layoutStatic() {
    for (IButton button : m_buttons) {
        // No need to calculate any layout, just make sure the properties from gridDataHints are copied to gridData (e.g. horizontal alignment)
        GridData data = GridDataBuilder.createFromHints(button, 1);
        button.setGridDataInternal(data);
    }
}
Also used : IButton(org.eclipse.scout.rt.client.ui.form.fields.button.IButton) GridData(org.eclipse.scout.rt.client.ui.form.fields.GridData)

Example 2 with IButton

use of org.eclipse.scout.rt.client.ui.form.fields.button.IButton in project scout.rt by eclipse.

the class DefaultSearchFilterService method applySearchDelegate.

@Override
public void applySearchDelegate(IFormField field, SearchFilter search, boolean includeChildren) {
    String label = field.getLabel();
    if (field.getParentField() instanceof ISequenceBox && field.getParentField() instanceof AbstractFormField) {
        AbstractFormField range = (AbstractFormField) field.getParentField();
        if (range.getInitialLabel() != null) {
            label = range.getInitialLabel() + (StringUtility.isNullOrEmpty(label) ? "" : " " + label);
        }
    }
    // composer
    if (field instanceof AbstractComposerField) {
        AbstractComposerField composerField = (AbstractComposerField) field;
        ITreeNode rootNode = composerField.getTree().getRootNode();
        if (rootNode != null) {
            StringBuilder buf = new StringBuilder();
            new ComposerDisplayTextBuilder().build(rootNode, buf, "");
            String s = buf.toString();
            if (StringUtility.hasText(s)) {
                search.addDisplayText(s);
            }
        }
        return;
    }
    // list box
    if (field instanceof AbstractListBox<?>) {
        AbstractListBox<?> valueField = (AbstractListBox<?>) field;
        if (!valueField.getValue().isEmpty()) {
            search.addDisplayText(label + " " + TEXTS.get("LogicIn") + " " + valueField.getDisplayText());
        }
        return;
    }
    // tree box
    if (field instanceof AbstractTreeBox<?>) {
        AbstractTreeBox<?> valueField = (AbstractTreeBox<?>) field;
        if (!valueField.getValue().isEmpty()) {
            search.addDisplayText(label + " " + TEXTS.get("LogicIn") + " " + valueField.getDisplayText());
        }
        return;
    }
    // string, html, label field
    if (field instanceof AbstractStringField || field instanceof AbstractHtmlField || field instanceof AbstractLabelField) {
        AbstractValueField<?> valueField = (AbstractValueField<?>) field;
        if (valueField.getValue() != null) {
            search.addDisplayText(label + " " + TEXTS.get("LogicLike") + " " + valueField.getDisplayText());
        }
        return;
    }
    // boolean field
    if (field instanceof AbstractBooleanField) {
        AbstractBooleanField valueField = (AbstractBooleanField) field;
        if (valueField.getValue() != null && valueField.getValue()) {
            search.addDisplayText(label);
        }
        return;
    }
    // radiobuttongroup field
    if (field instanceof AbstractRadioButtonGroup<?>) {
        AbstractRadioButtonGroup<?> valueField = (AbstractRadioButtonGroup<?>) field;
        if (valueField.getValue() != null) {
            IButton selectedButton = valueField.getSelectedButton();
            search.addDisplayText(label + " = " + (selectedButton != null ? selectedButton.getLabel() : ""));
        }
        return;
    }
    // value field
    if (field instanceof AbstractValueField<?>) {
        AbstractValueField<?> valueField = (AbstractValueField<?>) field;
        if (valueField.getValue() != null) {
            search.addDisplayText(label + " " + TEXTS.get("LogicEQ") + " " + valueField.getDisplayText());
        }
        return;
    }
    if (includeChildren) {
        applySearchDelegateForChildren(field, search);
    }
}
Also used : AbstractFormField(org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField) AbstractHtmlField(org.eclipse.scout.rt.client.ui.form.fields.htmlfield.AbstractHtmlField) AbstractStringField(org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField) ISequenceBox(org.eclipse.scout.rt.client.ui.form.fields.sequencebox.ISequenceBox) ITreeNode(org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode) AbstractValueField(org.eclipse.scout.rt.client.ui.form.fields.AbstractValueField) AbstractLabelField(org.eclipse.scout.rt.client.ui.form.fields.labelfield.AbstractLabelField) IButton(org.eclipse.scout.rt.client.ui.form.fields.button.IButton) AbstractRadioButtonGroup(org.eclipse.scout.rt.client.ui.form.fields.radiobuttongroup.AbstractRadioButtonGroup) AbstractListBox(org.eclipse.scout.rt.client.ui.form.fields.listbox.AbstractListBox) AbstractComposerField(org.eclipse.scout.rt.client.ui.form.fields.composer.AbstractComposerField) ComposerDisplayTextBuilder(org.eclipse.scout.rt.client.ui.form.fields.composer.internal.ComposerDisplayTextBuilder) AbstractBooleanField(org.eclipse.scout.rt.client.ui.form.fields.booleanfield.AbstractBooleanField) AbstractTreeBox(org.eclipse.scout.rt.client.ui.form.fields.treebox.AbstractTreeBox)

Example 3 with IButton

use of org.eclipse.scout.rt.client.ui.form.fields.button.IButton in project scout.rt by eclipse.

the class AbstractForm method startWizardStep.

@Override
public void startWizardStep(IWizardStep wizardStep, Class<? extends IFormHandler> handlerType) {
    if (handlerType != null) {
        IFormHandler formHandler = ConfigurationUtility.newInnerInstance(this, handlerType);
        setHandler(formHandler);
    }
    m_wizardStep = wizardStep;
    setShowOnStart(false);
    setAskIfNeedSave(false);
    final String systemButtonHiddenInWizard = "systemButtonHiddenInWizard";
    // hide top level process buttons with a system type
    for (IFormField f : getRootGroupBox().getFields()) {
        if (f instanceof IButton) {
            IButton b = (IButton) f;
            if (b.getSystemType() != IButton.SYSTEM_TYPE_NONE) {
                // hide
                b.setVisible(false, systemButtonHiddenInWizard);
            }
        }
    }
    // start
    start();
}
Also used : IFormField(org.eclipse.scout.rt.client.ui.form.fields.IFormField) IButton(org.eclipse.scout.rt.client.ui.form.fields.button.IButton)

Example 4 with IButton

use of org.eclipse.scout.rt.client.ui.form.fields.button.IButton in project scout.rt by eclipse.

the class AbstractForm method initConfig.

protected void initConfig() {
    m_uiFacade = BEANS.get(ModelContextProxy.class).newProxy(new P_UIFacade(), ModelContext.copyCurrent().withForm(this));
    m_timerFutureMap = new HashMap<>();
    setShowOnStart(getConfiguredShowOnStart());
    m_contributionHolder = new ContributionComposite(this);
    // prepare injected fields
    List<Class<IFormField>> fieldArray = getConfiguredInjectedFields();
    DefaultFormFieldInjection injectedFields = null;
    IGroupBox rootBox = getRootGroupBox();
    try {
        if (fieldArray.size() > 0) {
            injectedFields = new DefaultFormFieldInjection(this);
            injectedFields.addFields(fieldArray);
            FormFieldInjectionThreadLocal.push(injectedFields);
        }
        // add mainbox if getter returns null
        if (rootBox == null) {
            List<IGroupBox> contributedFields = m_contributionHolder.getContributionsByClass(IGroupBox.class);
            rootBox = CollectionUtility.firstElement(contributedFields);
            if (rootBox == null) {
                Class<? extends IGroupBox> mainBoxClass = getConfiguredMainBox();
                if (mainBoxClass != null) {
                    rootBox = ConfigurationUtility.newInnerInstance(this, mainBoxClass);
                }
            }
            m_mainBox = rootBox;
        }
    } finally {
        if (injectedFields != null) {
            m_fieldReplacements = injectedFields.getReplacementMapping();
            FormFieldInjectionThreadLocal.pop(injectedFields);
        }
    }
    if (rootBox != null) {
        rootBox.setFormInternal(this);
        rootBox.setMainBox(true);
        rootBox.updateKeyStrokes();
        if (rootBox.isScrollable().isUndefined()) {
            rootBox.setScrollable(true);
        }
    }
    // move form fields
    new MoveFormFieldsHandler(this).moveFields();
    // 
    if (getConfiguredCloseTimer() > 0) {
        setCloseTimer(getConfiguredCloseTimer());
    }
    if (getConfiguredCustomTimer() > 0) {
        setTimer("custom", getConfiguredCustomTimer());
    }
    if (getConfiguredCancelVerificationText() != null) {
        setCancelVerificationText(getConfiguredCancelVerificationText());
    }
    if (getConfiguredTitle() != null) {
        setTitle(getConfiguredTitle());
    }
    if (getConfiguredSubTitle() != null) {
        setSubTitle(getConfiguredSubTitle());
    }
    setMinimizeEnabled(getConfiguredMinimizeEnabled());
    setMaximizeEnabled(getConfiguredMaximizeEnabled());
    setMinimized(getConfiguredMinimized());
    setMaximized(getConfiguredMaximized());
    setCacheBounds(getConfiguredCacheBounds());
    setAskIfNeedSave(getConfiguredAskIfNeedSave());
    setIconId(getConfiguredIconId());
    setCssClass((getConfiguredCssClass()));
    // Set 'modality' as preferred value if not 'auto'.
    int modalityHint = getConfiguredModalityHint();
    if (modalityHint != MODALITY_HINT_AUTO) {
        m_modal.set(modalityHint == MODALITY_HINT_MODAL, true);
    }
    // Set 'displayParent' as preferred value if not null; must precede setting of the 'displayHint'.
    IDisplayParent displayParent = getConfiguredDisplayParent();
    if (displayParent != null) {
        m_displayParent.set(displayParent, true);
    } else {
        m_displayParent.set(getDesktop(), false);
    }
    setDisplayHint(getConfiguredDisplayHint());
    setDisplayViewId(getConfiguredDisplayViewId());
    setClosable(getConfiguredClosable());
    setSaveNeededVisible(getConfiguredSaveNeededVisible());
    // visit all system buttons and attach observer
    // is auto-detaching
    m_systemButtonListener = new P_SystemButtonListener();
    IFormFieldVisitor v2 = new IFormFieldVisitor() {

        @Override
        public boolean visitField(IFormField field, int level, int fieldIndex) {
            if (field instanceof IButton) {
                final IButton button = (IButton) field;
                if (button.getSystemType() != IButton.SYSTEM_TYPE_NONE) {
                    button.addButtonListener(m_systemButtonListener);
                }
            }
            return true;
        }
    };
    visitFields(v2);
    getRootGroupBox().addPropertyChangeListener(new P_MainBoxPropertyChangeProxy());
    setButtonsArmed(true);
}
Also used : ContributionComposite(org.eclipse.scout.rt.shared.extension.ContributionComposite) IFormField(org.eclipse.scout.rt.client.ui.form.fields.IFormField) MoveFormFieldsHandler(org.eclipse.scout.rt.client.extension.ui.form.MoveFormFieldsHandler) IButton(org.eclipse.scout.rt.client.ui.form.fields.button.IButton) IGroupBox(org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox) IDisplayParent(org.eclipse.scout.rt.client.ui.IDisplayParent)

Example 5 with IButton

use of org.eclipse.scout.rt.client.ui.form.fields.button.IButton in project scout.rt by eclipse.

the class AbstractForm method closeFormInternal.

private void closeFormInternal(boolean kill) {
    if (isBlockingInternal()) {
        try {
            // check if there is an active close, cancel or finish button
            final Set<Integer> enabledSystemTypes = new HashSet<Integer>();
            final Set<IButton> enabledSystemButtons = new HashSet<IButton>();
            IFormFieldVisitor v = new IFormFieldVisitor() {

                @Override
                public boolean visitField(IFormField field, int level, int fieldIndex) {
                    if (field instanceof IButton) {
                        IButton b = (IButton) field;
                        if (b.isEnabled() && b.isVisible()) {
                            enabledSystemTypes.add(b.getSystemType());
                            enabledSystemButtons.add(b);
                        }
                    }
                    return true;
                }
            };
            visitFields(v);
            interceptOnCloseRequest(kill, enabledSystemTypes);
        } catch (RuntimeException | PlatformError e) {
            throw BEANS.get(PlatformExceptionTranslator.class).translate(e).withContextInfo("form", getClass().getName());
        }
    }
}
Also used : IFormField(org.eclipse.scout.rt.client.ui.form.fields.IFormField) PlatformError(org.eclipse.scout.rt.platform.exception.PlatformError) IButton(org.eclipse.scout.rt.client.ui.form.fields.button.IButton) PlatformExceptionTranslator(org.eclipse.scout.rt.platform.exception.PlatformExceptionTranslator) HashSet(java.util.HashSet)

Aggregations

IButton (org.eclipse.scout.rt.client.ui.form.fields.button.IButton)9 IFormField (org.eclipse.scout.rt.client.ui.form.fields.IFormField)5 GridData (org.eclipse.scout.rt.client.ui.form.fields.GridData)3 ArrayList (java.util.ArrayList)2 IGroupBox (org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox)2 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 IClientSession (org.eclipse.scout.rt.client.IClientSession)1 MoveFormFieldsHandler (org.eclipse.scout.rt.client.extension.ui.form.MoveFormFieldsHandler)1 IDisplayParent (org.eclipse.scout.rt.client.ui.IDisplayParent)1 IKeyStroke (org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke)1 IMenu (org.eclipse.scout.rt.client.ui.action.menu.IMenu)1 IViewButton (org.eclipse.scout.rt.client.ui.action.view.IViewButton)1 CalendarComponent (org.eclipse.scout.rt.client.ui.basic.calendar.CalendarComponent)1 ICalendar (org.eclipse.scout.rt.client.ui.basic.calendar.ICalendar)1 IFileChooser (org.eclipse.scout.rt.client.ui.basic.filechooser.IFileChooser)1 IPlanner (org.eclipse.scout.rt.client.ui.basic.planner.IPlanner)1 ITable (org.eclipse.scout.rt.client.ui.basic.table.ITable)1 IAggregateTableControl (org.eclipse.scout.rt.client.ui.basic.table.controls.IAggregateTableControl)1 IFormTableControl (org.eclipse.scout.rt.client.ui.basic.table.controls.IFormTableControl)1