use of db.ViewDef in project common by zenlunatics.
the class Admin method writeViewDefCache.
// --------------------------------------------------------------------------
private void writeViewDefCache(Request request) throws IOException {
String remove = request.getParameter("remove");
if (remove != null)
request.releaseViewDef(remove);
HTMLWriter writer = request.writer;
Table table = new Table(writer).addClass("table table-condensed table-striped").addStyle("width", "auto");
Map<String, ViewDef> view_defs = request.site.getViewDefs();
for (String name : view_defs.keySet()) {
table.tr().td(name).td();
DBObject.write(view_defs.get(name), writer);
table.td();
writer.aOnClick("remove", componentReplaceJS("action=get_view_def_cache&remove=" + name, request));
}
table.close();
}
use of db.ViewDef in project common by zenlunatics.
the class Module method updateSettings.
// --------------------------------------------------------------------------
protected void updateSettings(Request request) throws IOException {
DBObject.set(this, request);
store(request.db);
request.writer.write("fade_alert('saved',$('" + Validation.getValidIdentifier("db_submit_id", request) + "'))");
for (ViewDef view_def : m_view_defs) request.site.removeViewDef(view_def.getName());
m_view_defs.clear();
request.site.publish(this, Message.UPDATE, null, request.db);
}
use of db.ViewDef in project common by zenlunatics.
the class Site method getViewDef.
// --------------------------------------------------------------------------
public ViewDef getViewDef(String name, DBConnection db) {
ViewDef view_def = null;
if (name != null)
view_def = m_view_defs.get(name);
if (view_def == null) {
view_def = newViewDef(name);
if (view_def != null) {
DBConnection dbc = db != null ? db : new DBConnection(this);
if (!view_def._load_(dbc) && "Record".equals(view_def.getRecordName()))
view_def.setRecordName(name);
if (db == null)
dbc.close();
m_view_defs.put(name, view_def);
}
}
return view_def;
}
Aggregations