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);
}
}
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);
}
}
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();
}
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);
}
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());
}
}
}
Aggregations