Search in sources :

Example 1 with ACLNptuiScreen

use of com.eicon.iConnect.acl.ACLNptuiScreen in project convertigo by convertigo.

the class Nptui method execute.

/**
 * Applies the extraction rule to the current iJavelin object.
 *
 * @param javelin the Javelin object.
 * @param block the current block to analyze.
 * @param blockFactory the block context of the current block.
 *
 * @return an ExtractionRuleResult object containing the result of
 * the query.
 */
public JavelinExtractionRuleResult execute(iJavelin javelin, Block block, BlockFactory blockFactory, org.w3c.dom.Document dom) {
    JavelinExtractionRuleResult xrs = new JavelinExtractionRuleResult();
    int screenWidth = javelin.getScreenWidth();
    if (bFirstTime) {
        bFirstTime = false;
        ACLNptuiScreen mptuiScreen = null;
        try {
            mptuiScreen = (ACLNptuiScreen) javelin.getInternalDataStructure();
        } catch (ClassCastException e) {
            xrs.hasMatched = false;
            xrs.newCurrentBlock = block;
            return (xrs);
        }
        ACLNptuiComponent[] components = mptuiScreen.getComponents();
        if (components.length == 0) {
            // no Nptui component on this screen
            xrs.hasMatched = false;
            xrs.newCurrentBlock = block;
            return (xrs);
        }
        ACLNptuiWindow[] windows = mptuiScreen.getWindows();
        // inspect all windows to handle them first
        for (int i = 0; i < windows.length; i++) {
            Engine.logBeans.trace("Treating window " + i + " : z-order " + windows[i].getZOrder());
            treatAndAddComponent(windows[i], screenWidth, dom, blockFactory, null, javelin);
        }
        // inspect all other components
        for (int i = 0; i < components.length; i++) {
            if (components[i] instanceof ACLNptuiWindow) {
                Engine.logBeans.trace("Not treating component " + i + " : " + components[i].getClass());
            } else {
                Engine.logBeans.trace("Treating component " + i + " : " + components[i].getClass());
                treatAndAddComponent(components[i], screenWidth, dom, blockFactory, null, javelin);
            }
        }
        xrs.hasMatched = true;
        xrs.newCurrentBlock = block;
        return (xrs);
    } else {
        xrs.hasMatched = false;
        xrs.newCurrentBlock = block;
        return (xrs);
    }
}
Also used : JavelinExtractionRuleResult(com.twinsoft.convertigo.beans.extractionrules.JavelinExtractionRuleResult) ACLNptuiScreen(com.eicon.iConnect.acl.ACLNptuiScreen) ACLNptuiComponent(com.eicon.iConnect.acl.ACLNptuiComponent) ACLNptuiWindow(com.eicon.iConnect.acl.ACLNptuiWindow)

Aggregations

ACLNptuiComponent (com.eicon.iConnect.acl.ACLNptuiComponent)1 ACLNptuiScreen (com.eicon.iConnect.acl.ACLNptuiScreen)1 ACLNptuiWindow (com.eicon.iConnect.acl.ACLNptuiWindow)1 JavelinExtractionRuleResult (com.twinsoft.convertigo.beans.extractionrules.JavelinExtractionRuleResult)1