Java 类ims.admin.vo.BusinessRuleVo 实例源码

项目:AvoinApotti    文件:Logic.java   
/**
 * Function used to populate the Business Rules collection from business
 * rules grid on ICP Stage tab
 * 
 * @return
 */
private BusinessRuleVoCollection getICPStageRules()
{
    // Create a new rule collection
    BusinessRuleVoCollection rules = new BusinessRuleVoCollection();

    // Iterate rules grid rows
    for (int i = 0; i < form.ctnConfiguration().lyrICPTabs().Stage().grdStageRules().getRows().size(); i++)
    {
        BusinessRuleVo rule = form.ctnConfiguration().lyrICPTabs().Stage().grdStageRules().getRows().get(i).getValue();

        // Skip null rules
        if (rule == null)
            continue;

        // Add rule to collection
        rules.add(rule);
    }

    // Return populated rule collection
    return rules;
}
项目:AvoinApotti    文件:Logic.java   
/**
 * Function used to populate the Business Rules collection from business
 * rules grid on ICP Phase tab
 * 
 * @return
 */
private BusinessRuleVoCollection getICPPhaseRules()
{
    // Create a new rule collection
    BusinessRuleVoCollection rules = new BusinessRuleVoCollection();

    // Iterate rules grid rows
    for (int i = 0; i < form.ctnConfiguration().lyrICPTabs().Phase().grdPhaseRules().getRows().size(); i++)
    {
        BusinessRuleVo rule = form.ctnConfiguration().lyrICPTabs().Phase().grdPhaseRules().getRows().get(i).getValue();

        // Skip null rules
        if (rule == null)
            continue;

        // Add rule to collection
        rules.add(rule);
    }

    // Return populated rule collection
    return rules;
}
项目:AvoinApotti    文件:Logic.java   
/**
 * Function used to open the dialog to edit a business rule
 */
private void editBussinessRule()
{
    // Set local context action to EDIT rule (will be used in
    // OnFormDialogClosed)
    form.getLocalContext().setBusinessRuleAction(ACTION_BUSINESS_RULE_EDIT);

    // Rule passed to be edited global context (OVERKILL)
    BusinessRuleVo rule = form.ctnConfiguration().lyrICPTabs().Stage().isVisible() ? form.ctnConfiguration().lyrICPTabs().Stage().grdStageRules().getValue() : form.ctnConfiguration().lyrICPTabs().Phase().grdPhaseRules().getValue();

    form.getGlobalContext().Rules.setRuleToEdit(rule);

    // Open business rule editor dialog (with parameters - selected rule -
    // currently is not used but it might in the future, current selected
    // ICP, form mode)
    engine.open(form.getForms().ICP.ICPRulesEditorDialog, new Object[] { rule, form.getLocalContext().getSelectedICP(), FormMode.EDIT });
}
项目:AvoinApotti    文件:Logic.java   
@Override
protected void onBtnCancelClick() throws PresentationLogicException 
{   
    //If Clone and press Cancel return to List screen
    if (form.getGlobalContext().Rules.RuleEditorComponent.getFormMode() != null &&
            form.getGlobalContext().Rules.RuleEditorComponent.getFormMode().equals(RulesEditorComponentFormAction.CLONE))
    {
        engine.close(DialogResult.CANCEL);          
    }

    form.getLocalContext().setDialogResult(DialogResult.CANCEL);
    form.setMode(FormMode.VIEW);

    BusinessRuleVo editedRule = form.getGlobalContext().Rules.getRuleToEdit();
    form.ccRules().setValue(editedRule);        
}
项目:AvoinApotti    文件:Logic.java   
/**
 * 
 */
private BusinessRuleVoCollection getRuleList()
{
    if (form.dyngrdRules().getRows().size() == 0)
        return null;

    BusinessRuleVoCollection ruleList = new BusinessRuleVoCollection();

    for (int i = 0; i < form.dyngrdRules().getRows().size(); i++)
    {
        DynamicGridRow row = form.dyngrdRules().getRows().get(i);

        if (row.getValue() instanceof BusinessRuleVo)
        {
            BusinessRuleVo rule = (BusinessRuleVo) row.getValue();
            ruleList.add(rule);
        }
    }

    return ruleList;
}
项目:AvoinApotti    文件:Logic.java   
/**
 * 
 */
private void setRuleList(BusinessRuleVoCollection list)
{
    // Clear the rules list
    form.dyngrdRules().getRows().clear();

    if (list == null)
        return;

    for (int i = 0; i < list.size(); i++)
    {
        BusinessRuleVo rule = list.get(i);

        // Add non nulls elements to the grid
        if (rule != null)
        {
            setRuleListRow(form.dyngrdRules().getRows().newRow(), rule);
        }
    }
}
项目:AvoinApotti    文件:Logic.java   
/**
 * 
 * @param indexSelected
 * @param indexTarget
 * @return
 */
private boolean swap(int indexSelected, int indexTarget)
{
    if (!(form.dyngrdRules().getRows().get(indexSelected).getValue() instanceof BusinessRuleVo)
            || !(form.dyngrdRules().getRows().get(indexTarget).getValue() instanceof BusinessRuleVo))
        throw new CodingRuntimeException("Major Logical Error - Type mismatch of row values");

    BusinessRuleVo ruleSelected = (BusinessRuleVo) form.dyngrdRules().getRows().get(indexSelected).getValue();
    BusinessRuleVo ruleTarget = (BusinessRuleVo) form.dyngrdRules().getRows().get(indexTarget).getValue();

    setRuleListRow(form.dyngrdRules().getRows().get(indexTarget), ruleSelected);
    setRuleListRow(form.dyngrdRules().getRows().get(indexSelected), ruleTarget);

    // Keep selection
    form.dyngrdRules().setValue(form.getLocalContext().getSelectedRule());

    return true;
}
项目:AvoinApotti    文件:Logic.java   
/**
 * 
 * @param indexSelected
 * @return
 */
private boolean moveTop(int indexSelected)
{
    if (!(form.dyngrdRules().getRows().get(indexSelected).getValue() instanceof BusinessRuleVo))
        throw new CodingRuntimeException("Major Logical Error - Type mismatch of row values");

    BusinessRuleVo ruleSelected = (BusinessRuleVo) form.dyngrdRules().getRows().get(indexSelected).getValue();

    for (int i = indexSelected - 1; i >= 0; i--)
    {
        BusinessRuleVo rule = (BusinessRuleVo) form.dyngrdRules().getRows().get(i).getValue();

        setRuleListRow(form.dyngrdRules().getRows().get(i + 1), rule);
    }

    setRuleListRow(form.dyngrdRules().getRows().get(0), ruleSelected);

    // Keep selection
    form.dyngrdRules().setValue(form.getLocalContext().getSelectedRule());

    return true;
}
项目:AvoinApotti    文件:Logic.java   
/**
 * 
 * @param indexSelected
 * @return
 */
private boolean moveBottom(int indexSelected)
{
    if (!(form.dyngrdRules().getRows().get(indexSelected).getValue() instanceof BusinessRuleVo))
        throw new CodingRuntimeException("Major Logical Error - Type mismatch of row values");

    BusinessRuleVo ruleSelected = (BusinessRuleVo) form.dyngrdRules().getRows().get(indexSelected).getValue();

    for (int i = indexSelected + 1; i < form.dyngrdRules().getRows().size(); i++)
    {
        BusinessRuleVo rule = (BusinessRuleVo) form.dyngrdRules().getRows().get(i).getValue();

        setRuleListRow(form.dyngrdRules().getRows().get(i - 1), rule);
    }

    setRuleListRow(form.dyngrdRules().getRows().get(form.dyngrdRules().getRows().size() - 1), ruleSelected);

    // Keep selection
    form.dyngrdRules().setValue(form.getLocalContext().getSelectedRule());

    return true;
}
项目:AvoinApotti    文件:Logic.java   
/**
 * 
 * @return
 */
private boolean assignPriority()
{
    int rows = form.dyngrdRules().getRows().size();

    for (int i = 0; i < rows; i++)
    {
        DynamicGridRow row = form.dyngrdRules().getRows().get(i);

        // Set the rank for BusinessRuleVo
        BusinessRuleVo rule = (BusinessRuleVo) row.getValue();
        rule.setPriority(rows - i);

        // Set row value
        setRuleListRow(row, rule);
    }

    return true;
}
项目:AvoinApotti    文件:Logic.java   
/**
 * 
 */
private void updateContextMenu()
{
    if (FormMode.VIEW.equals(form.getMode()))
    {
        form.getContextMenus().Rules.getRulesListContextMenuNEWItem().setVisible(true);
        form.getContextMenus().Rules.getRulesListContextMenuEDITItem().setVisible(form.dyngrdRules().getValue() instanceof BusinessRuleVo);
        form.getContextMenus().Rules.getRulesListContextMenuVIEWItem().setVisible(form.dyngrdRules().getValue() instanceof BusinessRuleVo);
        form.getContextMenus().Rules.getRulesListContextMenuCLONEItem().setVisible(form.dyngrdRules().getValue() instanceof BusinessRuleVo);

        form.getContextMenus().Rules.getRulesListContextMenuVIEWXMLItem().setVisible(form.dyngrdRules().getValue() instanceof BusinessRuleVo);

        form.getContextMenus().Rules.getRulesListContextMenuIMPORTItem().setVisible(true);
        form.getContextMenus().Rules.getRulesListContextMenuEXPORTItem().setVisible(form.dyngrdRules().getValue() instanceof BusinessRuleVo);
    }
    else  if (FormMode.EDIT.equals(form.getMode()))
    {
        form.getContextMenus().Rules.hideAllRulesListContextMenuMenuItems();
    }
}
项目:AvoinApotti    文件:Logic.java   
private void open() throws PresentationLogicException
{
    // populate Root Entity
    populateRootEntity();

    BusinessRuleVo editedRule = form.getLocalContext().getEditedRule();

    // If any edited rule, display it
    if (editedRule != null)
    {
        IRule rule;
        try
        {
            rule = RuleXmlSerialization.deserializeFromXml(editedRule.getXmlContent(), Entities.getInstance());
            displayRule(rule, editedRule);
        }
        catch (Exception e)
        {
            e.printStackTrace();
            throw new DomainRuntimeException(e.toString());
        }
    }
    updateContextMenu();
}
项目:AvoinApotti    文件:Logic.java   
@Override
protected void onFormOpen(Object[] args) throws PresentationLogicException 
{   
    RulesEditorComponentFormAction mode = form.getGlobalContext().Rules.RuleEditorComponent.getFormMode();      


    if (RulesEditorComponentFormAction.VIEW.equals(mode)) 
    {                                                       
        form.setMode(FormMode.VIEW);
    }
    else 
    {           
        form.setMode(FormMode.EDIT);                        
    }               

    //display Rule
    BusinessRuleVo editedRule = form.getGlobalContext().Rules.getRuleToEdit();
    form.cc1RuleEditor().setValue(editedRule);

    //Set BtnPreview Status
    setBtnPreviewRule();        
}
项目:AvoinApotti    文件:Logic.java   
@Override
protected void onBtnCancelClick() throws PresentationLogicException 
{
    //If Clone and press Cancel return to List screen
    if (form.getGlobalContext().Rules.RuleEditorComponent.getFormMode() != null &&
            form.getGlobalContext().Rules.RuleEditorComponent.getFormMode().equals(RulesEditorComponentFormAction.CLONE))
    {
        engine.close(DialogResult.CANCEL);
        onLnkReturnClick();
    }

    form.setMode(FormMode.VIEW);

    BusinessRuleVo editedRule = form.getGlobalContext().Rules.getRuleToEdit();
    form.cc1RuleEditor().setValue(editedRule);
}
项目:openMAXIMS    文件:Logic.java   
/**
 * Function used to populate the Business Rules collection from business
 * rules grid on ICP Stage tab
 * 
 * @return
 */
private BusinessRuleVoCollection getICPStageRules()
{
    // Create a new rule collection
    BusinessRuleVoCollection rules = new BusinessRuleVoCollection();

    // Iterate rules grid rows
    for (int i = 0; i < form.ctnConfiguration().lyrICPTabs().Stage().grdStageRules().getRows().size(); i++)
    {
        BusinessRuleVo rule = form.ctnConfiguration().lyrICPTabs().Stage().grdStageRules().getRows().get(i).getValue();

        // Skip null rules
        if (rule == null)
            continue;

        // Add rule to collection
        rules.add(rule);
    }

    // Return populated rule collection
    return rules;
}
项目:openMAXIMS    文件:Logic.java   
/**
 * Function used to populate the Business Rules collection from business
 * rules grid on ICP Phase tab
 * 
 * @return
 */
private BusinessRuleVoCollection getICPPhaseRules()
{
    // Create a new rule collection
    BusinessRuleVoCollection rules = new BusinessRuleVoCollection();

    // Iterate rules grid rows
    for (int i = 0; i < form.ctnConfiguration().lyrICPTabs().Phase().grdPhaseRules().getRows().size(); i++)
    {
        BusinessRuleVo rule = form.ctnConfiguration().lyrICPTabs().Phase().grdPhaseRules().getRows().get(i).getValue();

        // Skip null rules
        if (rule == null)
            continue;

        // Add rule to collection
        rules.add(rule);
    }

    // Return populated rule collection
    return rules;
}
项目:openMAXIMS    文件:Logic.java   
/**
 * Function used to open the dialog to edit a business rule
 */
private void editBussinessRule()
{
    // Set local context action to EDIT rule (will be used in
    // OnFormDialogClosed)
    form.getLocalContext().setBusinessRuleAction(ACTION_BUSINESS_RULE_EDIT);

    // Rule passed to be edited global context (OVERKILL)
    BusinessRuleVo rule = form.ctnConfiguration().lyrICPTabs().Stage().isVisible() ? form.ctnConfiguration().lyrICPTabs().Stage().grdStageRules().getValue() : form.ctnConfiguration().lyrICPTabs().Phase().grdPhaseRules().getValue();

    form.getGlobalContext().Rules.setRuleToEdit(rule);

    // Open business rule editor dialog (with parameters - selected rule -
    // currently is not used but it might in the future, current selected
    // ICP, form mode)
    engine.open(form.getForms().ICP.ICPRulesEditorDialog, new Object[] { rule, form.getLocalContext().getSelectedICP(), FormMode.EDIT });
}
项目:openMAXIMS    文件:Logic.java   
@Override
protected void onBtnCancelClick() throws PresentationLogicException 
{   
    //If Clone and press Cancel return to List screen
    if (form.getGlobalContext().Rules.RuleEditorComponent.getFormMode() != null &&
            form.getGlobalContext().Rules.RuleEditorComponent.getFormMode().equals(RulesEditorComponentFormAction.CLONE))
    {
        engine.close(DialogResult.CANCEL);          
    }

    form.getLocalContext().setDialogResult(DialogResult.CANCEL);
    form.setMode(FormMode.VIEW);

    BusinessRuleVo editedRule = form.getGlobalContext().Rules.getRuleToEdit();
    form.ccRules().setValue(editedRule);        
}
项目:openMAXIMS    文件:Logic.java   
/**
 * 
 */
private BusinessRuleVoCollection getRuleList()
{
    if (form.dyngrdRules().getRows().size() == 0)
        return null;

    BusinessRuleVoCollection ruleList = new BusinessRuleVoCollection();

    for (int i = 0; i < form.dyngrdRules().getRows().size(); i++)
    {
        DynamicGridRow row = form.dyngrdRules().getRows().get(i);

        if (row.getValue() instanceof BusinessRuleVo)
        {
            BusinessRuleVo rule = (BusinessRuleVo) row.getValue();
            ruleList.add(rule);
        }
    }

    return ruleList;
}
项目:openMAXIMS    文件:Logic.java   
/**
 * 
 */
private void setRuleList(BusinessRuleVoCollection list)
{
    // Clear the rules list
    form.dyngrdRules().getRows().clear();

    if (list == null)
        return;

    for (int i = 0; i < list.size(); i++)
    {
        BusinessRuleVo rule = list.get(i);

        // Add non nulls elements to the grid
        if (rule != null)
        {
            setRuleListRow(form.dyngrdRules().getRows().newRow(), rule);
        }
    }
}
项目:openMAXIMS    文件:Logic.java   
/**
 * 
 * @param indexSelected
 * @param indexTarget
 * @return
 */
private boolean swap(int indexSelected, int indexTarget)
{
    if (!(form.dyngrdRules().getRows().get(indexSelected).getValue() instanceof BusinessRuleVo)
            || !(form.dyngrdRules().getRows().get(indexTarget).getValue() instanceof BusinessRuleVo))
        throw new CodingRuntimeException("Major Logical Error - Type mismatch of row values");

    BusinessRuleVo ruleSelected = (BusinessRuleVo) form.dyngrdRules().getRows().get(indexSelected).getValue();
    BusinessRuleVo ruleTarget = (BusinessRuleVo) form.dyngrdRules().getRows().get(indexTarget).getValue();

    setRuleListRow(form.dyngrdRules().getRows().get(indexTarget), ruleSelected);
    setRuleListRow(form.dyngrdRules().getRows().get(indexSelected), ruleTarget);

    // Keep selection
    form.dyngrdRules().setValue(form.getLocalContext().getSelectedRule());

    return true;
}
项目:openMAXIMS    文件:Logic.java   
/**
 * 
 * @param indexSelected
 * @return
 */
private boolean moveTop(int indexSelected)
{
    if (!(form.dyngrdRules().getRows().get(indexSelected).getValue() instanceof BusinessRuleVo))
        throw new CodingRuntimeException("Major Logical Error - Type mismatch of row values");

    BusinessRuleVo ruleSelected = (BusinessRuleVo) form.dyngrdRules().getRows().get(indexSelected).getValue();

    for (int i = indexSelected - 1; i >= 0; i--)
    {
        BusinessRuleVo rule = (BusinessRuleVo) form.dyngrdRules().getRows().get(i).getValue();

        setRuleListRow(form.dyngrdRules().getRows().get(i + 1), rule);
    }

    setRuleListRow(form.dyngrdRules().getRows().get(0), ruleSelected);

    // Keep selection
    form.dyngrdRules().setValue(form.getLocalContext().getSelectedRule());

    return true;
}
项目:openMAXIMS    文件:Logic.java   
/**
 * 
 * @param indexSelected
 * @return
 */
private boolean moveBottom(int indexSelected)
{
    if (!(form.dyngrdRules().getRows().get(indexSelected).getValue() instanceof BusinessRuleVo))
        throw new CodingRuntimeException("Major Logical Error - Type mismatch of row values");

    BusinessRuleVo ruleSelected = (BusinessRuleVo) form.dyngrdRules().getRows().get(indexSelected).getValue();

    for (int i = indexSelected + 1; i < form.dyngrdRules().getRows().size(); i++)
    {
        BusinessRuleVo rule = (BusinessRuleVo) form.dyngrdRules().getRows().get(i).getValue();

        setRuleListRow(form.dyngrdRules().getRows().get(i - 1), rule);
    }

    setRuleListRow(form.dyngrdRules().getRows().get(form.dyngrdRules().getRows().size() - 1), ruleSelected);

    // Keep selection
    form.dyngrdRules().setValue(form.getLocalContext().getSelectedRule());

    return true;
}
项目:openMAXIMS    文件:Logic.java   
/**
 * 
 * @return
 */
private boolean assignPriority()
{
    int rows = form.dyngrdRules().getRows().size();

    for (int i = 0; i < rows; i++)
    {
        DynamicGridRow row = form.dyngrdRules().getRows().get(i);

        // Set the rank for BusinessRuleVo
        BusinessRuleVo rule = (BusinessRuleVo) row.getValue();
        rule.setPriority(rows - i);

        // Set row value
        setRuleListRow(row, rule);
    }

    return true;
}
项目:openMAXIMS    文件:Logic.java   
/**
 * 
 */
private void updateContextMenu()
{
    if (FormMode.VIEW.equals(form.getMode()))
    {
        form.getContextMenus().Rules.getRulesListContextMenuNEWItem().setVisible(true);
        form.getContextMenus().Rules.getRulesListContextMenuEDITItem().setVisible(form.dyngrdRules().getValue() instanceof BusinessRuleVo);
        form.getContextMenus().Rules.getRulesListContextMenuVIEWItem().setVisible(form.dyngrdRules().getValue() instanceof BusinessRuleVo);
        form.getContextMenus().Rules.getRulesListContextMenuCLONEItem().setVisible(form.dyngrdRules().getValue() instanceof BusinessRuleVo);

        form.getContextMenus().Rules.getRulesListContextMenuVIEWXMLItem().setVisible(form.dyngrdRules().getValue() instanceof BusinessRuleVo);

        form.getContextMenus().Rules.getRulesListContextMenuIMPORTItem().setVisible(true);
        form.getContextMenus().Rules.getRulesListContextMenuEXPORTItem().setVisible(form.dyngrdRules().getValue() instanceof BusinessRuleVo);
    }
    else  if (FormMode.EDIT.equals(form.getMode()))
    {
        form.getContextMenus().Rules.hideAllRulesListContextMenuMenuItems();
    }
}
项目:openMAXIMS    文件:Logic.java   
private void open() throws PresentationLogicException
{
    // populate Root Entity
    populateRootEntity();

    BusinessRuleVo editedRule = form.getLocalContext().getEditedRule();

    // If any edited rule, display it
    if (editedRule != null)
    {
        IRule rule;
        try
        {
            rule = RuleXmlSerialization.deserializeFromXml(editedRule.getXmlContent(), Entities.getInstance());
            displayRule(rule, editedRule);
        }
        catch (Exception e)
        {
            e.printStackTrace();
            throw new DomainRuntimeException(e.toString());
        }
    }
    updateContextMenu();
}
项目:openMAXIMS    文件:Logic.java   
@Override
protected void onFormOpen(Object[] args) throws PresentationLogicException 
{   
    RulesEditorComponentFormAction mode = form.getGlobalContext().Rules.RuleEditorComponent.getFormMode();      


    if (RulesEditorComponentFormAction.VIEW.equals(mode)) 
    {                                                       
        form.setMode(FormMode.VIEW);
    }
    else 
    {           
        form.setMode(FormMode.EDIT);                        
    }               

    //display Rule
    BusinessRuleVo editedRule = form.getGlobalContext().Rules.getRuleToEdit();
    form.cc1RuleEditor().setValue(editedRule);

    //Set BtnPreview Status
    setBtnPreviewRule();        
}
项目:openMAXIMS    文件:Logic.java   
@Override
protected void onBtnCancelClick() throws PresentationLogicException 
{
    //If Clone and press Cancel return to List screen
    if (form.getGlobalContext().Rules.RuleEditorComponent.getFormMode() != null &&
            form.getGlobalContext().Rules.RuleEditorComponent.getFormMode().equals(RulesEditorComponentFormAction.CLONE))
    {
        engine.close(DialogResult.CANCEL);
        onLnkReturnClick();
    }

    form.setMode(FormMode.VIEW);

    BusinessRuleVo editedRule = form.getGlobalContext().Rules.getRuleToEdit();
    form.cc1RuleEditor().setValue(editedRule);
}
项目:openMAXIMS    文件:Logic.java   
/**
 * Function used to populate the Business Rules collection from business
 * rules grid on ICP Stage tab
 * 
 * @return
 */
private BusinessRuleVoCollection getICPStageRules()
{
    // Create a new rule collection
    BusinessRuleVoCollection rules = new BusinessRuleVoCollection();

    // Iterate rules grid rows
    for (int i = 0; i < form.ctnConfiguration().lyrICPTabs().Stage().grdStageRules().getRows().size(); i++)
    {
        BusinessRuleVo rule = form.ctnConfiguration().lyrICPTabs().Stage().grdStageRules().getRows().get(i).getValue();

        // Skip null rules
        if (rule == null)
            continue;

        // Add rule to collection
        rules.add(rule);
    }

    // Return populated rule collection
    return rules;
}
项目:openMAXIMS    文件:Logic.java   
/**
 * Function used to populate the Business Rules collection from business
 * rules grid on ICP Phase tab
 * 
 * @return
 */
private BusinessRuleVoCollection getICPPhaseRules()
{
    // Create a new rule collection
    BusinessRuleVoCollection rules = new BusinessRuleVoCollection();

    // Iterate rules grid rows
    for (int i = 0; i < form.ctnConfiguration().lyrICPTabs().Phase().grdPhaseRules().getRows().size(); i++)
    {
        BusinessRuleVo rule = form.ctnConfiguration().lyrICPTabs().Phase().grdPhaseRules().getRows().get(i).getValue();

        // Skip null rules
        if (rule == null)
            continue;

        // Add rule to collection
        rules.add(rule);
    }

    // Return populated rule collection
    return rules;
}
项目:openMAXIMS    文件:Logic.java   
/**
 * Function used to open the dialog to edit a business rule
 */
private void editBussinessRule()
{
    // Set local context action to EDIT rule (will be used in
    // OnFormDialogClosed)
    form.getLocalContext().setBusinessRuleAction(ACTION_BUSINESS_RULE_EDIT);

    // Rule passed to be edited global context (OVERKILL)
    BusinessRuleVo rule = form.ctnConfiguration().lyrICPTabs().Stage().isVisible() ? form.ctnConfiguration().lyrICPTabs().Stage().grdStageRules().getValue() : form.ctnConfiguration().lyrICPTabs().Phase().grdPhaseRules().getValue();

    form.getGlobalContext().Rules.setRuleToEdit(rule);

    // Open business rule editor dialog (with parameters - selected rule -
    // currently is not used but it might in the future, current selected
    // ICP, form mode)
    engine.open(form.getForms().ICP.ICPRulesEditorDialog, new Object[] { rule, form.getLocalContext().getSelectedICP(), FormMode.EDIT });
}
项目:openMAXIMS    文件:Logic.java   
@Override
protected void onBtnCancelClick() throws PresentationLogicException 
{   
    //If Clone and press Cancel return to List screen
    if (form.getGlobalContext().Rules.RuleEditorComponent.getFormMode() != null &&
            form.getGlobalContext().Rules.RuleEditorComponent.getFormMode().equals(RulesEditorComponentFormAction.CLONE))
    {
        engine.close(DialogResult.CANCEL);          
    }

    form.getLocalContext().setDialogResult(DialogResult.CANCEL);
    form.setMode(FormMode.VIEW);

    BusinessRuleVo editedRule = form.getGlobalContext().Rules.getRuleToEdit();
    form.ccRules().setValue(editedRule);        
}
项目:openMAXIMS    文件:Logic.java   
/**
 * 
 */
private BusinessRuleVoCollection getRuleList()
{
    if (form.dyngrdRules().getRows().size() == 0)
        return null;

    BusinessRuleVoCollection ruleList = new BusinessRuleVoCollection();

    for (int i = 0; i < form.dyngrdRules().getRows().size(); i++)
    {
        DynamicGridRow row = form.dyngrdRules().getRows().get(i);

        if (row.getValue() instanceof BusinessRuleVo)
        {
            BusinessRuleVo rule = (BusinessRuleVo) row.getValue();
            ruleList.add(rule);
        }
    }

    return ruleList;
}
项目:openMAXIMS    文件:Logic.java   
/**
 * 
 */
private void setRuleList(BusinessRuleVoCollection list)
{
    // Clear the rules list
    form.dyngrdRules().getRows().clear();

    if (list == null)
        return;

    for (int i = 0; i < list.size(); i++)
    {
        BusinessRuleVo rule = list.get(i);

        // Add non nulls elements to the grid
        if (rule != null)
        {
            setRuleListRow(form.dyngrdRules().getRows().newRow(), rule);
        }
    }
}
项目:openMAXIMS    文件:Logic.java   
/**
 * 
 * @param indexSelected
 * @param indexTarget
 * @return
 */
private boolean swap(int indexSelected, int indexTarget)
{
    if (!(form.dyngrdRules().getRows().get(indexSelected).getValue() instanceof BusinessRuleVo)
            || !(form.dyngrdRules().getRows().get(indexTarget).getValue() instanceof BusinessRuleVo))
        throw new CodingRuntimeException("Major Logical Error - Type mismatch of row values");

    BusinessRuleVo ruleSelected = (BusinessRuleVo) form.dyngrdRules().getRows().get(indexSelected).getValue();
    BusinessRuleVo ruleTarget = (BusinessRuleVo) form.dyngrdRules().getRows().get(indexTarget).getValue();

    setRuleListRow(form.dyngrdRules().getRows().get(indexTarget), ruleSelected);
    setRuleListRow(form.dyngrdRules().getRows().get(indexSelected), ruleTarget);

    // Keep selection
    form.dyngrdRules().setValue(form.getLocalContext().getSelectedRule());

    return true;
}
项目:openMAXIMS    文件:Logic.java   
/**
 * 
 * @param indexSelected
 * @return
 */
private boolean moveTop(int indexSelected)
{
    if (!(form.dyngrdRules().getRows().get(indexSelected).getValue() instanceof BusinessRuleVo))
        throw new CodingRuntimeException("Major Logical Error - Type mismatch of row values");

    BusinessRuleVo ruleSelected = (BusinessRuleVo) form.dyngrdRules().getRows().get(indexSelected).getValue();

    for (int i = indexSelected - 1; i >= 0; i--)
    {
        BusinessRuleVo rule = (BusinessRuleVo) form.dyngrdRules().getRows().get(i).getValue();

        setRuleListRow(form.dyngrdRules().getRows().get(i + 1), rule);
    }

    setRuleListRow(form.dyngrdRules().getRows().get(0), ruleSelected);

    // Keep selection
    form.dyngrdRules().setValue(form.getLocalContext().getSelectedRule());

    return true;
}
项目:openMAXIMS    文件:Logic.java   
/**
 * 
 * @param indexSelected
 * @return
 */
private boolean moveBottom(int indexSelected)
{
    if (!(form.dyngrdRules().getRows().get(indexSelected).getValue() instanceof BusinessRuleVo))
        throw new CodingRuntimeException("Major Logical Error - Type mismatch of row values");

    BusinessRuleVo ruleSelected = (BusinessRuleVo) form.dyngrdRules().getRows().get(indexSelected).getValue();

    for (int i = indexSelected + 1; i < form.dyngrdRules().getRows().size(); i++)
    {
        BusinessRuleVo rule = (BusinessRuleVo) form.dyngrdRules().getRows().get(i).getValue();

        setRuleListRow(form.dyngrdRules().getRows().get(i - 1), rule);
    }

    setRuleListRow(form.dyngrdRules().getRows().get(form.dyngrdRules().getRows().size() - 1), ruleSelected);

    // Keep selection
    form.dyngrdRules().setValue(form.getLocalContext().getSelectedRule());

    return true;
}
项目:openMAXIMS    文件:Logic.java   
/**
 * 
 * @return
 */
private boolean assignPriority()
{
    int rows = form.dyngrdRules().getRows().size();

    for (int i = 0; i < rows; i++)
    {
        DynamicGridRow row = form.dyngrdRules().getRows().get(i);

        // Set the rank for BusinessRuleVo
        BusinessRuleVo rule = (BusinessRuleVo) row.getValue();
        rule.setPriority(rows - i);

        // Set row value
        setRuleListRow(row, rule);
    }

    return true;
}
项目:openMAXIMS    文件:Logic.java   
/**
 * 
 */
private void updateContextMenu()
{
    if (FormMode.VIEW.equals(form.getMode()))
    {
        form.getContextMenus().Rules.getRulesListContextMenuNEWItem().setVisible(true);
        form.getContextMenus().Rules.getRulesListContextMenuEDITItem().setVisible(form.dyngrdRules().getValue() instanceof BusinessRuleVo);
        form.getContextMenus().Rules.getRulesListContextMenuVIEWItem().setVisible(form.dyngrdRules().getValue() instanceof BusinessRuleVo);
        form.getContextMenus().Rules.getRulesListContextMenuCLONEItem().setVisible(form.dyngrdRules().getValue() instanceof BusinessRuleVo);

        form.getContextMenus().Rules.getRulesListContextMenuVIEWXMLItem().setVisible(form.dyngrdRules().getValue() instanceof BusinessRuleVo);

        form.getContextMenus().Rules.getRulesListContextMenuIMPORTItem().setVisible(true);
        form.getContextMenus().Rules.getRulesListContextMenuEXPORTItem().setVisible(form.dyngrdRules().getValue() instanceof BusinessRuleVo);
    }
    else  if (FormMode.EDIT.equals(form.getMode()))
    {
        form.getContextMenus().Rules.hideAllRulesListContextMenuMenuItems();
    }
}
项目:openMAXIMS    文件:Logic.java   
private void open() throws PresentationLogicException
{
    // populate Root Entity
    populateRootEntity();

    BusinessRuleVo editedRule = form.getLocalContext().getEditedRule();

    // If any edited rule, display it
    if (editedRule != null)
    {
        IRule rule;
        try
        {
            rule = RuleXmlSerialization.deserializeFromXml(editedRule.getXmlContent(), Entities.getInstance());
            displayRule(rule, editedRule);
        }
        catch (Exception e)
        {
            e.printStackTrace();
            throw new DomainRuntimeException(e.toString());
        }
    }
    updateContextMenu();
}