Search in sources :

Example 36 with SimpleWidgetModel

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

the class LabelEditorForm method getDisplayOverridesOnlyWM.

/**
 * Getter for property displayOverridesOnly. This is invoked by the custom tag, when the jsp is rendered, to get the current value.
 * @return Value of property displayOverridesOnly.
 */
public SimpleWidgetModel getDisplayOverridesOnlyWM() {
    SimpleWidgetModel displayOverridesOnlyModel = (SimpleWidgetModel) getWidgetCache().getModel("displayOverridesOnly");
    if (displayOverridesOnlyModel == null) {
        displayOverridesOnlyModel = new SimpleWidgetModel(getDisplayOverridesOnly());
        getWidgetCache().addModel("displayOverridesOnly", displayOverridesOnlyModel);
    }
    return displayOverridesOnlyModel;
}
Also used : SimpleWidgetModel(org.jaffa.presentation.portlet.widgets.model.SimpleWidgetModel)

Example 37 with SimpleWidgetModel

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

the class LabelEditorForm method getLabelFilterWM.

/**
 * Getter for property labelFilter. This is invoked by the custom tag, when the jsp is rendered, to get the current value.
 * @return Value of property labelFilter.
 */
public SimpleWidgetModel getLabelFilterWM() {
    SimpleWidgetModel labelFilterModel = (SimpleWidgetModel) getWidgetCache().getModel("labelFilter");
    if (labelFilterModel == null) {
        labelFilterModel = new SimpleWidgetModel(getLabelFilter());
        getWidgetCache().addModel("labelFilter", labelFilterModel);
    }
    return labelFilterModel;
}
Also used : SimpleWidgetModel(org.jaffa.presentation.portlet.widgets.model.SimpleWidgetModel)

Example 38 with SimpleWidgetModel

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

the class LabelEditorForm method populateRows.

private void populateRows(GridModel rows) {
    rows.clearRows();
    Map labels = ((LabelEditorComponent) getComponent()).getLabels();
    for (Iterator itr = labels.keySet().iterator(); itr.hasNext(); ) {
        Object label = itr.next();
        Map map = (Map) labels.get(label);
        GridModelRow row = rows.newRow();
        row.addElement(LabelEditorComponent.LABEL, label);
        row.addElement(LabelEditorComponent.DEFAULT, map.get(LabelEditorComponent.DEFAULT));
        SimpleWidgetModel overrideModel = null;
        Object overrideValue = map.get(LabelEditorComponent.OVERRIDE);
        overrideModel = new SimpleWidgetModel(overrideValue);
        row.addElement(LabelEditorComponent.OVERRIDE, overrideModel);
    }
}
Also used : GridModelRow(org.jaffa.presentation.portlet.widgets.model.GridModelRow) SimpleWidgetModel(org.jaffa.presentation.portlet.widgets.model.SimpleWidgetModel)

Example 39 with SimpleWidgetModel

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

the class LabelEditorForm method getSearchPathForSourceFragmentsWM.

/**
 * Getter for property searchPathForSourceFragments. This is invoked by the custom tag, when the jsp is rendered, to get the current value.
 * @return Value of property searchPathForSourceFragments.
 */
public SimpleWidgetModel getSearchPathForSourceFragmentsWM() {
    SimpleWidgetModel searchPathForSourceFragmentsModel = (SimpleWidgetModel) getWidgetCache().getModel("searchPathForSourceFragments");
    if (searchPathForSourceFragmentsModel == null) {
        searchPathForSourceFragmentsModel = new SimpleWidgetModel(getSearchPathForSourceFragments());
        getWidgetCache().addModel("searchPathForSourceFragments", searchPathForSourceFragmentsModel);
    }
    return searchPathForSourceFragmentsModel;
}
Also used : SimpleWidgetModel(org.jaffa.presentation.portlet.widgets.model.SimpleWidgetModel)

Example 40 with SimpleWidgetModel

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

the class FileExplorerAction method performDelete.

/**
 * This will delete all selected files
 * @throws ApplicationExceptions if any error occurs while writing the file.
 * @throws FrameworkException if any error occurs.
 */
protected String performDelete(GridModel model) {
    int deletes = 0;
    int deleted = 0;
    for (Iterator it = model.getRows().iterator(); it.hasNext(); ) {
        GridModelRow row = (GridModelRow) it.next();
        SimpleWidgetModel value = (SimpleWidgetModel) row.get("selected");
        if (value != null && Boolean.TRUE.equals(value.getBooleanValue())) {
            // Delete this file
            deletes++;
            File f = (File) row.get("file");
            try {
                if (f == null || !f.exists())
                    row.put("error", MessageHelper.findMessage("message.Jaffa.Admin.FileExplorer.fileNotFound", null));
                else {
                    if (f.delete()) {
                        // Delete OK, remove row
                        it.remove();
                        deleted++;
                    } else {
                        // Did not delete
                        row.put("error", MessageHelper.findMessage("message.Jaffa.Admin.FileExplorer.fileNotDeleted", null));
                    }
                }
            } catch (Exception e) {
                log.error("Delete failed on " + (f == null ? "NULL" : f.getAbsolutePath()), e);
                row.put("error", MessageHelper.findMessage("message.Jaffa.Admin.FileExplorer.deleteError", new Object[] { e.getLocalizedMessage() }));
            }
        }
    }
    String token = "message.Jaffa.Admin.FileExplorer.";
    if (deletes == 0)
        token += "noFilesSelected";
    else if (deletes == deleted)
        token += "deleteOK";
    else
        token += "deleteErrors";
    return MessageHelper.findMessage(token, new String[] { "" + deletes, "" + deleted });
}
Also used : Iterator(java.util.Iterator) GridModelRow(org.jaffa.presentation.portlet.widgets.model.GridModelRow) File(java.io.File) SimpleWidgetModel(org.jaffa.presentation.portlet.widgets.model.SimpleWidgetModel) FrameworkException(org.jaffa.exceptions.FrameworkException)

Aggregations

SimpleWidgetModel (org.jaffa.presentation.portlet.widgets.model.SimpleWidgetModel)40 GridModelRow (org.jaffa.presentation.portlet.widgets.model.GridModelRow)5 JspWriteRuntimeException (org.jaffa.presentation.portlet.widgets.taglib.exceptions.JspWriteRuntimeException)5 IOException (java.io.IOException)4 JspException (javax.servlet.jsp.JspException)4 JspWriter (javax.servlet.jsp.JspWriter)4 MissingParametersRuntimeException (org.jaffa.presentation.portlet.widgets.taglib.exceptions.MissingParametersRuntimeException)4 OuterFormTagMissingRuntimeException (org.jaffa.presentation.portlet.widgets.taglib.exceptions.OuterFormTagMissingRuntimeException)4 IPropertyRuleIntrospector (org.jaffa.rules.IPropertyRuleIntrospector)4 Iterator (java.util.Iterator)2 IntegerFieldMetaData (org.jaffa.metadata.IntegerFieldMetaData)2 Recurrence (org.jaffa.modules.scheduler.services.Recurrence)2 FormBase (org.jaffa.presentation.portlet.FormBase)2 File (java.io.File)1 TreeSet (java.util.TreeSet)1 FrameworkException (org.jaffa.exceptions.FrameworkException)1 TaskMaintenanceDto (org.jaffa.modules.scheduler.components.taskmaintenance.dto.TaskMaintenanceDto)1 GridModel (org.jaffa.presentation.portlet.widgets.model.GridModel)1 WidgetModelAccessMethodNotFoundRuntimeException (org.jaffa.presentation.portlet.widgets.taglib.exceptions.WidgetModelAccessMethodNotFoundRuntimeException)1