Search in sources :

Example 16 with ViewDef

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();
}
Also used : HTMLWriter(web.HTMLWriter) Table(web.Table) JDBCTable(db.JDBCTable) ViewDef(db.ViewDef)

Example 17 with ViewDef

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);
}
Also used : ViewDef(db.ViewDef)

Example 18 with ViewDef

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;
}
Also used : DBConnection(db.DBConnection) ViewDef(db.ViewDef)

Aggregations

ViewDef (db.ViewDef)18 Column (db.column.Column)9 Request (app.Request)8 LookupColumn (db.column.LookupColumn)8 JDBCColumn (db.JDBCColumn)7 RecordOwnerAccessPolicy (db.access.RecordOwnerAccessPolicy)6 OneToMany (db.OneToMany)5 View (db.View)5 DBConnection (db.DBConnection)4 NameValuePairs (db.NameValuePairs)4 Select (db.Select)4 ArrayList (java.util.ArrayList)4 JDBCTable (db.JDBCTable)3 AccessPolicy (db.access.AccessPolicy)3 RoleAccessPolicy (db.access.RoleAccessPolicy)3 FileColumn (db.column.FileColumn)3 IOException (java.io.IOException)3 ResultSet (java.sql.ResultSet)3 SQLException (java.sql.SQLException)3 FormHook (db.FormHook)2