Commit 22062bcf authored by dkasliwal's avatar dkasliwal

update src folder


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@97962 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 1aeba394
......@@ -7,13 +7,16 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.mortbay.util.ajax.JSON;
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;
import com.google.gwt.user.client.Window;
import com.google.gwt.xml.client.Document;
import com.google.gwt.xml.client.Node;
import com.google.gwt.xml.client.NodeList;
import com.google.gwt.xml.client.XMLParser;
public class ChartCreator
{
......@@ -231,6 +234,50 @@ public class ChartCreator
{
dataStringValue = new JSONString("" + mapValuList.get(seriesCnt));
categoryMap.put(dataStringKey, dataStringValue);
if(linkLMetadataList.get(seriesCnt).length()>0)
{
linkStringKey = new JSONString("link");
String temp = Window.Location.getHref();
String prevUrl = temp.substring(temp.indexOf('&'), temp.length());
String period =FilterCreator.parameterList.get(1);
String url=Window.Location.getParameter("titleName");
String prdFilter="";
if(GWTDashBoardReport.prdFilterName.length()>0)
{
prdFilter=GWTDashBoardReport.prdFilterName;
}
if(url=="undefined" || url.equals("undefined") || url.equalsIgnoreCase("undefined"))
{
url="&titleName@"+(FilterCreator.title).get(0)+(""+jsnStringValue).replace('"', ' ').trim();
}
else
{
url="&titleName@"+url+":"+(FilterCreator.title).get(0)+(""+jsnStringValue).replace('"', ' ').trim();
}
if((prevUrl).trim().length()>1)
{
if(linkTypeList.get(seriesCnt).trim().equalsIgnoreCase("n"))
{
linkStringValue=new JSONString(linkTypeList.get(seriesCnt)+"-"+"/ibase/dwh/GwtDashboardPage.html?metadataname@"+linkLMetadataList.get(seriesCnt)+prevUrl.replace('=', '@')+"&"+prdFilter+"@"+period+url+"&"+yAxisColunList.get(seriesCnt)+"@"+(""+dataStringValue).replace('"', ' ').trim()+"&"+xAxisColunList.get(0)+"@"+(""+jsnStringValue).replace('"', ' ').trim());
}
else if(linkTypeList.get(seriesCnt).trim().equalsIgnoreCase("p"))
{
linkStringValue=new JSONString(linkTypeList.get(seriesCnt)+"-detailsPopUp,"+linkedProperties+"-/ibase/dwh/GwtDashboardPage.html?metadataname@"+linkLMetadataList.get(seriesCnt)+prevUrl.replace('=', '@')+"&"+prdFilter+"@"+period+url+"&"+yAxisColunList.get(seriesCnt)+"@"+(""+dataStringValue).replace('"', ' ').trim()+"&"+xAxisColunList.get(0)+"@"+(""+jsnStringValue).replace('"', ' ').trim());
}
}
else
{
if(linkTypeList.get(seriesCnt).trim().equalsIgnoreCase("n"))
{
linkStringValue=new JSONString(linkTypeList.get(seriesCnt)+"-"+"/ibase/dwh/GwtDashboardPage.html?metadataname@"+linkLMetadataList.get(seriesCnt)+"&"+prdFilter+"@"+period+url+"&"+yAxisColunList.get(seriesCnt)+"@"+(""+dataStringValue).replace('"', ' ').trim()+"&"+xAxisColunList.get(0)+"@"+(""+jsnStringValue).replace('"', ' ').trim());
}
else if(linkTypeList.get(seriesCnt).trim().equalsIgnoreCase("p")){
linkStringValue=new JSONString(linkTypeList.get(seriesCnt)+"-detailsPopUp,"+linkedProperties+"-/ibase/dwh/GwtDashboardPage.html?metadataname@"+linkLMetadataList.get(seriesCnt)+"&"+prdFilter+"@"+period+url+"&"+yAxisColunList.get(seriesCnt)+"@"+(""+dataStringValue).replace('"', ' ').trim()+"&"+xAxisColunList.get(0)+"@"+(""+jsnStringValue).replace('"', ' ').trim());
}
}
categoryMap.put(linkStringKey, linkStringValue);
}
barValueList.add(categoryMap);
barDataVal = JSONParser.parseStrict(barValueList.toString().replace('=', ':'));
}
......@@ -330,9 +377,11 @@ public class ChartCreator
barChartMap.put(new JSONString("showValue"), new JSONString(showValList.get(seriesCnt)));
linkStringKey = new JSONString("link");
String temp = Window.Location.getHref();
String prevUrl = temp.substring(temp.indexOf('&'), temp.length());
String period =FilterCreator.parameterList.get(1);
String url=Window.Location.getParameter("titleName");
String prdFilter="";
if(GWTDashBoardReport.prdFilterName.length()>0)
......@@ -347,29 +396,50 @@ public class ChartCreator
{
url="&titleName@"+url+":"+(FilterCreator.title).get(0)+(""+jsnStringValue).replace('"', ' ').trim();
}
String linkType=linkTypeList.get(seriesCnt).trim();
if((prevUrl).trim().length()>1)
{
if(linkTypeList.get(seriesCnt).trim().equalsIgnoreCase("n"))
if(linkType.equalsIgnoreCase("n"))
{
linkStringValue=new JSONString(linkTypeList.get(seriesCnt)+"-"+"/ibase/dwh/GwtDashboardPage.html?metadataname@"+linkLMetadataList.get(seriesCnt)+prevUrl.replace('=', '@')+"&"+prdFilter+"@"+period+url+"&"+yAxisColunList.get(seriesCnt)+"@"+(""+dataStringValue).replace('"', ' ').trim()+"&"+xAxisColunList.get(0)+"@"+(""+jsnStringValue).replace('"', ' ').trim());
if(linkLMetadataList.get(seriesCnt).trim().contains("/"))
{
linkStringValue=new JSONString(linkType+"-"+linkLMetadataList.get(seriesCnt)+prevUrl.replace('=', '@')+"&"+prdFilter+"@"+period+url+"&"+yAxisColunList.get(seriesCnt)+"@"+(""+dataStringValue).replace('"', ' ').trim()+"&"+xAxisColunList.get(0)+"@"+(""+jsnStringValue).replace('"', ' ').trim());
}else {
linkStringValue=new JSONString(linkType+"-"+"/ibase/dwh/GwtDashboardPage.html?metadataname@"+linkLMetadataList.get(seriesCnt)+prevUrl.replace('=', '@')+"&"+prdFilter+"@"+period+url+"&"+yAxisColunList.get(seriesCnt)+"@"+(""+dataStringValue).replace('"', ' ').trim()+"&"+xAxisColunList.get(0)+"@"+(""+jsnStringValue).replace('"', ' ').trim());
}
else if(linkTypeList.get(seriesCnt).trim().equalsIgnoreCase("p"))
}
else if(linkType.equalsIgnoreCase("p"))
{
linkStringValue=new JSONString(linkTypeList.get(seriesCnt)+"-detailsPopUp,"+linkedProperties+"-/ibase/dwh/GwtDashboardPage.html?metadataname@"+linkLMetadataList.get(seriesCnt)+prevUrl.replace('=', '@')+"&"+prdFilter+"@"+period+url+"&"+yAxisColunList.get(seriesCnt)+"@"+(""+dataStringValue).replace('"', ' ').trim()+"&"+xAxisColunList.get(0)+"@"+(""+jsnStringValue).replace('"', ' ').trim());
if(linkLMetadataList.get(seriesCnt).trim().contains("/"))
{
linkStringValue=new JSONString(linkType+"-detailsPopUp,"+linkedProperties+"-"+linkLMetadataList.get(seriesCnt)+prevUrl.replace('=', '@')+"&"+prdFilter+"@"+period+url+"&"+yAxisColunList.get(seriesCnt)+"@"+(""+dataStringValue).replace('"', ' ').trim()+"&"+xAxisColunList.get(0)+"@"+(""+jsnStringValue).replace('"', ' ').trim());
}else {
linkStringValue=new JSONString(linkType+"-detailsPopUp,"+linkedProperties+"-/ibase/dwh/GwtDashboardPage.html?metadataname@"+linkLMetadataList.get(seriesCnt)+prevUrl.replace('=', '@')+"&"+prdFilter+"@"+period+url+"&"+yAxisColunList.get(seriesCnt)+"@"+(""+dataStringValue).replace('"', ' ').trim()+"&"+xAxisColunList.get(0)+"@"+(""+jsnStringValue).replace('"', ' ').trim());
}
}
}
else
{
if(linkTypeList.get(seriesCnt).trim().equalsIgnoreCase("n"))
if(linkType.equalsIgnoreCase("n"))
{
linkStringValue=new JSONString(linkTypeList.get(seriesCnt)+"-"+"/ibase/dwh/GwtDashboardPage.html?metadataname@"+linkLMetadataList.get(seriesCnt)+"&"+prdFilter+"@"+period+url+"&"+yAxisColunList.get(seriesCnt)+"@"+(""+dataStringValue).replace('"', ' ').trim()+"&"+xAxisColunList.get(0)+"@"+(""+jsnStringValue).replace('"', ' ').trim());
if(linkLMetadataList.get(seriesCnt).trim().contains("/"))
{
linkStringValue=new JSONString(linkType+"-"+linkLMetadataList.get(seriesCnt)+"&"+prdFilter+"@"+period+url+"&"+yAxisColunList.get(seriesCnt)+"@"+(""+dataStringValue).replace('"', ' ').trim()+"&"+xAxisColunList.get(0)+"@"+(""+jsnStringValue).replace('"', ' ').trim());
}else {
linkStringValue=new JSONString(linkType+"-"+"/ibase/dwh/GwtDashboardPage.html?metadataname@"+linkLMetadataList.get(seriesCnt)+"&"+prdFilter+"@"+period+url+"&"+yAxisColunList.get(seriesCnt)+"@"+(""+dataStringValue).replace('"', ' ').trim()+"&"+xAxisColunList.get(0)+"@"+(""+jsnStringValue).replace('"', ' ').trim());
}
}
else if(linkType.equalsIgnoreCase("p"))
{
if(linkLMetadataList.get(seriesCnt).trim().contains("/"))
{
linkStringValue=new JSONString(linkType+"-detailsPopUp,"+linkedProperties+"-"+linkLMetadataList.get(seriesCnt)+"&"+prdFilter+"@"+period+url+"&"+yAxisColunList.get(seriesCnt)+"@"+(""+dataStringValue).replace('"', ' ').trim()+"&"+xAxisColunList.get(0)+"@"+(""+jsnStringValue).replace('"', ' ').trim());
}else {
linkStringValue=new JSONString(linkType+"-detailsPopUp,"+linkedProperties+"-/ibase/dwh/GwtDashboardPage.html?metadataname@"+linkLMetadataList.get(seriesCnt)+"&"+prdFilter+"@"+period+url+"&"+yAxisColunList.get(seriesCnt)+"@"+(""+dataStringValue).replace('"', ' ').trim()+"&"+xAxisColunList.get(0)+"@"+(""+jsnStringValue).replace('"', ' ').trim());
}
else if(linkTypeList.get(seriesCnt).trim().equalsIgnoreCase("p")){
linkStringValue=new JSONString(linkTypeList.get(seriesCnt)+"-detailsPopUp,"+linkedProperties+"-/ibase/dwh/GwtDashboardPage.html?metadataname@"+linkLMetadataList.get(seriesCnt)+"&"+prdFilter+"@"+period+url+"&"+yAxisColunList.get(seriesCnt)+"@"+(""+dataStringValue).replace('"', ' ').trim()+"&"+xAxisColunList.get(0)+"@"+(""+jsnStringValue).replace('"', ' ').trim());
}
}
barChartMap.put(linkStringKey, linkStringValue);
//barChartMap.put(new JSONString("color"), new JSONString(colorInfoList.get(seriesCnt)));
barValueList.add(barChartMap);
}
barDataVal = JSONParser.parseStrict(barValueList.toString().replace('=', ':'));
......@@ -670,11 +740,12 @@ public class ChartCreator
dataJson.put(new JSONString("showValue"),new JSONString(showValueList.get(i)));
dataJson.put(new JSONString("columnid"),new JSONString(columnNameList.get(i)));
dataJson.put(new JSONString("value"),new JSONString(mapValuList.get(i)));
/*add link code here 29 jan 2015*/
String temp = Window.Location.getHref();
String prevUrl = temp.substring(temp.indexOf('&'), temp.length());
String period =FilterCreator.parameterList.get(1);
String url=Window.Location.getParameter("titleName");
/*add link code here 29 jan 2015*/
String prdFilter="";
if(GWTDashBoardReport.prdFilterName.length()>0)
{
......@@ -746,4 +817,359 @@ public class ChartCreator
return graphJson;
}
// ended new method of heat map
/**Start of Gantt chart method by swati dated: 05 April 2015 **/
public static JSONObject buildCountryMap(ArrayList<ArrayList<String>> graphDtlList, JSONObject jsonObjGraph, String dataSource)
{
JSONObject graphJson = new JSONObject();
ArrayList<String> metaDataList = new ArrayList<String>();
ArrayList<String> columnIdList = new ArrayList<String>();
ArrayList<String> columnValueList = new ArrayList<String>();
ArrayList<String> colorRangeList = new ArrayList<String>();
ArrayList<String> colorList = new ArrayList<String>();
ArrayList<String> toptoolTipList = new ArrayList<String>();
ArrayList<String> bottomToolTipList = new ArrayList<String>();
ArrayList<String> linkedMetadataList = new ArrayList<String>();
ArrayList<String> linkTypeList = new ArrayList<String>();
ArrayList<String> showLabelList = new ArrayList<String>();
ArrayList<String> hovercolorList = new ArrayList<String>();
ArrayList<String> toolTextLblList= null;
JSONValue jsonChartVal = null;
JSONObject colorDataJson = new JSONObject();
JSONValue colorDataVal = null;
String key = "";
String currentvalue = "";
List<String> valueList = null;
HashMap<String, List<String>> allDataMap = null;
HashMap<String, List<String>> coulmnValueMap = null;
HashMap<String, List<String>> topToolTipDateMap = null;
HashMap<String, List<String>> bottomToolTipDateMap = null;
HashMap<String, List<String>> showLableMap = null;
HashMap<String, List<String>> useHoverMap = null;
HashMap<String, List<String>> toolTextDataMap = null;
Set<String> valueMapSet = null;
List<String> colValueList =null;
List<String> topToolList =null;
List<String> bottomToolList =null;
List<String> toolTextDataList= null;
JSONString linkStringKey = null;
JSONString linkStringValue = null;
String linkedProperties="";
/*Start Declaration part for maxvalue dyanamic by dhanendra on 25/04/2015 */
String avgVal = "";
String maxVal = "";
String colorListNodeStr = "";
String colorListXmlStr = "";
Document document = null;
NodeList rootNodeList = null;
Node rootNode = null;
LinkedHashMap<JSONString, JSONString> colorDataMap = null;
Node columnNode = null;
JSONString dataStringValue = null;
JSONString jsnStringKey = null;
/*End Declaration part for maxvalue dyanamic by dhanendra on 25/04/2015 */
LinkedHashMap<JSONString, JSONValue> dataValueJson = new LinkedHashMap<JSONString, JSONValue>();
List<LinkedHashMap<JSONString, JSONValue>> dataValueJsonList = new ArrayList<LinkedHashMap<JSONString, JSONValue>>();
for (int i = 0; i < graphDtlList.size(); i++)
{
if (i == 3)
{
metaDataList = (ArrayList<String>) graphDtlList.get(i);
}
if (i == 4)
{
columnIdList = (ArrayList<String>) graphDtlList.get(i);
}
if (i == 5)
{
columnValueList = (ArrayList<String>) graphDtlList.get(i);
}
if (i == 6)
{
colorRangeList = (ArrayList<String>) graphDtlList.get(i);
}
if (i == 7)
{
colorList = (ArrayList<String>) graphDtlList.get(i);
}
if (i == 8)
{
toptoolTipList = (ArrayList<String>) graphDtlList.get(i);
}
if (i == 9)
{
bottomToolTipList = (ArrayList<String>)graphDtlList.get(i);
}
if (i == 10)
{
linkedMetadataList = (ArrayList<String>)graphDtlList.get(i);
}
if (i == 11)
{
linkTypeList = (ArrayList<String>)graphDtlList.get(i);
}
if (i == 12)
{
showLabelList = (ArrayList<String>)graphDtlList.get(i);
}
if (i == 13)
{
hovercolorList = (ArrayList<String>)graphDtlList.get(i);
}
if (i == 14)
{
toolTextLblList = (ArrayList<String>)graphDtlList.get(i);
}
}
if (jsonObjGraph != null)
{
allDataMap = new HashMap<String, List<String>>();
coulmnValueMap = new HashMap<String, List<String>>();
topToolTipDateMap= new HashMap<String, List<String>>();
bottomToolTipDateMap= new HashMap<String, List<String>>();
toolTextDataMap= new HashMap<String, List<String>>();
try
{
jsonChartVal = JSONParser.parseStrict(metaDataList.get(0));
graphJson.put("map", jsonChartVal);
JSONObject jsonObjFrGraph =(JSONObject) jsonObjGraph.get(dataSource);
for (int jsnCnt = 0; jsnCnt < jsonObjFrGraph.size(); jsnCnt++)
{
JSONObject fetchRowWiseVal = (JSONObject) jsonObjFrGraph.get(String.valueOf(jsnCnt));
/*if(jsnCnt == 0)
{*/
avgVal = ""+fetchRowWiseVal.get("avgval");
maxVal = ""+fetchRowWiseVal.get("maxval");
maxVal = maxVal.replace('"', ' ');
avgVal = avgVal.replace('"', ' ');
/*}*/
for (int xCnt = 0; xCnt < columnIdList.size(); xCnt++)
{
if(fetchRowWiseVal.get(columnIdList.get(xCnt))!=null)
key = (columnIdList.get(xCnt));
}
valueList = new ArrayList<String>();
for (int yCnt = 0; yCnt < columnIdList.size(); yCnt++)
{
if(fetchRowWiseVal.get(columnIdList.get(yCnt)) !=null)
{
currentvalue = (fetchRowWiseVal.get(columnIdList.get(yCnt)).toString().replace('"', ' ').trim());
valueList.add(currentvalue);
}
}
coulmnValueMap.put(key, valueList);
valueList = new ArrayList<String>();
for (int yCnt = 0; yCnt < columnIdList.size(); yCnt++)
{
if(fetchRowWiseVal.get(columnIdList.get(yCnt)) !=null)
{
currentvalue = (fetchRowWiseVal.get(toptoolTipList.get(yCnt)).toString().replace('"', ' ').trim());
valueList.add(currentvalue);
}
}
topToolTipDateMap.put(key, valueList);
valueList = new ArrayList<String>();
for (int yCnt = 0; yCnt < columnIdList.size(); yCnt++)
{
if(fetchRowWiseVal.get(columnIdList.get(yCnt)) !=null)
{
currentvalue = (fetchRowWiseVal.get(bottomToolTipList.get(yCnt)).toString().replace('"', ' ').trim());
valueList.add(currentvalue);
}
}
bottomToolTipDateMap.put(key, valueList);
valueList = new ArrayList<String>();
for (int yCnt = 0; yCnt < columnIdList.size(); yCnt++)
{
if(toolTextLblList.get(yCnt).trim().length()!=0)
{
currentvalue = (fetchRowWiseVal.get(toolTextLblList.get(yCnt)).toString().replace('"', ' ').trim());
}else
{
currentvalue="";
}
valueList.add(currentvalue);
}
toolTextDataMap.put(key, valueList);
}
valueMapSet = coulmnValueMap.keySet();
int cnt=0;
for (String keyString : valueMapSet)
{
colValueList=coulmnValueMap.get(keyString);
topToolList=topToolTipDateMap.get(keyString);
bottomToolList = bottomToolTipDateMap.get(keyString);
toolTextDataList = toolTextDataMap.get(keyString);
if(colValueList.size()>0)
{
linkStringValue=null;
dataValueJson=new LinkedHashMap<JSONString, JSONValue>();
dataValueJson.put(new JSONString("id"), new JSONString(keyString.replace('"', ' ').trim()));
dataValueJson.put(new JSONString("value"), new JSONString(colValueList.get(0)));
dataValueJson.put(new JSONString("showLabel"), new JSONString(showLabelList.get(cnt)));
dataValueJson.put(new JSONString("useHoverColor"), new JSONString(hovercolorList.get(cnt)));
dataValueJson.put(new JSONString("tooltext"), new JSONString(toolTextDataList.get(cnt)));
/******start of code for link to new chart*/
if(linkedMetadataList.get(cnt).trim().length()>0)
{
/*String temp = Window.Location.getHref();
String prevUrl = temp.substring(temp.indexOf('&'), temp.length());
String period =FilterCreator.parameterList.get(1);
String url=Window.Location.getParameter("titleName");
String prdFilter="";
if(GWTDashBoardReport.prdFilterName.length()>0)
{
prdFilter=GWTDashBoardReport.prdFilterName;
}
if(url=="undefined" || url.equals("undefined") || url.equalsIgnoreCase("undefined"))
{
url="&titleName@"+(FilterCreator.title).get(0)+(""+jsnStringValue).replace('"', ' ').trim();
}
else
{
url="&titleName@"+url+":"+(FilterCreator.title).get(0)+(""+jsnStringValue).replace('"', ' ').trim();
}*/
String linkType=linkTypeList.get(cnt).trim();
//if((prevUrl).trim().length()>1)
//{
if(linkType.equalsIgnoreCase("n"))
{
if(linkedMetadataList.get(cnt).trim().contains("/"))
{
linkStringValue=new JSONString(linkType+"-"+linkedMetadataList.get(cnt));
//linkStringValue=new JSONString(linkType+"-"+linkedMetadataList.get(cnt)+prevUrl.replace('=', '@')+"&"+prdFilter+"@"+period+url+"&"+yAxisColunList.get(seriesCnt)+"@"+(""+dataStringValue).replace('"', ' ').trim()+"&"+xAxisColunList.get(0)+"@"+(""+jsnStringValue).replace('"', ' ').trim());
}else {
linkStringValue=new JSONString(linkType+"-"+"/ibase/dwh/GwtDashboardPage.html?metadataname@"+linkedMetadataList.get(cnt));
//linkStringValue=new JSONString(linkType+"-"+"/ibase/dwh/GwtDashboardPage.html?metadataname@"+linkedMetadataList.get(seriesCnt)+prevUrl.replace('=', '@')+"&"+prdFilter+"@"+period+url+"&"+yAxisColunList.get(seriesCnt)+"@"+(""+dataStringValue).replace('"', ' ').trim()+"&"+xAxisColunList.get(0)+"@"+(""+jsnStringValue).replace('"', ' ').trim());
}
}
else if(linkType.equalsIgnoreCase("p"))
{
if(linkedMetadataList.get(cnt).trim().contains("/"))
{
linkStringValue=new JSONString(linkType+"-"+linkedMetadataList.get(cnt));
//linkStringValue=new JSONString(linkType+"-detailsPopUp,"+linkedProperties+"-"+linkedMetadataList.get(cnt)+prevUrl.replace('=', '@')+"&"+prdFilter+"@"+period+url+"&"+yAxisColunList.get(seriesCnt)+"@"+(""+dataStringValue).replace('"', ' ').trim()+"&"+xAxisColunList.get(0)+"@"+(""+jsnStringValue).replace('"', ' ').trim());
}else {
linkStringValue=new JSONString(linkType+"-"+"/ibase/dwh/GwtDashboardPage.html?metadataname@"+linkedMetadataList.get(cnt));
//linkStringValue=new JSONString(linkType+"-detailsPopUp,"+linkedProperties+"-/ibase/dwh/GwtDashboardPage.html?metadataname@"+linkedMetadataList.get(cnt)+prevUrl.replace('=', '@')+"&"+prdFilter+"@"+period+url+"&"+yAxisColunList.get(seriesCnt)+"@"+(""+dataStringValue).replace('"', ' ').trim()+"&"+xAxisColunList.get(0)+"@"+(""+jsnStringValue).replace('"', ' ').trim());
}
}
/*}
else
{
if(linkType.equalsIgnoreCase("n"))
{
if(linkedMetadataList.get(cnt).trim().contains("/"))
{
linkStringValue=new JSONString(linkType+"-"+linkedMetadataList.get(cnt)+"&"+prdFilter+"@"+period+url+"&"+yAxisColunList.get(seriesCnt)+"@"+(""+dataStringValue).replace('"', ' ').trim()+"&"+xAxisColunList.get(0)+"@"+(""+jsnStringValue).replace('"', ' ').trim());
}else {
linkStringValue=new JSONString(linkType+"-"+"/ibase/dwh/GwtDashboardPage.html?metadataname@"+linkedMetadataList.get(cnt)+"&"+prdFilter+"@"+period+url+"&"+yAxisColunList.get(seriesCnt)+"@"+(""+dataStringValue).replace('"', ' ').trim()+"&"+xAxisColunList.get(0)+"@"+(""+jsnStringValue).replace('"', ' ').trim());
}
}
else if(linkType.equalsIgnoreCase("p"))
{
if(linkedMetadataList.get(cnt).trim().contains("/"))
{
linkStringValue=new JSONString(linkType+"-detailsPopUp,"+linkedProperties+"-"+linkedMetadataList.get(cnt)+"&"+prdFilter+"@"+period+url+"&"+yAxisColunList.get(seriesCnt)+"@"+(""+dataStringValue).replace('"', ' ').trim()+"&"+xAxisColunList.get(0)+"@"+(""+jsnStringValue).replace('"', ' ').trim());
}else {
linkStringValue=new JSONString(linkType+"-detailsPopUp,"+linkedProperties+"-/ibase/dwh/GwtDashboardPage.html?metadataname@"+linkedMetadataList.get(cnt)+"&"+prdFilter+"@"+period+url+"&"+yAxisColunList.get(seriesCnt)+"@"+(""+dataStringValue).replace('"', ' ').trim()+"&"+xAxisColunList.get(0)+"@"+(""+jsnStringValue).replace('"', ' ').trim());
}
}
}*/
/*end of code for link to new chatr*/
dataValueJson.put(new JSONString("link"), linkStringValue);
}
dataValueJsonList.add(dataValueJson);
}
cnt++;
}
graphJson.put("data", JSONParser.parseStrict(dataValueJsonList.toString().replace('=', ':')));
for (int clrRngCnt = 0; clrRngCnt < colorRangeList.size(); clrRngCnt++)
{
if(clrRngCnt==0)
{
colorDataJson.put("startlabel",new JSONString(colorRangeList.get(clrRngCnt)));
}
if(clrRngCnt==1 )
{
colorDataJson.put("endlabel",new JSONString(colorRangeList.get(clrRngCnt)));
}
if(clrRngCnt==2)
{
colorDataJson.put("gradient",new JSONString(colorRangeList.get(clrRngCnt)));
}
if(clrRngCnt==3)
{
colorDataJson.put("minvalue",new JSONString(colorRangeList.get(clrRngCnt)));
}
if(clrRngCnt==4)
{
colorDataJson.put("code",new JSONString((colorRangeList.get(clrRngCnt)).toString()));
}
}
colorListNodeStr = colorList.toString().replace("[", "").replace("]", "");
colorListXmlStr = "<Root>" + colorListNodeStr + "</Root>";
colorList = new ArrayList<String>();
document = XMLParser.parse(colorListXmlStr) ;
rootNodeList = document.getElementsByTagName("Root").item(0).getChildNodes();
//Window.alert("avgval : "+ avgVal+ "maxval :"+maxVal);
for (int rootCtr = 0; rootCtr < rootNodeList.getLength(); rootCtr++)
{
rootNode = rootNodeList.item(rootCtr);
if ("color".equals(rootNode.getNodeName()))
{
colorDataMap = new LinkedHashMap<JSONString, JSONString>();
columnNode = rootNode;
if (columnNode.getAttributes().getNamedItem("code") != null)
{
dataStringValue = new JSONString(columnNode.getAttributes().getNamedItem("code").getNodeValue());
jsnStringKey = new JSONString("code");
colorDataMap.put(jsnStringKey, dataStringValue);
}
if (columnNode.getAttributes().getNamedItem("maxvalue") != null)
{
dataStringValue = new JSONString(columnNode.getAttributes().getNamedItem("maxvalue").getNodeValue());
jsnStringKey = new JSONString("maxvalue");
if(rootCtr == 0)
{
//Window.alert("avgVal :"+avgVal);
colorDataMap.put(jsnStringKey, new JSONString(avgVal));
}else if(rootCtr == 1)
{
//Window.alert("maxVal :"+maxVal);
colorDataMap.put(jsnStringKey, new JSONString(maxVal));
}
}
if (columnNode.getAttributes().getNamedItem("label") != null)
{
dataStringValue = new JSONString(columnNode.getAttributes().getNamedItem("label").getNodeValue());
jsnStringKey = new JSONString("displayvalue");
colorDataMap.put(jsnStringKey, dataStringValue);
}
colorList.add(colorDataMap.toString().replace('=', ':'));
}
}
//Window.alert("colorList afer loop : "+colorList);
colorDataVal = JSONParser.parseStrict(colorList.toString());
colorDataJson.put("color", colorDataVal);
graphJson.put("colorrange", colorDataJson);
}
catch (Exception e)
{
Window.alert("Exception :ChartCreator : buildCountryMap() : Build Country Mapcomponent [" + e.getMessage() + "]");
}
}
return graphJson;
}
/**End of Gantt chart method by swati dated: 05 April 2015 **/
}
......@@ -80,7 +80,6 @@ public class CustomGrid extends AbstractDataGrid<DataGridTableRowModel>
@Override
public void createContextMenu() {
}
/*Start code for progess bar to data building- Dhanendra 17Nov2014*/
protected E12LoadingInterface e12LoadImg=new E12LoadingInterface();
/*End code for progess bar to data building- Dhanendra 17Nov2014*/
......@@ -142,14 +141,18 @@ public class CustomGrid extends AbstractDataGrid<DataGridTableRowModel>
count=rowData.size();
for(int jDataCtr=0;jDataCtr<graphDtlList.size();jDataCtr++)
{
//if(jsonEachRow.get(graphDtlList.get(jDataCtr))!=null)
// {
if(jsonEachRow.get(graphDtlList.get(jDataCtr))!=null)
{
//Changed By Prashant Chavan on 11-Mar-15 [For Link Chart] Start
if(graphMetaLink !=null && graphMetaLink !="")
{
/*if(graphLinkFormat !=null && graphLinkFormat !="")
{
celldata = new E12CustomTextCell.CellData(0,(""+jsonEachRow.get(""+graphDtlList.get(jDataCtr))).replace('"', ' '),graphMetaLink+"@"+graphLinkFormat);
}else
{*/
celldata = new E12CustomTextCell.CellData(0,(""+jsonEachRow.get(""+graphDtlList.get(jDataCtr))).replace('"', ' '),graphMetaLink);
//}
}
else
{
......@@ -162,7 +165,6 @@ public class CustomGrid extends AbstractDataGrid<DataGridTableRowModel>
rowData.put(count, celldata);
count++;
}
// }
}
}
celldata.setMandatory(true);
......@@ -190,10 +192,12 @@ public class CustomGrid extends AbstractDataGrid<DataGridTableRowModel>
graphAlignList.add(""+graphAlignMap.get(graphKey));
}
}
String arr[] = graphLinkFormat.split("@");
graphLinkFormat = arr[0];
graphCaptionList.add(""+graphCaptioneMap.get("componentCaption"+componentId));
if(graphLinkFormat.equalsIgnoreCase("F"))
//Window.alert("graphLinkFormat: "+graphLinkFormat);
//if(graphLinkFormat.contains("@"))
//{
String arr[] = graphLinkFormat.split("@");
if(arr[0].equalsIgnoreCase("F"))
{
flexTable=createTableComponent(dataGridTableRowList,dataGridTableColList,flexTable,graphAlignList,graphCaptionList,graphLinkFormat);
}
......@@ -202,6 +206,13 @@ public class CustomGrid extends AbstractDataGrid<DataGridTableRowModel>
flexTable.setStyleName("flexCSS");
flexTable=createTableComponent(dataGridTableRowList,dataGridTableColList,flexTable,graphAlignList,graphCaptionList);
}
/*}
else
{
flexTable.setStyleName("flexCSS");
flexTable=createTableComponent(dataGridTableRowList,dataGridTableColList,flexTable,graphAlignList,graphCaptionList);
}*/
e12LoadImg.setLoading(false);
} catch (Exception e)
{
......@@ -272,18 +283,20 @@ public class CustomGrid extends AbstractDataGrid<DataGridTableRowModel>
{
firstColumn = column;
}
sortHandler.setComparator( column , new Comparator<DataGridTableRowModel>() {
sortHandler.setComparator( column , new Comparator<DataGridTableRowModel>()
{
public int compare( DataGridTableRowModel o1, DataGridTableRowModel o2 )
{
if(isValidDate1(o1.getCellText( index )) && isValidDate1(o2.getCellText( index )))
{
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yy");
Date date1=null,date2=null;
try {
try
{
date1 = formatter.parse(o1.getCellText( index ));
date2 = formatter.parse(o2.getCellText( index ));
} catch (Exception e) {
} catch (Exception e)
{
e.printStackTrace();
}
return date1.compareTo(date2);
......@@ -417,11 +430,8 @@ public class CustomGrid extends AbstractDataGrid<DataGridTableRowModel>
//flexTable.setHeight( Window.getClientHeight() - 240 + "px" );
flexTable.setHeight("280px");
setHeight("280px");
/*setHeight( Window.getClientHeight() - 207+ "px" );*/
/*setHeight( ( ( Window.getClientHeight() - 250 ))+ "px" );*/
addStyleName("e12AdvDataGrid-SideBars");
return flexTable;
......@@ -535,6 +545,7 @@ public class CustomGrid extends AbstractDataGrid<DataGridTableRowModel>
dispFilterStatus = splitArr[2];
if(linkFormat.trim().length()>0 && linkFormat.trim().equalsIgnoreCase("F"))
{
buildGridFrame(metadataName,cellValue, propertyStr,urlStr,parameterListString,dispFilterStatus);
}
if(linkFormat.trim().length()>0 && linkFormat.trim().equalsIgnoreCase("P"))
{
......@@ -544,14 +555,15 @@ public class CustomGrid extends AbstractDataGrid<DataGridTableRowModel>
{
Window.open("/ibase/dwh/GwtDashboardPage.html?metadataname="+metadataName+"&CELL_VAL="+cellValue.trim()+propertyStr+"&"+parameterListString+"&FLAG="+dispFilterStatus+"&P1="+urlStr,"", "");
}*/
buildGridFrame(metadataName,cellValue, propertyStr,urlStr,parameterListString);
buildGridFrame(metadataName,cellValue, propertyStr,urlStr,parameterListString,dispFilterStatus);
}
}
private native void buildGridFrame(String metadataName,String cellValue,String propertyStr,String urlStr,String parameterListString)
private native void buildGridFrame(String metadataName,String cellValue,String propertyStr,String urlStr,String parameterListString,String dispFilterStatus)
/*-{
try {
document.getElementById('frameContainer').innerHTML = "<iframe scrolling='no' id='frame1' width='99%' height='230' frameborder='0' src='/ibase/dwh/GwtDashboardPage.html?metadataname="+metadataName+propertyStr+"&"+parameterListString+"&CELL_VAL="+cellValue.trim()+"&P1="+urlStr+"&FLAG=N'></iframe>";
//document.getElementById('frameContainer').innerHTML = "<iframe scrolling='no' id='frame1' width='99%' height='230' frameborder='0' src='/ibase/dwh/GwtDashboardPage.html?metadataname="+metadataName+propertyStr+"&"+parameterListString+"&CELL_VAL="+cellValue.trim()+"&P1="+urlStr+"&FLAG="+dispFilterStatus+"'></iframe>";
} catch (e) {
alert("Excpeiton :: GraphComponent : createChart [" + e.message+ "]");
......
......@@ -37,7 +37,7 @@ public class E12DashBoardPage extends Composite
try
{
this.metaDataJsnObj = metaDataJsnObj;
graphComponent = new GraphComponent(parameterList,metaDataJsnObj);
graphComponent = new GraphComponent(parameterList,metaDataJsnObj,"Y");
graphComponent.setWidth("100%");
mainReportContainer.setWidth("100%");
mainReportContainer.add(graphComponent);
......
......@@ -42,6 +42,9 @@ import com.google.gwt.xml.client.Document;
import com.google.gwt.xml.client.Node;
import com.google.gwt.xml.client.NodeList;
import com.google.gwt.xml.client.XMLParser;
import com.google.gwt.user.datepicker.client.DateBox;
import com.google.gwt.i18n.client.DateTimeFormat;
public class FilterCreator extends Composite
{
......@@ -60,6 +63,7 @@ public class FilterCreator extends Composite
Label label = null;
public static ArrayList<String> title = new ArrayList<String>();
public static ArrayList<String> parameterList = null;
public static ArrayList<String> parameterListDtl = null;
HorizontalPanel headingLableImgPanel = new HorizontalPanel();
String windowTitle = "Title";
MetaDataDtl metaDataDtl =new MetaDataDtl();
......@@ -70,6 +74,7 @@ public class FilterCreator extends Composite
{
boolean showFilter=metaDataDtl.isFiltrHide(metaDataJsnObj);
this.parameterList = parameterList;
this.parameterListDtl = parameterList;
label = new Label();
setTitleOnFilterSubmit(parameterList,metaDataJsnObj);
xmlName = parameterList.get(0);
......@@ -131,6 +136,16 @@ public class FilterCreator extends Composite
this.parameterList = parameterList;
}
public ArrayList<String> getParameterListDtl()
{
return parameterListDtl;
}
public void setParameterListDtl(ArrayList<String> parameterListDtl)
{
this.parameterListDtl = parameterListDtl;
}
public void getMetaDataForFltr(final ArrayList<String> parameterList)
{
......@@ -219,6 +234,83 @@ public class FilterCreator extends Composite
{
getPopHelpString(popUpHPnl, filterInfo, fltrParmtrArray);
}
/*Start Code for Datepicker by Dhanendra on 13/04/2015*/
if (filterInfo.filterType.equals("4"))
{
DateTimeFormat dateFormat = DateTimeFormat.getFormat("dd/MM/yyyy");
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yy");
DateBox dateBox = new DateBox();
dateBox.setFormat(new DateBox.DefaultFormat(dateFormat));
dateBox.setTitle(filterInfo.getColName());
dateBox.setStylePrimaryName("textBoxCss");
VerticalPanel outerVPanel = new VerticalPanel();
HorizontalPanel Hpanel = new HorizontalPanel();
VerticalPanel Vpanel = new VerticalPanel();
columnNameLbl = new Label("" + filterInfo.getColName());
Vpanel.add(columnNameLbl);
columnNameLbl.setStyleName("filterHeaderLabel");
Vpanel.setStyleName("filterHeaderPanel");
Hpanel.add(dateBox);
outerVPanel.add(Vpanel);
outerVPanel.add(Hpanel);
//Window.alert("fltrParmtrArray: "+fltrParmtrArray);
//Added By Prashant Chavan on 27-Apr-15 For setting the value in date box Start
if (fltrParmtrArray != null)
{
for (int arrayCnt = 0; arrayCnt < fltrParmtrArray.length; arrayCnt++)
{
Date date =null;
try {
date = formatter.parse(fltrParmtrArray[arrayCnt]);
} catch (Exception e) {
//Window.alert("Exception in Date"+e.getMessage());
}
dateBox.setValue(date);
//dateBox.setText(fltrParmtrArray[arrayCnt]);
}
}
//Added By Prashant Chavan on 27-Apr-15 For setting the value in date box End
popUpHPnl.add(outerVPanel);
}
/*End Code for Datepicker by Dhanendra on 13/04/2015*/
/****Start Code for Datepicker by Dhanendra on 13/04/2015*/
/*if (filterInfo.filterType.equals("4"))
{
DateTimeFormat dateFormat = DateTimeFormat.getFormat("dd/MM/yyyy");
DateBox dateBox = new DateBox();
dateBox.setFormat(new DateBox.DefaultFormat(dateFormat));
dateBox.setTitle(filterInfo.getColName());
dateBox.setStylePrimaryName("textBoxCss");
VerticalPanel outerVPanel = new VerticalPanel();
HorizontalPanel Hpanel = new HorizontalPanel();
VerticalPanel Vpanel = new VerticalPanel();
columnNameLbl = new Label("" + filterInfo.getColName());
Vpanel.add(columnNameLbl);
columnNameLbl.setStyleName("filterHeaderLabel");
Vpanel.setStyleName("filterHeaderPanel");
Hpanel.add(dateBox);
outerVPanel.add(Vpanel);
outerVPanel.add(Hpanel);
popUpHPnl.add(outerVPanel);
/* if (fltrParmtrArray != null)
{
for (int arrayCnt = 0; arrayCnt < fltrParmtrArray.length; arrayCnt++)
{
inputTxtBox.setText(fltrParmtrArray[arrayCnt]);
}
}*/
//}
/****End Code for Datepicker by Dhanendra on 13/04/2015*/
}
}
......@@ -838,8 +930,7 @@ public class FilterCreator extends Composite
private void getFltrSelectedData(ArrayList<FilterInfo> filterList, PopupPanel mainPopupPnl)
{
DateBox fltrDateBox = null;
boolean isFilterNotSelected = false;
int row = 0;
FlexTable grid = null;
......@@ -848,12 +939,15 @@ public class FilterCreator extends Composite
BulletList bulletList = null;
ScrollPanel scrollPnl = null;
ArrayList<String> popUpSendDtatList = new ArrayList<String>();
ArrayList<String> popUpSendDtatListDtl = new ArrayList<String>();
FilterInfo fltrInfo = null;
String colName = "";
popUpSendDtatList.add(xmlName);
popUpSendDtatListDtl.add(xmlName);
ListItem listItem = null;
Paragraph paragraph = null;
StringBuffer selectedChkBoxBuffer = null;
StringBuffer selectedChkBoxBufferDtl = null;
HorizontalPanel horizontalPanel = null;
VerticalPanel verticalPanel = null;
String colNameId = "";
......@@ -877,6 +971,7 @@ public class FilterCreator extends Composite
{
scrollPnl = (ScrollPanel) horizontalPanel.getWidget(0);
selectedChkBoxBuffer = new StringBuffer();
selectedChkBoxBufferDtl = new StringBuffer();
grid = (FlexTable) scrollPnl.getWidget();
row = grid.getRowCount();
for (int rowCnt = 1; rowCnt < row; rowCnt++)
......@@ -887,9 +982,11 @@ public class FilterCreator extends Composite
if (selectedChkBoxBuffer.length() != 0)
{
selectedChkBoxBuffer.append("," + grid.getText(rowCnt, 1).trim());
selectedChkBoxBufferDtl.append("," + grid.getText(rowCnt, 2).trim());
} else
{
selectedChkBoxBuffer.append(grid.getText(rowCnt, 1).trim());
selectedChkBoxBufferDtl.append(grid.getText(rowCnt, 2).trim());
}
}
}
......@@ -899,6 +996,7 @@ public class FilterCreator extends Composite
//if (selectedChkBoxBuffer.toString()!= null)
{
popUpSendDtatList.add(selectedChkBoxBuffer.toString());
popUpSendDtatListDtl.add(selectedChkBoxBufferDtl.toString());
} else
{
......@@ -909,6 +1007,12 @@ public class FilterCreator extends Composite
Window.setTitle(windowTitle);
isFilterNotSelected = true;
}
else
{
popUpSendDtatList.add("");
popUpSendDtatListDtl.add("");
}
}
}
......@@ -921,6 +1025,7 @@ public class FilterCreator extends Composite
//if (fltrTxtBox.getText()!=null)
{
popUpSendDtatList.add(fltrTxtBox.getText());
popUpSendDtatListDtl.add(fltrTxtBox.getText());
} else
{
//if(!"CUST_CODE_SUNUSA".equalsIgnoreCase(colNameId) && !"CUST_CODE_DLV".equalsIgnoreCase(colNameId))
......@@ -930,12 +1035,42 @@ public class FilterCreator extends Composite
Window.setTitle(windowTitle);
isFilterNotSelected = true;
}
else
{
popUpSendDtatList.add("");
popUpSendDtatListDtl.add("");
}
}
}
}
else if (horizontalPanel.getWidget(0) instanceof DateBox)
{
fltrDateBox = (DateBox) horizontalPanel.getWidget(0);
if (fltrDateBox.getTitle().equals(colName))
{
if(!fltrDateBox.toString().isEmpty())
{
popUpSendDtatList.add(DateTimeFormat.getFormat("dd/MM/yyyy").format(fltrDateBox.getValue()));
popUpSendDtatListDtl.add(DateTimeFormat.getFormat("dd/MM/yyyy").format(fltrDateBox.getValue()));
fltrDateBox.hideDatePicker();
}
else
{
Window.alert(fltrInfo.getColName() + "Can't Be Empty");
Window.setTitle(windowTitle);
isFilterNotSelected = true;
}
}
}
} else if (horizontalPanel.getWidget(0) instanceof BulletList)
else if (horizontalPanel.getWidget(0) instanceof BulletList)
{
bulletList = (BulletList) horizontalPanel.getWidget(0);
selectedChkBoxBuffer = new StringBuffer();
selectedChkBoxBufferDtl = new StringBuffer();
if (bulletList.getTitle().equals(colName))
{
for (int j = 0; j < bulletList.getWidgetCount(); j++)
......@@ -950,9 +1085,11 @@ public class FilterCreator extends Composite
if (selectedChkBoxBuffer.length() != 0)
{
selectedChkBoxBuffer.append("," + paragraph.getText().trim());
selectedChkBoxBufferDtl.append("," + paragraph.getText().trim());
} else
{
selectedChkBoxBuffer.append(paragraph.getText().trim());
selectedChkBoxBufferDtl.append(paragraph.getText().trim());
}
}
......@@ -962,6 +1099,7 @@ public class FilterCreator extends Composite
//if (selectedChkBoxBuffer.toString()!= null)
{
popUpSendDtatList.add(selectedChkBoxBuffer.toString());
popUpSendDtatListDtl.add(selectedChkBoxBufferDtl.toString());
} else
{
//if(!"CUST_CODE_SUNUSA".equalsIgnoreCase(colNameId) && !"CUST_CODE_DLV".equalsIgnoreCase(colNameId))
......@@ -971,35 +1109,88 @@ public class FilterCreator extends Composite
Window.setTitle(windowTitle);
isFilterNotSelected = true;
}
else
{
popUpSendDtatList.add("");
popUpSendDtatListDtl.add("");
}
}
}
}
}
}
}
}
//Window.alert("poupsenddatalist : "+popUpSendDtatList);
if (!isFilterNotSelected)
{
Window.setTitle("");
mainPopupPnl.hide();
popUpSendDtatList.add(selectedView);
setParameterList(popUpSendDtatList);
/*Start add List for India Map Caption Dhanendra 06/05/2015*/
setParameterListDtl(popUpSendDtatListDtl);
/*End add List for India Map Caption Dhanendra 06/05/2015*/
setTitleOnFilterSubmit(popUpSendDtatList,metaDataJsnObj);
E12DashBoardPage.initaliseGraphNGrid(popUpSendDtatList);
}
}
public void setTitleOnFilterSubmit(ArrayList<String> parameterList,JSONObject metaDataJsnObj)
{
String metadatName= parameterList.get(0);
String temp="";
if(GWTDashBoardReport.flag)
{
subTitle= Window.Location.getParameter("titleName");
}
title = new MetaDataDtl().getTitle(metaDataJsnObj);
if(metadatName=="halolmfgmonth")
{
temp= parameterList.get(2);
if (title.size() > 1)
{
label.setText(temp+" "+title.get(0) + " : " + getMonth(parameterList.get(1)) + title.get(1) + getMonth(parameterList.get(2)));
}
else if (title.size() == 1 && (subTitle=="undefined") || (subTitle.equals("undefined")) || (subTitle.equalsIgnoreCase("undefined")))
{
label.setText(temp+" "+title.get(0) + " : " + getMonth(parameterList.get(1)));
}
//if(subTitle.trim().length()>0)
else if( (title.size() == 1 && (subTitle!="") || (!subTitle.equals("")) || (!subTitle.equalsIgnoreCase(""))))
{
label.setText(temp+" "+ subTitle + " : " + getMonth(parameterList.get(1)) );
}
else
{
label.setText(temp+" "+title.get(0)+ " : " +getMonth( parameterList.get(1)));//+ "-" + parameterList.get(2));
}
}
if(metadatName=="userlogintracedashboard")
{
if (title.size() > 1)
{
label.setText(title.get(0) + " : " + (parameterList.get(1)) + title.get(1) + (parameterList.get(2)));
}
else if (title.size() == 1 && (subTitle=="undefined") || (subTitle.equals("undefined")) || (subTitle.equalsIgnoreCase("undefined")))
{
label.setText(title.get(0) + " : " + (parameterList.get(1)));
}
//if(subTitle.trim().length()>0)
else if( (title.size() == 1 && (subTitle!="") || (!subTitle.equals("")) || (!subTitle.equalsIgnoreCase(""))))
{
label.setText( subTitle + " : " + (parameterList.get(1)) );
}
else
{
label.setText(title.get(0)+ " : " +( parameterList.get(1)));//+ "-" + parameterList.get(2));
}
}
else
{
if (title.size() > 1)
{
label.setText(title.get(0) + " : " + getMonth(parameterList.get(1)) + title.get(1) + getMonth(parameterList.get(2)));
......@@ -1017,7 +1208,7 @@ public class FilterCreator extends Composite
{
label.setText(title.get(0)+ " : " +getMonth( parameterList.get(1)));//+ "-" + parameterList.get(2));
}
}
}
}
\ No newline at end of file
......@@ -78,9 +78,11 @@ public class GWTDashBoardReport implements EntryPoint
filterList =dataDtl.getFilters(metaDataJsnObj);
int year=0;
String month="";
String scmMonth="";
String monthYear="";
year= 1900+date.getYear();
month=String.valueOf(date.getMonth()+1);
scmMonth=String.valueOf((date.getMonth()));
if(month.trim().length()==1)
{
month="0"+month;
......@@ -95,8 +97,20 @@ public class GWTDashBoardReport implements EntryPoint
if(count==1)//if(filterInfo.getColNameId().equals("LAST_MONTH"))
{
prdFilterName=filterInfo.getColNameId();
if(prdFilterName=="PRD_SALESDASH")
{
if(scmMonth.trim().length()==1)
{
scmMonth="0"+scmMonth;
}
monthYear=year+scmMonth;
parameterList.add(Window.Location.getParameter(filterInfo.getColNameId()) == null ? monthYear : Window.Location.getParameter(filterInfo.getColNameId()));
}
else
{
parameterList.add(Window.Location.getParameter(filterInfo.getColNameId()) == null ? monthYear : Window.Location.getParameter(filterInfo.getColNameId()));
}
}
else
{
parameterList.add(Window.Location.getParameter(filterInfo.getColNameId()) == null ? "" : Window.Location.getParameter(filterInfo.getColNameId()));
......
......@@ -57,19 +57,31 @@ public class GraphComponent extends Composite
* This constructor initializes the graphcontainer
*
*/
String userMail =null;
String reportCaption=null;
/*Start code for progess bar to data building- Dhanendra 17Nov2014*/
protected E12LoadingInterface e12LoadImg=new E12LoadingInterface();
/*End code for progess bar to data building- Dhanendra 17Nov2014*/
public GraphComponent(ArrayList<String> parameterList, JSONObject metaDataJsnObj)
public GraphComponent(ArrayList<String> parameterList, JSONObject metaDataJsnObj,String showfilter)
{
userMail = Window.Location.getParameter("EMP_MAILCODE") == null ? "" : Window.Location.getParameter("EMP_MAILCODE");
reportCaption= Window.Location.getParameter("GEO_LOCATION") == null ? "" : Window.Location.getParameter("GEO_LOCATION");
String isShowfilter= Window.Location.getParameter("FLAG");
this.jsonObjMetaData = metaDataJsnObj;
this.parameterList = parameterList;
mainContainer.setWidth("100%");
if(! ("N").equalsIgnoreCase(isShowfilter)){
/*Added New code by sachin on 4/5/15*/
if("Y".equalsIgnoreCase(showfilter))
{
if (!("N").equalsIgnoreCase(isShowfilter))
{
mainContainer.add(new FilterCreator(parameterList, metaDataJsnObj));
}
}
/*End Added New code by sachin on 4/5/15*/
initWidget(mainContainer);
}
@SuppressWarnings("unchecked")
......@@ -163,7 +175,7 @@ public class GraphComponent extends Composite
// end- added empty json chartdata to display no data found message by swati on 7jan2015
if (graphJson != null && graphJson.size() > 0)
{
this.createChart(graphJson.toString().replace('@', '='), "chartContainer" + componentId, "chartContainer" + componentId, width, height, imageName);
this.createChart(graphJson.toString().replace('@', '='), componentId, "chartContainer" + componentId, width, height, imageName,userMail,reportCaption);
}
}
}
......@@ -250,10 +262,31 @@ public class GraphComponent extends Composite
// end- added empty json chartdata to display no data found message by swati on 7jan2015
if (graphJson != null && graphJson.size() > 0)
{
this.createChart(graphJson.toString().replace('@', '='), "chartContainer" + componentId, "chartContainer" + componentId, width, height, imageName);
this.createChart(graphJson.toString().replace('@', '='), "chartContainer" + componentId, "chartContainer" + componentId, width, height, imageName,userMail,reportCaption);
}
}
}
/**Start of india map build method by swati 17 April 2015**/
if ("C".equalsIgnoreCase(type))
{
for (String graphNo : graphDataMap.keySet())
{
graphDtlList = graphDataMap.get(graphNo);
imageName = (String) graphDtlList.get(0);
width = (String) graphDtlList.get(1);
height = (String) graphDtlList.get(2);
graphJson = ChartCreator.buildCountryMap(graphDtlList, jsonObjFrGraph, dtSrouce); // start- added empty json chartdata to display no data found message by swati on 7jan2015
if(graphJson.size()==0 )
{
graphJson.put("chart", new JSONString(""));
}
if (graphJson != null && graphJson.size() > 0)
{
this.createChart(graphJson.toString().replace('@', '='), "chartContainer" + componentId, "chartContainer" + componentId, width, height, imageName,userMail,reportCaption);
}
}
}
/**end of country map build method by swati 17 April 2015**/
}
}
e12LoadImg.setLoading(false);
......@@ -261,12 +294,248 @@ public class GraphComponent extends Composite
{
Window.alert("No Data Found");
}*/
}
/*added new method for smart filter by sachin 12 may 2015*/
@SuppressWarnings("unchecked")
public void buildChart(final LinkedHashMap<String, JSONObject> dataMap ,HashMap<String, HashMap> gridNGraphMeataDataMap)
{
JSONObject jsonObjFrGraph = null;
String height = null;
String width = null;
String imageName = null;
ArrayList graphDtlList = null;
HashMap<String, ArrayList<String>> graphDataMap = null;
HashMap<String, HashMap<String, String>> componentTypeMap = null;
HashMap<String, HashMap<String, String>> datasourceMap = null;
ScrollPanel scrlPanel = null;
FlexTable flexTable = null;
String caption = "";
ArrayList<String> graphCaptionList = new ArrayList<String>();
JSONObject graphJson = null;
final String componentType = "componentType";
String compType = "";
String component = "";
HashMap<String, ArrayList<String>> graphTypeMap = null;
String dtSrouce = "";
/** Add Code By Dhanendra for No Data Found Msg **/
String parameter = "";
boolean isParameter = false;
for (int i = 0; i < parameterList.size(); i++)
{
if (i < parameterList.size() - 1 && i != 0)
{
parameter = parameterList.get(i);
if (parameter.trim().length() != 0)
{
isParameter = true;
}
}
}
/** End Code By Dhanendra for No Data Found Msg **/
if (idList.size() > 0)
{
for (int i = 0; i < idList.size(); i++)
{
RootPanel panel = RootPanel.get("chartContainer" + idList.get(i));
panel.clear();
if (panel.getElement().getFirstChild() != null)
{
panel.getElement().getFirstChild().removeFromParent();
}
}
idList = new ArrayList<String>();
}
/*
* if(dataMap.toString().length()>20) //if loop for no data found alert
* {
*/// for only OTC
for (String componentId : gridNGraphMeataDataMap.keySet())
{
jsonObjFrGraph = new JSONObject();
if (isNumeric(componentId))
{
idList.add(componentId);
compType = componentType.trim() + componentId.trim();
graphDataMap = gridNGraphMeataDataMap.get(componentId);
datasourceMap = gridNGraphMeataDataMap.get("datasource" + componentId);
dtSrouce = "" + datasourceMap.get("datasource" + componentId);
private native void createChart(String chartData, String containerId, String chartContainer, String width, String height, String imageName)
//check code for datasource by Birendra Pandey
graphTypeMap = gridNGraphMeataDataMap.get("type" + componentId);
String type = "" + (graphTypeMap.get("type" + componentId));
if ("T".equalsIgnoreCase(type))
{
componentTypeMap = gridNGraphMeataDataMap.get(compType);
component = "" + componentTypeMap.get("buildComponent" + componentId);
}
jsonObjFrGraph = (JSONObject) dataMap.get(dtSrouce);
// Window.alert("dtSrouce is ="+dtSrouce +"json is ="+jsonObjFrGraph);
/*
* String abc=
* "{'0':{'tran_ser':'R-ADV ', 'adj_amt':'0', 'cust_code':'CV0004 ', 'cr_term':'', 'cust_name':'CVS PHARMACY', 'bal_amt':'-5000', 'ref_date':'12/02/15', 'site_code':'TA821', 'exch_rate':'1', 'ref_no':'718IR00058 ', 'due_date':'12/02/15', 'tot_amt':'-5000', 'curr_code':'USD '}, '1':{'tran_ser':'R-ADV ', 'adj_amt':'0', 'cust_code':'CV0004 ', 'cr_term':'', 'cust_name':'CVS PHARMACY', 'bal_amt':'-2748.77', 'ref_date':'12/02/15', 'site_code':'TA821', 'exch_rate':'1', 'ref_no':'718IR00052 ', 'due_date':'12/02/15', 'tot_amt':'-2748.77', 'curr_code':'USD '}, '2':{'tran_ser':'R-ADV ', 'adj_amt':'0', 'cust_code':'CV0004 ', 'cr_term':'', 'cust_name':'CVS PHARMACY', 'bal_amt':'-2748.77', 'ref_date':'12/02/15', 'site_code':'TA821', 'exch_rate':'1', 'ref_no':'718IR00054 ', 'due_date':'12/02/15', 'tot_amt':'-2748.77', 'curr_code':'USD '}, '3':{'tran_ser':'R-ADV ', 'adj_amt':'0', 'cust_code':'CV0004 ', 'cr_term':'', 'cust_name':'CVS PHARMACY', 'bal_amt':'-60', 'ref_date':'28/04/15', 'site_code':'TA821', 'exch_rate':'2.5', 'ref_no':'718IR00207 ', 'due_date':'28/04/15', 'tot_amt':'-60', 'curr_code':'RS '}, '4':{'tran_ser':'R-ADV ', 'adj_amt':'0', 'cust_code':'CV0004 ', 'cr_term':'', 'cust_name':'CVS PHARMACY', 'bal_amt':'-2748.77', 'ref_date':'12/02/15', 'site_code':'TA821', 'exch_rate':'1', 'ref_no':'718IR00056 ', 'due_date':'12/02/15', 'tot_amt':'-2748.77', 'curr_code':'USD '}, '5':{'tran_ser':'R-ADV ', 'adj_amt':'0', 'cust_code':'CV0004 ', 'cr_term':'', 'cust_name':'CVS PHARMACY', 'bal_amt':'-5000', 'ref_date':'13/02/15', 'site_code':'TA821', 'exch_rate':'1', 'ref_no':'718IR00059 ', 'due_date':'13/02/15', 'tot_amt':'-5000', 'curr_code':'USD '}, '6':{'tran_ser':'R-ADV ', 'adj_amt':'0', 'cust_code':'CV0004 ', 'cr_term':'', 'cust_name':'CVS PHARMACY', 'bal_amt':'-10000', 'ref_date':'13/02/15', 'site_code':'TA821', 'exch_rate':'1', 'ref_no':'718IR00060 ', 'due_date':'13/02/15', 'tot_amt':'-10000', 'curr_code':'USD '}, '7':{'tran_ser':'R-ADV ', 'adj_amt':'0', 'cust_code':'CV0004 ', 'cr_term':'', 'cust_name':'CVS PHARMACY', 'bal_amt':'-780', 'ref_date':'14/04/15', 'site_code':'TA821', 'exch_rate':'1', 'ref_no':'718IR00177 ', 'due_date':'14/04/15', 'tot_amt':'-780', 'curr_code':'USD '}, '8':{'tran_ser':'R-ADV ', 'adj_amt':'0', 'cust_code':'CV0004 ', 'cr_term':'', 'cust_name':'CVS PHARMACY', 'bal_amt':'-10', 'ref_date':'13/02/15', 'site_code':'TA821', 'exch_rate':'1', 'ref_no':'718IR00067 ', 'due_date':'13/02/15', 'tot_amt':'-10', 'curr_code':'USD '}, '9':{'tran_ser':'R-ADV ', 'adj_amt':'0', 'cust_code':'CV0004 ', 'cr_term':'', 'cust_name':'CVS PHARMACY', 'bal_amt':'-20', 'ref_date':'18/02/15', 'site_code':'TA821', 'exch_rate':'1', 'ref_no':'718IR00091 ', 'due_date':'18/02/15', 'tot_amt':'-20', 'curr_code':'USD '}, '10':{'tran_ser':'R-ADV ', 'adj_amt':'0', 'cust_code':'CV0004 ', 'cr_term':'', 'cust_name':'CVS PHARMACY', 'bal_amt':'-2748.77', 'ref_date':'12/02/15', 'site_code':'TA821', 'exch_rate':'1', 'ref_no':'718IR00057 ', 'due_date':'12/02/15', 'tot_amt':'-2748.77', 'curr_code':'USD '}, '11':{'tran_ser':'R-ADV ', 'adj_amt':'0', 'cust_code':'CV0004 ', 'cr_term':'', 'cust_name':'CVS PHARMACY', 'bal_amt':'-10', 'ref_date':'12/02/15', 'site_code':'TA821', 'exch_rate':'1', 'ref_no':'718IR00055 ', 'due_date':'12/02/15', 'tot_amt':'-10', 'curr_code':'USD '}}"
* ;
*
* JSONValue jsonValue=new JSONString(abc); JSONObject
* jsonObject=new JSONObject(); jsonObject.put(""+1, jsonValue);
* if(dtSrouce.equals("1")) { jsonObjFrGraph=jsonObject;
* Window.alert("jsonObjFrGraph is =-"+jsonObjFrGraph); }
*/
// System.out.print("jsonObjFrGraph is ="+jsonObjFrGraph);
if ("G".equalsIgnoreCase(type))
{
for (String graphNo : graphDataMap.keySet())
{
graphDtlList = graphDataMap.get(graphNo);
imageName = (String) graphDtlList.get(0);
width = (String) graphDtlList.get(1);
height = (String) graphDtlList.get(2);
graphJson = ChartCreator.buildChartData(graphDtlList, jsonObjFrGraph, dtSrouce);
// start- added empty json chartdata to display no data found message by swati on 7jan2015
if (graphJson.size() == 0)
{
graphJson.put("chart", new JSONString(""));
}
// end- added empty json chartdata to display no data found message by swati on 7jan2015
if (graphJson != null && graphJson.size() > 0)
{
this.createChart(graphJson.toString().replace('@', '='), componentId, "chartContainer" + componentId, width, height, imageName, userMail, reportCaption);
}
}
} else if ("T".equalsIgnoreCase(type))
{
if (jsonObjFrGraph != null)
{
RootPanel.get("chartContainer" + componentId).clear();
//RootPanel.get().clear();
scrlPanel = new ScrollPanel();
flexTable = new FlexTable();
if ("FlexTable".equalsIgnoreCase(component))
{
CustomFlxTable customFlxTable = new CustomFlxTable();
flexTable = customFlxTable.createFlxTbl(flexTable, gridNGraphMeataDataMap, jsonObjFrGraph, componentId);
//This Block for Export to excel and PDF formate
HorizontalPanel horizontalPnl = new HorizontalPanel();
Button excelBtn = new Button("Export To Excel");
excelBtn.setTitle("Excel");
Button pdFBtn = new Button("Export To PDF");
pdFBtn.setTitle("PDF");
horizontalPnl.add(ibase.client.tabletoexcel.TableToExcelClientBuilder.fromTable(flexTable).withWidget(pdFBtn).buildExportFormWidget());
horizontalPnl.add(ibase.client.tabletoexcel.TableToExcelClientBuilder.fromTable(flexTable).withWidget(excelBtn).buildExportFormWidget());
//End Block for Export to excel and PDF formate
scrlPanel.add(flexTable);
scrlPanel.setStyleName("flextableScrlPnl");
// RootPanel.get("chartContainergrid").add(scrlPanel);
RootPanel.get("chartContainer" + componentId).add(scrlPanel);
RootPanel.get("chartContainer" + componentId).add(horizontalPnl);
} else if ("DataGrid".equalsIgnoreCase(component))
{
flexTable = new FlexTable();
CustomGrid data = new CustomGrid(8);
flexTable = data.jsonToArrayList(gridNGraphMeataDataMap, jsonObjFrGraph, dtSrouce, componentId);
Button excelBtn = new Button("Export To Excel");
excelBtn.setTitle("Excel");
RootPanel.get("chartContainer" + componentId).add(flexTable);
}
}
/**
* Start Code By Dhanendra for No Data Found Msg - 08 Dec
* 2014
**/
else
{
RootPanel.get("chartContainer" + componentId).clear();
if (isParameter)
{
flexTable = new FlexTable();
graphCaptionList.clear();
graphCaptioneMap = gridNGraphMeataDataMap.get("componentCaption" + componentId);
graphCaptionList.add("" + graphCaptioneMap.get("componentCaption" + componentId));
caption = graphCaptionList.get(0);
Label labelNoDataFound = new Label("No Data Found");
if (caption != null && caption.trim().length() > 0)
{
flexTable.setText(0, 0, caption);
flexTable.setWidget(1, 0, labelNoDataFound);
flexTable.getCellFormatter().setStyleName(0, 0, "FlexTable-ColumnHeaderCell");
flexTable.getCellFormatter().setStyleName(1, 0, "gwt-ScrollTable");
} else
{
flexTable.setWidget(0, 0, labelNoDataFound);
flexTable.getCellFormatter().setStyleName(0, 0, "gwt-ScrollTable");
}
flexTable.setStyleName("flexCSS");
RootPanel.get("chartContainer" + componentId).add(flexTable);
}
}
/** End Code By Dhanendra for No Data Found Msg **/
}
if ("H".equalsIgnoreCase(type))
{
for (String graphNo : graphDataMap.keySet())
{
graphDtlList = graphDataMap.get(graphNo);
imageName = (String) graphDtlList.get(0);
width = (String) graphDtlList.get(1);
height = (String) graphDtlList.get(2);
graphJson = ChartCreator.buildHeatMap(graphDtlList, jsonObjFrGraph, dtSrouce); // start- added empty json chartdata to display no data found message by swati on 7jan2015
if (graphJson.size() == 0)
{
graphJson.put("chart", new JSONString(""));
}
// end- added empty json chartdata to display no data found message by swati on 7jan2015
if (graphJson != null && graphJson.size() > 0)
{
this.createChart(graphJson.toString().replace('@', '='), "chartContainer" + componentId, "chartContainer" + componentId, width, height, imageName, userMail, reportCaption);
}
}
}
/** Start of india map build method by swati 17 April 2015 **/
if ("C".equalsIgnoreCase(type))
{
for (String graphNo : graphDataMap.keySet())
{
graphDtlList = graphDataMap.get(graphNo);
imageName = (String) graphDtlList.get(0);
width = (String) graphDtlList.get(1);
height = (String) graphDtlList.get(2);
graphJson = ChartCreator.buildCountryMap(graphDtlList, jsonObjFrGraph, dtSrouce); // start- added empty json chartdata to display no data found message by swati on 7jan2015
if (graphJson.size() == 0)
{
graphJson.put("chart", new JSONString(""));
}
if (graphJson != null && graphJson.size() > 0)
{
this.createChart(graphJson.toString().replace('@', '='), "chartContainer" + componentId, "chartContainer" + componentId, width, height, imageName, userMail, reportCaption);
}
}
}
/** end of country map build method by swati 17 April 2015 **/
}
}
e12LoadImg.setLoading(false);
/*
* }else { Window.alert("No Data Found"); }
*/
}
/*ended of new method*/
private native void createChart(String chartData, String containerId, String chartContainer, String width, String height, String imageName,String userMail,String reportCaption)
/*-{
try {
$wnd.createFusionChart(chartData, containerId, chartContainer,width, height, imageName);
$wnd.createFusionChart(chartData, containerId, chartContainer,width, height, imageName,userMail,reportCaption);
} catch (e) {
alert("Excpeiton :: GraphComponent : createChart [" + e.message + "]");
}
......@@ -301,6 +570,7 @@ public class GraphComponent extends Composite
String servletname = values.get(1);
String objActionPath = "";
String page = parameterList.get(0);
String viewOptionSelectd = parameterList.get(parameterList.size()-1);
FilterInfo filterInfo = null;
/** Start Added New code By sachin for Creating Dynamic Url For Report on 04/12/14**/
......@@ -318,7 +588,7 @@ public class GraphComponent extends Composite
objActionPath=objActionPath + "&" + filterInfo.getName()+"="+parameterList.get(cnt);
}
}
objActionPath=objActionPath+"&dataSourceName=" + dbDataSource + "&reportName="+page;
objActionPath=objActionPath+"&dataSourceName=" + dbDataSource + "&reportName="+page+"&viewOptionSelectd="+viewOptionSelectd;
/** End Added New code By sachin for Creating Dynamic Url For Report on 04/12/14**/
......@@ -416,6 +686,9 @@ public class GraphComponent extends Composite
if (componentDataMap.size() == datsSourceDtlMap.size())
{
buildChart(componentDataMap);
/*added by sachin for smart filter 12 may 2015*/
mainContainer.add(new SmartFiltrCreator(datsSourceDtlMap, componentDataMap, jsonObjMetaData, parameterList));
/*ended by sachin for smart filter 12 may 2015*/
}
} else
{
......
......@@ -23,6 +23,7 @@ import com.google.gwt.xml.client.Document;
import com.google.gwt.xml.client.Node;
import com.google.gwt.xml.client.NodeList;
import com.google.gwt.xml.client.XMLParser;
import com.google.gwt.user.client.Window;
public class InputListWidget extends Composite
{
......@@ -121,9 +122,114 @@ public class InputListWidget extends Composite
box.setFocus(true);
}
private void deselectItem(final TextBox itemBox, final BulletList list)
public InputListWidget(ArrayList<String> suggetions, HorizontalPanel popUpHPnl, SmrtFilterInfo smrtFilterInfo)
{
final BulletList list = new BulletList();
list.setTitle(smrtFilterInfo.getFltrColName());
list.setStyleName("token-input-list");
ListItem item = new ListItem();
item.setStyleName("token-input-input-token");
final TextBox itemBox = new TextBox();
itemBox.getElement().setAttribute("style", "outline-color: -moz-use-text-color; outline-style: none; outline-width: medium;");
MultiWordSuggestOracle oracle = new MultiWordSuggestOracle();
SuggestBox box = null;
for (String fltrData : suggetions)
{
oracle.add(fltrData);
}
box = new SuggestBox(oracle, itemBox);
box.getElement().setId("suggestion_box");
item.add(box);
list.add(item);
itemBox.addKeyDownHandler(new KeyDownHandler()
{
public void onKeyDown(KeyDownEvent event)
{
if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER)
{
if (itemBox.getValue().contains("@"))
deselectItemWithoutDesc(itemBox, list);
}
// handle backspace
if (event.getNativeKeyCode() == KeyCodes.KEY_BACKSPACE)
{
if ("".equals(itemBox.getValue().trim()))
{
ListItem li = (ListItem) list.getWidget(list.getWidgetCount() - 2);
Paragraph p = (Paragraph) li.getWidget(0);
if (itemsSelected.contains(p.getText()))
{
itemsSelected.remove(p.getText());
GWT.log("Removing selected item '" + p.getText() + "'", null);
GWT.log("Remaining: " + itemsSelected, null);
}
list.remove(li);
itemBox.setFocus(true);
}
}
}
});
box.addSelectionHandler(new SelectionHandler<SuggestOracle.Suggestion>()
{
public void onSelection(SelectionEvent selectionEvent)
{
deselectItemWithoutDesc(itemBox, list);
}
});
popUpHPnl.add(list);
//popUpHPnl.getElement().setAttribute("onclick", "document.getElementById('suggestion_box').focus()");
box.setFocus(true);
}
private void deselectItemWithoutDesc(final TextBox itemBox, final BulletList list)
{
Paragraph paragraph = null;
if (itemBox.getValue() != null && !"".equals(itemBox.getValue().trim()))
{
String[] itmBoxArr = null;
final ListItem displayItem = new ListItem();
displayItem.setStyleName("token-input-token");
paragraph = new Paragraph(itemBox.getValue());
displayItem.addClickHandler(new ClickHandler()
{
public void onClick(ClickEvent clickEvent)
{
displayItem.addStyleName("token-input-selected-token");
}
});
Span span = new Span("x");
span.addClickHandler(new ClickHandler()
{
public void onClick(ClickEvent clickEvent)
{
removeListItem(displayItem, list);
}
});
displayItem.add(paragraph);
displayItem.add(span);
GWT.log("Adding selected item '" + itemBox.getValue() + "'", null);
itemsSelected.add(itemBox.getValue());
GWT.log("Total: " + itemsSelected, null);
list.insert(displayItem, list.getWidgetCount() - 1);
itemBox.setValue("");
itemBox.setFocus(true);
}
}
private void deselectItem(final TextBox itemBox, final BulletList list)
{ String[] itmBoxArr = null;
String itmBoxValue = "";
if (itemBox.getValue() != null && !"".equals(itemBox.getValue().trim()))
{
......@@ -132,7 +238,7 @@ public class InputListWidget extends Composite
displayItem.setStyleName("token-input-token");
//Paragraph p = new Paragraph(itemBox.getValue());
//**Added new code by sachin on 20/11/14*//
//*Added new code by sachin on 20/11/14//
itmBoxValue = itemBox.getValue();
itmBoxArr = itmBoxValue.split("-");
......@@ -166,7 +272,8 @@ public class InputListWidget extends Composite
itemBox.setValue("");
itemBox.setFocus(true);
}
}
}
private void removeListItem(ListItem displayItem, BulletList list)
{
......
......@@ -6,6 +6,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.user.client.Window;
......@@ -130,6 +131,9 @@ public class MetaDataDtl
NodeList columnNodeList = null;
// ended for heat map
/*Start For countrymap maxvalue dynamic pass throw query 24/04/2015*/
ArrayList<NodeList> colorNodeList= null;
/*End For countrymap maxvalue dynamic pass throw query 24/04/2015*/
if (jsonObjMetadata != null)
{
......@@ -148,6 +152,7 @@ public class MetaDataDtl
xmlMetadata = jsonObjMetadata.get("metaData").toString();
xmlMetadata = jsonObjMetadata.get("metaData").toString().replace("\\", "").trim();
xmlMetadata = xmlMetadata.replace('"', ' ').trim();
String metDtName = Window.Location.getParameter("metadataname");
try
{
document = XMLParser.parse(xmlMetadata);
......@@ -170,6 +175,7 @@ public class MetaDataDtl
String columnsize = "";
String columnAlign = "";
String dataSource="";
if ("view".equals(rootNode.getNodeName()))
{
viewNodeList = rootNode.getChildNodes();
......@@ -224,7 +230,10 @@ public class MetaDataDtl
{
linkFormat = columnGrpNode.getChildNodes().item(0).getNodeValue();
filterDisplay = columnGrpNode.getAttributes().getNamedItem("filterdisplay").getNodeValue();
//if(linkFormat.trim().length()>0 && filterDisplay.trim().length()>0)
//{
linkFormat = linkFormat+"@"+filterDisplay;
//}
}
else
{
......@@ -435,19 +444,19 @@ public class MetaDataDtl
if ("chart_properties".equalsIgnoreCase(childNodeName))
{
chartTypeList = new ArrayList<String>();
chartPropertyNodeList = graphDataNode.getChildNodes();
for (int k = 0; k < chartPropertyNodeList.getLength(); k++)
{
chartPropertyNode = chartPropertyNodeList.item(k);
String metDtName = Window.Location.getParameter("metadataname");
if ("caption".equals(chartPropertyNode.getNodeName()))
{
dataStringValue = new JSONString(chartPropertyNode.getChildNodes().item(0).getNodeValue());
jsnStringKey = new JSONString("caption");
if(metDtName=="halolmfgmonth")
{
dataStringValue = new JSONString(chartPropertyNode.getChildNodes().item(0).getNodeValue()+" ("+getCurrentDate()+")");
//Window.alert(FilterCreator.parameterList.get(1));
String temp = FilterCreator.parameterList.get(2);
dataStringValue = new JSONString(temp+" "+chartPropertyNode.getChildNodes().item(0).getNodeValue()+" ("+getCurrentDate()+")");
}
metaDataMap.put(jsnStringKey, dataStringValue);
}
......@@ -465,7 +474,6 @@ public class MetaDataDtl
dataStringValue = new JSONString(chartPropertyNode.getChildNodes().item(0).getNodeValue());
jsnStringKey = new JSONString("slantLabels");
metaDataMap.put(jsnStringKey, dataStringValue);
}
if ("bg_color".equals(chartPropertyNode.getNodeName()))
{
......@@ -540,19 +548,25 @@ public class MetaDataDtl
if ("exportenabled".equals(chartPropertyNode.getNodeName()))
{
dataStringValue = new JSONString(chartPropertyNode.getChildNodes().item(0).getNodeValue());
jsnStringKey = new JSONString("exportenabled");
jsnStringKey = new JSONString("exportEnabled");
metaDataMap.put(jsnStringKey, dataStringValue);
}
if ("exportatclient".equals(chartPropertyNode.getNodeName()))
{
dataStringValue = new JSONString(chartPropertyNode.getChildNodes().item(0).getNodeValue());
jsnStringKey = new JSONString("exportatclient");
jsnStringKey = new JSONString("exportAtClient");
metaDataMap.put(jsnStringKey, dataStringValue);
}
if ("exporthandler".equals(chartPropertyNode.getNodeName()))
{
dataStringValue = new JSONString(chartPropertyNode.getChildNodes().item(0).getNodeValue());
jsnStringKey = new JSONString("exporthandler");
jsnStringKey = new JSONString("exportHandler");
metaDataMap.put(jsnStringKey, dataStringValue);
}
if ("exportaction".equals(chartPropertyNode.getNodeName()))
{
dataStringValue = new JSONString(chartPropertyNode.getChildNodes().item(0).getNodeValue());
jsnStringKey = new JSONString("exportAction");
metaDataMap.put(jsnStringKey, dataStringValue);
}
}
......@@ -896,6 +910,344 @@ public class MetaDataDtl
gridNGraphMeataDataMap.put("datasource"+graphID, graphDataSourceMap);
}
/**Start of build metadata for country map chart by swati 16 April 2015**/
if ("countrymap".equals(viewNode.getNodeName()))
{
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);
graphDtlList = new ArrayList<String>();
columnIdList = new ArrayList<String>();
columnNameList = new ArrayList<String>();
linkedMetadataList= new ArrayList<String>();
linkTypeList = new ArrayList<String>();
ArrayList<String> toptoolTipList= new ArrayList<String>();
ArrayList<String> bottomToolTipList= new ArrayList<String>();
ArrayList<String> showLabelList= new ArrayList<String>();
ArrayList<String> hovercolorList= new ArrayList<String>();
ArrayList<String> tooltextList= new ArrayList<String>();
colorRangeList = new ArrayList<String>();
metaDataList = new ArrayList<String>();
graphMeataDataMap = new HashMap<String, ArrayList<Object>>();
graphNodeList = viewNode.getChildNodes();
StringBuffer brandNameStr = new StringBuffer();
StringBuffer divisionNameStr = new StringBuffer();
String brandName = "";
String divisionName = "";
String[] brandNameArr = null;
String[] divisionNameArr = null;
for (int i = 0; i < graphNodeList.getLength(); i++)
{
graphDataNode = graphNodeList.item(i);
childNodeName = graphDataNode.getNodeName();
if ("chart_properties".equalsIgnoreCase(childNodeName))
{
chartTypeList = new ArrayList<String>();
chartPropertyNodeList = graphDataNode.getChildNodes();
for (int k = 0; k < chartPropertyNodeList.getLength(); k++)
{
chartPropertyNode = chartPropertyNodeList.item(k);
if ("chart_type".equalsIgnoreCase(chartPropertyNode.getNodeName()))
{
dataStringValue = new JSONString(chartPropertyNode.getChildNodes().item(0).getNodeValue());
jsnStringKey = new JSONString("chart_type");
graphDtlList.add(chartPropertyNode.getChildNodes().item(0).getNodeValue());
chartTypeList.add(chartPropertyNode.getAttributes().getNamedItem("id").getNodeValue());
}
if ("width".equalsIgnoreCase(chartPropertyNode.getNodeName()))
{
dataStringValue = new JSONString(chartPropertyNode.getChildNodes().item(0).getNodeValue());
jsnStringKey = new JSONString("width");
graphDtlList.add(chartPropertyNode.getChildNodes().item(0).getNodeValue());
}
if ("height".equalsIgnoreCase(chartPropertyNode.getNodeName()))
{
dataStringValue = new JSONString(chartPropertyNode.getChildNodes().item(0).getNodeValue());
jsnStringKey = new JSONString("height");
graphDtlList.add(chartPropertyNode.getChildNodes().item(0).getNodeValue());
}
if ("caption".equals(chartPropertyNode.getNodeName()))
{
dataStringValue = new JSONString(chartPropertyNode.getChildNodes().item(0).getNodeValue());
jsnStringKey = new JSONString("caption");
/*Start add code for india map Dhanendra 06/05/2015*/
if(metDtName=="indiamap")
{
brandName = FilterCreator.parameterListDtl.get(2);
divisionName = FilterCreator.parameterListDtl.get(3);
if(brandName.length()==0 && brandName.equals(""))
{
brandName = "All";
}
if(divisionName.length()==0 && divisionName.equals(""))
{
divisionName = "All";
}
brandNameArr = brandName.split(",");
divisionNameArr = divisionName.split(",");
for(int cnt=0; cnt<brandNameArr.length; cnt++)
{
if(cnt<2)
{
if(cnt==0)
{
brandNameStr.append(brandNameArr[cnt]);
}else{
brandNameStr.append(",");
brandNameStr.append(brandNameArr[cnt]);
}
}
}
if(brandNameArr.length>2)
{
brandNameStr.append("...");
}
for(int cnt=0; cnt<divisionNameArr.length; cnt++)
{
if(cnt<2)
{
if(cnt==0)
{
divisionNameStr.append(divisionNameArr[cnt]);
}else{
divisionNameStr.append(",");
divisionNameStr.append(divisionNameArr[cnt]);
}
}
}
if(divisionNameArr.length>2)
{
divisionNameStr.append("...");
}
}
if(brandName.length()==0 && divisionName.length()==0)
{
dataStringValue = new JSONString(chartPropertyNode.getChildNodes().item(0).getNodeValue()+" Brand : "+brandName + " And Division : "+ divisionName);
}else{
dataStringValue = new JSONString(chartPropertyNode.getChildNodes().item(0).getNodeValue()+" Brand : "+brandNameStr + " And Division : "+ divisionNameStr);
}
/*End add code for india map Dhanendra 06/05/2015*/
metaDataMap.put(jsnStringKey, dataStringValue);
}
if ("bgcolor".equals(chartPropertyNode.getNodeName()))
{
dataStringValue = new JSONString(chartPropertyNode.getChildNodes().item(0).getNodeValue());
jsnStringKey = new JSONString("bgcolor");
metaDataMap.put(jsnStringKey, dataStringValue);
}
if ("theme".equals(chartPropertyNode.getNodeName()))
{
dataStringValue = new JSONString(chartPropertyNode.getChildNodes().item(0).getNodeValue());
jsnStringKey = new JSONString("theme");
metaDataMap.put(jsnStringKey, dataStringValue);
}
if ("basefontsize".equals(chartPropertyNode.getNodeName()))
{
dataStringValue = new JSONString(chartPropertyNode.getChildNodes().item(0).getNodeValue());
jsnStringKey = new JSONString("baseFontSize");
metaDataMap.put(jsnStringKey, dataStringValue);
}
if ("legendshadow".equals(chartPropertyNode.getNodeName()))
{
dataStringValue = new JSONString(chartPropertyNode.getChildNodes().item(0).getNodeValue());
jsnStringKey = new JSONString("legendshadow");
metaDataMap.put(jsnStringKey, dataStringValue);
}
if ("legenddisplay".equals(chartPropertyNode.getNodeName()))
{
dataStringValue = new JSONString(chartPropertyNode.getChildNodes().item(0).getNodeValue());
jsnStringKey = new JSONString("showlegend");
metaDataMap.put(jsnStringKey, dataStringValue);
}
if ("legendposition".equals(chartPropertyNode.getNodeName()))
{
dataStringValue = new JSONString(chartPropertyNode.getChildNodes().item(0).getNodeValue());
jsnStringKey = new JSONString("legendposition");
metaDataMap.put(jsnStringKey, dataStringValue);
}
if ("legendborderalpha".equals(chartPropertyNode.getNodeName()))
{
dataStringValue = new JSONString(chartPropertyNode.getChildNodes().item(0).getNodeValue());
jsnStringKey = new JSONString("legendborderalpha");
metaDataMap.put(jsnStringKey, dataStringValue);
}
if ("legendbordercolor".equals(chartPropertyNode.getNodeName()))
{
dataStringValue = new JSONString(chartPropertyNode.getChildNodes().item(0).getNodeValue());
jsnStringKey = new JSONString("legendbordercolor");
metaDataMap.put(jsnStringKey, dataStringValue);
}
if ("legendallowdrag".equals(chartPropertyNode.getNodeName()))
{
dataStringValue = new JSONString(chartPropertyNode.getChildNodes().item(0).getNodeValue());
jsnStringKey = new JSONString("legendallowdrag");
metaDataMap.put(jsnStringKey, dataStringValue);
}
if ("animation".equals(chartPropertyNode.getNodeName()))
{
dataStringValue = new JSONString(chartPropertyNode.getChildNodes().item(0).getNodeValue());
jsnStringKey = new JSONString("animation");
metaDataMap.put(jsnStringKey, dataStringValue);
}
if ("hovercolor".equals(chartPropertyNode.getNodeName()))
{
dataStringValue = new JSONString(chartPropertyNode.getChildNodes().item(0).getNodeValue());
jsnStringKey = new JSONString("hovercolor");
metaDataMap.put(jsnStringKey, dataStringValue);
}
if ("usehovercolor".equals(chartPropertyNode.getNodeName()))
{
dataStringValue = new JSONString(chartPropertyNode.getChildNodes().item(0).getNodeValue());
jsnStringKey = new JSONString("usehovercolor");
metaDataMap.put(jsnStringKey, dataStringValue);
}
if ("fillalpha".equals(chartPropertyNode.getNodeName()))
{
dataStringValue = new JSONString(chartPropertyNode.getChildNodes().item(0).getNodeValue());
jsnStringKey = new JSONString("fillalpha");
metaDataMap.put(jsnStringKey, dataStringValue);
}
if ("connectorcolor".equals(chartPropertyNode.getNodeName()))
{
dataStringValue = new JSONString(chartPropertyNode.getChildNodes().item(0).getNodeValue());
jsnStringKey = new JSONString("connectorcolor");
metaDataMap.put(jsnStringKey, dataStringValue);
}
if ("showborder".equals(chartPropertyNode.getNodeName()))
{
dataStringValue = new JSONString(chartPropertyNode.getChildNodes().item(0).getNodeValue());
jsnStringKey = new JSONString("showborder");
metaDataMap.put(jsnStringKey, dataStringValue);
}
if ("bordercolor".equals(chartPropertyNode.getNodeName()))
{
dataStringValue = new JSONString(chartPropertyNode.getChildNodes().item(0).getNodeValue());
jsnStringKey = new JSONString("bordercolor");
metaDataMap.put(jsnStringKey, dataStringValue);
}
if ("canvasbordercolor".equals(chartPropertyNode.getNodeName()))
{
dataStringValue = new JSONString(chartPropertyNode.getChildNodes().item(0).getNodeValue());
jsnStringKey = new JSONString("canvasbordercolor");
metaDataMap.put(jsnStringKey, dataStringValue);
}
if ("showbevel".equals(chartPropertyNode.getNodeName()))
{
dataStringValue = new JSONString(chartPropertyNode.getChildNodes().item(0).getNodeValue());
jsnStringKey = new JSONString("showbevel");
metaDataMap.put(jsnStringKey, dataStringValue);
}
if ("showshadow".equals(chartPropertyNode.getNodeName()))
{
dataStringValue = new JSONString(chartPropertyNode.getChildNodes().item(0).getNodeValue());
jsnStringKey = new JSONString("showshadow");
metaDataMap.put(jsnStringKey, dataStringValue);
}
}
}
if ("data".equalsIgnoreCase(childNodeName))
{
columnNodeList = graphDataNode.getChildNodes();
for (int j = 0; j < columnNodeList.getLength(); j++)
{
columnNode = columnNodeList.item(j);
columnIdList.add(columnNode.getAttributes().getNamedItem("id").getNodeValue());
linkedMetadataList.add(columnNode.getAttributes().getNamedItem("linkedmetadata").getNodeValue());
linkTypeList.add(columnNode.getAttributes().getNamedItem("linktype").getNodeValue());
toptoolTipList.add(columnNode.getAttributes().getNamedItem("toptooltip").getNodeValue());
bottomToolTipList.add(columnNode.getAttributes().getNamedItem("bottomtooltip").getNodeValue());
showLabelList.add(columnNode.getAttributes().getNamedItem("showlabel").getNodeValue());
hovercolorList.add(columnNode.getAttributes().getNamedItem("usehovercolor").getNodeValue());
tooltextList.add(columnNode.getAttributes().getNamedItem("tooltext").getNodeValue());
}
}
if ("colorrange".equalsIgnoreCase(childNodeName))
{
if (graphDataNode.getAttributes().getNamedItem("startlabel") != null)
{
colorRangeList.add(graphDataNode.getAttributes().getNamedItem("startlabel").getNodeValue());
}
if (graphDataNode.getAttributes().getNamedItem("endlabel") != null)
{
colorRangeList.add(graphDataNode.getAttributes().getNamedItem("endlabel").getNodeValue());
}
if (graphDataNode.getAttributes().getNamedItem("gradient") != null)
{
colorRangeList.add(graphDataNode.getAttributes().getNamedItem("gradient").getNodeValue());
}
if (graphDataNode.getAttributes().getNamedItem("minvalue") != null)
{
colorRangeList.add(graphDataNode.getAttributes().getNamedItem("minvalue").getNodeValue());
}
if (graphDataNode.getAttributes().getNamedItem("code") != null)
{
colorRangeList.add(graphDataNode.getAttributes().getNamedItem("code").getNodeValue());
}
colorNodeList = new ArrayList<NodeList>();
columnNodeList = graphDataNode.getChildNodes();
colorNodeList.add(columnNodeList);
/*Start This code is write in Chart Creator for max value set from sql by dhanendra on 24/04/2015*/
/*for (int j = 0; j < columnNodeList.getLength(); j++)
{
colorDataMap = new LinkedHashMap<JSONString, JSONString>();
columnNode = columnNodeList.item(j);
if (columnNode.getAttributes().getNamedItem("code") != null)
{
dataStringValue = new JSONString(columnNode.getAttributes().getNamedItem("code").getNodeValue());
jsnStringKey = new JSONString("code");
colorDataMap.put(jsnStringKey, dataStringValue);
}
if (columnNode.getAttributes().getNamedItem("maxvalue") != null)
{
dataStringValue = new JSONString(columnNode.getAttributes().getNamedItem("maxvalue").getNodeValue());
jsnStringKey = new JSONString("maxvalue");
colorDataMap.put(jsnStringKey, dataStringValue);
}
if (columnNode.getAttributes().getNamedItem("label") != null)
{
dataStringValue = new JSONString(columnNode.getAttributes().getNamedItem("label").getNodeValue());
jsnStringKey = new JSONString("displayvalue");
colorDataMap.put(jsnStringKey, dataStringValue);
}
colorList.add(colorDataMap.toString().replace('=', ':'));
}*/
/*End This code is write in Chart Creator for max value set from sql by dhanendra on 24/04/2015*/
}
}
metaDataList.add(metaDataMap.toString().replace('=', ':'));
graphDtlList.add(metaDataList);
graphDtlList.add(columnIdList);
graphDtlList.add(columnNameList);
graphDtlList.add(colorRangeList);
/*graphDtlList.add(colorList);*/
graphDtlList.add(colorNodeList);
graphDtlList.add(toptoolTipList);
graphDtlList.add(bottomToolTipList);
graphDtlList.add(linkedMetadataList);
graphDtlList.add(linkTypeList);
graphDtlList.add(showLabelList);
graphDtlList.add(hovercolorList);
graphDtlList.add(tooltextList);
conuter++;
gridNGraphMeataDataMap.put("type"+graphID, typeGraphMap);
graphMeataDataMap.put("graph" + conuter, graphDtlList);
gridNGraphMeataDataMap.put(graphID, graphMeataDataMap);
gridNGraphMeataDataMap.put("datasource"+graphID, graphDataSourceMap);
}
/**End of build metadata for country mao by swati 16 April 2015**/
}
}
}
......
package ibase.client;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.event.dom.client.KeyUpHandler;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.RadioButton;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.datepicker.client.DateBox;
import com.google.gwt.xml.client.Document;
import com.google.gwt.xml.client.Node;
import com.google.gwt.xml.client.NodeList;
import com.google.gwt.xml.client.XMLParser;
public class SmartFiltrCreator extends Composite
{
LinkedHashMap<String, ArrayList<String>> datsSourceDtlMap = null;
LinkedHashMap<String, JSONObject> componentDataMap = null;
PopupPanel mainPopupPnl = new PopupPanel();
final VerticalPanel popUpHPnl = new VerticalPanel();
JSONObject jsonObjMetaData = null;
ArrayList<String> fltrColumnDataList = null;
HashMap<String, ArrayList<String>> fltrDataMap = null;
String columnName = "";
Document document = null;
String xmlMetadata = null;
Node rootNode = null;
NodeList rootNodeList = null;
NodeList filtrNodeList = null;
NodeList fltrDtlNodeList = null;
Node columNode = null;
ArrayList<SmrtFilterInfo> fltrDtlList = null;
SmrtFilterInfo filterInfo = null;
ArrayList<String> parameterList = null;
String viewOptionSelectd = "";
GraphComponent component = null;
MetaDataDtl dataDtl = null;
public SmartFiltrCreator(LinkedHashMap<String, ArrayList<String>> datsSourceDtlMap, LinkedHashMap<String, JSONObject> componentDataMap, JSONObject jsonObjMetaData, ArrayList<String> parameterList)
{
this.datsSourceDtlMap = datsSourceDtlMap;
this.componentDataMap = componentDataMap;
this.jsonObjMetaData = jsonObjMetaData;
this.parameterList = parameterList;
viewOptionSelectd = parameterList.get(parameterList.size() - 1);
component = new GraphComponent(parameterList, jsonObjMetaData, "N");
dataDtl = new MetaDataDtl();
this.initPopUpPnl();
}
private void initPopUpPnl()
{
mainPopupPnl.setPopupPosition(30, 50);
mainPopupPnl.setStylePrimaryName("vPanelCSS");
mainPopupPnl.getElement().setId("smartFilterMainOuterDiv");
this.buildSmrtFiltr();
mainPopupPnl.add(popUpHPnl);
mainPopupPnl.show();
this.filtrClickActn(fltrDtlList);
}
public HashMap<String, ArrayList<String>> getFilterData()
{
JSONObject dataJsn = null;
JSONObject fetchRowWiseVal = null;
String data = "";
fltrDtlList = this.getSmartFilters(jsonObjMetaData);
fltrColumnDataList = new ArrayList<String>();
fltrDataMap = new HashMap<String, ArrayList<String>>();
for (SmrtFilterInfo smrtFilterInfo : fltrDtlList)
{
fltrColumnDataList = new ArrayList<String>();
columnName = smrtFilterInfo.getFltrColName();
for (Map.Entry<String, JSONObject> entry : componentDataMap.entrySet())
{
dataJsn = entry.getValue();
dataJsn = (JSONObject) dataJsn.get(entry.getKey());
for (int jsnCnt = 0; jsnCnt < dataJsn.size(); jsnCnt++)
{
fetchRowWiseVal = (JSONObject) dataJsn.get(String.valueOf(jsnCnt));
data = "" + fetchRowWiseVal.get(columnName);
if (!"null".equals(data))
{
data = data.replace('"', ' ');
if (data.trim().length() != 0)
{
if (!fltrColumnDataList.contains(data))
{
fltrColumnDataList.add(data);
}
}
}
}
}
fltrDataMap.put(columnName, fltrColumnDataList);
}
return fltrDataMap;
}
public ArrayList<SmrtFilterInfo> getSmartFilters(JSONObject jsonObjMetadata)
{
fltrDtlList = new ArrayList<SmrtFilterInfo>();
if (jsonObjMetadata != null)
{
xmlMetadata = jsonObjMetadata.get("metaData").toString();
xmlMetadata = jsonObjMetadata.get("metaData").toString().replace("\\", "").trim();
xmlMetadata = xmlMetadata.replace('"', ' ').trim();
try
{
document = XMLParser.parse(xmlMetadata);
XMLParser.removeWhitespace(document);
if (document != null)
{
rootNodeList = document.getElementsByTagName("Root").item(0).getChildNodes();
for (int rootCtr = 0; rootCtr < rootNodeList.getLength(); rootCtr++)
{
rootNode = rootNodeList.item(rootCtr);
if ("smart_filters".equals(rootNode.getNodeName()))
{
filtrNodeList = rootNode.getChildNodes();
for (int fltrCtr = 0; fltrCtr < filtrNodeList.getLength(); fltrCtr++)
{
fltrDtlNodeList = filtrNodeList.item(fltrCtr).getChildNodes();
filterInfo = new SmrtFilterInfo();
filterInfo.setFltrType(filtrNodeList.item(fltrCtr).getAttributes().getNamedItem("type").getNodeValue());
for (int dtlCnt = 0; dtlCnt < fltrDtlNodeList.getLength(); dtlCnt++)
{
columNode = fltrDtlNodeList.item(dtlCnt);
if ("title_filter".equals(columNode.getNodeName()))
{
filterInfo.setFltrTitle(columNode.getChildNodes().item(0).getNodeValue());
}
if ("col_name_filter".equals(columNode.getNodeName()))
{
filterInfo.setFltrColName(columNode.getChildNodes().item(0).getNodeValue());
}
if ("selection_mode".equals(columNode.getNodeName()))
{
filterInfo.setFltrSelectnMode(columNode.getChildNodes().item(0).getNodeValue());
}
}
fltrDtlList.add(filterInfo);
}
}
}
}
} catch (Exception e)
{
Window.alert(" Exception :: SmartFiltrCreator:: getSmartFilters() :: MetaDataDtl [" + e.getMessage() + "]");
}
}
return fltrDtlList;
}
public void buildSmrtFiltr()
{
String fltrTitle = "";
String fltrSelectnMode = "";
String fltrType = "";
VerticalPanel outerVPanel = null;
VerticalPanel fltrTitlPnl = null;
HorizontalPanel fltrComponentPnl = null;
DateTimeFormat dateFormat = null;
DateBox dateBox = null;
TextBox inputTxtBox = null;
Label fltrTitlLbl = null;
fltrDtlList = this.getSmartFilters(jsonObjMetaData);
fltrDataMap = this.getFilterData();
for (SmrtFilterInfo smrtFilterInfo : fltrDtlList)
{
columnName = smrtFilterInfo.getFltrColName();
fltrTitle = smrtFilterInfo.getFltrTitle();
fltrSelectnMode = smrtFilterInfo.getFltrSelectnMode();
fltrType = smrtFilterInfo.getFltrType();
fltrColumnDataList = fltrDataMap.get(columnName);
fltrTitlLbl = new Label(fltrTitle);
outerVPanel = new VerticalPanel();
fltrComponentPnl = new HorizontalPanel();
fltrTitlPnl = new VerticalPanel();
fltrTitlPnl.add(fltrTitlLbl);
fltrTitlLbl.setStyleName("filterHeaderLabel");
fltrTitlPnl.setStyleName("filterHeaderPanel");
outerVPanel.add(fltrTitlPnl);
if ("1".equals(fltrType))
{
if ("1".equals(fltrSelectnMode))
{
inputTxtBox = new TextBox();
inputTxtBox.setTitle(columnName);
inputTxtBox.setStylePrimaryName("textBoxCss");
fltrComponentPnl.add(inputTxtBox);
outerVPanel.add(fltrComponentPnl);
popUpHPnl.add(outerVPanel);
} else if ("2".equals(fltrSelectnMode))
{
new InputListWidget(fltrColumnDataList, fltrComponentPnl, smrtFilterInfo);
outerVPanel.add(fltrComponentPnl);
popUpHPnl.add(outerVPanel);
} else if ("4".equals(fltrSelectnMode))
{
dateFormat = DateTimeFormat.getFormat("dd/MM/yyyy");
dateBox = new DateBox();
dateBox.setFormat(new DateBox.DefaultFormat(dateFormat));
dateBox.setTitle(columnName);
dateBox.setStylePrimaryName("textBoxCss");
fltrComponentPnl.add(dateBox);
outerVPanel.add(fltrComponentPnl);
popUpHPnl.add(outerVPanel);
} else if ("5".equals(fltrSelectnMode) || "3".equals(fltrSelectnMode))
{
if ("3".equals(fltrSelectnMode))
{
fltrComponentPnl.add(this.getChkBoxSlectnOptn(smrtFilterInfo, fltrColumnDataList));
} else
{
fltrComponentPnl.add(this.getRdoBtnSlectnOptn(smrtFilterInfo, fltrColumnDataList));
}
outerVPanel.setHeight("200px");
outerVPanel.add(fltrComponentPnl);
popUpHPnl.add(outerVPanel);
}
}
}
}
public Widget getChkBoxSlectnOptn(SmrtFilterInfo smrtFilterInfo, ArrayList<String> fltrColumnDataList)
{
final ScrollPanel checkboxScrlPnl = new ScrollPanel();
checkboxScrlPnl.setTitle(smrtFilterInfo.getFltrColName());
checkboxScrlPnl.setStyleName("filterScrlPnl");
CheckBox chkBox = null;
try
{
final FlexTable flexTable = new FlexTable();
//flexTable.setBorderWidth(1);
flexTable.setStyleName("flexTable");
final CheckBox selectAllChkBox = new CheckBox();
for (int colNo = 0; colNo < 2; colNo++)
{
if (colNo == 0)
{
flexTable.setWidget(0, 0, selectAllChkBox);
flexTable.getCellFormatter().setAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE);
flexTable.getCellFormatter().addStyleName(0, 0, "flexTable-cell");
} else
{
flexTable.setText(0, 1, "All");
flexTable.getCellFormatter().addStyleName(0, 1, "flexTable-cell");
}
}
selectAllChkBox.addClickHandler(new ClickHandler()
{
@Override
public void onClick(ClickEvent event)
{
CheckBox checkBox = (CheckBox) event.getSource();
int noOfRow = flexTable.getRowCount();
for (int rowCnt = 0; rowCnt < noOfRow; rowCnt++)
{
if (checkBox.getValue())
{
CheckBox box = (CheckBox) flexTable.getWidget(rowCnt + 1, 0);
box.setValue(true);
} else
{
CheckBox box = (CheckBox) flexTable.getWidget(rowCnt + 1, 0);
box.setValue(false);
}
}
}
});
for (int rowNo = 0; rowNo < fltrColumnDataList.size(); rowNo++)
{
int row = rowNo + 1;
for (int colNo = 0; colNo < 2; colNo++)
{
if (colNo == 0)
{
chkBox = new CheckBox();
chkBox.addClickHandler(new ClickHandler()
{
@Override
public void onClick(ClickEvent event)
{
CheckBox checkBox = (CheckBox) event.getSource();
if (!checkBox.getValue())
{
selectAllChkBox.setValue(false);
}
}
});
flexTable.getCellFormatter().setAlignment(row, colNo, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE);
flexTable.getCellFormatter().setWidth(row, colNo, "5em");
flexTable.setWidget(row, colNo, chkBox);
} else
{
flexTable.setText(row, colNo, fltrColumnDataList.get(rowNo));
}
}
}
checkboxScrlPnl.add(flexTable);
} catch (Exception e)
{
Window.alert(" Exception :: SmartFiltrCreator:: getChkBoxSlectnOptn() " + e.getMessage());
}
return checkboxScrlPnl;
}
public Widget getRdoBtnSlectnOptn(SmrtFilterInfo smrtFilterInfo, ArrayList<String> fltrColumnDataList)
{
final ScrollPanel radioBtnScrlPnl = new ScrollPanel();
radioBtnScrlPnl.setTitle(smrtFilterInfo.getFltrColName());
radioBtnScrlPnl.setStyleName("filterScrlPnl");
RadioButton radioBtn = null;
FlexTable flexTable = new FlexTable();
try
{
flexTable.setStyleName("flexTable");
for (int rowNo = 0; rowNo < fltrColumnDataList.size(); rowNo++)
{
for (int colNo = 0; colNo < 2; colNo++)
{
if (colNo == 0)
{
radioBtn = new RadioButton(smrtFilterInfo.getFltrTitle());
/*
* radioBtn.addClickHandler(new ClickHandler() {
*
* @Override public void onClick(ClickEvent event) { }
* });
*/
flexTable.getCellFormatter().setAlignment(rowNo, colNo, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE);
flexTable.getCellFormatter().setWidth(rowNo, colNo, "5em");
flexTable.setWidget(rowNo, colNo, radioBtn);
} else
{
flexTable.setText(rowNo, colNo, fltrColumnDataList.get(rowNo));
}
}
}
radioBtnScrlPnl.add(flexTable);
} catch (Exception e)
{
Window.alert("Exception :: SmartFiltrCreator:: getRdoBrnSlectnOptn() " + e.getMessage());
}
return radioBtnScrlPnl;
}
/*
* public void filtrClickActn(final ArrayList<SmrtFilterInfo>
* smrtFltrDtlList) {
*
* mainPopupPnl.addDomHandler(new ClickHandler() {
*
* @Override public void onClick(ClickEvent event) { HashMap<String,
* ArrayList<String>> selectedDataMap = getSelectnMap(smrtFltrDtlList); if
* (!selectedDataMap.isEmpty()) { getFilterdJson(selectedDataMap); } } },
* ClickEvent.getType());
*
*
* mainPopupPnl.addDomHandler(new KeyUpHandler() { public void
* onKeyUp(KeyUpEvent event) { int keyCode = event.getNativeKeyCode(); if
* (keyCode == KeyCodes.KEY_ENTER) { HashMap<String, ArrayList<String>>
* selectedDataMap = getSelectnMap(smrtFltrDtlList); if
* (!selectedDataMap.isEmpty()) { getFilterdJson(selectedDataMap); }
*
* } } }, KeyUpEvent.getType()); }
*/
public HashMap<String, ArrayList<String>> getSelectnMap(ArrayList<SmrtFilterInfo> smrtFltrDtlList)
{
DateBox fltrDateBox = null;
int row = 0;
FlexTable grid = null;
CheckBox checkBox = null;
TextBox fltrTxtBox = null;
BulletList bulletList = null;
ScrollPanel scrollPnl = null;
SmrtFilterInfo fltrInfo = null;
String colName = "";
ListItem listItem = null;
Paragraph paragraph = null;
HorizontalPanel horizontalPanel = null;
VerticalPanel verticalPanel = null;
ArrayList<String> selectedValueList = null;
HashMap<String, ArrayList<String>> selectedDataMap = new HashMap<String, ArrayList<String>>();
for (int i = 0; i < smrtFltrDtlList.size(); i++)
{
fltrInfo = smrtFltrDtlList.get(i);
colName = fltrInfo.getFltrColName();
for (int scrlPnlCnt = 0; scrlPnlCnt < popUpHPnl.getWidgetCount(); scrlPnlCnt++)
{
if (popUpHPnl.getWidget(scrlPnlCnt) instanceof VerticalPanel)
{
verticalPanel = (VerticalPanel) popUpHPnl.getWidget(scrlPnlCnt);
if (verticalPanel.getWidget(1) instanceof HorizontalPanel)
{
horizontalPanel = (HorizontalPanel) verticalPanel.getWidget(1);
if (horizontalPanel.getWidget(0) instanceof ScrollPanel)
{
scrollPnl = (ScrollPanel) horizontalPanel.getWidget(0);
selectedValueList = new ArrayList<String>();
grid = (FlexTable) scrollPnl.getWidget();
row = grid.getRowCount();
for (int rowCnt = 0; rowCnt < row; rowCnt++)
{
checkBox = (CheckBox) grid.getWidget(rowCnt, 0);
if (checkBox.getValue())
{
if (rowCnt == 0)
{
if (!"All".equals(grid.getText(rowCnt, 1).trim()))
{
selectedValueList.add(grid.getText(rowCnt, 1).trim());
}
} else
{
selectedValueList.add(grid.getText(rowCnt, 1).trim());
}
}
}
if (scrollPnl.getTitle().equals(colName))
{
if (!selectedValueList.isEmpty())
selectedDataMap.put(colName, selectedValueList);
}
} else if (horizontalPanel.getWidget(0) instanceof TextBox)
{
selectedValueList = new ArrayList<String>();
fltrTxtBox = (TextBox) horizontalPanel.getWidget(0);
if (fltrTxtBox.getTitle().equals(colName))
{
if (!fltrTxtBox.getText().isEmpty())
{
selectedValueList.add(fltrTxtBox.getText());
}
if (!selectedValueList.isEmpty())
selectedDataMap.put(colName, selectedValueList);
}
} else if (horizontalPanel.getWidget(0) instanceof DateBox)
{
selectedValueList = new ArrayList<String>();
fltrDateBox = (DateBox) horizontalPanel.getWidget(0);
if (fltrDateBox.getTitle().equals(colName))
{
selectedValueList.add(DateTimeFormat.getFormat("dd/MM/yyyy").format(fltrDateBox.getValue()));
fltrDateBox.hideDatePicker();
if (!selectedValueList.isEmpty())
{
selectedDataMap.put(colName, selectedValueList);
}
}
} else if (horizontalPanel.getWidget(0) instanceof BulletList)
{
bulletList = (BulletList) horizontalPanel.getWidget(0);
selectedValueList = new ArrayList<String>();
if (bulletList.getTitle().equals(colName))
{
for (int j = 0; j < bulletList.getWidgetCount(); j++)
{
if (bulletList.getWidget(j) instanceof ListItem)
{
listItem = (ListItem) bulletList.getWidget(j);
if (listItem.getWidget(0) instanceof Paragraph)
{
paragraph = (Paragraph) listItem.getWidget(0);
selectedValueList.add(paragraph.getText().trim());
}
}
}
if (!selectedValueList.isEmpty())
selectedDataMap.put(colName, selectedValueList);
}
}
}
}
}
}
return selectedDataMap;
}
public HashMap<String, ArrayList<String>> filtrClickActn(final ArrayList<SmrtFilterInfo> smrtFltrDtlList)
{
DateBox fltrDateBox = null;
int row = 0;
FlexTable grid = null;
CheckBox checkBox = null;
TextBox fltrTxtBox = null;
BulletList bulletList = null;
ScrollPanel scrollPnl = null;
HorizontalPanel horizontalPanel = null;
VerticalPanel verticalPanel = null;
HashMap<String, ArrayList<String>> selectedDataMap = new HashMap<String, ArrayList<String>>();
for (int scrlPnlCnt = 0; scrlPnlCnt < popUpHPnl.getWidgetCount(); scrlPnlCnt++)
{
if (popUpHPnl.getWidget(scrlPnlCnt) instanceof VerticalPanel)
{
verticalPanel = (VerticalPanel) popUpHPnl.getWidget(scrlPnlCnt);
if (verticalPanel.getWidget(1) instanceof HorizontalPanel)
{
horizontalPanel = (HorizontalPanel) verticalPanel.getWidget(1);
if (horizontalPanel.getWidget(0) instanceof ScrollPanel)
{
scrollPnl = (ScrollPanel) horizontalPanel.getWidget(0);
grid = (FlexTable) scrollPnl.getWidget();
row = grid.getRowCount();
for (int rowCnt = 0; rowCnt < row; rowCnt++)
{
checkBox = (CheckBox) grid.getWidget(rowCnt, 0);
this.addEnterKeyHndlr(checkBox, smrtFltrDtlList);
this.addMouseClickHndlr(checkBox, smrtFltrDtlList);
}
} else if (horizontalPanel.getWidget(0) instanceof TextBox)
{
fltrTxtBox = (TextBox) horizontalPanel.getWidget(0);
this.addEnterKeyHndlr(fltrTxtBox, smrtFltrDtlList);
this.addMouseClickHndlr(fltrTxtBox, smrtFltrDtlList);
} else if (horizontalPanel.getWidget(0) instanceof DateBox)
{
fltrDateBox = (DateBox) horizontalPanel.getWidget(0);
this.addEnterKeyHndlr(fltrDateBox, smrtFltrDtlList);
this.addMouseClickHndlr(fltrDateBox, smrtFltrDtlList);
} else if (horizontalPanel.getWidget(0) instanceof BulletList)
{
bulletList = (BulletList) horizontalPanel.getWidget(0);
this.addEnterKeyHndlr(fltrDateBox, smrtFltrDtlList);
this.addMouseClickHndlr(fltrDateBox, smrtFltrDtlList);
}
}
}
}
return selectedDataMap;
}
public void getFilterdJson(HashMap<String, ArrayList<String>> selectedDataMap)
{
ArrayList<String> presentKeyList = null;
JSONObject dataJsn = null;
JSONObject fetchRowWiseVal = null;
String data = "";
String coulumName = "";
fltrDtlList = this.getSmartFilters(jsonObjMetaData);
fltrColumnDataList = new ArrayList<String>();
fltrDataMap = new HashMap<String, ArrayList<String>>();
ArrayList<String> selectedDataList = null;
LinkedHashMap<String, JSONObject> filterdDataMap = new LinkedHashMap<String, JSONObject>();
JSONObject dataJsnObj = null;
JSONObject filtrdJsn = null;
for (Map.Entry<String, JSONObject> entry : componentDataMap.entrySet())
{
dataJsnObj = new JSONObject();
dataJsn = entry.getValue();
presentKeyList = new ArrayList<String>();
dataJsn = (JSONObject) dataJsn.get(entry.getKey());
int cnt = 0;
for (Map.Entry<String, ArrayList<String>> selectedDataMap1 : selectedDataMap.entrySet())
{
coulumName = selectedDataMap1.getKey();
fetchRowWiseVal = (JSONObject) dataJsn.get(String.valueOf(0));
if (fetchRowWiseVal.containsKey(coulumName))
{
presentKeyList.add(coulumName);
}
}
for (int jsnCnt = 0; jsnCnt < dataJsn.size(); jsnCnt++)
{
fetchRowWiseVal = (JSONObject) dataJsn.get(String.valueOf(jsnCnt));
filtrdJsn = new JSONObject();
int count = 0;
for (String presntColumn : presentKeyList)
{
selectedDataList = selectedDataMap.get(presntColumn);
data = "" + fetchRowWiseVal.get(presntColumn);
data = data.replace('"', ' ');
if (selectedDataList.contains(data.trim()) || selectedDataList.isEmpty())
{
count++;
}
}
if (presentKeyList.size() == count && count != 0)
{
dataJsnObj.put("" + cnt, fetchRowWiseVal);
cnt++;
}
}
filtrdJsn.put(entry.getKey(), dataJsnObj);
if (dataJsnObj.toString().length() > 5)
{
filterdDataMap.put(entry.getKey(), filtrdJsn);
}
}
component.buildChart(filterdDataMap, dataDtl.getGridNMapMetData(jsonObjMetaData, viewOptionSelectd));
}
private void addMouseClickHndlr(Widget widget, final ArrayList<SmrtFilterInfo> smrtFltrDtlList)
{
widget.addDomHandler(new ClickHandler()
{
@Override
public void onClick(ClickEvent event)
{
HashMap<String, ArrayList<String>> selectedDataMap = getSelectnMap(smrtFltrDtlList);
if (!selectedDataMap.isEmpty())
{
getFilterdJson(selectedDataMap);
}
}
}, ClickEvent.getType());
}
private void addEnterKeyHndlr(Widget widget, final ArrayList<SmrtFilterInfo> smrtFltrDtlList)
{
widget.addDomHandler(new KeyUpHandler()
{
public void onKeyUp(KeyUpEvent event)
{
int keyCode = event.getNativeKeyCode();
if (keyCode == KeyCodes.KEY_ENTER)
{
HashMap<String, ArrayList<String>> selectedDataMap = getSelectnMap(smrtFltrDtlList);
if (!selectedDataMap.isEmpty())
{
getFilterdJson(selectedDataMap);
}
}
}
}, KeyUpEvent.getType());
}
}
/**
*
*/
package ibase.client;
/**
* @author sachin
*
*/
public class SmrtFilterInfo
{
public SmrtFilterInfo()
{
// TODO Auto-generated constructor stub
}
public String getFltrSelectnMode()
{
return fltrSelectnMode;
}
public void setFltrSelectnMode(String fltrSelectnMode)
{
this.fltrSelectnMode = fltrSelectnMode;
}
public String getFltrColName()
{
return fltrColName;
}
public void setFltrColName(String fltrColName)
{
this.fltrColName = fltrColName;
}
public String getFltrTitle()
{
return fltrTitle;
}
public void setFltrTitle(String filtrTitle)
{
this.fltrTitle = filtrTitle;
}
public String getFltrType()
{
return fltrType;
}
public void setFltrType(String filtrType)
{
this.fltrType = filtrType;
}
String fltrSelectnMode = "";
String fltrColName = "";
String fltrTitle = "";
String fltrType = "";
}
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