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;
}
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;
}
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);
}
}
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;
}
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 });
}
Aggregations