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;
|
}
|
}
|