Search in sources :

Example 6 with IApplication

use of com.servoy.j2db.IApplication in project servoy-client by Servoy.

the class SwingFoundSet method fireSelectionAdjusting.

@Override
protected void fireSelectionAdjusting() {
    if (selectionModel == null)
        createSelectionModel();
    Runnable runner = new Runnable() {

        public void run() {
            selectionModel.fireAdjusting();
        }
    };
    IApplication app = fsm.getApplication();
    if (app.isEventDispatchThread()) {
        runner.run();
    } else {
        app.invokeLater(runner);
    }
}
Also used : IApplication(com.servoy.j2db.IApplication)

Example 7 with IApplication

use of com.servoy.j2db.IApplication in project servoy-client by Servoy.

the class SwingForm method print.

/**
 * @see com.servoy.j2db.IFormUIInternal#print(boolean, boolean, boolean, java.awt.print.PrinterJob)
 */
public void print(boolean showDialogs, boolean printCurrentRecordOnly, boolean showPrinterSelectDialog, PrinterJob printerJob) {
    IFoundSetInternal fs = formController.getFoundSet();
    if (!printCurrentRecordOnly) {
        if (showDialogs) {
            int option = willingToPrint(fs);
            if (option == 2) {
                printCurrentRecordOnly = true;
            } else if (option == 1) {
                // cancel
                return;
            }
        }
    }
    IApplication application = formController.getApplication();
    try {
        // $NON-NLS-1$
        application.blockGUI(Messages.getString("servoy.formPanel.status.printProgress"));
        if (printCurrentRecordOnly) {
            fs = fs.copyCurrentRecordFoundSet();
        }
        FormPreviewPanel fpp = new FormPreviewPanel(application, formController, fs);
        fpp.process();
        PrintPreview.startPrinting(application, fpp.getPageable(), printerJob, formController.getPreferredPrinterName(), showPrinterSelectDialog, false);
        fpp.destroy();
    } catch (Exception ex) {
        // $NON-NLS-1$
        application.reportError(Messages.getString("servoy.formPanel.error.printDocument"), ex);
    } finally {
        application.releaseGUI();
    }
}
Also used : IApplication(com.servoy.j2db.IApplication) IFoundSetInternal(com.servoy.j2db.dataprocessing.IFoundSetInternal) FormPreviewPanel(com.servoy.j2db.printing.FormPreviewPanel) Point(java.awt.Point)

Example 8 with IApplication

use of com.servoy.j2db.IApplication in project servoy-client by Servoy.

the class SwingForm method printXML.

/**
 * @see com.servoy.j2db.IFormUIInternal#printXML(boolean)
 */
public String printXML(boolean printCurrentRecordOnly) {
    IApplication application = formController.getApplication();
    IFoundSetInternal fs = formController.getFoundSet();
    try {
        // $NON-NLS-1$
        application.blockGUI(Messages.getString("servoy.formPanel.status.xmlPrinting"));
        if (printCurrentRecordOnly) {
            fs = fs.copyCurrentRecordFoundSet();
        }
        FormPreviewPanel fpp = new FormPreviewPanel(application, formController, fs);
        fpp.process();
        StringWriter w = new StringWriter();
        ((PageList) fpp.getPageable()).toXML(w);
        fpp.destroy();
        return w.toString();
    } catch (Throwable ex) {
        // $NON-NLS-1$
        application.reportError(Messages.getString("servoy.formPanel.error.printDocument"), ex);
    } finally {
        application.releaseGUI();
    }
    return null;
}
Also used : IApplication(com.servoy.j2db.IApplication) StringWriter(java.io.StringWriter) IFoundSetInternal(com.servoy.j2db.dataprocessing.IFoundSetInternal) FormPreviewPanel(com.servoy.j2db.printing.FormPreviewPanel) PageList(com.servoy.j2db.printing.PageList)

Example 9 with IApplication

use of com.servoy.j2db.IApplication in project servoy-client by Servoy.

the class ViewFoundSet method getQuery.

/**
 * Get the cloned query that created this ViewFoundSset (modifying this QBSelect will not change the foundset).
 * The ViewFoundSets main query can't be altered after creation; you need to make a new ViewFoundSet for that (it can have the same datasource name).
 *
 * @sample
 * var q = foundset.getQuery()
 * q.where.add(q.columns.x.eq(100))
 * var newVF = databaseManager.getViewFoundset("name", q);
 *
 * @return query.
 */
@JSFunction
public QBSelect getQuery() {
    QuerySelect query = AbstractBaseQuery.deepClone(this.select, true);
    IApplication application = manager.getApplication();
    return new QBSelect(manager, manager.getScopesScopeProvider(), application.getFlattenedSolution(), application.getScriptEngine().getSolutionScope(), select.getTable().getDataSource(), null, query);
}
Also used : IApplication(com.servoy.j2db.IApplication) QBSelect(com.servoy.j2db.querybuilder.impl.QBSelect) QuerySelect(com.servoy.j2db.query.QuerySelect) JSFunction(org.mozilla.javascript.annotations.JSFunction)

Example 10 with IApplication

use of com.servoy.j2db.IApplication in project servoy-client by Servoy.

the class SwingRelatedFoundSet method fireSelectionAdjusting.

@Override
protected void fireSelectionAdjusting() {
    if (selectionModel == null)
        createSelectionModel();
    Runnable runner = new Runnable() {

        public void run() {
            selectionModel.fireAdjusting();
        }
    };
    IApplication app = fsm.getApplication();
    if (app.isEventDispatchThread()) {
        runner.run();
    } else {
        app.invokeLater(runner);
    }
}
Also used : IApplication(com.servoy.j2db.IApplication)

Aggregations

IApplication (com.servoy.j2db.IApplication)18 IFoundSetInternal (com.servoy.j2db.dataprocessing.IFoundSetInternal)6 QuerySelect (com.servoy.j2db.query.QuerySelect)4 ServoyException (com.servoy.j2db.util.ServoyException)4 RepositoryException (com.servoy.j2db.persistence.RepositoryException)3 FormPreviewPanel (com.servoy.j2db.printing.FormPreviewPanel)3 ArrayList (java.util.ArrayList)3 BaseQueryTable (com.servoy.base.query.BaseQueryTable)2 ApplicationException (com.servoy.j2db.ApplicationException)2 IFormController (com.servoy.j2db.IFormController)2 IDisplayData (com.servoy.j2db.dataprocessing.IDisplayData)2 ISwingFoundSet (com.servoy.j2db.dataprocessing.ISwingFoundSet)2 SortColumn (com.servoy.j2db.dataprocessing.SortColumn)2 DbIdentValue (com.servoy.j2db.dataprocessing.ValueFactory.DbIdentValue)2 Column (com.servoy.j2db.persistence.Column)2 Form (com.servoy.j2db.persistence.Form)2 IRepository (com.servoy.j2db.persistence.IRepository)2 Relation (com.servoy.j2db.persistence.Relation)2 Solution (com.servoy.j2db.persistence.Solution)2 Placeholder (com.servoy.j2db.query.Placeholder)2