Commit 33afcc96 authored by nsawalakhe's avatar nsawalakhe

Added Gantt chart Implementation.

Add new files GanttChartBuilder.java, dhtmlxgantt.js and dhtmlxgantt.css.
Modify in GraphComponent.java Added new Method createGnttChart,
Added  New Method getGanttDataList and Added New Code in getGridNMapMetData  method For  Type DHTML_GANTT in MetaDataDtl.java,
Added Js Css And ganttfilter Div in GwtDashboardPage.html,
Added New Methods createGanttChart,filter_tasks,set_scale_units,zoom_tasks,show_scale_options in BuildChart.js


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98525 ce508802-f39f-4f6c-b175-0d175dae99d5
parent bc5e017f
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>GWT-Component</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
package ibase.client;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONParser;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.json.client.JSONValue;
public class GanttChartBuilder
{
public JSONObject buildGanttChart(ArrayList<ArrayList<String>> graphDtlList, JSONObject jsonObjGraph, String dataSource)
{
JSONObject jsonObjFrGraph = (JSONObject) jsonObjGraph.get(dataSource);
JSONObject graphJson = new JSONObject();
ArrayList<String> dataList = new ArrayList<String>();
ArrayList<String> widthList = null;
LinkedHashMap<JSONValue, JSONValue> barMap = null;
ArrayList<LinkedHashMap<JSONValue, JSONValue>> allDataList = null;
JSONObject fetchRowWiseVal = null;
String data = "";
/* ArrayList<String> linkList = null;
JSONValue categryDataVal = null;
JSONValue jsonValue = null;
*/
for (int i = 0; i < graphDtlList.size(); i++)
{
if (i == 7)
{
dataList = (ArrayList<String>) graphDtlList.get(i);
}
if (i == 8)
{
widthList = (ArrayList<String>) graphDtlList.get(i);
}
}
allDataList = new ArrayList<LinkedHashMap<JSONValue, JSONValue>>();
for (int jsnCnt = 0; jsnCnt < jsonObjFrGraph.size(); jsnCnt++)
{
barMap = new LinkedHashMap<JSONValue, JSONValue>();
fetchRowWiseVal = (JSONObject) jsonObjFrGraph.get(String.valueOf(jsnCnt));
for (String idName : dataList)
{
data = fetchRowWiseVal.get(idName).toString().replace('"', ' ');
if (data.trim().length() != 0)
{
barMap.put(new JSONString(idName),fetchRowWiseVal.get(idName));
}
}
allDataList.add(barMap);
}
graphJson.put("data",JSONParser.parseStrict(allDataList.toString().replace('=', ':')));
return graphJson;
}
}
package ibase.client; package ibase.client;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -36,8 +35,6 @@ import com.google.gwt.user.client.ui.SimplePanel; ...@@ -36,8 +35,6 @@ import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.SplitLayoutPanel; import com.google.gwt.user.client.ui.SplitLayoutPanel;
import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.VerticalPanel;
/** /**
* *
* The GraphComponent class create a FusionChart * The GraphComponent class create a FusionChart
...@@ -546,6 +543,65 @@ public class GraphComponent extends Composite ...@@ -546,6 +543,65 @@ public class GraphComponent extends Composite
} }
} }
/**end of card build method by sachin 10 July 2015**/ /**end of card build method by sachin 10 July 2015**/
/** Star Code for Building ganttChart by sachin 5 Aug 2015 **/
if ("DHTML_GANTT".equalsIgnoreCase(type))
{
for (String graphNo : graphDataMap.keySet())
{
graphDtlList = graphDataMap.get(graphNo);
for (int i = 0; i < graphDtlList.size(); i++)
{
if (i == 0)
{
gridComponantTitleName = (String) graphDtlList.get(i);
}
if (i == 1)
{
gridCssName = (String) graphDtlList.get(i);
}
if (i == 2)
{
height = (String) graphDtlList.get(i);
}
if (i == 3)
{
width = (String) graphDtlList.get(i);
}
if (i == 4)
{
caption = (String) graphDtlList.get(i);
}
if (i == 5)
{
String bgClolorList = (String) graphDtlList.get(i);
}
}
graphJson = new GanttChartBuilder().buildGanttChart(graphDtlList, jsonObjFrGraph, dtSrouce);
if (graphJson.size() == 0)
{
graphJson.put("chart", new JSONString(""));
}
if (graphJson != null && graphJson.size() > 0)
{
this.createOuterDiv("Gantt" + componentId, type, gridCssName);
this.createGnttChart(graphJson.toString(), "Gantt" + componentId + "Div", height, width);
}
}
}
/** End Star Code for Building ganttChart by sachin 5 Aug 2015 **/
} }
} }
e12LoadImg.setLoading(false); e12LoadImg.setLoading(false);
...@@ -828,6 +884,18 @@ public class GraphComponent extends Composite ...@@ -828,6 +884,18 @@ public class GraphComponent extends Composite
/*End Code for create dyanamic div by Dhanendra for one by one report display*/ /*End Code for create dyanamic div by Dhanendra for one by one report display*/
/** Added new Method by sachin on 10 Aug 2015 **/
private native void createGnttChart(String chartData, String chartContainer, String height, String width)
/*-{
try {
$wnd.createGanttChart(chartData, chartContainer, height, width);
} catch (e) {
alert("Excpeiton :: GraphComponent : createGnttCht [" + e.message
+ "]");
}
}-*/;
/**End Added new Method by sachin on 10 Aug 2015 **/
/** End Native Method */ /** End Native Method */
...@@ -913,7 +981,7 @@ public class GraphComponent extends Composite ...@@ -913,7 +981,7 @@ public class GraphComponent extends Composite
JSONObject jsonObjData = new JSONObject(); JSONObject jsonObjData = new JSONObject();
jsonObjData.put(key, servletJsnObj); jsonObjData.put(key, servletJsnObj);
componentDataMap.put(key, jsonObjData); componentDataMap.put(key, jsonObjData);
/*RootPanel.get("chartContainer").clear();*/ RootPanel.get("chartContainer").clear();
}else }else
{ {
componentDataMap.put(key, null); componentDataMap.put(key, null);
...@@ -952,6 +1020,8 @@ public class GraphComponent extends Composite ...@@ -952,6 +1020,8 @@ public class GraphComponent extends Composite
} }
/*Start Add this method for multiple Report By Dhanendra 25MAy2015*/ /*Start Add this method for multiple Report By Dhanendra 25MAy2015*/
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private JSONObject getDataMapJson(JSONObject dataJsn, String groupName, ArrayList graphDtlList) private JSONObject getDataMapJson(JSONObject dataJsn, String groupName, ArrayList graphDtlList)
...@@ -1011,7 +1081,7 @@ public class GraphComponent extends Composite ...@@ -1011,7 +1081,7 @@ public class GraphComponent extends Composite
if (!"null".equals(groupVal)) if (!"null".equals(groupVal))
{ {
groupVal = groupVal.replace('"', ' ').trim(); groupVal = groupVal.replace('"', ' ');
groupVal = groupVal +"@"+ designation; groupVal = groupVal +"@"+ designation;
xAxisVal = "" + fetchRowWiseValJsn.get(xAxixNameList.get(0)).toString().replace('"', ' '); xAxisVal = "" + fetchRowWiseValJsn.get(xAxixNameList.get(0)).toString().replace('"', ' ');
yAxisVal = Integer.parseInt(fetchRowWiseValJsn.get(yAxixNameList.get(0)).toString().replace('"', ' ').trim()); yAxisVal = Integer.parseInt(fetchRowWiseValJsn.get(yAxixNameList.get(0)).toString().replace('"', ' ').trim());
...@@ -1070,8 +1140,8 @@ public class GraphComponent extends Composite ...@@ -1070,8 +1140,8 @@ public class GraphComponent extends Composite
for (int jsnCnt = 0; jsnCnt < dataJsn.size(); jsnCnt++) for (int jsnCnt = 0; jsnCnt < dataJsn.size(); jsnCnt++)
{ {
fetchRowWiseVal = (JSONObject) dataJsn.get(String.valueOf(jsnCnt)); fetchRowWiseVal = (JSONObject) dataJsn.get(String.valueOf(jsnCnt));
group = fetchRowWiseVal.get(groupName).toString().replace("\"", "").trim(); group = fetchRowWiseVal.get(groupName).toString().replace("\"", "").trim();
//Window.alert("group :"+group);
if(selcetIndex == null || selcetIndex.equals("")) if(selcetIndex == null || selcetIndex.equals(""))
{ {
if(jsnCnt == 0) if(jsnCnt == 0)
...@@ -1081,7 +1151,7 @@ public class GraphComponent extends Composite ...@@ -1081,7 +1151,7 @@ public class GraphComponent extends Composite
} }
}else }else
{ {
firstValue = selcetIndex; firstValue=selcetIndex;
firstIndex = firstValue; firstIndex = firstValue;
} }
if(group.equalsIgnoreCase(firstValue)) if(group.equalsIgnoreCase(firstValue))
...@@ -1090,6 +1160,7 @@ public class GraphComponent extends Composite ...@@ -1090,6 +1160,7 @@ public class GraphComponent extends Composite
count++; count++;
} }
} }
//Window.alert("In Filter Method :"+fltrDataJson);
return fltrDataJson; return fltrDataJson;
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
...@@ -1173,6 +1244,7 @@ public class GraphComponent extends Composite ...@@ -1173,6 +1244,7 @@ public class GraphComponent extends Composite
} }
getClearDiv(groupName); getClearDiv(groupName);
getDisplayData(fltrAfterDataJson, graphDtlList, groupCssList.get(0), width, height, imageName, refrshMapVal, mainDataJson,groupName,filterList); getDisplayData(fltrAfterDataJson, graphDtlList, groupCssList.get(0), width, height, imageName, refrshMapVal, mainDataJson,groupName,filterList);
} }
}else if ("T".equalsIgnoreCase(type)) }else if ("T".equalsIgnoreCase(type))
...@@ -1252,6 +1324,7 @@ public class GraphComponent extends Composite ...@@ -1252,6 +1324,7 @@ public class GraphComponent extends Composite
String[] personArr = null; String[] personArr = null;
String persondesg = ""; String persondesg = "";
for (final String multGrph : mainDataJson.keySet()) for (final String multGrph : mainDataJson.keySet())
{ {
cnt++; cnt++;
......
...@@ -1600,6 +1600,30 @@ public class MetaDataDtl ...@@ -1600,6 +1600,30 @@ public class MetaDataDtl
gridNGraphMeataDataMap.put("datasource" + graphID, graphDataSourceMap); gridNGraphMeataDataMap.put("datasource" + graphID, graphDataSourceMap);
} }
//***End Code for Card (Added by sachin on 1-jully-2015)*****\\ //***End Code for Card (Added by sachin on 1-jully-2015)*****\\
//***Start Code for Gantt Chart (Added by sachin on 4-08-15)*****\\
if ("component".equals(viewNode.getNodeName()) && type.equalsIgnoreCase("DHTML_GANTT"))
{
graphMeataDataMap = new HashMap<String, ArrayList<Object>>();
typeGraphMap = new LinkedHashMap<String, String>();
graphDataSourceMap = new LinkedHashMap<String, String>();
graphID = viewNode.getAttributes().getNamedItem("id").getNodeValue();
type = viewNode.getAttributes().getNamedItem("type").getNodeValue();
dataSource = viewNode.getAttributes().getNamedItem("datasource").getNodeValue();
graphDataSourceMap.put("datasource" + graphID, dataSource);
typeGraphMap.put("type" + graphID, type);
graphNodeList = viewNode.getChildNodes();
conuter++;
gridNGraphMeataDataMap.put("type" + graphID, typeGraphMap);
graphMeataDataMap.put("graph" + conuter, this.getGanttDataList(graphNodeList));
gridNGraphMeataDataMap.put(graphID, graphMeataDataMap);
gridNGraphMeataDataMap.put("datasource" + graphID, graphDataSourceMap);
}
//*** End Start Code for Gantt Chart (Added by sachin on 4-8-15)*****\\
} }
} }
} }
...@@ -1849,4 +1873,114 @@ public class MetaDataDtl ...@@ -1849,4 +1873,114 @@ public class MetaDataDtl
currDate = dateFor.format(date); currDate = dateFor.format(date);
return currDate; return currDate;
} }
/* Added New Method By sachin on 12 Aug 15 */
private ArrayList<Object> getGanttDataList(NodeList graphNodeList)
{
ArrayList<String> dataList = new ArrayList<String>();
ArrayList<String> linkList = new ArrayList<String>();
ArrayList<Object> graphDtlList = new ArrayList<Object>();
NodeList groupFilterNodeList = null;
NodeList columNodeList = null;
Node groupFilterNode = null;
Node graphDataNode = null;
String componentTitle = "";
String componentIcon = "";
String childNodeName = "";
String componentCss = "";
Node columnNode = null;
String data = "";
String height = "";
String width = "";
String caption = "";
String bgColor = "";
for (int i = 0; i < graphNodeList.getLength(); i++)
{
graphDataNode = graphNodeList.item(i);
childNodeName = graphDataNode.getNodeName();
if ("ComponentTitle".equalsIgnoreCase(childNodeName))
{
componentTitle = graphDataNode.getChildNodes().item(0).getNodeValue();
}
if ("component_css".equalsIgnoreCase(childNodeName))
{
componentCss = graphDataNode.getChildNodes().item(0).getNodeValue();
}
if ("component_icon".equalsIgnoreCase(childNodeName))
{
componentIcon = graphDataNode.getChildNodes().item(0).getNodeValue();
}
if ("chart_properties".equalsIgnoreCase(childNodeName))
{
groupFilterNodeList = graphDataNode.getChildNodes();
for (int j = 0; j < groupFilterNodeList.getLength(); j++)
{
groupFilterNode = groupFilterNodeList.item(j);
if ("height".equals(groupFilterNode.getNodeName()))
{
height = groupFilterNode.getChildNodes().item(0).getNodeValue();
}
if ("width".equals(groupFilterNode.getNodeName()))
{
width = groupFilterNode.getChildNodes().item(0).getNodeValue();
}
if ("caption".equals(groupFilterNode.getNodeName()))
{
caption = groupFilterNode.getChildNodes().item(0).getNodeValue();
}
if ("bg_color".equals(groupFilterNode.getNodeName()))
{
bgColor = groupFilterNode.getChildNodes().item(0).getNodeValue();
}
}
}
if (("column_group".equalsIgnoreCase(childNodeName)) && (null) != graphDataNode.getAttributes().getNamedItem("id") && "data".equals(graphDataNode.getAttributes().getNamedItem("id").getNodeValue()))
{
groupFilterNodeList = graphDataNode.getChildNodes();
for (int j = 0; j < groupFilterNodeList.getLength(); j++)
{
groupFilterNode = groupFilterNodeList.item(j);
columNodeList = groupFilterNode.getChildNodes();
for (int k = 0; k < columNodeList.getLength(); k++)
{
columnNode = columNodeList.item(k);
data = columnNode.getAttributes().getNamedItem("id").getNodeValue();
dataList.add(data);
}
}
}
if (("column_group".equalsIgnoreCase(childNodeName)) && (null) != graphDataNode.getAttributes().getNamedItem("id") && "links".equals(graphDataNode.getAttributes().getNamedItem("id").getNodeValue()))
{
groupFilterNodeList = graphDataNode.getChildNodes();
for (int j = 0; j < groupFilterNodeList.getLength(); j++)
{
groupFilterNode = groupFilterNodeList.item(j);
columNodeList = groupFilterNode.getChildNodes();
for (int k = 0; k < columNodeList.getLength(); k++)
{
columnNode = columNodeList.item(k);
data = columnNode.getAttributes().getNamedItem("id").getNodeValue();
linkList.add(data);
}
}
}
}
graphDtlList.add(componentTitle);
graphDtlList.add(componentCss);
graphDtlList.add(height);
graphDtlList.add(width);
graphDtlList.add(caption);
graphDtlList.add(bgColor);
graphDtlList.add(componentIcon);
graphDtlList.add(dataList);
graphDtlList.add(linkList);
return graphDtlList;
}
/* End Added New Method By sachin on 12 Aug 15 */
} }
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -9,6 +9,21 @@ ...@@ -9,6 +9,21 @@
<script type="text/javascript" language="javascript" src="gwtdashboardreport/gwtdashboardreport.nocache.js"></script> <script type="text/javascript" language="javascript" src="gwtdashboardreport/gwtdashboardreport.nocache.js"></script>
<!--Start-Imports new Css And Script For gantt Chart by sachin on 05-Aug-15 -->
<script type="text/javascript" language="javascript" src="FusionChart/js/dhtmlxgantt.js"></script>
<link type="text/css" rel="stylesheet" href="dhtmlxgantt.css">
<!-- End-Imports new Css And Script For gantt Chart by sachin on 05-Aug-15 -->
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
function removeCSS() function removeCSS()
{ {
...@@ -32,6 +47,9 @@ function removeCSS() ...@@ -32,6 +47,9 @@ function removeCSS()
el.parentNode.removeChild(el); el.parentNode.removeChild(el);
} }
} }
document.getElementById('ganttfilter').style.visibility = "hidden";
} }
</script> </script>
</head> </head>
...@@ -41,7 +59,114 @@ function removeCSS() ...@@ -41,7 +59,114 @@ function removeCSS()
<div id="filterDiv" class="filterDiv"></div> <div id="filterDiv" class="filterDiv"></div>
<div id="optioDiv"></div> <div id="optioDiv"></div>
<div id="chartContainer"> <div id="chartContainer">
<!-- <div id="chartContainer2" class="outerChartContainerPos1of2"></div> -->
</div> </div>
<!--Start-Added new div For gantt Chart by sachin on 07-Aug-15 -->
<div class="filterhours" id="ganttfilter" align="left" >
<strong> Filtering: &nbsp; </strong>
<label>
<input name='filter' onclick='filter_tasks(this);' type='radio' value='' checked='true'>
<span>All tasks</span></label>
<label>
<input name='filter' onclick='filter_tasks(this);' type='radio' value='1'>
<span>Low priority</span></label>
<label>
<input name='filter' onclick='filter_tasks(this);' type='radio' value='2'>
<span>High priority</span></label>
<span>&nbsp; &nbsp; | &nbsp; &nbsp; </span>
<strong> Zooming: &nbsp; </strong>
<label>
<input name='scales' onclick='zoom_tasks(this)' type='radio' value='hours'>
<span>Hours</span></label>
<label>
<input name='scales' onclick='zoom_tasks(this)' type='radio' value='days' >
<span>Days</span></label>
<label>
<input name='scales' onclick='zoom_tasks(this)' type='radio' value='weeks' >
<span>Week</span></label>
<label>
<input name='scales' onclick='zoom_tasks(this)' type='radio' value='months'>
<span>Months</span></label>
<div id="filter_hours" align="left">
<!--
<span>&nbsp; &nbsp; | &nbsp; &nbsp; </span>
<strong> Display: &nbsp; </strong>
<label>
<input name='scales_filter' onclick='set_scale_units(this)' type='radio' value='full_day'>
<span>Full day</span>
</label>
<label>
<input name='scales_filter' onclick='set_scale_units(this)' type='radio' value='work_hours'>
<span>Office hours</span>
</label> -->
</div>
<div id="filter_days" align="left">
<!--
<span>&nbsp; &nbsp; | &nbsp; &nbsp; </span>
<strong> Display: &nbsp; </strong>
<label>
<input name='scales_filter' onclick='set_scale_units(this)' type='radio' value='full_week'>
<span>Full week</span>
</label>
<label>
<input name='scales_filter' onclick='set_scale_units(this)' type='radio' value='work_week'>
<span>Workdays</span>
</label> -->
</div>
</div>
<!--End Added new div For gantt Chart by sachin on 07-Aug-15 -->
</body> </body>
</html> </html>
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment