NC 附件管理参考代码

package nc.ui.fbm.base.actions;

import java.awt.event.ActionEvent;
import nc.pub.filesystem.newui.FileManageUIFactory;
import nc.ui.ml.NCLangRes;
import nc.ui.pub.beans.UIDialog;
import nc.ui.pub.filesystem.FileManageUI;
import nc.ui.pubapp.uif2app.actions.FileDocManageAction;
import nc.ui.uif2.model.AbstractUIAppModel;
import nc.ui.uif2.model.BillManageModel;
import nc.vo.bd.meta.IBDObject;
import nc.vo.bd.meta.IBDObjectAdapterFactory;
import nc.vo.pub.AggregatedValueObject;
import nc.vo.pub.SuperVO;
import nc.vo.uif2.LoginContext;

public class FbmBaseFileDocManageAction
  extends FileDocManageAction
{
  private static final long serialVersionUID = -7803187635852451053L;
  
  public void doAction(ActionEvent e)
    throws Exception
  {
    Object selectedData = ((BillManageModel)getModel()).getSelectedData();
    AggregatedValueObject aggvo = (AggregatedValueObject)selectedData;
    IBDObject target = ((BillManageModel)getModel()).getBusinessObjectAdapterFactory().createBDObject(selectedData);
    

    String rootPath = (String)target.getId();
    FileManageUI ui = new FileManageUI(rootPath);
    
    SuperVO parent = (SuperVO)aggvo.getParentVO();
    Object vbillstauts = parent.getAttributeValue("vbillstatus");
    if ((vbillstauts != null) && ((((Integer)vbillstauts).intValue() == 2) || (((Integer)vbillstauts).intValue() == -1)))
    {
      ui.setUploadFileEnable(true);
      ui.setDeleteNodeEnable(true);
      ui.setRenameNodeEnable(true);
      ui.setCreateNewFolderEnable(true);
    }
    else
    {
      ui.setUploadFileEnable(false);
      ui.setDeleteNodeEnable(false);
      ui.setRenameNodeEnable(false);
      ui.setCreateNewFolderEnable(false);
    }
    ui.setTreeRootVisible(false);
    UIDialog fileDlg = FileManageUIFactory.getFileManageDLG(getModel().getContext().getEntranceUI(), NCLangRes.getInstance().getStrByID("org", "BusiRole-000010"), rootPath, getModel().getContext().getFuncInfo());
    


    fileDlg.showModal();
  }
  
  protected boolean isActionEnable()
  {
    AggregatedValueObject aggvo = (AggregatedValueObject)((BillManageModel)getModel()).getSelectedData();
    if ((aggvo == null) || (aggvo.getParentVO() == null)) {
      return false;
    }
    return true;
  }
}
posted @ 2020-10-21 14:45  Tamako521  阅读(469)  评论(0编辑  收藏  举报