Search in sources :

Example 11 with HtmlConnector

use of com.twinsoft.convertigo.beans.connectors.HtmlConnector in project convertigo by convertigo.

the class ComponentInfoWizardPage method fillTree.

public void fillTree(Class<? extends DatabaseObject> beanClass) {
    treeItemName = null;
    tree.removeAll();
    if (parentObject instanceof Transaction) {
        Connector connector = (Connector) ((Transaction) parentObject).getParent();
        boolean isScreenClassAware = connector instanceof IScreenClassContainer<?>;
        if (beanClass.equals(ScEntryHandlerStatement.class) || beanClass.equals(ScExitHandlerStatement.class)) {
            if (isScreenClassAware) {
                if (connector instanceof HtmlConnector) {
                    HtmlConnector htmlConnector = (HtmlConnector) connector;
                    ScreenClass defaultScreenClass = htmlConnector.getDefaultScreenClass();
                    TreeItem branch = new TreeItem(tree, SWT.NONE);
                    branch.setText(defaultScreenClass.getName());
                    List<ScreenClass> screenClasses = defaultScreenClass.getInheritedScreenClasses();
                    for (ScreenClass screenClass : screenClasses) {
                        getInHeritedScreenClass(screenClass, branch);
                    }
                } else if (connector instanceof JavelinConnector) {
                    JavelinConnector javelinConnector = (JavelinConnector) connector;
                    ScreenClass defaultScreenClass = javelinConnector.getDefaultScreenClass();
                    TreeItem branch = new TreeItem(tree, SWT.NONE);
                    branch.setText(defaultScreenClass.getName());
                    List<ScreenClass> screenClasses = defaultScreenClass.getInheritedScreenClasses();
                    for (ScreenClass screenClass : screenClasses) {
                        getInHeritedScreenClass(screenClass, branch);
                    }
                }
                tree.setVisible(true);
            }
        } else if (beanClass.equals(HandlerStatement.class)) {
            TreeItem branch;
            branch = new TreeItem(tree, SWT.NONE);
            branch.setText(HandlerStatement.EVENT_TRANSACTION_STARTED);
            branch = new TreeItem(tree, SWT.NONE);
            branch.setText(HandlerStatement.EVENT_XML_GENERATED);
            tree.setVisible(true);
        } else
            tree.setVisible(false);
    }
}
Also used : HtmlConnector(com.twinsoft.convertigo.beans.connectors.HtmlConnector) Connector(com.twinsoft.convertigo.beans.core.Connector) FullSyncConnector(com.twinsoft.convertigo.beans.connectors.FullSyncConnector) JavelinConnector(com.twinsoft.convertigo.beans.connectors.JavelinConnector) CouchDbConnector(com.twinsoft.convertigo.beans.connectors.CouchDbConnector) HtmlConnector(com.twinsoft.convertigo.beans.connectors.HtmlConnector) TreeItem(org.eclipse.swt.widgets.TreeItem) ScreenClass(com.twinsoft.convertigo.beans.core.ScreenClass) IScreenClassContainer(com.twinsoft.convertigo.beans.core.IScreenClassContainer) ScExitHandlerStatement(com.twinsoft.convertigo.beans.statements.ScExitHandlerStatement) ScHandlerStatement(com.twinsoft.convertigo.beans.statements.ScHandlerStatement) HandlerStatement(com.twinsoft.convertigo.beans.statements.HandlerStatement) ScEntryHandlerStatement(com.twinsoft.convertigo.beans.statements.ScEntryHandlerStatement) ScExitHandlerStatement(com.twinsoft.convertigo.beans.statements.ScExitHandlerStatement) JavelinConnector(com.twinsoft.convertigo.beans.connectors.JavelinConnector) AbstractCouchDbTransaction(com.twinsoft.convertigo.beans.transactions.couchdb.AbstractCouchDbTransaction) Transaction(com.twinsoft.convertigo.beans.core.Transaction) ScEntryHandlerStatement(com.twinsoft.convertigo.beans.statements.ScEntryHandlerStatement) List(java.util.List)

Example 12 with HtmlConnector

use of com.twinsoft.convertigo.beans.connectors.HtmlConnector in project convertigo by convertigo.

the class ObjectInfoWizardPage method fillTree.

public void fillTree(Class<? extends DatabaseObject> beanClass) {
    treeItemName = null;
    tree.removeAll();
    if (parentObject instanceof Transaction) {
        Connector connector = (Connector) ((Transaction) parentObject).getParent();
        boolean isScreenClassAware = connector instanceof IScreenClassContainer<?>;
        if (beanClass.equals(ScEntryHandlerStatement.class) || beanClass.equals(ScExitHandlerStatement.class)) {
            if (isScreenClassAware) {
                if (connector instanceof HtmlConnector) {
                    HtmlConnector htmlConnector = (HtmlConnector) connector;
                    ScreenClass defaultScreenClass = htmlConnector.getDefaultScreenClass();
                    TreeItem branch = new TreeItem(tree, SWT.NONE);
                    branch.setText(defaultScreenClass.getName());
                    List<ScreenClass> screenClasses = defaultScreenClass.getInheritedScreenClasses();
                    for (ScreenClass screenClass : screenClasses) {
                        getInHeritedScreenClass(screenClass, branch);
                    }
                } else if (connector instanceof JavelinConnector) {
                    JavelinConnector javelinConnector = (JavelinConnector) connector;
                    ScreenClass defaultScreenClass = javelinConnector.getDefaultScreenClass();
                    TreeItem branch = new TreeItem(tree, SWT.NONE);
                    branch.setText(defaultScreenClass.getName());
                    List<ScreenClass> screenClasses = defaultScreenClass.getInheritedScreenClasses();
                    for (ScreenClass screenClass : screenClasses) {
                        getInHeritedScreenClass(screenClass, branch);
                    }
                }
                tree.setVisible(true);
            }
        } else if (beanClass.equals(HandlerStatement.class)) {
            TreeItem branch;
            branch = new TreeItem(tree, SWT.NONE);
            branch.setText(HandlerStatement.EVENT_TRANSACTION_STARTED);
            branch = new TreeItem(tree, SWT.NONE);
            branch.setText(HandlerStatement.EVENT_XML_GENERATED);
            tree.setVisible(true);
        } else
            tree.setVisible(false);
    }
}
Also used : HtmlConnector(com.twinsoft.convertigo.beans.connectors.HtmlConnector) Connector(com.twinsoft.convertigo.beans.core.Connector) FullSyncConnector(com.twinsoft.convertigo.beans.connectors.FullSyncConnector) JavelinConnector(com.twinsoft.convertigo.beans.connectors.JavelinConnector) CouchDbConnector(com.twinsoft.convertigo.beans.connectors.CouchDbConnector) HtmlConnector(com.twinsoft.convertigo.beans.connectors.HtmlConnector) TreeItem(org.eclipse.swt.widgets.TreeItem) ScreenClass(com.twinsoft.convertigo.beans.core.ScreenClass) IScreenClassContainer(com.twinsoft.convertigo.beans.core.IScreenClassContainer) ScExitHandlerStatement(com.twinsoft.convertigo.beans.statements.ScExitHandlerStatement) ScHandlerStatement(com.twinsoft.convertigo.beans.statements.ScHandlerStatement) HandlerStatement(com.twinsoft.convertigo.beans.statements.HandlerStatement) ScEntryHandlerStatement(com.twinsoft.convertigo.beans.statements.ScEntryHandlerStatement) ScExitHandlerStatement(com.twinsoft.convertigo.beans.statements.ScExitHandlerStatement) JavelinConnector(com.twinsoft.convertigo.beans.connectors.JavelinConnector) AbstractCouchDbTransaction(com.twinsoft.convertigo.beans.transactions.couchdb.AbstractCouchDbTransaction) SqlTransaction(com.twinsoft.convertigo.beans.transactions.SqlTransaction) Transaction(com.twinsoft.convertigo.beans.core.Transaction) ScEntryHandlerStatement(com.twinsoft.convertigo.beans.statements.ScEntryHandlerStatement) List(java.util.List)

Example 13 with HtmlConnector

use of com.twinsoft.convertigo.beans.connectors.HtmlConnector in project convertigo by convertigo.

the class TabManagementStatement method execute.

@Override
public boolean execute(Context javascriptContext, Scriptable scope) throws EngineException {
    if (isEnabled()) {
        if (super.execute(javascriptContext, scope)) {
            HtmlTransaction htmlTransaction = (HtmlTransaction) getParentTransaction();
            HtmlConnector htmlConnector = (HtmlConnector) htmlTransaction.getParent();
            TabManagementEvent evt;
            if (action.equalsIgnoreCase(TabManagementEvent.ACTION_SETINDEX)) {
                try {
                    evaluate(javascriptContext, scope, jsIndex, "jsIndex", false);
                    int index = (int) Double.parseDouble(evaluated.toString());
                    evt = new TabManagementEvent(action, index);
                } catch (Exception e) {
                    throw new EngineException("Tab index value isn't good.", e);
                }
            } else {
                evt = new TabManagementEvent(action);
            }
            HtmlParser htmlParser = htmlConnector.getHtmlParser();
            boolean success = htmlParser.dispatchEvent(evt, htmlTransaction.context, null);
            if (!success)
                Engine.logBeans.debug("NavigationBarStatement has failed");
            else {
                if (action.equalsIgnoreCase(TabManagementEvent.ACTION_GETINDEX)) {
                    String code = getIndexVarname + "=" + evt.getIndex();
                    evaluate(javascriptContext, scope, code, "ContextGet", true);
                } else if (action.equalsIgnoreCase(TabManagementEvent.ACTION_GETNBTAB)) {
                    String code = getIndexVarname + "=" + evt.getNbTab();
                    evaluate(javascriptContext, scope, code, "ContextGet", true);
                }
            }
            success = true;
            return success;
        }
    }
    return false;
}
Also used : HtmlParser(com.twinsoft.convertigo.engine.parsers.HtmlParser) HtmlConnector(com.twinsoft.convertigo.beans.connectors.HtmlConnector) TabManagementEvent(com.twinsoft.convertigo.engine.parsers.events.TabManagementEvent) HtmlTransaction(com.twinsoft.convertigo.beans.transactions.HtmlTransaction) EngineException(com.twinsoft.convertigo.engine.EngineException) EngineException(com.twinsoft.convertigo.engine.EngineException)

Example 14 with HtmlConnector

use of com.twinsoft.convertigo.beans.connectors.HtmlConnector in project convertigo by convertigo.

the class WaitTriggerStatement method execute.

@Override
public boolean execute(Context javascriptContext, Scriptable scope) throws EngineException {
    if (isEnabled()) {
        if (super.execute(javascriptContext, scope)) {
            HtmlTransaction htmlTransaction = getParentTransaction();
            HtmlConnector htmlConnector = (HtmlConnector) htmlTransaction.getParent();
            htmlConnector.getHtmlParser().waitTrigger(htmlTransaction.context, trigger.getTrigger());
            return true;
        }
    }
    return false;
}
Also used : HtmlConnector(com.twinsoft.convertigo.beans.connectors.HtmlConnector) HtmlTransaction(com.twinsoft.convertigo.beans.transactions.HtmlTransaction)

Example 15 with HtmlConnector

use of com.twinsoft.convertigo.beans.connectors.HtmlConnector 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);
}
Also used : HtmlConnector(com.twinsoft.convertigo.beans.connectors.HtmlConnector) HtmlScreenClass(com.twinsoft.convertigo.beans.screenclasses.HtmlScreenClass) ScreenClass(com.twinsoft.convertigo.beans.core.ScreenClass) HtmlScreenClass(com.twinsoft.convertigo.beans.screenclasses.HtmlScreenClass)

Aggregations

HtmlConnector (com.twinsoft.convertigo.beans.connectors.HtmlConnector)42 HtmlTransaction (com.twinsoft.convertigo.beans.transactions.HtmlTransaction)14 ScreenClass (com.twinsoft.convertigo.beans.core.ScreenClass)13 EngineException (com.twinsoft.convertigo.engine.EngineException)13 JavelinConnector (com.twinsoft.convertigo.beans.connectors.JavelinConnector)12 Connector (com.twinsoft.convertigo.beans.core.Connector)12 Transaction (com.twinsoft.convertigo.beans.core.Transaction)10 HttpConnector (com.twinsoft.convertigo.beans.connectors.HttpConnector)8 SqlConnector (com.twinsoft.convertigo.beans.connectors.SqlConnector)8 SiteClipperConnector (com.twinsoft.convertigo.beans.connectors.SiteClipperConnector)7 Statement (com.twinsoft.convertigo.beans.core.Statement)7 Document (org.w3c.dom.Document)7 CicsConnector (com.twinsoft.convertigo.beans.connectors.CicsConnector)6 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)6 HandlerStatement (com.twinsoft.convertigo.beans.statements.HandlerStatement)6 List (java.util.List)6 HtmlScreenClass (com.twinsoft.convertigo.beans.screenclasses.HtmlScreenClass)5 ScHandlerStatement (com.twinsoft.convertigo.beans.statements.ScHandlerStatement)5 IOException (java.io.IOException)5 TransformerException (javax.xml.transform.TransformerException)5