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;
}
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]);
// }
}
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);
}
}
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;
}
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);
}
}
Aggregations