use of org.olat.core.gui.components.form.flexible.FormMultipartItem in project OpenOLAT by OpenOLAT.
the class FormLayoutContainer method add.
@Override
public void add(String name, FormItem formComp) {
if (!hasRootForm) {
throw new AssertionError("first ensure that the layout container knows about its rootform!!");
}
// set the formtranslator, and parent
Translator itemTranslator = formComp.getTranslator();
if (itemTranslator != null && itemTranslator instanceof PackageTranslator) {
// let the FormItem provide a more specialized translator
PackageTranslator itemPt = (PackageTranslator) itemTranslator;
itemTranslator = PackageTranslator.cascadeTranslators(itemPt, translator);
} else {
itemTranslator = translator;
}
formComp.setTranslator(itemTranslator);
formComp.setRootForm(getRootForm());
//
String formCompName = name;
// book keeping of FormComponent order
formComponentsNames.add(formCompName);
formComponents.put(formCompName, formComp);
/*
* add the gui representation
*/
formLayoutContainer.put(formCompName, formComp.getComponent());
formLayoutContainer.put(formCompName + FormItem.ERRORC, formComp.getErrorC());
formLayoutContainer.put(formCompName + FormItem.EXAMPLEC, formComp.getExampleC());
formLayoutContainer.put(formCompName + FormItem.LABELC, formComp.getLabelC());
// Check for multipart data, add upload limit to form
if (formComp instanceof FormMultipartItem) {
getRootForm().setMultipartEnabled(true);
}
}
use of org.olat.core.gui.components.form.flexible.FormMultipartItem in project OpenOLAT by OpenOLAT.
the class FormLayoutContainer method replace.
public void replace(FormItem toBeReplaced, FormItem with) {
String formCompName = toBeReplaced.getName();
int pos = formComponentsNames.indexOf(formCompName);
formComponentsNames.add(pos, with.getName());
formComponentsNames.remove(formCompName);
/*
* remove the gui representation
*/
formLayoutContainer.remove(toBeReplaced.getComponent());
formLayoutContainer.remove(toBeReplaced.getErrorC());
formLayoutContainer.remove(toBeReplaced.getExampleC());
formLayoutContainer.remove(toBeReplaced.getLabelC());
// set the formtranslator, and parent
Translator itemTranslator = with.getTranslator();
if (with.getTranslator() != null && itemTranslator instanceof PackageTranslator) {
// let the FormItem provide a more specialized translator
PackageTranslator itemPt = (PackageTranslator) itemTranslator;
itemTranslator = PackageTranslator.cascadeTranslators(itemPt, translator);
} else {
itemTranslator = translator;
}
with.setTranslator(itemTranslator);
with.setRootForm(getRootForm());
formComponents.put(formCompName, with);
/*
* add the gui representation
*/
formLayoutContainer.put(formCompName, with.getComponent());
formLayoutContainer.put(formCompName + FormItem.ERRORC, with.getErrorC());
formLayoutContainer.put(formCompName + FormItem.EXAMPLEC, with.getExampleC());
formLayoutContainer.put(formCompName + FormItem.LABELC, with.getLabelC());
// Check for multipart data, add upload limit to form
if (with instanceof FormMultipartItem) {
getRootForm().setMultipartEnabled(true);
}
}
use of org.olat.core.gui.components.form.flexible.FormMultipartItem in project openolat by klemens.
the class FormLayoutContainer method replace.
public void replace(FormItem toBeReplaced, FormItem with) {
String formCompName = toBeReplaced.getName();
int pos = formComponentsNames.indexOf(formCompName);
formComponentsNames.add(pos, with.getName());
formComponentsNames.remove(formCompName);
/*
* remove the gui representation
*/
formLayoutContainer.remove(toBeReplaced.getComponent());
formLayoutContainer.remove(toBeReplaced.getErrorC());
formLayoutContainer.remove(toBeReplaced.getExampleC());
formLayoutContainer.remove(toBeReplaced.getLabelC());
// set the formtranslator, and parent
Translator itemTranslator = with.getTranslator();
if (with.getTranslator() != null && itemTranslator instanceof PackageTranslator) {
// let the FormItem provide a more specialized translator
PackageTranslator itemPt = (PackageTranslator) itemTranslator;
itemTranslator = PackageTranslator.cascadeTranslators(itemPt, translator);
} else {
itemTranslator = translator;
}
with.setTranslator(itemTranslator);
with.setRootForm(getRootForm());
formComponents.put(formCompName, with);
/*
* add the gui representation
*/
formLayoutContainer.put(formCompName, with.getComponent());
formLayoutContainer.put(formCompName + FormItem.ERRORC, with.getErrorC());
formLayoutContainer.put(formCompName + FormItem.EXAMPLEC, with.getExampleC());
formLayoutContainer.put(formCompName + FormItem.LABELC, with.getLabelC());
// Check for multipart data, add upload limit to form
if (with instanceof FormMultipartItem) {
getRootForm().setMultipartEnabled(true);
}
}
use of org.olat.core.gui.components.form.flexible.FormMultipartItem in project openolat by klemens.
the class FormLayoutContainer method add.
@Override
public void add(String name, FormItem formComp) {
if (!hasRootForm) {
throw new AssertionError("first ensure that the layout container knows about its rootform!!");
}
// set the formtranslator, and parent
Translator itemTranslator = formComp.getTranslator();
if (itemTranslator != null && itemTranslator instanceof PackageTranslator) {
// let the FormItem provide a more specialized translator
PackageTranslator itemPt = (PackageTranslator) itemTranslator;
itemTranslator = PackageTranslator.cascadeTranslators(itemPt, translator);
} else {
itemTranslator = translator;
}
formComp.setTranslator(itemTranslator);
formComp.setRootForm(getRootForm());
//
String formCompName = name;
// book keeping of FormComponent order
formComponentsNames.add(formCompName);
formComponents.put(formCompName, formComp);
/*
* add the gui representation
*/
formLayoutContainer.put(formCompName, formComp.getComponent());
formLayoutContainer.put(formCompName + FormItem.ERRORC, formComp.getErrorC());
formLayoutContainer.put(formCompName + FormItem.EXAMPLEC, formComp.getExampleC());
formLayoutContainer.put(formCompName + FormItem.LABELC, formComp.getLabelC());
// Check for multipart data, add upload limit to form
if (formComp instanceof FormMultipartItem) {
getRootForm().setMultipartEnabled(true);
}
}
Aggregations