use of com.twinsoft.convertigo.beans.core.ScreenClass in project convertigo by convertigo.
the class ScHandlerStatement method getTagsForProperty.
@Override
public String[] getTagsForProperty(String propertyName) {
if (propertyName.equals("normalizedScreenClassName")) {
HtmlConnector connector = (HtmlConnector) getParent().getParent();
List<HtmlScreenClass> v = connector.getAllScreenClasses();
String[] sNames = new String[v.size() + 1];
sNames[0] = "";
for (int i = 1; i <= v.size(); i++) {
ScreenClass screenClass = (ScreenClass) v.get(i - 1);
String normalizedScreenClassName = StringUtils.normalize(screenClass.getName());
sNames[i] = normalizedScreenClassName;
}
return sNames;
}
return super.getTagsForProperty(propertyName);
}
use of com.twinsoft.convertigo.beans.core.ScreenClass in project convertigo by convertigo.
the class ContextManager method verifyPoolContext.
private boolean verifyPoolContext(Context context) {
JavelinConnector javelinConnector = (JavelinConnector) context.getConnector();
if (javelinConnector == null) {
return true;
}
// TODO: find why the javelin is null sometimes with pools
if (javelinConnector.javelin == null) {
return true;
}
Engine.logContextManager.trace("verifyPoolContext() context=" + context.contextID);
Engine.logContextManager.trace("verifyPoolContext() connector=" + Integer.toHexString(javelinConnector.hashCode()));
Engine.logContextManager.trace("verifyPoolContext() javelin=" + Integer.toHexString(javelinConnector.javelin.hashCode()));
boolean isConnected = ((iJavelin) javelinConnector.javelin).isConnected();
Engine.logContextManager.trace("verifyPoolContext() isConnected=" + isConnected);
boolean isInExpectedScreenClass = true;
String initialScreenClass = context.pool.getInitialScreenClass();
String currentScreenClassName = "none";
if (initialScreenClass.length() > 0) {
ScreenClass currentScreenClass = javelinConnector.getCurrentScreenClass();
currentScreenClassName = currentScreenClass.getName();
isInExpectedScreenClass = initialScreenClass.equals(currentScreenClass.getName());
}
Engine.logContextManager.trace("verifyPoolContext() expected screen class: " + context.pool.getInitialScreenClass());
Engine.logContextManager.trace("verifyPoolContext() current screen class: " + currentScreenClassName);
Engine.logContextManager.trace("verifyPoolContext() isInExpectedScreenClass=" + isInExpectedScreenClass);
boolean b = isConnected && isInExpectedScreenClass;
if (!b) {
Engine.logContextManager.warn("Zombie context detected! context: " + context.contextID);
}
return b;
}
use of com.twinsoft.convertigo.beans.core.ScreenClass in project convertigo by convertigo.
the class ClipboardManager method cutAndPaste.
public void cutAndPaste(final DatabaseObject object, DatabaseObject parentDatabaseObject) throws ConvertigoException {
// Verifying if a sheet with the same browser does not already exist
if (object instanceof Sheet) {
String browser = ((Sheet) object).getBrowser();
Sheet sheet = null;
if (parentDatabaseObject instanceof ScreenClass) {
sheet = ((ScreenClass) parentDatabaseObject).getLocalSheet(browser);
} else if (parentDatabaseObject instanceof RequestableObject) {
sheet = ((RequestableObject) parentDatabaseObject).getSheet(browser);
}
if (sheet != null) {
throw new EngineException("You cannot cut and paste the sheet because a sheet is already defined for the browser \"" + browser + "\" in the screen class \"" + parentDatabaseObject.getName() + "\".");
}
}
if (object instanceof Step) {
if (object instanceof ThenStep) {
throw new EngineException("You cannot cut the \"Then\" step");
}
if (object instanceof ElseStep) {
throw new EngineException("You cannot cut the \"Else\" step");
}
}
if (object instanceof Statement) {
if (object instanceof ThenStatement)
throw new EngineException("You cannot cut the \"Then\" statement");
if (object instanceof ElseStatement)
throw new EngineException("You cannot cut the \"Else\" statement");
}
// Verify object is accepted for paste
if (!DatabaseObjectsManager.acceptDatabaseObjects(parentDatabaseObject, object)) {
throw new EngineException("You cannot cut and paste to a " + parentDatabaseObject.getClass().getSimpleName() + " a database object of type " + object.getClass().getSimpleName());
}
if (parentDatabaseObject instanceof com.twinsoft.convertigo.beans.mobile.components.MobileComponent) {
if (!com.twinsoft.convertigo.beans.mobile.components.dynamic.ComponentManager.acceptDatabaseObjects(parentDatabaseObject, object)) {
throw new EngineException("You cannot cut and paste to a " + parentDatabaseObject.getClass().getSimpleName() + " a database object of type " + object.getClass().getSimpleName());
}
if (!com.twinsoft.convertigo.beans.mobile.components.dynamic.ComponentManager.isTplCompatible(parentDatabaseObject, object)) {
String tplVersion = com.twinsoft.convertigo.beans.mobile.components.dynamic.ComponentManager.getTplRequired(object);
throw new EngineException("Template project " + tplVersion + " compatibility required");
}
} else if (parentDatabaseObject instanceof com.twinsoft.convertigo.beans.ngx.components.MobileComponent) {
if (!com.twinsoft.convertigo.beans.ngx.components.dynamic.ComponentManager.acceptDatabaseObjects(parentDatabaseObject, object)) {
throw new EngineException("You cannot cut and paste to a " + parentDatabaseObject.getClass().getSimpleName() + " a database object of type " + object.getClass().getSimpleName());
}
if (!com.twinsoft.convertigo.beans.ngx.components.dynamic.ComponentManager.isTplCompatible(parentDatabaseObject, object)) {
String tplVersion = com.twinsoft.convertigo.beans.ngx.components.dynamic.ComponentManager.getTplRequired(object);
throw new EngineException("Template project " + tplVersion + " compatibility required");
}
}
// Verify if a child object with same name exist
boolean bContinue = true;
boolean bIncName = false;
String dboName = object.getName();
while (bContinue) {
try {
if (bIncName) {
dboName = DatabaseObject.incrementName(dboName);
object.setName(dboName);
}
new WalkHelper() {
boolean root = true;
boolean find = false;
@Override
protected boolean before(DatabaseObject databaseObject, Class<? extends DatabaseObject> dboClass) {
boolean isInstance = dboClass.isInstance(object);
find |= isInstance;
return isInstance;
}
@Override
protected void walk(DatabaseObject databaseObject) throws Exception {
if (root) {
root = false;
if (databaseObject instanceof Project) {
if (object instanceof Connector && ((Connector) object).isDefault) {
throw new EngineException("You cannot cut the default connector to another project");
}
} else if (databaseObject instanceof Connector) {
if (object instanceof ScreenClass) {
throw new EngineException("You cannot cut the default screen class to another connector");
} else if (object instanceof Transaction && ((Transaction) object).isDefault) {
throw new EngineException("You cannot cut the default transaction to another connector");
}
} else if (databaseObject instanceof ScreenClass) {
if (object instanceof Criteria && databaseObject.getParent() instanceof Connector) {
throw new EngineException("You cannot cut the criterion of default screen class");
}
} else if (databaseObject instanceof MobileObject) {
if (databaseObject instanceof com.twinsoft.convertigo.beans.mobile.components.ApplicationComponent) {
if (object instanceof com.twinsoft.convertigo.beans.mobile.components.PageComponent) {
com.twinsoft.convertigo.beans.mobile.components.PageComponent pc = GenericUtils.cast(object);
if (pc.isRoot) {
throw new EngineException("You cannot cut the root page to another application");
}
}
} else if (databaseObject instanceof com.twinsoft.convertigo.beans.ngx.components.ApplicationComponent) {
if (object instanceof com.twinsoft.convertigo.beans.ngx.components.PageComponent) {
com.twinsoft.convertigo.beans.ngx.components.PageComponent pc = GenericUtils.cast(object);
if (pc.isRoot) {
throw new EngineException("You cannot cut the root page to another application");
}
}
}
}
super.walk(databaseObject);
if (!find) {
throw new EngineException("You cannot cut and paste to a " + databaseObject.getClass().getSimpleName() + " a database object of type " + object.getClass().getSimpleName());
}
} else {
if (object != databaseObject && object.getName().equalsIgnoreCase(databaseObject.getName())) {
throw new ObjectWithSameNameException("Unable to cut the object because an object with the same name already exists in target.");
}
}
}
}.init(parentDatabaseObject);
bContinue = false;
} catch (ObjectWithSameNameException e) {
bIncName = true;
} catch (EngineException e) {
throw e;
} catch (Exception e) {
throw new EngineException("Exception in cutAndPaste", e);
}
}
move(object, parentDatabaseObject);
}
use of com.twinsoft.convertigo.beans.core.ScreenClass in project convertigo by convertigo.
the class ProjectExplorerView method objectDetected.
public void objectDetected(EngineEvent engineEvent) {
final Object source = engineEvent.getSource();
boolean highlightDetectedObject = ConvertigoPlugin.getHighlightDetectedObject();
if (source instanceof Step) {
try {
highlightDetectedObject = Boolean.TRUE.equals(RequestAttribute.debug.get(((Step) source).getSequence().context.httpServletRequest));
} catch (Exception e) {
// silently ignore
}
}
if (highlightDetectedObject) {
if (source instanceof DatabaseObject) {
getSite().getShell().getDisplay().syncExec(new Runnable() {
public void run() {
DatabaseObjectTreeObject databaseTreeObject = (DatabaseObjectTreeObject) findTreeObjectByUserObject((DatabaseObject) source);
if (databaseTreeObject != null) {
if (lastDetectedDatabaseObjectTreeObject != null) {
lastDetectedDatabaseObjectTreeObject.isDetectedObject = false;
updateTreeObject(lastDetectedDatabaseObjectTreeObject);
}
databaseTreeObject.isDetectedObject = true;
updateTreeObject(databaseTreeObject);
viewer.expandToLevel(databaseTreeObject, 0);
lastDetectedDatabaseObjectTreeObject = databaseTreeObject;
if (databaseTreeObject instanceof ScreenClassTreeObject) {
lastDetectedScreenClass = (ScreenClass) source;
lastDetectedScreenClassTreeObject = (ScreenClassTreeObject) databaseTreeObject;
}
}
}
});
}
} else {
if (source instanceof ScreenClass) {
lastDetectedScreenClass = (ScreenClass) source;
}
}
}
use of com.twinsoft.convertigo.beans.core.ScreenClass in project convertigo by convertigo.
the class DatabaseObjectTreeObject method treeObjectPropertyChanged.
public void treeObjectPropertyChanged(TreeObjectEvent treeObjectEvent) {
checkDone(treeObjectEvent);
TreeObject treeObject = (TreeObject) treeObjectEvent.getSource();
String propertyName = (String) treeObjectEvent.propertyName;
propertyName = ((propertyName == null) ? "" : propertyName);
Object oldValue = treeObjectEvent.oldValue;
Object newValue = treeObjectEvent.newValue;
if (this instanceof INamedSourceSelectorTreeObject) {
((INamedSourceSelectorTreeObject) this).getNamedSourceSelector().treeObjectPropertyChanged(treeObjectEvent);
}
// this is a pool
if (getObject() instanceof Pool) {
// handle bean's name changes
if ("name".equals(propertyName)) {
Pool pool = (Pool) getObject();
// case transaction name changed
if (treeObject instanceof TransactionTreeObject) {
Transaction transaction = (Transaction) treeObject.getObject();
if (transaction.getConnector().equals(pool.getConnector())) {
if (pool.getStartTransaction().equals(oldValue)) {
pool.setStartTransaction(newValue.toString());
hasBeenModified(true);
viewer.refresh();
}
}
}
// case screenclass name changed
if (treeObject instanceof ScreenClassTreeObject) {
ScreenClass sc = (ScreenClass) treeObject.getObject();
if (sc.getConnector().equals(pool.getConnector())) {
if (pool.getInitialScreenClass().equals(oldValue)) {
pool.setInitialScreenClass(newValue.toString());
hasBeenModified(true);
viewer.refresh();
}
}
}
}
}
// refresh editors (e.g labels in combobox)
getDescriptors();
}
Aggregations