田源
2025-01-09 8a166a60cfd1a2e593ffa103d10c0dc224fc8628
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package com.vci.client.uif.actions.client;
 
import com.vci.client.bof.ClientBusinessObject;
import com.vci.client.bof.ClientBusinessObjectOperation;
import com.vci.client.ui.swing.components.VCIJDialog;
import com.vci.client.ui.swing.components.VCIJDialog.DialogResult;
import com.vci.client.uif.engine.client.objopt.ObjectAddEditDialog;
import com.vci.client.uif.engine.common.IDataNode;
import com.vci.corba.common.VCIError;
 
public class EditSaveAction extends DoseNotSelectDataAction {
 
    /**
     * 按钮所属窗口
     */
    private ObjectAddEditDialog oaed = null;
 
    @Override
    public String getKey() {
        // TODO Auto-generated method stub
        return EDIT_SAVE;
    }
 
    @Override
    public boolean checkHasRight() {
        return true;
    }
 
    @Override
    public boolean doPost() {
        Object obj = getDataModel().getRootObject();
 
        VCIJDialog dialog = getOwnerDialog();
        if (dialog instanceof ObjectAddEditDialog) {
            oaed = (ObjectAddEditDialog) dialog;
        }
        if (oaed == null) {
            return false;
        }
 
        if (obj instanceof IDataNode) {
            IDataNode dataNode = (IDataNode) obj;
            obj = dataNode.getMaterObject();
            if (obj instanceof ClientBusinessObject) {
                ClientBusinessObject cbo = (ClientBusinessObject) obj;
                ClientBusinessObjectOperation boOperation = new ClientBusinessObjectOperation();
                try {
                    // 上传文件
                    if (!UploadFile(oaed, cbo)) {
                        // operation.showMessage(ClientContextVariable.getFrame(),
                        // "uifmodel.plm.uif.actions.createlinkerror");
                        // return false;
                    }
                    boOperation.updateBuinessObject(cbo);
                    closeOwnerDailog(getOwnerDialog(), DialogResult.OK);
                    UIFUtils.showMessage(getParentComponent(),
                            "uifmodel.plm.uif.actions.editsuccessmsg",
                            cbo.getName());
                } catch (VCIError e) {
                    UIFUtils.showErrorMessage(getParentComponent(), e);
                }
            }
        }
        // 调用此按钮所在Dialog注册的回调函数
        super.invokeOwnedDialogCallback();
        return true;
    }
}