use of org.eclipse.scout.rt.client.ui.form.fields.IFormField in project scout.rt by eclipse.
the class TabBoxGrid method validate.
@Override
public void validate(ITabBox tabBox) {
// reset
m_gridColumns = 0;
m_gridRows = 0;
ArrayList<IFormField> list = new ArrayList<IFormField>();
// filter
for (IFormField f : tabBox.getGroupBoxes()) {
if (f.isVisible()) {
list.add(f);
} else {
GridData data = GridDataBuilder.createFromHints(f, 1);
f.setGridDataInternal(data);
}
}
m_fields = list.toArray(new IFormField[list.size()]);
layoutStatic();
}
use of org.eclipse.scout.rt.client.ui.form.fields.IFormField in project scout.rt by eclipse.
the class SplitBoxGrid method validate.
@Override
public void validate(ISplitBox splitBox) {
// reset
m_gridColumns = 2;
m_gridRows = 1;
ArrayList<IFormField> list = new ArrayList<IFormField>();
// filter
for (IFormField f : splitBox.getFields()) {
if (f.isVisible()) {
list.add(f);
} else {
GridData data = GridDataBuilder.createFromHints(f, 1);
f.setGridDataInternal(data);
}
}
m_fields = list.toArray(new IFormField[list.size()]);
layoutStatic();
}
use of org.eclipse.scout.rt.client.ui.form.fields.IFormField in project scout.rt by eclipse.
the class MoveFormFieldsHandler method moveFields.
public void moveFields() {
P_FormFieldVisitor visitor = new P_FormFieldVisitor();
m_form.visitFields(visitor);
if (m_moveDescriptors.isEmpty()) {
return;
}
StringBuilder sb = new StringBuilder();
for (MoveDescriptor<IFormField> moveItem : m_moveDescriptors) {
IFormField field = moveItem.getModel();
ICompositeField oldContainer = field.getParentField();
ICompositeField newContainer = findContainer(oldContainer, moveItem.getNewContainerIdentifer(), null);
if (newContainer != null) {
Double newOrder = moveItem.getNewOrder();
if (newOrder != null) {
field.setOrder(newOrder);
}
try {
field.setFieldChanging(true);
oldContainer.moveFieldTo(field, newContainer);
// field grid is not rebuilt for performance reasons and because this handler is intended to be used during initConfig of a form.
} finally {
field.setFieldChanging(false);
}
} else {
if (sb.length() == 0) {
sb.append("Invalid field move commands:");
}
sb.append(" \nField '").append(field).append("' cannot be moved into container '").append(newContainer).append("'");
}
}
if (sb.length() > 0) {
throw new IllegalArgumentException(sb.toString());
}
}
use of org.eclipse.scout.rt.client.ui.form.fields.IFormField in project scout.rt by eclipse.
the class AbstractForm method doCancel.
@Override
public void doCancel() {
if (!isBlockingInternal()) {
return;
}
m_closeType = IButton.SYSTEM_TYPE_CANCEL;
try {
// ensure all fields have the right save-needed-state
checkSaveNeeded();
// find any fields that needs save
P_AbstractCollectingFieldVisitor<IFormField> collector = new P_AbstractCollectingFieldVisitor<IFormField>() {
@Override
public boolean visitField(IFormField field, int level, int fieldIndex) {
if (field.isSaveNeeded()) {
collect(field);
return false;
} else {
return true;
}
}
};
visitFields(collector);
if (collector.getCollectionCount() > 0 && isAskIfNeedSave()) {
int result = MessageBoxes.createYesNoCancel().withDisplayParent(this).withHeader(getCancelVerificationText()).withSeverity(IStatus.INFO).show();
if (result == IMessageBox.YES_OPTION) {
doOk();
return;
} else if (result == IMessageBox.NO_OPTION) {
doClose();
return;
} else {
VetoException e = new VetoException(TEXTS.get("UserCancelledOperation"));
e.consume();
throw e;
}
}
discardStateInternal();
doFinally();
disposeFormInternal();
} catch (RuntimeException | PlatformError e) {
m_closeType = IButton.SYSTEM_TYPE_NONE;
throw BEANS.get(PlatformExceptionTranslator.class).translate(e).withContextInfo("form", getClass().getName());
}
}
use of org.eclipse.scout.rt.client.ui.form.fields.IFormField 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();
}
Aggregations