Search in sources :

Example 1 with ImageModel

use of org.jaffa.presentation.portlet.widgets.model.ImageModel in project jaffa-framework by jaffa-projects.

the class ImageTag method otherDoStartTagOperations.

/**
 * Called from the doStartTag()
 */
public void otherDoStartTagOperations() throws JspException {
    super.otherDoStartTagOperations();
    // Get the formName
    String formName = TagHelper.getFormTag(pageContext).getHtmlName();
    if (formName == null) {
        String str = "The " + TAG_NAME + " should be inside a FormTag";
        log.error(str);
        throw new OuterFormTagMissingRuntimeException(str);
    }
    // Get the model
    ImageModel model = null;
    try {
        model = (ImageModel) TagHelper.getModel(pageContext, getField(), TAG_NAME);
    } catch (ClassCastException e) {
        String str = "Wrong WidgetModel for " + TAG_NAME + " on field " + getField();
        log.error(str, e);
        throw new JspWriteRuntimeException(str, e);
    }
    if (model != null) {
        // Generate the HTML
        JspWriter out = pageContext.getOut();
        String idPrefix = getHtmlIdPrefix() + '_' + TagHelper.getFormBase(pageContext).getComponent().getComponentId();
        try {
            out.println(getHtml(idPrefix, formName, model));
        } catch (IOException e) {
            String str = "Exception in writing the " + TAG_NAME;
            log.error(str, e);
            throw new JspWriteRuntimeException(str, e);
        }
    }
}
Also used : JspWriteRuntimeException(org.jaffa.presentation.portlet.widgets.taglib.exceptions.JspWriteRuntimeException) OuterFormTagMissingRuntimeException(org.jaffa.presentation.portlet.widgets.taglib.exceptions.OuterFormTagMissingRuntimeException) IOException(java.io.IOException) ImageModel(org.jaffa.presentation.portlet.widgets.model.ImageModel) JspWriter(javax.servlet.jsp.JspWriter)

Example 2 with ImageModel

use of org.jaffa.presentation.portlet.widgets.model.ImageModel in project jaffa-framework by jaffa-projects.

the class GridComponent method getGridChildren.

public void getGridChildren(String rowNo, String field, GridForm myForm) {
    GridModel w_model1 = (GridModel) myForm.getWidgetCache().getModel(field);
    GridModelRow row;
    System.out.println("The row number is " + rowNo);
    row = w_model1.getRowById(new Integer(rowNo).intValue());
    if ((row.getElement("isExpanded") != null) && (Boolean.TRUE.equals((Boolean) row.getElement("isExpanded")))) {
        return;
    }
    row.addElement("isExpanded", new Boolean(true));
    row.addElement("isDisplayed", new Boolean(true));
    w_model1.setTarget(row);
    row = w_model1.newRow(new Integer(rowNo).intValue() + 1);
    row.addElement("isDisplayed", new Boolean(true));
    row.addElement("isTarget", new Boolean(false));
    row.addElement("isParent", new Boolean(false));
    row.addElement("level", new Integer(4));
    row.addElement("field1", new EditBoxModel("Field91Value"));
    row.addElement("field2", new EditBoxModel("Field92Value"));
    row.addElement("field3", new DateTimeModel(DateTime.addMonth(new DateTime(), 1)));
    row.addElement("field4", new CheckBoxModel(true));
    row.addElement("field5", new ImageModel(ImageComponent.getImageBytes("C:\\Sandbox\\Jaffa\\source\\httpunittest\\html\\widgets\\tests\\testimage1_up.gif")));
    row.addElement("field6", new DropDownModel("Value3"));
}
Also used : GridModel(org.jaffa.presentation.portlet.widgets.model.GridModel) DateTimeModel(org.jaffa.presentation.portlet.widgets.model.DateTimeModel) DropDownModel(org.jaffa.presentation.portlet.widgets.model.DropDownModel) EditBoxModel(org.jaffa.presentation.portlet.widgets.model.EditBoxModel) GridModelRow(org.jaffa.presentation.portlet.widgets.model.GridModelRow) ImageModel(org.jaffa.presentation.portlet.widgets.model.ImageModel) DateTime(org.jaffa.datatypes.DateTime) CheckBoxModel(org.jaffa.presentation.portlet.widgets.model.CheckBoxModel)

Example 3 with ImageModel

use of org.jaffa.presentation.portlet.widgets.model.ImageModel in project jaffa-framework by jaffa-projects.

the class ImageForm method getFieldWithCachedModelWM.

public WidgetModel getFieldWithCachedModelWM() {
    if (w_fieldWithCachedModel == null) {
        w_fieldWithCachedModel = (ImageModel) getWidgetCache().getModel("fieldWithCachedModel");
        if (w_fieldWithCachedModel == null) {
            w_fieldWithCachedModel = new ImageModel(getFieldWithCachedModel());
            getWidgetCache().addModel("fieldWithCachedModel", w_fieldWithCachedModel);
        }
    }
    return w_fieldWithCachedModel;
}
Also used : ImageModel(org.jaffa.presentation.portlet.widgets.model.ImageModel)

Example 4 with ImageModel

use of org.jaffa.presentation.portlet.widgets.model.ImageModel in project jaffa-framework by jaffa-projects.

the class UserGridForm method createNewModel.

private GridModel createNewModel() {
    GridModel model = new GridModel();
    GridModelRow row;
    row = model.newRow();
    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("field5", new ImageModel(ImageComponent.getImageBytes("C:\\Sandbox\\Jaffa\\source\\httpunittest\\html\\widgets\\tests\\testimage1_up.gif")));
    row.addElement("field6", new DropDownModel("Value1"));
    row = model.newRow();
    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("field5", new ImageModel(ImageComponent.getImageBytes("C:\\Sandbox\\Jaffa\\source\\httpunittest\\html\\widgets\\tests\\testimage1_down.gif")));
    row.addElement("field6", new DropDownModel("Value2"));
    row = model.newRow();
    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("field5", new ImageModel(ImageComponent.getImageBytes("C:\\Sandbox\\Jaffa\\source\\httpunittest\\html\\widgets\\tests\\testimage1_up.gif")));
    row.addElement("field6", new DropDownModel("Value3"));
    return model;
}
Also used : GridModel(org.jaffa.presentation.portlet.widgets.model.GridModel) DateTimeModel(org.jaffa.presentation.portlet.widgets.model.DateTimeModel) DropDownModel(org.jaffa.presentation.portlet.widgets.model.DropDownModel) EditBoxModel(org.jaffa.presentation.portlet.widgets.model.EditBoxModel) GridModelRow(org.jaffa.presentation.portlet.widgets.model.GridModelRow) ImageModel(org.jaffa.presentation.portlet.widgets.model.ImageModel) DateTime(org.jaffa.datatypes.DateTime) CheckBoxModel(org.jaffa.presentation.portlet.widgets.model.CheckBoxModel)

Example 5 with ImageModel

use of org.jaffa.presentation.portlet.widgets.model.ImageModel in project jaffa-framework by jaffa-projects.

the class ImageForm method getFieldLinkedToCCAndCachedWM.

public WidgetModel getFieldLinkedToCCAndCachedWM() {
    if (w_fieldLinkedToCCAndCached == null) {
        w_fieldLinkedToCCAndCached = (ImageModel) getWidgetCache().getModel("fieldLinkedToCCAndCached");
        if (w_fieldLinkedToCCAndCached == null) {
            w_fieldLinkedToCCAndCached = new ImageModel(getFieldLinkedToCCAndCached());
            getWidgetCache().addModel("fieldLinkedToCCAndCached", w_fieldLinkedToCCAndCached);
        }
    }
    return w_fieldLinkedToCCAndCached;
}
Also used : ImageModel(org.jaffa.presentation.portlet.widgets.model.ImageModel)

Aggregations

ImageModel (org.jaffa.presentation.portlet.widgets.model.ImageModel)5 DateTime (org.jaffa.datatypes.DateTime)2 CheckBoxModel (org.jaffa.presentation.portlet.widgets.model.CheckBoxModel)2 DateTimeModel (org.jaffa.presentation.portlet.widgets.model.DateTimeModel)2 DropDownModel (org.jaffa.presentation.portlet.widgets.model.DropDownModel)2 EditBoxModel (org.jaffa.presentation.portlet.widgets.model.EditBoxModel)2 GridModel (org.jaffa.presentation.portlet.widgets.model.GridModel)2 GridModelRow (org.jaffa.presentation.portlet.widgets.model.GridModelRow)2 IOException (java.io.IOException)1 JspWriter (javax.servlet.jsp.JspWriter)1 JspWriteRuntimeException (org.jaffa.presentation.portlet.widgets.taglib.exceptions.JspWriteRuntimeException)1 OuterFormTagMissingRuntimeException (org.jaffa.presentation.portlet.widgets.taglib.exceptions.OuterFormTagMissingRuntimeException)1