Commit ff9a7c96 authored by sbade's avatar sbade

Added updated client source file for GWT component


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@96896 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 19d4d6e0
......@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.google.gwt.json.client.JSONObject;
......@@ -126,13 +127,14 @@ public class ChartCreator
currentvalue = (fetchRowWiseVal.get(yAxisColunList.get(yCnt)).toString().replace('"', ' ').trim());
valueList.add(currentvalue);
}
allDataMap.put(key, valueList);
key = "";
}
valueMapSet = allDataMap.keySet();
if(chartTypeList.get(0).trim().equals("bar"))
{
for (String keyString : valueMapSet)
{
mapValuList = allDataMap.get(keyString);
......@@ -183,7 +185,7 @@ public class ChartCreator
categryDataVal = JSONParser.parseStrict(labelList.toString().replace('=', ':'));
categryJson.put("category", categryDataVal);
graphJson.put("dataset", JSONParser.parseStrict(allDataList.toString().replace('=', ':')));
graphJson.put("categories", categryJson);
graphJson.put("categories", categryJson);
}
else if(chartTypeList.get(0).trim().equals("pie"))
{
......@@ -207,9 +209,62 @@ public class ChartCreator
graphJson.put("data", barDataVal);
}
}
if(chartTypeList.get(0).trim().equals("stack"))
{
HashMap<String, String> dMap = new HashMap<String, String>();
for (String keyString : valueMapSet)
{
mapValuList = allDataMap.get(keyString);
jsnStringKey = new JSONString("label");
dataStringKey = new JSONString("value");
String value = mapValuList.get(1).replace("{", "");
value = value.replace("}", "");
String[] tempArray = value.split(",");
barMap = new LinkedHashMap<JSONValue, JSONValue>();
barValueList = new ArrayList<LinkedHashMap<JSONValue, JSONValue>>();
for(int i=0;i<tempArray.length;i++)
{
if(! tempArray[i].equals(""))
{
String[] tempArr = tempArray[i].split(":");
categoryMap = new LinkedHashMap<JSONValue, JSONValue>();
barChartMap = new LinkedHashMap<JSONValue, JSONValue>();
for(int j=0;j<tempArr.length;j++)
{
jsnStringValue = new JSONString(tempArr[0]);
categoryMap.put(jsnStringKey, jsnStringValue);
if(!barChartMap.containsKey(jsnStringKey))
{
barChartMap.put(dataStringKey, new JSONString(tempArr[1]));
}
}
if(! labelList.contains(categoryMap))
{
labelList.add(categoryMap);
}
if(! barValueList.contains(categoryMap))
{
barValueList.add(barChartMap);
}
}
}
barMap.put(new JSONString("seriesname"), new JSONString(mapValuList.get(0)));
barDataVal = JSONParser.parseStrict(barValueList.toString().replace('=', ':'));
barMap.put(new JSONString("data"), barDataVal);
allDataList.add(barMap);
graphJson.put("dataset", JSONParser.parseStrict(allDataList.toString().replace('=', ':')));
}
categryDataVal = JSONParser.parseStrict(labelList.toString().replace('=', ':'));
categryJson.put("category", categryDataVal);
graphJson.put("categories", categryJson);
}
jsonChartVal = JSONParser.parseStrict(metaDataList.toString());
graphJson.put("chart", jsonChartVal);
//Window.alert("graphJson:"+graphJson);
} catch (Exception e)
{
Window.alert(" Exception :: Build Final Graph component [" + e.getMessage() + "]");
......
......@@ -10,8 +10,6 @@ import ibase.e12ria.e12table.client.E12CustomTextCell;
import ibase.e12ria.e12table.client.ResizableHeader;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.TreeMap;
......@@ -19,11 +17,9 @@ import com.google.gwt.cell.client.TextCell;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.logical.shared.ResizeEvent;
import com.google.gwt.event.logical.shared.ResizeHandler;
import com.google.gwt.i18n.shared.DateTimeFormat;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.user.cellview.client.ColumnSortEvent;
import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler;
import com.google.gwt.user.cellview.client.E12SimplePager;
import com.google.gwt.user.cellview.client.Header;
import com.google.gwt.user.cellview.client.SimplePager;
import com.google.gwt.user.client.Command;
......@@ -33,9 +29,9 @@ import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.view.client.ListDataProvider;
import com.google.gwt.xml.client.Node;
/**
* This class is used to show the data in paged format.
*
......@@ -75,7 +71,7 @@ public class CustomGrid extends AbstractDataGrid<DataGridTableRowModel>
@SuppressWarnings("unchecked")
public FlexTable jsonToArrayList(HashMap<String, HashMap> gridNGraphMeataDataMap,JSONObject jsonObjGridData ,String dataSrc,String componentId)
{
//Window.alert("in jsonarray");
DataGridTableRowModel rowDataGrid= null;
E12CustomTextCell.CellData celldata = null;
......@@ -100,26 +96,29 @@ public class CustomGrid extends AbstractDataGrid<DataGridTableRowModel>
int count=0;
for(int jRowCtr=0;jRowCtr<jsonObjData.size();jRowCtr++)
{
rowData = new HashMap<Integer, E12CustomTextCell.CellData> ();
for (String graphKey : graphDataMap.keySet())
{
graphDtlList = graphDataMap.get(graphKey);
jsonEachRow = new JSONObject();
jsonEachRow = (JSONObject)jsonObjData.get(""+jRowCtr);
count=rowData.size();
for(int jDataCtr=0;jDataCtr<graphDtlList.size();jDataCtr++)
rowData = new HashMap<Integer, E12CustomTextCell.CellData> ();
for (String graphKey : graphDataMap.keySet())
{
celldata = new E12CustomTextCell.CellData((""+jsonEachRow.get(""+graphDtlList.get(jDataCtr))).replace('"', ' '));
celldata.setMandatory(true);
celldata.setOriginalText("Cell"+jDataCtr);
celldata.setName(""+(graphDtlList.get(jDataCtr)).replace('"', ' '));
rowData.put(count, celldata);
count++;
}
}
rowDataGrid = new DataGridTableRowModel(rowData);
dataGridTableRowList.add(rowDataGrid);
graphDtlList = graphDataMap.get(graphKey);
jsonEachRow = new JSONObject();
jsonEachRow = (JSONObject)jsonObjData.get(""+jRowCtr);
// Window.alert("jsonEachRow:"+jsonEachRow);
count=rowData.size();
for(int jDataCtr=0;jDataCtr<graphDtlList.size();jDataCtr++)
{
celldata = new E12CustomTextCell.CellData((""+jsonEachRow.get(""+graphDtlList.get(jDataCtr))).replace('"', ' '));
celldata.setMandatory(true);
celldata.setOriginalText("Cell"+jDataCtr);
celldata.setName(""+(graphDtlList.get(jDataCtr)).replace('"', ' '));
rowData.put(count, celldata);
count++;
}
}
rowDataGrid = new DataGridTableRowModel(rowData);
dataGridTableRowList.add(rowDataGrid);
}
ColumnInfoBean columnInfoBean=null;
graphDataMap =gridNGraphMeataDataMap.get("columnName"+componentId);
......@@ -177,7 +176,8 @@ public class CustomGrid extends AbstractDataGrid<DataGridTableRowModel>
final ListHandler<DataGridTableRowModel> sortHandler = new ListHandler<DataGridTableRowModel>( dataProvider.getList())
{
@Override
public void onColumnSort(ColumnSortEvent event) {
public void onColumnSort(ColumnSortEvent event)
{
super.onColumnSort(event);
dataProvider.refresh();
}
......@@ -186,7 +186,6 @@ public class CustomGrid extends AbstractDataGrid<DataGridTableRowModel>
int width = 0;
for( int i= 0 ; i < noOfColumns ; i++ )
{
final int index = i;
ColumnInfoBean colInfo = dataGridTableColList.get( i );
final String colName = colInfo.getDisplayNameOfCol();
width = colInfo.getWidth();
......@@ -208,7 +207,6 @@ public class CustomGrid extends AbstractDataGrid<DataGridTableRowModel>
{
firstColumn = column;
}
final String dispDate ="12/12/2014";
this.setColumnWidth( column, width +"px" );
header = new ResizableHeader<DataGridTableRowModel>(colName, this, column ) {
@Override
......@@ -254,6 +252,7 @@ public class CustomGrid extends AbstractDataGrid<DataGridTableRowModel>
final SimplePager displayPager = new SimplePager(SimplePager.TextLocation.CENTER, displayPagerResources, false, 0 , true, excelBtnPnl);
displayPager.setDisplay(this);
displayPager.setRangeText(rangeText);
Label labelNoDataFound = new Label("No Data Found");
Command setRowCmd = new Command() {
@Override
public void execute()
......@@ -285,7 +284,16 @@ public class CustomGrid extends AbstractDataGrid<DataGridTableRowModel>
if(caption.trim().length()!=0)
{
flexTable.setText(0, 0, caption);
flexTable.setWidget(1, 0, this);
if(noOfRows<=0)
{
flexTable.setWidget(1, 0, labelNoDataFound);
}else
{
flexTable.setWidget(1, 0, this);
}
//flexTable.setWidget(1, 0, this);
flexTable.setWidget(2, 0, displayPager);
flexTable.getCellFormatter().setStyleName(0 ,0 , "FlexTable-ColumnHeaderCell");
flexTable.getCellFormatter().setStyleName(1 ,0 , "gwt-ScrollTable");
......@@ -301,7 +309,15 @@ public class CustomGrid extends AbstractDataGrid<DataGridTableRowModel>
}else
{
flexTable.setWidget(0, 0, this);
if(noOfRows<=0)
{
flexTable.setWidget(0, 0, labelNoDataFound);
}else
{
flexTable.setWidget(0, 0, this);
}
//flexTable.setWidget(0, 0, this);
flexTable.setWidget(1, 0, displayPager);
flexTable.getCellFormatter().setStyleName(0 ,0 , "gwt-ScrollTable");
......@@ -315,27 +331,18 @@ public class CustomGrid extends AbstractDataGrid<DataGridTableRowModel>
}
}
flexTable.setHeight( Window.getClientHeight() - 195 + "px" );
setHeight( Window.getClientHeight() - 207+ "px" );
setHeight( ( ( Window.getClientHeight() - 207 ))+ "px" );
/*flexTable.setHeight( Window.getClientHeight() - 195 + "px" );
setHeight( Window.getClientHeight() - 240+ "px" );
setHeight( ( ( Window.getClientHeight() - 250 ))+ "px" );*/
flexTable.setHeight("330px");
setHeight("330px");
/*flexTable.setText(0, 0, caption);
flexTable.setWidget(1, 0, this);
flexTable.setWidget(2, 0, displayPager);
//flexTable.setWidth( Window.getClientWidth() -10+ "px" );
//flexTable.setWidth("100% !important");
flexTable.getCellFormatter().setStyleName(0 ,0 , "FlexTable-ColumnHeaderCell");
flexTable.getCellFormatter().setStyleName(1 ,0 , "gwt-ScrollTable");
//flexTable.getCellFormatter().setStyleName(1 ,0 , "e12Pager");
if( GridThemes.getBrowserVersion() == -1 )
{
flexTable.getCellFormatter().setStyleName(2 ,0 , "e12Pager");
}
else
{
flexTable.getCellFormatter().setStyleName(2 ,0 , "e12Pager-forIE");
}*/
addStyleName("e12AdvDataGrid-SideBars");
/*flexTable.setHeight( Window.getClientHeight() - 225 + "px" );
setHeight( Window.getClientHeight() - 207+ "px" );
setHeight( ( ( Window.getClientHeight() - 215 ))+ "px" );*/
//flexTable.setHeight("320px");
//setHeight( ( ( Window.getClientHeight() - 350 ))+ "px" );
//addStyleName("e12AdvDataGrid-SideBars");
return flexTable;
}
......
......@@ -4,6 +4,7 @@ import java.util.Date;
import com.google.gwt.core.client.Callback;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONValue;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.RootPanel;
......@@ -25,9 +26,9 @@ public class GWTDashBoardReport implements EntryPoint
@SuppressWarnings("unchecked")
public void onModuleLoad()
{
metadataname = Window.Location.getParameter("metadataname") == null ? "" : Window.Location.getParameter("metadataname");
if (metadataname.trim().length() != 0)
{
metadataname = Window.Location.getParameter("metadataname") == null ? "" : Window.Location.getParameter("metadataname");
if (metadataname.trim().length() != 0)
{
parameterList.add(metadataname);
E12DashBoardPage.getJsonForFilterData(new Callback<JSONObject, String>()
......@@ -35,18 +36,26 @@ public class GWTDashBoardReport implements EntryPoint
@Override
public void onSuccess(JSONObject jsnObj)
{
getParameterList(jsnObj);
JSONValue jsonValue = jsnObj.get("metaData");
if (jsonValue.toString().length() != 2)
{
getParameterList(jsnObj);
}else
{
Window.alert("MetaData Should Be Proper");
}
}
@Override
public void onFailure(String result)
{
Window.alert("Exception :: onModuleLoad() [" + result + "]");
}
}, metadataname);
} else
{
Window.alert("Please Enter Metadata name");
}
} else
{
Window.alert("Please Enter Metadata name");
}
}
public void getParameterList(JSONObject metaDataJsnObj)
......
......@@ -154,7 +154,6 @@ public class GraphComponent extends Composite
scrlPanel.add(flexTable);
scrlPanel.setStyleName("flextableScrlPnl");
// RootPanel.get("chartContainergrid").add(scrlPanel);
RootPanel.get("chartContainer"+componentId).add(scrlPanel);
RootPanel.get("chartContainer"+componentId).add(horizontalPnl);
......@@ -216,37 +215,52 @@ public class GraphComponent extends Composite
String objActionPath = "";
String page = parameterList.get(0);
String append="";
/****Start Add For SUN Dashboard****/
if (page.equals("sales"))
{
objActionPath = "/ibase/" + servletname + "?month=" + parameterList.get(1) + "&dataSourceName=" + dbDataSource;
} else if (page.equals("expense"))
}
else if (page.equals("expense"))
{
objActionPath = "/ibase/" + servletname + "?month=" + parameterList.get(1) + "&dataSourceName=" + dbDataSource;
} else if (page.equals("topbrand"))
}
else if (page.equals("topbrand"))
{
objActionPath = "/ibase/" + servletname + "?topNos=" + parameterList.get(1) + "&month=" + parameterList.get(2) + "&dataSourceName=" + dbDataSource;
} else if (page.equals("recall"))
}
else if (page.equals("recall"))
{
objActionPath = "/ibase/" + servletname + "?days=" + parameterList.get(1) + "&dataSourceName=" + dbDataSource;
} else if (page.equals("rcp"))
objActionPath = "/ibase/" + servletname + "?lastMonth=" + parameterList.get(1) + "&dataSourceName=" + dbDataSource;
}
else if (page.equals("rcp"))
{
objActionPath = "/ibase/" + servletname + "?dataSourceName=" + dbDataSource + "&days=" + parameterList.get(1);
} else if (page.equals("qc"))
}
else if (page.equals("qc"))
{
objActionPath = "/ibase/" + servletname + "?geoLocation=" + parameterList.get(1) + "&month=" + parameterList.get(2) + "&dataSourceName=" + dbDataSource;
} else if (page.equals("bspl"))
}
else if (page.equals("bspl"))
{
objActionPath = "/ibase/" + servletname + "?sitecode=" + parameterList.get(1) + "&acctprd=" + parameterList.get(2) + "&prdfrom=" + parameterList.get(3) + "&prdto=" + parameterList.get(4) + "&formatcode=" + parameterList.get(5) + "&reporttype=" + parameterList.get(6) + "&dataSourceName=" + dbDataSource;
} else if (page.equals("msrscore"))
}
else if (page.equals("msrscore"))
{
objActionPath = "/ibase/" + servletname + "?territory=" + parameterList.get(1) + "&salesperson=" + parameterList.get(2) + "&month=" + parameterList.get(3) + "&year=" + parameterList.get(4) + "&dataSourceName=" + dbDataSource;
} else if (page.equals("dqsa"))
}
else if (page.equals("dqsa"))
{
objActionPath = "/ibase/" + servletname + "?&dataSourceName=" + dbDataSource;
objActionPath = "/ibase/" + servletname + "?&dataSourceName=" + dbDataSource+ "&reportName="+page;
}
else if (page.equals("customerinfo"))
{
objActionPath = "/ibase/" + servletname + "?custCode=" + parameterList.get(1) + "&prdCode=" + parameterList.get(2) + "&dataSourceName=" + dbDataSource+"&reportName="+page;
}
else if (page.equals("ordershipment"))
{
objActionPath = "/ibase/" + servletname + "?lastMonth=" + parameterList.get(1)+"&siteCode=" + parameterList.get(2) + "&custCode=" + parameterList.get(3) + "&custCodeDlv=" + parameterList.get(4) +"&dataSourceName=" + dbDataSource+"&reportName="+page;
}
/****End Add For SUN Dashboard****/
// start Add dashboard mapping for OTC dashboard on dated 15-oct-2004
......@@ -269,12 +283,6 @@ public class GraphComponent extends Composite
}
//end Add dashboard mapping for OTC dashboard on dated 15-oct-2004
/*Start Add For SUN Dashboard*/
else if (page.equals("customerinfo"))
{
objActionPath = "/ibase/" + servletname + "?custCode=" + parameterList.get(1) + "&prdCode=" + parameterList.get(2) + "&dataSourceName=" + dbDataSource+"&reportName="+page;
}
/*End Add For SUN Dashboard*/
RequestBuilder reqBuilder = new RequestBuilder(RequestBuilder.POST, objActionPath);
try
......@@ -315,9 +323,9 @@ public class GraphComponent extends Composite
}
}
}
public boolean isNumeric(String s) {
public boolean isNumeric(String s) {
return s.matches("[-+]?\\d*\\.?\\d+");
}
}
......@@ -72,7 +72,6 @@ public class InputListWidget extends Composite
});
onLodListItm.add(paragraph);
onLodListItm.add(span);
itemBox.setFocus(true);
list.add(onLodListItm);
}
......@@ -118,19 +117,29 @@ public class InputListWidget extends Composite
});
popUpHPnl.add(list);
// popUpHPnl.getElement().setAttribute("onclick", "document.getElementById('suggestion_box').focus()");
//popUpHPnl.getElement().setAttribute("onclick", "document.getElementById('suggestion_box').focus()");
box.setFocus(true);
}
private void deselectItem(final TextBox itemBox, final BulletList list)
{
String[] itmBoxArr = null;
String itmBoxValue = "";
if (itemBox.getValue() != null && !"".equals(itemBox.getValue().trim()))
{
final ListItem displayItem = new ListItem();
displayItem.setStyleName("token-input-token");
Paragraph p = new Paragraph(itemBox.getValue());
//Paragraph p = new Paragraph(itemBox.getValue());
//**Added new code by sachin on 20/11/14*//
itmBoxValue = itemBox.getValue();
itmBoxArr = itmBoxValue.split("-");
System.out.println(" spltedVlaue=" + itmBoxArr[0]);
/** End Added new code by sachin on 20/11/14 */
Paragraph p = new Paragraph(itmBoxArr[1].trim());
displayItem.addClickHandler(new ClickHandler()
{
public void onClick(ClickEvent clickEvent)
......@@ -138,7 +147,6 @@ public class InputListWidget extends Composite
displayItem.addStyleName("token-input-selected-token");
}
});
Span span = new Span("x");
span.addClickHandler(new ClickHandler()
{
......@@ -151,11 +159,9 @@ public class InputListWidget extends Composite
displayItem.add(p);
displayItem.add(span);
// hold the original value of the item selected
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);
......@@ -181,6 +187,8 @@ public class InputListWidget extends Composite
Node detailNode = null;
NodeList columnList = null;
Node columnNode = null;
String code = "";
String descr = "";
try
{
document = XMLParser.parse(xmlMetadata);
......@@ -205,11 +213,19 @@ public class InputListWidget extends Composite
if ("DETAIL".equals(detailNode.getNodeName()))
{
columnList = detailNode.getChildNodes();
for (int colNodCtr = 0; colNodCtr < 1; colNodCtr++)
for (int colNodCtr = 0; colNodCtr < 2; colNodCtr++)
{
columnNode = columnList.item(colNodCtr);
oracle.add(columnNode.getChildNodes().item(0).getNodeValue());
if (colNodCtr == 0)
{
code = columnNode.getChildNodes().item(0).getNodeValue();
} else if (colNodCtr == 1)
{
descr = columnNode.getChildNodes().item(0).getNodeValue();
}
//oracle.add(columnNode.getChildNodes().item(0).getNodeValue());
}
oracle.add(descr + " - " + code);
}
}
}
......@@ -222,7 +238,7 @@ public class InputListWidget extends Composite
System.out.println(" Exception in getparsing(String xmlMetadata)" + e.getMessage());
e.printStackTrace();
}
return oracle;
}
}
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