use of com.servoy.j2db.persistence.Solution in project servoy-client by Servoy.
the class FlattenedSolution method createFlattenedForm.
/*
* Create a flattened form for the form that is child of the current solution.
*/
public FlattenedForm createFlattenedForm(Form form) {
Form myForm;
Solution solcopy = getSolutionCopy(false);
if (form.getParent() == getSolution() || form.getParent() == solcopy) {
myForm = form;
} else {
myForm = null;
if (solcopy != null) {
myForm = (Form) solcopy.getChild(form.getUUID());
}
if (myForm == null) {
myForm = (Form) getSolution().getChild(form.getUUID());
}
if (myForm == null && modules != null) {
for (Solution mod : modules) {
myForm = (Form) mod.getChild(form.getUUID());
if (myForm != null)
break;
}
}
if (myForm == null) {
throw new RuntimeException("Cannot find form '" + form + "' in solution '" + getSolution() + "'");
}
}
try {
return new FlattenedForm(this, myForm);
} catch (RuntimeException ex) {
Debug.error("Error while creating full hierarchy form (flattened form) for: " + (myForm != null ? myForm.getName() : "<form not found>"), ex);
throw ex;
}
}
use of com.servoy.j2db.persistence.Solution in project servoy-client by Servoy.
the class FlattenedSolution method buildOrderedList.
private static List<Solution> buildOrderedList(Collection<Solution> modules, List<Solution> orderedSolutions, Solution solution) {
if (solution != null && solution.getModulesNames() != null) {
for (// $NON-NLS-1$
String moduleName : // $NON-NLS-1$
Utils.getTokenElements(solution.getModulesNames(), ",", true)) {
Solution module = null;
for (Solution sol : modules) {
if (sol.getName().equals(moduleName)) {
module = sol;
break;
}
}
if (module != null && !orderedSolutions.contains(module)) {
orderedSolutions.add(module);
buildOrderedList(modules, orderedSolutions, module);
}
}
}
return orderedSolutions;
}
use of com.servoy.j2db.persistence.Solution in project servoy-client by Servoy.
the class FormManager method propertyChange.
public void propertyChange(PropertyChangeEvent evt) {
String name = evt.getPropertyName();
if (// $NON-NLS-1$
"solution".equals(name)) {
final Solution s = (Solution) evt.getNewValue();
// must run on same thread
destroySolutionSettings();
if (s != null) {
application.invokeLater(new Runnable() {
public void run() {
makeSolutionSettings(s);
}
});
} else {
lastModalContainer = null;
}
} else if (// $NON-NLS-1$
"mode".equals(name)) {
int oldmode = ((Integer) evt.getOldValue()).intValue();
int newmode = ((Integer) evt.getNewValue()).intValue();
handleModeChange(oldmode, newmode);
}
}
use of com.servoy.j2db.persistence.Solution in project servoy-client by Servoy.
the class Messages method isI18NTable.
public static boolean isI18NTable(String serverName, String tableName, IApplication application) {
Solution solution = application.getSolution();
IFoundSetManagerInternal fm = application.getFoundSetManager();
if (solution != null && fm != null) {
String i18nDatasource = solution.getI18nDataSource();
String[] names = getServerTableNames(i18nDatasource, application.getSettings());
return names[0] != null && names[0].equals(serverName) && names[1] != null && ((tableName == null) || names[1].equals(tableName));
}
return false;
}
use of com.servoy.j2db.persistence.Solution in project servoy-client by Servoy.
the class ScriptEngine method compileFunction.
@SuppressWarnings("nls")
public Function compileFunction(IScriptProvider sp, Scriptable scope) throws Exception {
Context cx = Context.enter();
int iOp = cx.getOptimizationLevel();
String sourceName = sp.getDataProviderID();
if (sp.getScopeName() != null) {
Solution sol = (Solution) sp.getAncestor(IRepository.SOLUTIONS);
sourceName = sol.getName() + "/scopes/" + sp.getScopeName() + '/' + sourceName;
} else if (sp.getParent() instanceof Form) {
Solution sol = (Solution) sp.getAncestor(IRepository.SOLUTIONS);
sourceName = sol.getName() + "/forms/" + ((Form) sp.getParent()).getName() + '/' + sourceName;
} else if (sp.getParent() instanceof TableNode) {
Solution sol = (Solution) sp.getAncestor(IRepository.SOLUTIONS);
sourceName = sol.getName() + '/' + ((TableNode) sp.getParent()).getDataSource() + '/' + sourceName;
if (sp instanceof ScriptCalculation) {
sourceName = sourceName.replace("db:", "calculations");
} else {
sourceName = sourceName.replace("db:", "entities");
}
}
try {
if (// flag should only be used in rich client
Utils.getAsBoolean(System.getProperty(SERVOY_DISABLE_SCRIPT_COMPILE_PROPERTY, "false"))) {
cx.setOptimizationLevel(-1);
} else {
cx.setOptimizationLevel(9);
}
cx.setGeneratingSource(Boolean.getBoolean("servoy.generateJavascriptSource"));
return compileScriptProvider(sp, scope, cx, sourceName);
} catch (Exception e) {
Debug.error("Compilation failed for method: " + sourceName);
throw e;
} finally {
cx.setOptimizationLevel(iOp);
Context.exit();
}
}
Aggregations