从一个UI中调用另一个UI

UIContext uiContext = new UIContext(this); //uiContext可以将参数传给下个UI

uiContext.put("id", id); //uiContext是个Map

IUIWindow uiWindow = null;
        uiWindow = UIFactory.createUIFactory(UIFactoryName.MODEL).create(PrepayToPlaceUI.class.getName(), uiContext, null, OprtState.EDIT);
//PrepayToPlaceUI.class.getName() 要调出的UI

PrepayToPlaceUI window = (PrepayToPlaceUI) uiWindow.getUIObject(); //要调出的UI的类

window.pkDate.setValue(new Date()); //给UI上的空间赋值

uiWindow.show();

 

 

************************************************************************

以下是反编译出来的源码,ListUI编辑/查看EditUI的事件,从ListUI调出EditUI

 

 

 

public void actionView_actionPerformed(ActionEvent e)
        throws Exception
    {
        checkSelected();
        checkObjectExists();
        UIContext uiContext = new UIContext(this);
        uiContext.put("ID", getSelectedKeyValue());
        selectKeyValue = getSelectedKeyValue();
        prepareUIContext(uiContext, e);
        IUIWindow uiWindow = null;
        if(SwingUtilities.getWindowAncestor(this) != null && (SwingUtilities.getWindowAncestor(this) instanceof JDialog))
            uiWindow = UIFactory.createUIFactory(UIFactoryName.MODEL).create(getEditUIName(), uiContext, null, OprtState.VIEW);
        else
            uiWindow = UIFactory.createUIFactory(getEditUIModal()).create(getEditUIName(), uiContext, null, OprtState.VIEW);
        uiWindow.show();
        actionEvent = e;
        if(isDoRefresh(uiWindow))
        {
            isModify = true;
            setLocatePre(false);
            refresh(e);
            setLocatePre(true);
        }
    }

    public void actionEdit_actionPerformed(ActionEvent e)
        throws Exception
    {
        IUIWindow uiWindow = showEditUI(e);
        uiWindow.show();
        actionEvent = e;
        if(isDoRefresh(uiWindow))
        {
            setLocatePre(false);
            refresh(e);
            setPreSelecteRow();
            setLocatePre(true);
        }
    }

    private IUIWindow showEditUI(ActionEvent e)
        throws Exception
    {
        checkSelected();
        checkObjectExists();
        UIContext uiContext = new UIContext(this);
        uiContext.put("ID", getSelectedKeyValue());
        selectKeyValue = getSelectedKeyValue();
        prepareUIContext(uiContext, e);
        IUIWindow uiWindow = null;
        if(SwingUtilities.getWindowAncestor(this) != null && (SwingUtilities.getWindowAncestor(this) instanceof JDialog))
            uiWindow = UIFactory.createUIFactory(UIFactoryName.MODEL).create(getEditUIName(), uiContext, null, OprtState.EDIT);
        else
            uiWindow = UIFactory.createUIFactory(getEditUIModal()).create(getEditUIName(), uiContext, null, OprtState.EDIT);
        return uiWindow;
    }

你可能感兴趣的:(UI)