Search in sources :

Example 6 with JavelinConnector

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

the class RegularExpression method isMatching0.

protected boolean isMatching0(Connector connector) {
    iJavelin javelin = ((JavelinConnector) connector).javelin;
    String substring;
    int attribute = getAttribute();
    int x = getX();
    int y = getY();
    Engine.logBeans.trace("RegularExpression");
    Engine.logBeans.trace("  regularExpression: " + regularExpression);
    Engine.logBeans.trace("  attribute: " + attribute);
    // recreate the regular expression object.
    if (regexp == null) {
        try {
            setRegularExpression(regularExpression);
        } catch (RESyntaxException e) {
            Engine.logBeans.error("Unable to create the regular expression object", e);
        }
    }
    // Case (x, y)
    if ((x != -1) && (y != -1)) {
        Engine.logBeans.trace("  => case (x, y)");
        substring = getSubStringOfSameAttribute(javelin, x, y);
        // If the substring is empty, it doesn't match.
        if (substring.length() == 0)
            return false;
        Engine.logBeans.trace("  substring: " + substring);
        // We check the regular expression.
        boolean isMatching = regexp.match(substring);
        return isMatching;
    } else // Case (*, y)
    if ((x == -1) && (y != -1)) {
        Engine.logBeans.trace("  => case (*, y)");
        int screenWidth = javelin.getScreenWidth();
        for (int cx = 0; cx < screenWidth; cx++) {
            substring = getSubStringOfSameAttribute(javelin, cx, y);
            int substringLength = substring.length();
            // If the substring is empty, it doesn't match.
            if (substringLength == 0)
                continue;
            if (regexp.match(substring))
                return true;
            cx += substringLength - 1;
        }
        return false;
    } else // Case (x, *)
    if ((x != -1) && (y == -1)) {
        Engine.logBeans.trace("  => case (x, *)");
        int screenHeight = javelin.getScreenHeight();
        for (int cy = 0; cy < screenHeight; cy++) {
            substring = getSubStringOfSameAttribute(javelin, x, cy);
            // If the substring is empty, it doesn't match.
            if (substring.length() == 0)
                continue;
            if (regexp.match(substring))
                return true;
        }
        return false;
    } else // Case (*, *)
    {
        Engine.logBeans.trace("  => case (*, *)");
        int screenWidth = javelin.getScreenWidth();
        int screenHeight = javelin.getScreenHeight();
        for (int cx = 0; cx < screenWidth; cx++) {
            for (int cy = 0; cy < screenHeight; cy++) {
                substring = getSubStringOfSameAttribute(javelin, cx, cy);
                Engine.logBeans.trace("  substring: " + substring);
                // If the substring is empty, it doesn't match.
                if (substring.length() == 0)
                    continue;
                // We check the regular expression.
                boolean isMatching = regexp.match(substring);
                if (isMatching)
                    return true;
            }
        }
    }
    return false;
}
Also used : JavelinConnector(com.twinsoft.convertigo.beans.connectors.JavelinConnector) com.twinsoft.twinj.iJavelin(com.twinsoft.twinj.iJavelin)

Example 7 with JavelinConnector

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

the class ConnectorEditorPart method createCompositeConnector.

/**
 * This method initializes compositeConnector
 */
private void createCompositeConnector() {
    GridLayout gridLayout2 = new GridLayout();
    gridLayout2.horizontalSpacing = 0;
    gridLayout2.marginWidth = 0;
    gridLayout2.marginHeight = 0;
    gridLayout2.verticalSpacing = 0;
    try {
        int connectorCompositeStyle = (connector instanceof JavelinConnector ? SWT.EMBEDDED | SWT.LEFT : SWT.NONE);
        Constructor<?> constructor = compositeConnectorClass.getConstructor(new Class[] { ConnectorEditorPart.class, Connector.class, Composite.class, int.class });
        compositeConnector = (AbstractConnectorComposite) constructor.newInstance(new Object[] { this, connector, sashForm, Integer.valueOf(connectorCompositeStyle) });
        compositeConnector.setParent(sashForm);
        compositeConnector.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
        compositeConnector.setLayout(gridLayout2);
    } catch (Exception e) {
        ConvertigoPlugin.logException(e, "An unexpected exception has occured while creating the connector composite.");
    }
// test if the compositeConnector needs a zoneListener
// if (ILinkable.class.isAssignableFrom(compositeConnectorClass)) {
// ToolItem[] ti_tab = toolBar.getItems();
// 
// int i = ((Integer)toolItemsIds.get("Link")).intValue();
// ((ILinkable) compositeConnector).monitor(ti_tab[i]);
// }
}
Also used : JavelinConnector(com.twinsoft.convertigo.beans.connectors.JavelinConnector) GridLayout(org.eclipse.swt.layout.GridLayout) KeyExpiredException(com.twinsoft.convertigo.engine.KeyExpiredException) MaxCvsExceededException(com.twinsoft.convertigo.engine.MaxCvsExceededException) IOException(java.io.IOException)

Example 8 with JavelinConnector

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

the class JavelinStringEditor method setPropertyValueFromSelectionZone.

/**
 * Sets the property according to the current selected zone.
 * @param databaseObject
 * @param connector
 * @param setter
 */
public static void setPropertyValueFromSelectionZone(DatabaseObject databaseObject, Connector connector, Method setter) {
    if (connector == null) {
        throw new IllegalArgumentException("The connector object is null");
    }
    JavelinConnector jTmp = null;
    try {
        jTmp = (JavelinConnector) connector;
    } catch (ClassCastException e) {
        throw new IllegalArgumentException("The connector object is not a iJavelin");
    }
    Rectangle zone = jTmp.getSelectionZone();
    if (zone.width < 1)
        return;
    String sTmp = jTmp.javelin.getString(zone.x, zone.y, zone.width);
    if (sTmp == null)
        sTmp = "";
    try {
        setter.invoke(databaseObject, new Object[] { sTmp });
    } catch (Throwable e) {
        String message = "Error : " + e.getMessage();
        ConvertigoPlugin.logException(e, message);
    }
}
Also used : JavelinConnector(com.twinsoft.convertigo.beans.connectors.JavelinConnector)

Example 9 with JavelinConnector

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

the class JavelinStringEditor method getSelectionZoneValue.

/**
 * Gets the value to put in the property according to the current selected zone.
 * @param databaseObject
 * @param connector
 * @param setter
 */
public static Object getSelectionZoneValue(DatabaseObject databaseObject, Connector connector, Method setter) {
    if (connector == null) {
        throw new IllegalArgumentException("The connector object is null");
    }
    JavelinConnector jTmp = null;
    try {
        jTmp = (JavelinConnector) connector;
    } catch (ClassCastException e) {
        throw new IllegalArgumentException("The connector object is not a iJavelin");
    }
    Rectangle zone = jTmp.getSelectionZone();
    if (zone.width < 1)
        return null;
    String sTmp = jTmp.javelin.getString(zone.x, zone.y, zone.width);
    if (sTmp == null)
        sTmp = "";
    return sTmp;
}
Also used : JavelinConnector(com.twinsoft.convertigo.beans.connectors.JavelinConnector)

Example 10 with JavelinConnector

use of com.twinsoft.convertigo.beans.connectors.JavelinConnector 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)

Aggregations

JavelinConnector (com.twinsoft.convertigo.beans.connectors.JavelinConnector)50 ScreenClass (com.twinsoft.convertigo.beans.core.ScreenClass)17 Javelin (com.twinsoft.twinj.Javelin)12 HtmlConnector (com.twinsoft.convertigo.beans.connectors.HtmlConnector)11 Connector (com.twinsoft.convertigo.beans.core.Connector)11 EngineException (com.twinsoft.convertigo.engine.EngineException)10 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)9 Transaction (com.twinsoft.convertigo.beans.core.Transaction)8 JavelinTransaction (com.twinsoft.convertigo.beans.transactions.JavelinTransaction)8 XMLRectangle (com.twinsoft.convertigo.beans.common.XMLRectangle)7 SiteClipperConnector (com.twinsoft.convertigo.beans.connectors.SiteClipperConnector)7 SqlConnector (com.twinsoft.convertigo.beans.connectors.SqlConnector)7 CicsConnector (com.twinsoft.convertigo.beans.connectors.CicsConnector)6 HttpConnector (com.twinsoft.convertigo.beans.connectors.HttpConnector)6 com.twinsoft.twinj.iJavelin (com.twinsoft.twinj.iJavelin)6 Project (com.twinsoft.convertigo.beans.core.Project)5 ScHandlerStatement (com.twinsoft.convertigo.beans.statements.ScHandlerStatement)5 HtmlTransaction (com.twinsoft.convertigo.beans.transactions.HtmlTransaction)5 AbstractConnectorComposite (com.twinsoft.convertigo.eclipse.editors.connector.AbstractConnectorComposite)5 ConnectorEditor (com.twinsoft.convertigo.eclipse.editors.connector.ConnectorEditor)5