use of org.jaffa.presentation.portlet.widgets.model.EditBoxModel in project jaffa-framework by jaffa-projects.
the class EditBoxForm method setFieldLinkedToCCWV.
public void setFieldLinkedToCCWV(String value) {
EditBoxModel m = (EditBoxModel) getFieldLinkedToCCWM();
EditBoxController.updateModel(value, m);
}
use of org.jaffa.presentation.portlet.widgets.model.EditBoxModel in project jaffa-framework by jaffa-projects.
the class GridForm method createNewTreeModel.
private GridModel createNewTreeModel() {
GridModel model = new GridModel();
GridModelRow row;
// Root Node 1
row = model.newRow();
row.addElement("isExpanded", new Boolean(false));
row.addElement("isTarget", new Boolean(false));
row.addElement("isParent", new Boolean(true));
row.addElement("level", new Integer(1));
row.addElement("field1", new EditBoxModel("Field11Value"));
row.addElement("field2", new EditBoxModel("Field12Value"));
row.addElement("field3", new DateTimeModel());
row.addElement("field4", new CheckBoxModel(true));
row.addElement("field6", new DropDownModel("Value1"));
row = model.newRow();
row.addElement("isExpanded", new Boolean(false));
row.addElement("isTarget", new Boolean(false));
row.addElement("level", new Integer(2));
row.addElement("field1", new EditBoxModel("Field21Value"));
row.addElement("field2", new EditBoxModel("Field22Value"));
row.addElement("field3", new DateTimeModel(new DateTime()));
row.addElement("field4", new CheckBoxModel(false));
row.addElement("field6", new DropDownModel("Value2"));
row = model.newRow();
row.addElement("isExpanded", new Boolean(false));
row.addElement("isTarget", new Boolean(false));
row.addElement("isParent", new Boolean(true));
row.addElement("level", new Integer(1));
row.addElement("field1", new EditBoxModel("Field11Value"));
row.addElement("field2", new EditBoxModel("Field12Value"));
row.addElement("field3", new DateTimeModel());
row.addElement("field4", new CheckBoxModel(true));
row.addElement("field6", new DropDownModel("Value1"));
row = model.newRow();
row.addElement("isExpanded", new Boolean(false));
row.addElement("isTarget", new Boolean(false));
row.addElement("level", new Integer(2));
row.addElement("field1", new EditBoxModel("Field21Value"));
row.addElement("field2", new EditBoxModel("Field22Value"));
row.addElement("field3", new DateTimeModel(new DateTime()));
row.addElement("field4", new CheckBoxModel(false));
row.addElement("field6", new DropDownModel("Value2"));
row = model.newRow();
row.addElement("isExpanded", new Boolean(false));
row.addElement("isTarget", new Boolean(false));
row.addElement("isParent", new Boolean(true));
row.addElement("level", new Integer(1));
row.addElement("field1", new EditBoxModel("Field11Value"));
row.addElement("field2", new EditBoxModel("Field12Value"));
row.addElement("field3", new DateTimeModel());
row.addElement("field4", new CheckBoxModel(true));
row.addElement("field6", new DropDownModel("Value1"));
row = model.newRow();
row.addElement("isExpanded", new Boolean(false));
row.addElement("isTarget", new Boolean(false));
row.addElement("level", new Integer(2));
row.addElement("field1", new EditBoxModel("Field21Value"));
row.addElement("field2", new EditBoxModel("Field22Value"));
row.addElement("field3", new DateTimeModel(new DateTime()));
row.addElement("field4", new CheckBoxModel(false));
row.addElement("field6", new DropDownModel("Value2"));
row = model.newRow();
row.addElement("isExpanded", new Boolean(false));
row.addElement("isTarget", new Boolean(false));
row.addElement("isParent", new Boolean(true));
row.addElement("level", new Integer(1));
row.addElement("field1", new EditBoxModel("Field11Value"));
row.addElement("field2", new EditBoxModel("Field12Value"));
row.addElement("field3", new DateTimeModel());
row.addElement("field4", new CheckBoxModel(true));
row.addElement("field6", new DropDownModel("Value1"));
row = model.newRow();
row.addElement("isExpanded", new Boolean(false));
row.addElement("isTarget", new Boolean(false));
row.addElement("level", new Integer(2));
row.addElement("field1", new EditBoxModel("Field21Value"));
row.addElement("field2", new EditBoxModel("Field22Value"));
row.addElement("field3", new DateTimeModel(new DateTime()));
row.addElement("field4", new CheckBoxModel(false));
row.addElement("field6", new DropDownModel("Value2"));
row = model.newRow();
row.addElement("isExpanded", new Boolean(false));
row.addElement("isTarget", new Boolean(false));
row.addElement("isParent", new Boolean(true));
row.addElement("level", new Integer(1));
row.addElement("field1", new EditBoxModel("Field11Value"));
row.addElement("field2", new EditBoxModel("Field12Value"));
row.addElement("field3", new DateTimeModel());
row.addElement("field4", new CheckBoxModel(true));
row.addElement("field6", new DropDownModel("Value1"));
row = model.newRow();
row.addElement("isExpanded", new Boolean(false));
row.addElement("isTarget", new Boolean(false));
row.addElement("level", new Integer(2));
row.addElement("field1", new EditBoxModel("Field21Value"));
row.addElement("field2", new EditBoxModel("Field22Value"));
row.addElement("field3", new DateTimeModel(new DateTime()));
row.addElement("field4", new CheckBoxModel(false));
row.addElement("field6", new DropDownModel("Value2"));
row = model.newRow();
row.addElement("isExpanded", new Boolean(false));
row.addElement("isTarget", new Boolean(false));
row.addElement("isParent", new Boolean(true));
row.addElement("level", new Integer(1));
row.addElement("field1", new EditBoxModel("Field11Value"));
row.addElement("field2", new EditBoxModel("Field12Value"));
row.addElement("field3", new DateTimeModel());
row.addElement("field4", new CheckBoxModel(true));
row.addElement("field6", new DropDownModel("Value1"));
row = model.newRow();
row.addElement("isExpanded", new Boolean(false));
row.addElement("isTarget", new Boolean(false));
row.addElement("level", new Integer(2));
row.addElement("field1", new EditBoxModel("Field21Value"));
row.addElement("field2", new EditBoxModel("Field22Value"));
row.addElement("field3", new DateTimeModel(new DateTime()));
row.addElement("field4", new CheckBoxModel(false));
row.addElement("field6", new DropDownModel("Value2"));
row = model.newRow();
row.addElement("isExpanded", new Boolean(false));
row.addElement("isTarget", new Boolean(false));
row.addElement("isParent", new Boolean(true));
row.addElement("level", new Integer(1));
row.addElement("field1", new EditBoxModel("Field11Value"));
row.addElement("field2", new EditBoxModel("Field12Value"));
row.addElement("field3", new DateTimeModel());
row.addElement("field4", new CheckBoxModel(true));
row.addElement("field6", new DropDownModel("Value1"));
row = model.newRow();
row.addElement("isExpanded", new Boolean(false));
row.addElement("isTarget", new Boolean(false));
row.addElement("level", new Integer(2));
row.addElement("field1", new EditBoxModel("Field21Value"));
row.addElement("field2", new EditBoxModel("Field22Value"));
row.addElement("field3", new DateTimeModel(new DateTime()));
row.addElement("field4", new CheckBoxModel(false));
row.addElement("field6", new DropDownModel("Value2"));
row = model.newRow();
row.addElement("isExpanded", new Boolean(false));
row.addElement("isTarget", new Boolean(false));
row.addElement("isParent", new Boolean(true));
row.addElement("level", new Integer(1));
row.addElement("field1", new EditBoxModel("Field11Value"));
row.addElement("field2", new EditBoxModel("Field12Value"));
row.addElement("field3", new DateTimeModel());
row.addElement("field4", new CheckBoxModel(true));
row.addElement("field6", new DropDownModel("Value1"));
row = model.newRow();
row.addElement("isExpanded", new Boolean(false));
row.addElement("isTarget", new Boolean(false));
row.addElement("level", new Integer(2));
row.addElement("field1", new EditBoxModel("Field21Value"));
row.addElement("field2", new EditBoxModel("Field22Value"));
row.addElement("field3", new DateTimeModel(new DateTime()));
row.addElement("field4", new CheckBoxModel(false));
row.addElement("field6", new DropDownModel("Value2"));
row = model.newRow();
row.addElement("isExpanded", new Boolean(false));
row.addElement("isTarget", new Boolean(false));
row.addElement("isParent", new Boolean(true));
row.addElement("level", new Integer(1));
row.addElement("field1", new EditBoxModel("Field11Value"));
row.addElement("field2", new EditBoxModel("Field12Value"));
row.addElement("field3", new DateTimeModel());
row.addElement("field4", new CheckBoxModel(true));
row.addElement("field6", new DropDownModel("Value1"));
row = model.newRow();
row.addElement("isExpanded", new Boolean(false));
row.addElement("isTarget", new Boolean(false));
row.addElement("level", new Integer(2));
row.addElement("field1", new EditBoxModel("Field21Value"));
row.addElement("field2", new EditBoxModel("Field22Value"));
row.addElement("field3", new DateTimeModel(new DateTime()));
row.addElement("field4", new CheckBoxModel(false));
row.addElement("field6", new DropDownModel("Value2"));
row = model.newRow();
row.addElement("isExpanded", new Boolean(false));
row.addElement("isTarget", new Boolean(false));
row.addElement("isParent", new Boolean(true));
row.addElement("level", new Integer(1));
row.addElement("field1", new EditBoxModel("Field11Value"));
row.addElement("field2", new EditBoxModel("Field12Value"));
row.addElement("field3", new DateTimeModel());
row.addElement("field4", new CheckBoxModel(true));
row.addElement("field6", new DropDownModel("Value1"));
row = model.newRow();
row.addElement("isExpanded", new Boolean(false));
row.addElement("isTarget", new Boolean(false));
row.addElement("level", new Integer(2));
row.addElement("field1", new EditBoxModel("Field21Value"));
row.addElement("field2", new EditBoxModel("Field22Value"));
row.addElement("field3", new DateTimeModel(new DateTime()));
row.addElement("field4", new CheckBoxModel(false));
row.addElement("field6", new DropDownModel("Value2"));
row = model.newRow();
row.addElement("isExpanded", new Boolean(false));
row.addElement("isTarget", new Boolean(false));
row.addElement("isParent", new Boolean(true));
row.addElement("level", new Integer(1));
row.addElement("field1", new EditBoxModel("Field11Value"));
row.addElement("field2", new EditBoxModel("Field12Value"));
row.addElement("field3", new DateTimeModel());
row.addElement("field4", new CheckBoxModel(true));
row.addElement("field6", new DropDownModel("Value1"));
row = model.newRow();
row.addElement("isExpanded", new Boolean(false));
row.addElement("isTarget", new Boolean(false));
row.addElement("level", new Integer(2));
row.addElement("field1", new EditBoxModel("Field21Value"));
row.addElement("field2", new EditBoxModel("Field22Value"));
row.addElement("field3", new DateTimeModel(new DateTime()));
row.addElement("field4", new CheckBoxModel(false));
row.addElement("field6", new DropDownModel("Value2"));
// Root Node 2
row = model.newRow();
row.addElement("isExpanded", new Boolean(false));
row.addElement("isTarget", new Boolean(false));
row.addElement("isParent", new Boolean(true));
row.addElement("level", new Integer(1));
row.addElement("field1", new EditBoxModel("Field11Value"));
row.addElement("field2", new EditBoxModel("Field12Value"));
row.addElement("field3", new DateTimeModel());
row.addElement("field4", new CheckBoxModel(true));
row.addElement("field6", new DropDownModel("Value1"));
row = model.newRow();
row.addElement("isExpanded", new Boolean(false));
row.addElement("isTarget", new Boolean(false));
row.addElement("level", new Integer(2));
row.addElement("field1", new EditBoxModel("Field21Value"));
row.addElement("field2", new EditBoxModel("Field22Value"));
row.addElement("field3", new DateTimeModel(new DateTime()));
row.addElement("field4", new CheckBoxModel(false));
row.addElement("field6", new DropDownModel("Value2"));
row = model.newRow();
row.addElement("isExpanded", new Boolean(false));
row.addElement("isTarget", new Boolean(false));
row.addElement("isParent", new Boolean(true));
row.addElement("level", new Integer(2));
row.addElement("field1", new EditBoxModel("Field23Value"));
row.addElement("field2", new EditBoxModel("Field24Value"));
row.addElement("field3", new DateTimeModel(new DateTime()));
row.addElement("field4", new CheckBoxModel(false));
row.addElement("field6", new DropDownModel("Value2"));
row = model.newRow();
row.addElement("isExpanded", new Boolean(false));
row.addElement("isTarget", new Boolean(false));
row.addElement("level", new Integer(3));
row.addElement("field1", new EditBoxModel("Field31Value"));
row.addElement("field2", new EditBoxModel("Field32Value"));
row.addElement("field3", new DateTimeModel(DateTime.addMonth(new DateTime(), 1)));
row.addElement("field4", new CheckBoxModel(true));
row.addElement("field6", new DropDownModel("Value3"));
row = model.newRow();
row.addElement("isExpanded", new Boolean(false));
row.addElement("isTarget", new Boolean(false));
row.addElement("isParent", new Boolean(true));
row.addElement("level", new Integer(2));
row.addElement("field1", new EditBoxModel("Field43Value"));
row.addElement("field2", new EditBoxModel("Field44Value"));
row.addElement("field3", new DateTimeModel(new DateTime()));
row.addElement("field4", new CheckBoxModel(false));
row.addElement("field6", new DropDownModel("Value2"));
row = model.newRow();
row.addElement("isExpanded", new Boolean(false));
row.addElement("isTarget", new Boolean(false));
row.addElement("isParent", new Boolean(true));
row.addElement("level", new Integer(3));
row.addElement("field1", new EditBoxModel("Field51Value"));
row.addElement("field2", new EditBoxModel("Field52Value"));
row.addElement("field3", new DateTimeModel(DateTime.addMonth(new DateTime(), 1)));
row.addElement("field4", new CheckBoxModel(true));
row.addElement("field6", new DropDownModel("Value3"));
row = model.newRow();
row.addElement("isExpanded", new Boolean(false));
row.addElement("isTarget", new Boolean(false));
row.addElement("isParent", new Boolean(true));
row.addElement("level", new Integer(4));
row.addElement("field1", new EditBoxModel("Field61Value"));
row.addElement("field2", new EditBoxModel("Field62Value"));
row.addElement("field3", new DateTimeModel(DateTime.addMonth(new DateTime(), 1)));
row.addElement("field4", new CheckBoxModel(true));
row.addElement("field6", new DropDownModel("Value3"));
row = model.newRow();
row.addElement("isExpanded", new Boolean(false));
row.addElement("isTarget", new Boolean(false));
row.addElement("level", new Integer(5));
row.addElement("field1", new EditBoxModel("Field71Value"));
row.addElement("field2", new EditBoxModel("Field72Value"));
row.addElement("field3", new DateTimeModel(DateTime.addMonth(new DateTime(), 1)));
row.addElement("field4", new CheckBoxModel(true));
row.addElement("field6", new DropDownModel("Value3"));
row = model.newRow();
row.addElement("isExpanded", new Boolean(false));
row.addElement("isTarget", new Boolean(false));
row.addElement("isParent", new Boolean(true));
row.addElement("level", new Integer(3));
row.addElement("field1", new EditBoxModel("Field81Value"));
row.addElement("field2", new EditBoxModel("Field82Value"));
row.addElement("field3", new DateTimeModel(DateTime.addMonth(new DateTime(), 1)));
row.addElement("field4", new CheckBoxModel(true));
row.addElement("field6", new DropDownModel("Value3"));
return model;
}
use of org.jaffa.presentation.portlet.widgets.model.EditBoxModel in project jaffa-framework by jaffa-projects.
the class FormSelectionMaintenanceComponent method display.
/**
* Following attributes can be set on component invocation to control the types of output allowed
* directDisplay (), printing (), email(), webPublish(), autoDisplayAll()
*/
public FormKey display() throws ApplicationExceptions, FrameworkException {
FormKey fk = null;
GridModel rows = new GridModel();
fileNames = new StringBuilder();
if (getAutoDisplayAll()) {
setDirectDisplay(true);
setPrinting(false);
setEmail(false);
setWebPublish(false);
}
if (getAutoDisplayAll()) {
FormSelectionMaintenanceOutDto finderOutDto = (FormSelectionMaintenanceOutDto) doInquiry();
if (finderOutDto != null && finderOutDto.getRowsCount() > 0) {
if (log.isDebugEnabled()) {
log.debug("Form Preview for event " + getEvent() + ", Key1=" + getKey1() + ", Key2=" + getKey2() + ", Key3=" + getKey3() + ", Key4=" + getKey4() + ", Key5=" + getKey5() + ", Key6=" + getKey6() + ". Found " + finderOutDto.getRowsCount() + " rows.");
}
for (int i = 0; i < finderOutDto.getRowsCount(); i++) {
FormSelectionMaintenanceOutRowDto rowDto = finderOutDto.getRows(i);
rowDto.setSelect(Boolean.TRUE);
rowDto.setAdditionalDataObject(getAdditionalDataObject());
GridModelRow row = rows.newRow();
row.addElement("select", new CheckBoxModel((rowDto.getSelect() != null ? rowDto.getSelect() : Boolean.FALSE)));
row.addElement("errMessage", rowDto.getErrMessage());
row.addElement("formName", rowDto.getFormName());
row.addElement("event", rowDto.getEvent());
row.addElement("key1", rowDto.getKey1());
row.addElement("key2", rowDto.getKey2());
row.addElement("key3", rowDto.getKey3());
row.addElement("key4", rowDto.getKey4());
row.addElement("key5", rowDto.getKey5());
row.addElement("key6", rowDto.getKey6());
row.addElement("value1", rowDto.getValue1());
row.addElement("value2", rowDto.getValue2());
row.addElement("value3", rowDto.getValue3());
row.addElement("value4", rowDto.getValue4());
row.addElement("value5", rowDto.getValue5());
row.addElement("value6", rowDto.getValue6());
row.addElement("printer", rowDto.getPrinter());
row.addElement("email", rowDto.getEmail());
row.addElement("publish", new CheckBoxModel((rowDto.getPublish() != null ? rowDto.getPublish() : Boolean.FALSE)));
row.addElement("copies", rowDto.getCopies());
EditBoxModel printerModel = new EditBoxModel(rowDto.getPrinter(), PrinterDefinitionMeta.META_PRINTER_ID);
printerModel.setMandatory(false);
row.addElement("printer", printerModel);
row.addElement("email", new EditBoxModel(rowDto.getEmail()));
row.addElement("copies", new EditBoxModel(rowDto.getCopies()));
row.addElement("formType", rowDto.getFormType());
row.addElement("object", rowDto);
row.addElement("additionalDataComponent", rowDto.getAdditionalDataComponent());
fk = doShowForm(row);
if (finderOutDto.getRowsCount() == 1 && ((HttpServletRequest) ContextManagerFactory.instance().getProperty("request")).getHeader("user-agent").indexOf("UnixWare") >= 0) {
String tmpDir = System.getProperty("java.io.tmpdir");
String[] path = getFileNames().split(",");
((HttpServletRequest) ContextManagerFactory.instance().getProperty("request")).setAttribute("org.jaffa.applications.jaffa.modules.admin.components.fileexplorer", new File(tmpDir, path[0]));
fk = new FormKey("jaffa_admin_fileExplorer_download", null);
}
}
} else {
throw new ApplicationExceptions(new FormSelectionException(FormSelectionException.NO_FORM_DEFINED_FOR_EVENT, getEvent()) {
});
}
} else {
fk = super.display();
}
return fk;
}
use of org.jaffa.presentation.portlet.widgets.model.EditBoxModel in project jaffa-framework by jaffa-projects.
the class FormSelectionMaintenanceComponent method validateFields.
protected void validateFields(GridModelRow row, ApplicationExceptions appExps, boolean showForm) throws ApplicationExceptions, FrameworkException {
String additionalComponent = null;
CheckBoxModel checkBoxModel = (CheckBoxModel) row.get("select");
if ((checkBoxModel != null && checkBoxModel.getState()) || showForm) {
// Check copies are greater then zero
EditBoxModel mCopies = (EditBoxModel) row.get("copies");
if (mCopies != null && !showForm) {
if (mCopies.getValue() != null && mCopies.getValue().length() > 0) {
int iCopies = Integer.parseInt(mCopies.getValue());
if (iCopies < 1) {
appExps.add(new FormSelectionException(FormSelectionException.INVALID_COPIES));
}
} else {
appExps.add(new FormSelectionException(FormSelectionException.INVALID_COPIES));
}
}
if (!showForm) {
// check either printer, email or publish has value
EditBoxModel mPrinter = (EditBoxModel) row.get("printer");
EditBoxModel mEmail = (EditBoxModel) row.get("email");
CheckBoxModel mPublish = (CheckBoxModel) row.get("publish");
if ((mPrinter.getValue() == null) && (mEmail.getValue() == null) && (mPublish.getState() != true) && !showForm) {
appExps.add(new FormSelectionException(FormSelectionException.INVALID_OUTPUT_DESTINATION));
}
}
// Validate AdditionalData exist or not
try {
FormSelectionMaintenanceOutRowDto rowDto = (FormSelectionMaintenanceOutRowDto) row.get("object");
additionalComponent = rowDto.getAdditionalDataComponent();
if (additionalComponent != null) {
Component comp = (Component) run(additionalComponent);
BeanUtils.setProperty(comp, getKey1(), getValue1());
if (getKey2() != null) {
BeanUtils.setProperty(comp, getKey2(), getValue2());
}
if (getKey3() != null) {
BeanUtils.setProperty(comp, getKey3(), getValue3());
}
if (getKey4() != null) {
BeanUtils.setProperty(comp, getKey4(), getValue4());
}
if (getKey5() != null) {
BeanUtils.setProperty(comp, getKey5(), getValue5());
}
if (getKey6() != null) {
BeanUtils.setProperty(comp, getKey6(), getValue6());
}
if (comp instanceof IAdditionalData) {
((IAdditionalData) comp).validate();
} else {
if (log.isDebugEnabled()) {
log.debug("Additional Data Interface not implemented ");
}
}
}
} catch (SecurityException se) {
log.error("SecurityException Occurred ", se);
appExps.add(new FormSelectionException(FormSelectionException.SECURITY_EXCEPTION));
} catch (IllegalAccessException e) {
log.error("IllegalAccessException Occurred ", e);
} catch (InvocationTargetException e) {
log.error("InvocationTargetException Occurred ", e);
} catch (IllegalArgumentException e) {
log.error("IllegalArgumentException Occurred ", e);
} catch (ApplicationExceptions applicationException) {
log.debug("Catch : Application Exception from additional data component");
if (applicationException != null && applicationException.size() > 0) {
for (Iterator i = applicationException.iterator(); i.hasNext(); ) {
ApplicationException appEx = (ApplicationException) i.next();
appExps.add(appEx);
}
}
} catch (FrameworkException frameworkException) {
throw frameworkException;
}
}
}
Aggregations