Commit 27f55cbb authored by sbade's avatar sbade

added rootpanle clear code


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@96686 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 0de0dc99
...@@ -2,6 +2,7 @@ package ibase.client; ...@@ -2,6 +2,7 @@ package ibase.client;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -13,6 +14,7 @@ import com.google.gwt.http.client.RequestException; ...@@ -13,6 +14,7 @@ import com.google.gwt.http.client.RequestException;
import com.google.gwt.http.client.Response; import com.google.gwt.http.client.Response;
import com.google.gwt.json.client.JSONObject; import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONParser; import com.google.gwt.json.client.JSONParser;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Window; import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.Composite;
...@@ -24,6 +26,7 @@ import com.google.gwt.user.client.ui.SimplePanel; ...@@ -24,6 +26,7 @@ import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.SplitLayoutPanel; import com.google.gwt.user.client.ui.SplitLayoutPanel;
import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.VerticalPanel;
//import com.googlecode.gwtTableToExcel.client.TableToExcelClientBuilder; //import com.googlecode.gwtTableToExcel.client.TableToExcelClientBuilder;
import com.google.gwt.user.client.ui.Widget;
/** /**
* *
...@@ -44,6 +47,7 @@ public class GraphComponent extends Composite ...@@ -44,6 +47,7 @@ public class GraphComponent extends Composite
public final int STATUS_CODE_OK = 200; public final int STATUS_CODE_OK = 200;
final LinkedHashMap<String, JSONObject> dataMap = new LinkedHashMap<String, JSONObject>(); final LinkedHashMap<String, JSONObject> dataMap = new LinkedHashMap<String, JSONObject>();
ArrayList<String> parameterList = null; ArrayList<String> parameterList = null;
ArrayList<String> idList = new ArrayList<String>();
/** /**
* This constructor initializes the graph container * This constructor initializes the graph container
...@@ -58,10 +62,9 @@ public class GraphComponent extends Composite ...@@ -58,10 +62,9 @@ public class GraphComponent extends Composite
mainContainer.add(new FilterCreator(parameterList, metaDataJsnObj)); mainContainer.add(new FilterCreator(parameterList, metaDataJsnObj));
initWidget(mainContainer); initWidget(mainContainer);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void buildChart(final LinkedHashMap<String, JSONObject> dataMap) public void buildChart(final LinkedHashMap<String, JSONObject> dataMap)
{ {
JSONObject jsonObjFrGraph = null; JSONObject jsonObjFrGraph = null;
String height = null; String height = null;
String width = null; String width = null;
...@@ -77,12 +80,25 @@ public class GraphComponent extends Composite ...@@ -77,12 +80,25 @@ public class GraphComponent extends Composite
String component =""; String component ="";
HashMap<String, ArrayList<String>> graphTypeMap = null; HashMap<String, ArrayList<String>> graphTypeMap = null;
String dtSrouce=""; String dtSrouce="";
int count=0; 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>();
}
for (String componentId : gridNGraphMeataDataMap.keySet()) for (String componentId : gridNGraphMeataDataMap.keySet())
{ {
jsonObjFrGraph=new JSONObject(); jsonObjFrGraph=new JSONObject();
if(isNumeric(componentId)) if(isNumeric(componentId))
{ {
idList.add(componentId);
compType = componentType.trim() +componentId.trim(); compType = componentType.trim() +componentId.trim();
graphDataMap = gridNGraphMeataDataMap.get(componentId); graphDataMap = gridNGraphMeataDataMap.get(componentId);
datasourceMap = gridNGraphMeataDataMap.get("datasource"+componentId); datasourceMap = gridNGraphMeataDataMap.get("datasource"+componentId);
...@@ -116,6 +132,7 @@ public class GraphComponent extends Composite ...@@ -116,6 +132,7 @@ public class GraphComponent extends Composite
else if("T".equalsIgnoreCase(type) && jsonObjFrGraph != null) else if("T".equalsIgnoreCase(type) && jsonObjFrGraph != null)
{ {
RootPanel.get("chartContainer"+componentId).clear(); RootPanel.get("chartContainer"+componentId).clear();
//RootPanel.get().clear();
ScrollPanel scrlPanel = new ScrollPanel(); ScrollPanel scrlPanel = new ScrollPanel();
FlexTable flexTable = new FlexTable(); FlexTable flexTable = new FlexTable();
...@@ -124,7 +141,6 @@ public class GraphComponent extends Composite ...@@ -124,7 +141,6 @@ public class GraphComponent extends Composite
CustomFlxTable customFlxTable = new CustomFlxTable(); CustomFlxTable customFlxTable = new CustomFlxTable();
flexTable = customFlxTable.createFlxTbl(flexTable, gridNGraphMeataDataMap, jsonObjFrGraph,componentId); flexTable = customFlxTable.createFlxTbl(flexTable, gridNGraphMeataDataMap, jsonObjFrGraph,componentId);
//This Block for Export to excel and PDF formate //This Block for Export to excel and PDF formate
HorizontalPanel horizontalPnl = new HorizontalPanel(); HorizontalPanel horizontalPnl = new HorizontalPanel();
Button excelBtn = new Button("Export To Excel"); Button excelBtn = new Button("Export To Excel");
excelBtn.setTitle("Excel"); excelBtn.setTitle("Excel");
...@@ -144,7 +160,6 @@ public class GraphComponent extends Composite ...@@ -144,7 +160,6 @@ public class GraphComponent extends Composite
CustomGrid data = new CustomGrid(10); CustomGrid data = new CustomGrid(10);
flexTable = data.jsonToArrayList(gridNGraphMeataDataMap, jsonObjFrGraph,dtSrouce,componentId); flexTable = data.jsonToArrayList(gridNGraphMeataDataMap, jsonObjFrGraph,dtSrouce,componentId);
//This Block for Export to excel and PDF formate //This Block for Export to excel and PDF formate
HorizontalPanel horizontalPnl = new HorizontalPanel(); HorizontalPanel horizontalPnl = new HorizontalPanel();
Button excelBtn = new Button("Export To Excel"); Button excelBtn = new Button("Export To Excel");
excelBtn.setTitle("Excel"); excelBtn.setTitle("Excel");
...@@ -164,23 +179,20 @@ public class GraphComponent extends Composite ...@@ -164,23 +179,20 @@ public class GraphComponent extends Composite
private native void createChart(String chartData, String containerId, String chartContainer, String width, String height, String imageName) private native void createChart(String chartData, String containerId, String chartContainer, String width, String height, String imageName)
/*-{ /*-{
try { try {
$wnd.createFusionChart(chartData, containerId, chartContainer, $wnd.createFusionChart(chartData, containerId, chartContainer,width, height, imageName);
width, height, imageName);
} catch (e) { } catch (e) {
alert("Excpeiton :: GraphComponent : createChart [" + e.message + "]"); alert("Excpeiton :: GraphComponent : createChart [" + e.message + "]");
} }
}-*/; }-*/;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void getData(final Callback<JSONObject, String> callback, ArrayList<String> parameterList) public void getData(final Callback<JSONObject, String> callback, ArrayList<String> parameterList)
{ {
String viewOptionSelectd = parameterList.get(parameterList.size()-1); String viewOptionSelectd = parameterList.get(parameterList.size()-1);
MetaDataDtl dataDtl = new MetaDataDtl(); MetaDataDtl dataDtl = new MetaDataDtl();
ArrayList<FilterInfo> filterList = new ArrayList<FilterInfo>(); ArrayList<FilterInfo> filterList = new ArrayList<FilterInfo>();
gridNGraphMeataDataMap = dataDtl.getGridNMapMetData(jsonObjMetaData,viewOptionSelectd);
gridNGraphMeataDataMap = dataDtl.getGridNMapMetData(jsonObjMetaData,viewOptionSelectd); final LinkedHashMap<String, ArrayList<String>> datsSourceDtlMap = (LinkedHashMap) gridNGraphMeataDataMap.get("datSrc");
getDataMap(datsSourceDtlMap);
final LinkedHashMap<String, ArrayList<String>> datsSourceDtlMap = (LinkedHashMap) gridNGraphMeataDataMap.get("datSrc");
getDataMap(datsSourceDtlMap);
} }
public void getDataMap(final LinkedHashMap<String, ArrayList<String>> datsSourceDtlMap) public void getDataMap(final LinkedHashMap<String, ArrayList<String>> datsSourceDtlMap)
...@@ -189,7 +201,6 @@ public class GraphComponent extends Composite ...@@ -189,7 +201,6 @@ public class GraphComponent extends Composite
for (Map.Entry<String, ArrayList<String>> entry : datsSourceDtlMap.entrySet()) for (Map.Entry<String, ArrayList<String>> entry : datsSourceDtlMap.entrySet())
{ {
count++; count++;
final String key = entry.getKey(); final String key = entry.getKey();
List<String> values = entry.getValue(); List<String> values = entry.getValue();
String dbDataSource = values.get(0); String dbDataSource = values.get(0);
...@@ -203,7 +214,7 @@ public class GraphComponent extends Composite ...@@ -203,7 +214,7 @@ public class GraphComponent extends Composite
} else if (page.equals("expense")) } else if (page.equals("expense"))
{ {
objActionPath = "/ibase/" + servletname + "?month=" + parameterList.get(1) + "&dataSourceName=" + dbDataSource; objActionPath = "/ibase/" + servletname + "?month=" + parameterList.get(1) + "&dataSourceName=" + dbDataSource;
} else if (page.equals("topbran")) } else if (page.equals("topbrand"))
{ {
objActionPath = "/ibase/" + servletname + "?topNos=" + parameterList.get(1) + "&month=" + parameterList.get(2) + "&dataSourceName=" + dbDataSource; objActionPath = "/ibase/" + servletname + "?topNos=" + parameterList.get(1) + "&month=" + parameterList.get(2) + "&dataSourceName=" + dbDataSource;
} else if (page.equals("recall")) } else if (page.equals("recall"))
...@@ -268,9 +279,8 @@ public class GraphComponent extends Composite ...@@ -268,9 +279,8 @@ public class GraphComponent extends Composite
JSONObject jsonObjData = new JSONObject(); JSONObject jsonObjData = new JSONObject();
jsonObjData.put(key, servletJsnObj); jsonObjData.put(key, servletJsnObj);
dataMap.put(key, jsonObjData); dataMap.put(key, jsonObjData);
// getData(callback,parameterList);
if (dataMap.size() == datsSourceDtlMap.size()) if (dataMap.size() == datsSourceDtlMap.size())
{ {
buildChart(dataMap); buildChart(dataMap);
} }
} }
......
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