265 lines
8.9 KiB
Plaintext
265 lines
8.9 KiB
Plaintext
<%@page import="com.amarsoft.awe.dw.ui.datamodel.MDataBuilder"%>
|
|
<%@page import="java.util.Date"%>
|
|
<%@page import="com.amarsoft.dict.als.cache.AWEDataWindowCache"%>
|
|
<%@ page contentType="text/html; charset=GBK"%>
|
|
<%@ include file="/Frame/resources/include/include_begin_info.jspf"%>
|
|
<%!
|
|
private ASColumn[] getSortColumn(Vector columns){
|
|
class SortColumn implements Comparable<SortColumn> {
|
|
public ASColumn column;
|
|
public SortColumn(ASColumn column){
|
|
this.column = column;
|
|
}
|
|
public int compareTo(SortColumn o) {
|
|
return column.getAttribute("SortNo").compareTo(o.column.getAttribute("SortNo"));
|
|
}
|
|
}
|
|
|
|
SortColumn[] cols = new SortColumn[columns.size()];
|
|
for(int i = 0; i < columns.size(); i++){
|
|
cols[i] = new SortColumn((ASColumn)columns.get(i));
|
|
}
|
|
Arrays.sort(cols);
|
|
ASColumn[] result = new ASColumn[cols.length];
|
|
for(int i = 0; i < cols.length; i++){
|
|
result[i] = cols[i].column;
|
|
}
|
|
return result;
|
|
}
|
|
%>
|
|
<%
|
|
String sDoNo = CurPage.getParameter("DoNo");
|
|
String sTime = CurPage.getParameter("Time");
|
|
|
|
ASObjectModel doTemp = null;
|
|
if(sTime == null){
|
|
doTemp = new ASObjectModel(sDoNo, "1=1");
|
|
doTemp.setJboWhere("1=2");
|
|
sTime = String.valueOf(new Date().getTime());
|
|
}else{
|
|
doTemp = (ASObjectModel)ObjectConverts.getObject(new File(Component.getDWTmpPath("Visualization_"+CurUser.getUserID()+"_"+sTime)));
|
|
String sMethodType = CurPage.getParameter("MethodType");
|
|
if("save".equals(sMethodType)){ // ±£´æ
|
|
BizObjectManager m = JBOFactory.getFactory().getManager("jbo.ui.system.DATAOBJECT_LIBRARY");
|
|
BizObjectQuery q = m.createQuery("DoNo = :DoNo");
|
|
q.setParameter("DoNo", sDoNo);
|
|
@SuppressWarnings("unchecked")
|
|
List<BizObject> bos = q.getResultList(true);
|
|
|
|
for(BizObject bo : bos){
|
|
ASColumn col = doTemp.getColumn(bo.getAttribute("ColName").getString());
|
|
if(col == null) continue;
|
|
for (int i = 0; i < MDataBuilder.ColumnsEN.length; i++) {
|
|
String sAttrName = MDataBuilder.ColumnsEN[i];
|
|
if(sAttrName.equalsIgnoreCase("COLTIPS"))
|
|
sAttrName = "TIPS";
|
|
bo.setAttributeValue(sAttrName, col.getAttribute(MDataBuilder.ColumnsEN[i]));
|
|
}
|
|
m.saveObject(bo);
|
|
}
|
|
}else{ // ÍÏ×§
|
|
String src = CurPage.getParameter("src");
|
|
String target = CurPage.getParameter("target");
|
|
String group = CurPage.getParameter("group");
|
|
if(target != null){
|
|
boolean before = "true".equals(CurPage.getParameter("before"));
|
|
DecimalFormat format = new DecimalFormat("0000");
|
|
int n = 0;
|
|
|
|
ASColumn srcCol = null;
|
|
String sSrcSortNo = null, sSrcGroupId = null;
|
|
ASColumn[] cols = getSortColumn(doTemp.Columns);
|
|
for(int i = 0; i < cols.length; i++){
|
|
String sColIndex = cols[i].getAttribute("ColIndex");
|
|
if(src.equals(sColIndex)){
|
|
srcCol = cols[i];
|
|
continue;
|
|
}
|
|
String sSortNo = format.format(++n*10);
|
|
if(target.equals(sColIndex)){
|
|
sSrcGroupId = cols[i].getAttribute("GroupId");
|
|
if(before){
|
|
sSrcSortNo = sSortNo;
|
|
sSortNo = format.format(++n*10);
|
|
}else{
|
|
sSrcSortNo = format.format(++n*10);
|
|
}
|
|
}
|
|
cols[i].setAttribute("SortNo", sSortNo);
|
|
}
|
|
srcCol.setAttribute("SortNo", sSrcSortNo);
|
|
srcCol.setAttribute("GroupId", sSrcGroupId);
|
|
}else if(group != null){
|
|
for(int i = 0; i < doTemp.Columns.size(); i++){
|
|
ASColumn col = (ASColumn)doTemp.Columns.get(i);
|
|
if(src.equals(col.getAttribute("ColIndex"))){
|
|
col.setAttribute("GroupId", group);
|
|
col.setAttribute("ColVisible", "1");
|
|
break;
|
|
}
|
|
}
|
|
}else{
|
|
for(int i = 0; i < doTemp.Columns.size(); i++){
|
|
ASColumn col = (ASColumn)doTemp.Columns.get(i);
|
|
if(src.equals(col.getAttribute("ColIndex"))){
|
|
col.setAttribute("ColVisible", "0");
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
ObjectConverts.saveObject(new File(Component.getDWTmpPath("Visualization_"+CurUser.getUserID()+"_"+sTime)), doTemp);
|
|
CurComp.getParentComponent().addDW("Visualization_"+CurUser.getUserID()+"_"+sTime);
|
|
|
|
ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request);
|
|
dwTemp.Style = "2"; // freeform
|
|
dwTemp.ReadOnly = "1"; // Ö»¶Áģʽ
|
|
dwTemp.genHTMLObjectWindow("");
|
|
|
|
String sButtons[][] = {
|
|
{"true","All","Button","±£´æËùÓÐÔªËØµ÷Õû","±£´æËùÓÐÐÞ¸Ä","saveRecord()","","","",""},
|
|
{"true","All","Button","ÖØÐ¼ÓÔØ","ÖØÐ¼ÓÔØÔʼģÐÍ","reloadModel()","","","",""},
|
|
};
|
|
|
|
%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%>
|
|
<div id="unvisible" style="display: none; position: absolute; left: 0; top: 0; background: #eee; border: 1px solid #f00;"><%
|
|
for(int i = 0; i < doTemp.Columns.size(); i++){
|
|
ASColumn col = (ASColumn)doTemp.Columns.get(i);
|
|
if(!"1".equals(col.getAttribute("ColVisible"))){
|
|
out.print("<a href=\"javascript:void(0);\" onclick=\"return false;\" colindex=\""+col.getAttribute("ColIndex")+"\">"+col.getAttribute("COLHEADER")+"</a>");
|
|
}
|
|
}
|
|
%></div>
|
|
<style>
|
|
.movediv {
|
|
position: absolute;
|
|
}
|
|
.point1 {
|
|
border-left: 1px solid #f00;
|
|
}
|
|
.point2 {
|
|
background: #f00;
|
|
}
|
|
.include {
|
|
border: 1px solid #f00;
|
|
}
|
|
#unvisible a {
|
|
display: block;
|
|
padding: 2px 5px;
|
|
}
|
|
#unvisible a:hover {
|
|
background: #aaa;
|
|
}
|
|
</style>
|
|
<script type="text/javascript">
|
|
function saveRecord(){
|
|
AsControl.OpenView("/AppConfig/PageMode/DWConfig/ObjectModelVisualization.jsp", "Time=<%=sTime%>&DoNo=<%=sDoNo%>&MethodType=save", "_self");
|
|
}
|
|
function reloadModel(){
|
|
AsControl.OpenView("/AppConfig/PageMode/DWConfig/ObjectModelVisualization.jsp", "DoNo=<%=sDoNo%>", "_self");
|
|
}
|
|
|
|
function bindASContextMenu(){}
|
|
|
|
(function(){
|
|
//alert($("[id^=A_Group_]").length);
|
|
function getAbsPoint(e){
|
|
var x = e.offsetLeft;
|
|
var y = e.offsetTop;
|
|
var iScrollTop = 0;
|
|
var iScrollLeft = 0;
|
|
while(e = e.offsetParent){
|
|
x += e.offsetLeft;
|
|
y += e.offsetTop;
|
|
iScrollTop += e.scrollTop;
|
|
iScrollLeft += e.scrollLeft;
|
|
}
|
|
return {"x": x-iScrollLeft, "y": y-iScrollTop};
|
|
}
|
|
|
|
var divs = $("[id^=A_div_]");
|
|
var groups = $("[id^=A_Group_]").find(">table:first");
|
|
var unvisible = $("#unvisible");
|
|
if(!unvisible.is(":empty"))
|
|
groups.contextmenu(function(e){
|
|
var thiz = this;
|
|
unvisible.css({top:e.clientY,left:e.clientX}).show();
|
|
unvisible.find(">a").click(function(){
|
|
AsControl.OpenView("/AppConfig/PageMode/DWConfig/ObjectModelVisualization.jsp", "Time=<%=sTime%>&DoNo=<%=sDoNo%>&src="+$(this).attr("colindex")+"&group="+thiz.parentNode.id.substring(8), "_self");
|
|
});
|
|
$(document).bind("mousedown.unvisible", function(e){
|
|
if(unvisible.find(e.target).length > 0) return;
|
|
unvisible.hide();
|
|
$(document).unbind("mousedown.unvisible");
|
|
});
|
|
});
|
|
divs.dblclick(function(){
|
|
AsControl.OpenView("/AppConfig/PageMode/DWConfig/ObjectModelVisualization.jsp", "Time=<%=sTime%>&DoNo=<%=sDoNo%>&src="+this.id.substring(6), "_self");
|
|
}).mousedown(function(e){
|
|
var thiz = this;
|
|
var offset = $(thiz).offset();
|
|
|
|
var target = null;
|
|
var group = null;
|
|
function mousemove(ev){
|
|
$(thiz).css({"top":offset.top+ev.clientY-e.clientY, "left":offset.left+ev.clientX-e.clientX});
|
|
//var top = offset.top+ev.clientY-e.clientY;
|
|
//var left = offset.left+ev.clientX-e.clientX;
|
|
var move = false;
|
|
divs.each(function(){
|
|
if(this == thiz) return true;
|
|
var point = getAbsPoint(this);
|
|
if(ev.clientY < point.y || ev.clientY > point.y + $(this).height() || ev.clientX < point.x || ev.clientX > point.x + $(this).width())
|
|
return true;
|
|
move = true;
|
|
$(target).removeClass("point1").removeClass("point2");
|
|
if(ev.clientX < point.x + $(this).width()/2){
|
|
$(this).addClass("point1");
|
|
}else{
|
|
$(this).addClass("point2");
|
|
}
|
|
target = this;
|
|
return false;
|
|
});
|
|
if(!move){
|
|
$(target).removeClass("point1").removeClass("point2");
|
|
target = null;
|
|
|
|
var include = false;
|
|
groups.each(function(){
|
|
var point = getAbsPoint(this);
|
|
if(ev.clientY < point.y || ev.clientY > point.y + $(this).height() || ev.clientX < point.x || ev.clientX > point.x + $(this).width())
|
|
return true;
|
|
include = true;
|
|
$(group).removeClass("include");
|
|
$(this).addClass("include");
|
|
group = this;
|
|
return false;
|
|
});
|
|
if(!include){
|
|
$(group).removeClass("include");
|
|
group = null;
|
|
}
|
|
}
|
|
}
|
|
|
|
function mouseup(){
|
|
$(document).unbind(".movediv");
|
|
$(thiz).removeClass("movediv");
|
|
var params = "Time=<%=sTime%>&DoNo=<%=sDoNo%>&src="+thiz.id.substring(6);
|
|
if(target){
|
|
params += "&target="+target.id.substring(6)+"&before="+$(target).hasClass("point1");
|
|
}else if(group){
|
|
params += "&group="+group.parentNode.id.substring(8);
|
|
}else return;
|
|
AsControl.OpenView("/AppConfig/PageMode/DWConfig/ObjectModelVisualization.jsp", params, "_self");
|
|
}
|
|
|
|
$(thiz).addClass("movediv").css({"top":offset.top, "left":offset.left,"z-index":new Date().getTime()});
|
|
$(document).bind("mousemove.movediv", mousemove).bind("mouseup.movediv", mouseup);
|
|
});
|
|
})();
|
|
</script>
|
|
<%@ include file="/Frame/resources/include/include_end.jspf"%> |