Search in sources :

Example 31 with HtmlConnector

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

the class ConnectorEditorPart method getStudioContext.

private Context getStudioContext(boolean bForce) {
    String projectName = connector.getParent().getName();
    String connectorName = connector.getName();
    String contextType = ContextManager.CONTEXT_TYPE_TRANSACTION;
    String contextID = Engine.theApp.contextManager.computeStudioContextName(contextType, projectName, connectorName);
    Context ctx = Engine.theApp.contextManager.get(contextID);
    if ((ctx == null) || bForce) {
        ctx = new Context(contextID);
        if (connector instanceof HtmlConnector) {
            ctx.cleanXpathApi();
            ctx.htmlParser = ((HtmlConnector) connector).getHtmlParser();
        }
        ctx.contextID = contextID;
        ctx.name = contextID;
        ctx.projectName = projectName;
        ctx.setConnector(connector);
        ctx.lastAccessTime = System.currentTimeMillis();
        Engine.theApp.contextManager.add(ctx);
    }
    return ctx;
}
Also used : Context(com.twinsoft.convertigo.engine.Context) HtmlConnector(com.twinsoft.convertigo.beans.connectors.HtmlConnector)

Example 32 with HtmlConnector

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

the class ConnectorEditorPart method createTabFolderOutputDesign.

/**
 * This method initializes tabFolder
 */
private void createTabFolderOutputDesign() {
    GridData gridData2 = new org.eclipse.swt.layout.GridData();
    gridData2.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
    gridData2.grabExcessVerticalSpace = true;
    gridData2.grabExcessHorizontalSpace = true;
    gridData2.verticalAlignment = org.eclipse.swt.layout.GridData.FILL;
    tabFolderOutputDesign = new TabFolder(this, SWT.BOTTOM);
    tabFolderOutputDesign.setLayoutData(gridData2);
    createCompositeDesign();
    createCompositeOutput();
    tabItemOutput = new TabItem(tabFolderOutputDesign, SWT.NONE);
    tabItemOutput.setText("Output");
    tabItemOutput.setControl(compositeOutput);
    tabItemDesign = new TabItem(tabFolderOutputDesign, SWT.NONE);
    tabItemDesign.setText("Design");
    tabItemDesign.setControl(compositeDesign);
    if (connector instanceof HtmlConnector)
        selectTabDesign();
}
Also used : TabItem(org.eclipse.swt.widgets.TabItem) HtmlConnector(com.twinsoft.convertigo.beans.connectors.HtmlConnector) GridData(org.eclipse.swt.layout.GridData) TabFolder(org.eclipse.swt.widgets.TabFolder)

Example 33 with HtmlConnector

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

the class HtmlConnectorDesignComposite method selectionChanged.

public void selectionChanged(SelectionChangedEvent event) {
    if (event.getSource() instanceof ISelectionProvider) {
        IStructuredSelection selection = (IStructuredSelection) event.getSelection();
        TreeObject treeObject = (TreeObject) selection.getFirstElement();
        if (treeObject != null) {
            ConnectorTreeObject connectorTreeObject = treeObject.getConnectorTreeObject();
            if (connectorTreeObject != null) {
                Connector connector = (Connector) connectorTreeObject.getObject();
                if (connector.equals(htmlConnector)) {
                    if (treeObject instanceof TransactionTreeObject) {
                        if (!htmlConnector.isLearning())
                            toolLearn.setEnabled(true);
                    } else {
                        if (!htmlConnector.isLearning())
                            toolLearn.setEnabled(false);
                    }
                } else {
                    if (!htmlConnector.isLearning())
                        toolLearn.setEnabled(false);
                }
            }
        }
    }
}
Also used : ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) HtmlConnector(com.twinsoft.convertigo.beans.connectors.HtmlConnector) HttpConnector(com.twinsoft.convertigo.beans.connectors.HttpConnector) Connector(com.twinsoft.convertigo.beans.core.Connector) TransactionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject) ISelectionProvider(org.eclipse.jface.viewers.ISelectionProvider) TransactionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 34 with HtmlConnector

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

the class HttpTriggerScreenClassEditorComposite method getScreenClassList.

private java.util.List<HtmlScreenClass> getScreenClassList() {
    java.util.List<HtmlScreenClass> screenClasses = null;
    TreeObject treeConnector = parent.cellEditor.databaseObjectTreeObject.getParentDatabaseObjectTreeObject().getConnectorTreeObject();
    HtmlConnector connector = (HtmlConnector) treeConnector.getObject();
    screenClasses = connector.getAllScreenClasses();
    return screenClasses;
}
Also used : HtmlConnector(com.twinsoft.convertigo.beans.connectors.HtmlConnector) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) HtmlScreenClass(com.twinsoft.convertigo.beans.screenclasses.HtmlScreenClass)

Example 35 with HtmlConnector

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

the class AbstractEventStatement method execute.

@Override
public boolean execute(Context javascriptContext, Scriptable scope) throws EngineException {
    if (isEnabled()) {
        if (super.execute(javascriptContext, scope)) {
            evaluate(javascriptContext, scope, getXpath(), "xpath", false);
            String jsXpath = evaluated.toString();
            HtmlTransaction htmlTransaction = (HtmlTransaction) getParentTransaction();
            HtmlConnector htmlConnector = (HtmlConnector) htmlTransaction.getParent();
            Engine.logBeans.trace("Getting event...");
            AbstractEvent event = getEvent(javascriptContext, scope);
            event.setXPath(jsXpath);
            event.setDelay(getDelay());
            Engine.logBeans.trace("Dispatching event...");
            boolean dispatch = htmlConnector.dispatchEvent(event, htmlTransaction.context, trigger.getTrigger());
            Engine.logBeans.trace("Getting DOM...");
            htmlTransaction.setCurrentXmlDocument(htmlConnector.getHtmlParser().getDom(htmlTransaction.context));
            if (dispatch)
                Engine.logBeans.trace("For target '" + jsXpath + " " + event + " has been successfully dispatched on webViewer");
            else {
                Engine.logBeans.warn("For target '" + jsXpath + " " + event + " has not been well dispatched on webViewer");
                throw new EngineException("Error when dispatch Html event");
            }
            return true;
        }
    }
    return false;
}
Also used : HtmlConnector(com.twinsoft.convertigo.beans.connectors.HtmlConnector) HtmlTransaction(com.twinsoft.convertigo.beans.transactions.HtmlTransaction) EngineException(com.twinsoft.convertigo.engine.EngineException) AbstractEvent(com.twinsoft.convertigo.engine.parsers.events.AbstractEvent)

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)9 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