Commit 36b3be19 authored by sbade's avatar sbade

updated all the java files for dashboard with enhanced functionality


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@96772 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 7c740e7d
......@@ -100,9 +100,10 @@ public class ChartCreator
}
}
int cnt=0;
if (jsonObjGraph != null)
{
cnt++;
allDataMap = new HashMap<String, List<String>>();
barMap = new LinkedHashMap<JSONValue, JSONValue>();
......@@ -111,7 +112,7 @@ public class ChartCreator
allDataList = new ArrayList<LinkedHashMap<JSONValue, JSONValue>>();
try
{
JSONObject jsonObjFrGraph =(JSONObject) jsonObjGraph.get(dataSource);
JSONObject jsonObjFrGraph =(JSONObject) jsonObjGraph.get(dataSource);
for (int jsnCnt = 0; jsnCnt < jsonObjFrGraph.size(); jsnCnt++)
{
JSONObject fetchRowWiseVal = (JSONObject) jsonObjFrGraph.get(String.valueOf(jsnCnt));
......@@ -131,6 +132,7 @@ public class ChartCreator
valueMapSet = allDataMap.keySet();
if(chartTypeList.get(0).trim().equals("bar"))
{
for (String keyString : valueMapSet)
{
mapValuList = allDataMap.get(keyString);
......@@ -168,16 +170,15 @@ public class ChartCreator
barMap.put(new JSONString("renderas"), new JSONString("Line"));
barMap.put(new JSONString("parentYAxis"), new JSONString("s"));
barMap.put(new JSONString("valuePosition"), new JSONString("ABOVE"));
}else{
}
else
{
barMap.put(new JSONString("valuePosition"), new JSONString("BELOW"));
}
barMap.put(new JSONString("color"), new JSONString(colorInfoList.get(seriesCnt)));
barMap.put(new JSONString("data"), barDataVal);
barMap.put(new JSONString("seriesname"), new JSONString(yAxisColumnName.get(seriesCnt)));
allDataList.add(barMap);
allDataList.add(barMap);
}
categryDataVal = JSONParser.parseStrict(labelList.toString().replace('=', ':'));
categryJson.put("category", categryDataVal);
......@@ -185,14 +186,14 @@ public class ChartCreator
graphJson.put("categories", categryJson);
}
else if(chartTypeList.get(0).trim().equals("pie"))
{
{
for (String keyString : valueMapSet)
{
{
mapValuList = allDataMap.get(keyString);
categoryMap = new LinkedHashMap<JSONValue, JSONValue>();
keyString = keyString.replace('"', ' ').trim();
jsnStringValue = new JSONString(keyString);
jsnStringKey = new JSONString("label");
jsnStringKey = new JSONString("label");
categoryMap.put(jsnStringKey, jsnStringValue);
dataStringKey = new JSONString("value");
......@@ -200,11 +201,11 @@ public class ChartCreator
{
dataStringValue = new JSONString("" + mapValuList.get(seriesCnt));
categoryMap.put(dataStringKey, dataStringValue);
barValueList.add(categoryMap);
barValueList.add(categoryMap);
barDataVal = JSONParser.parseStrict(barValueList.toString().replace('=', ':'));
}
graphJson.put("data", barDataVal);
}
}
jsonChartVal = JSONParser.parseStrict(metaDataList.toString());
......
......@@ -25,10 +25,14 @@ 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;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
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.PopupPanel;
import com.google.gwt.view.client.ListDataProvider;
import com.google.gwt.xml.client.Node;
......@@ -82,9 +86,12 @@ public class CustomGrid extends AbstractDataGrid<DataGridTableRowModel>
gridNGraphMeataDataMap.toString().replace('=', ':');
HashMap<String, ArrayList<String>> graphDataMap = null;
HashMap<String, ArrayList<String>> graphSizeMap=null;
HashMap<String, ArrayList<String>> graphCaptioneMap=null;
HashMap<String, ArrayList<String>> graphAlignMap = null;
ArrayList<String> graphDtlList = new ArrayList<String>();
ArrayList<String> graphAlignList=new ArrayList<String>();
ArrayList<String> graphAlignList=new ArrayList<String>();
ArrayList<String> graphCaptionList=new ArrayList<String>();
try
{
graphDataMap=gridNGraphMeataDataMap.get(componentId);
......@@ -117,8 +124,10 @@ public class CustomGrid extends AbstractDataGrid<DataGridTableRowModel>
graphDataMap =gridNGraphMeataDataMap.get("columnName"+componentId);
graphSizeMap =gridNGraphMeataDataMap.get("columnSize"+componentId);
graphAlignMap =gridNGraphMeataDataMap.get("columnAlign"+componentId);
graphCaptioneMap = gridNGraphMeataDataMap.get("componentCaption"+componentId);
for (String graphKey : graphDataMap.keySet())
{
graphDtlList.clear();
graphDtlList = graphDataMap.get(graphKey);
for(int jDataCtr=0;jDataCtr<graphDtlList.size();jDataCtr++)
{
......@@ -127,8 +136,9 @@ public class CustomGrid extends AbstractDataGrid<DataGridTableRowModel>
graphAlignList.add(""+graphAlignMap.get(graphKey));
}
}
graphCaptionList.add(""+graphCaptioneMap.get("componentCaption"+componentId));
flexTable.setStyleName("flexCSS");
flexTable=createTableComponent(dataGridTableRowList,dataGridTableColList,flexTable,graphAlignList);
flexTable=createTableComponent(dataGridTableRowList,dataGridTableColList,flexTable,graphAlignList,graphCaptionList);
} catch (Exception e)
{
Window.alert(" Exception : DataGrid : jsonToArrayList(): [" + e.getMessage() + "]");
......@@ -143,7 +153,7 @@ public class CustomGrid extends AbstractDataGrid<DataGridTableRowModel>
* @param dataGridTableRowList
* @return
*/
public FlexTable createTableComponent( ArrayList< DataGridTableRowModel> dataGridTableRowList, ArrayList<ColumnInfoBean> dataGridTableColList, FlexTable flexTable,ArrayList<String> graphAlignList)
public FlexTable createTableComponent( ArrayList< DataGridTableRowModel> dataGridTableRowList, ArrayList<ColumnInfoBean> dataGridTableColList, FlexTable flexTable,ArrayList<String> graphAlignList,ArrayList<String> graphCaptionList)
{
final int noOfRows = dataGridTableRowList.size();
final int noOfColumns = dataGridTableColList.size();
......@@ -152,7 +162,7 @@ public class CustomGrid extends AbstractDataGrid<DataGridTableRowModel>
//Add by Dnyaneshwar chavan on 07-DEC-2012 [WS2GSUN002 || ] Start
E12CustomColumn firstColumn = null;
//Add by Dnyaneshwar chavan on 07-DEC-2012 [WS2GSUN002 || ] End
String caption ="";
ResizableHeader<DataGridTableRowModel> header=null;
try
{
......@@ -215,68 +225,86 @@ public class CustomGrid extends AbstractDataGrid<DataGridTableRowModel>
this.addColumn(column, header, null);
}
caption = graphCaptionList.get(0);
dataProvider.addDataDisplay( this );
dataProvider.refresh();
this.getColumnSortList().clear();
this.getColumnSortList().push( firstColumn );
this.getColumnSortList().push( firstColumn );
ColumnSortEvent.fire(this, this.getColumnSortList());
}
catch (Exception e )
{
Window.alert("Exception in table "+ e.getMessage()) ;
}
GridThemes.applyDatagridThemes();
E12SimplePager.Resources pagerResources = GWT.create(E12SimplePager.Resources.class);
final E12SimplePager pager = new E12SimplePager(E12SimplePager.TextLocation.CENTER, pagerResources, false, 0 , true);
pager.setDisplay(this);
//E12SimplePager.Resources pagerResources = GWT.create(E12SimplePager.Resources.class);
//final E12SimplePager pager =new E12SimplePager(E12SimplePager.TextLocation.CENTER, pagerResources, false, 0 , true);
HorizontalPanel excelBtnPnl = new HorizontalPanel();
Button excelBtn = new Button();
excelBtn.setTitle("Excel");
Image excelImg = new Image("FusionChart/images/excel.png");
excelImg.setHeight("20px");
excelBtn.getElement().appendChild(excelImg.getElement());
excelBtnPnl.add(ibase.client.tabletoexcel.TableToExcelClientBuilder.fromTable(flexTable).withWidget(excelBtn).buildExportFormWidget());
SimplePager.Resources displayPagerResources = GWT.create(SimplePager.Resources.class);
final SimplePager displayPager = new SimplePager(SimplePager.TextLocation.CENTER, displayPagerResources, false, 0 , true, excelBtnPnl);
displayPager.setDisplay(this);
pager.setRangeText(rangeText);
displayPager.setRangeText(rangeText);
Command setRowCmd = new Command() {
@Override
public void execute() {
public void execute()
{
try
{
int rowNo= (int)Double.parseDouble( pager.getRangeText().trim() );
int rowNo= (int)Double.parseDouble( displayPager.getRangeText().trim() );
if( rowNo > 0 && rowNo <= noOfRows)
{
CustomGrid.this.setPageSize( rowNo );
pager.firstPage();
displayPager.firstPage();
dataProvider.refresh();
rangeText = pager.getRangeText();
pager.setRangeText(pager.getRangeText());
rangeText = displayPager.getRangeText();
displayPager.setRangeText(displayPager.getRangeText());
}
else
{
pager.setRangeText("Error");
displayPager.setRangeText("Error");
}
}
catch (Exception e)
{
pager.setRangeText("Error");
displayPager.setRangeText("Error");
}
}
};
pager.setRangeCommand( setRowCmd );
flexTable.setWidget(0, 0, this);
flexTable.setWidget(1, 0, pager);
displayPager.setRangeCommand( setRowCmd );
flexTable.setText(0, 0, caption);
flexTable.setWidget(1, 0, this);
flexTable.setWidget(2, 0, displayPager);
flexTable.setHeight( Window.getClientHeight() - 195 + "px" );
//flexTable.setWidth( Window.getClientWidth() -10+ "px" );
//flexTable.setWidth("100% !important");
setHeight( Window.getClientHeight() - 207+ "px" );
setHeight( ( ( Window.getClientHeight() - 207 ))+ "px" );
flexTable.getCellFormatter().setStyleName(0 ,0 , "gwt-ScrollTable");
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(1 ,0 , "e12Pager");
flexTable.getCellFormatter().setStyleName(2 ,0 , "e12Pager");
}
else
{
flexTable.getCellFormatter().setStyleName(1 ,0 , "e12Pager-forIE");
flexTable.getCellFormatter().setStyleName(2 ,0 , "e12Pager-forIE");
}
addStyleName("e12AdvDataGrid-SideBars");
......@@ -291,8 +319,7 @@ public class CustomGrid extends AbstractDataGrid<DataGridTableRowModel>
}
@Override
public FlexTable createTableComponent(
ArrayList<DataGridTableRowModel> dataGridTableRowList,
public FlexTable createTableComponent(ArrayList<DataGridTableRowModel> dataGridTableRowList,
ArrayList<ColumnInfoBean> dataGridTableColList, FlexTable flexTable)
{
// TODO Auto-generated method stub
......
......@@ -18,7 +18,6 @@ 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.HTMLPanel;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
......@@ -48,15 +47,17 @@ public class FilterCreator extends Composite
final HorizontalPanel buttonPanle = new HorizontalPanel();
Image HeadingLableImg = new Image("FusionChart/images/menu_button.png");
Image openButton = new Image("FusionChart/images/analysis_scope.png");
String selectedView = "";
String xmlName = "";
public JSONObject metaDataJsnObj = null;
boolean isParameterPrsnt = false;
Label label = null;
ArrayList<String> title = new ArrayList<String>();
ArrayList<String> parameterList = null;
HorizontalPanel headingLableImgPanel = new HorizontalPanel();
public FilterCreator(ArrayList<String> parameterList, JSONObject metaDataJsnObj)
{
this.parameterList = parameterList;
xmlName = parameterList.get(0);
label = new Label();
title = new MetaDataDtl().getTitle(metaDataJsnObj);
......@@ -65,21 +66,18 @@ public class FilterCreator extends Composite
label.setText(title.get(0) + " " + getMonth(parameterList.get(1)) + title.get(1) + getMonth(parameterList.get(2)));
} else
{
//this will depend on client requirement OTC
label.setText(title.get(0) + parameterList.get(2) +"-"+parameterList.get(3));
//label.setText(title.get(0) + parameterList.get(2) + "-" + parameterList.get(3));
label.setText(title.get(0) + parameterList.get(1)) ;//+ "-" + parameterList.get(2));
}
HorizontalPanel headingLableImgPanel = new HorizontalPanel();
HeadingLableImg.setStyleName("filterImage");
// headingLableImgPanel.add(HeadingLableImg);
headingLableImgPanel.add(getViewFilter(parameterList,metaDataJsnObj));
//CustomGrid cg = new CustomGrid(10);
//headingLableImgPanel.add(cg.showOptionMenu(1));
headingLableImgPanel.add(getViewFilter(parameterList, metaDataJsnObj));
headingLableImgPanel.add(label);
lablePanle.add(headingLableImgPanel);
label.getElement().setId("titleLbl");
lablePanle.setStylePrimaryName("lablePanleCSS");
lablePanle.setCellHorizontalAlignment(label, HasHorizontalAlignment.ALIGN_LEFT);
//openButton.setHeight("35px");
openButton.setStyleName("filterImage");
buttonPanle.add(openButton);
buttonPanle.setCellHorizontalAlignment(openButton, HasHorizontalAlignment.ALIGN_RIGHT);
......@@ -94,6 +92,8 @@ public class FilterCreator extends Composite
this.metaDataJsnObj = metaDataJsnObj;
openButton.addClickHandler(new FilterBtnActionHandler());
initWidget(vPanel);
selectedView = parameterList.get(parameterList.size() - 1);
setParameterList(parameterList);
for (int i = 1; i < parameterList.size(); i++)
{
......@@ -102,39 +102,34 @@ public class FilterCreator extends Composite
isParameterPrsnt = true;
}
}
if (isParameterPrsnt)
{
getMetaDataForFltr(parameterList);
}
}
public ArrayList<String> getParameterList()
{
return parameterList;
}
public void setParameterList(ArrayList<String> parameterList)
{
this.parameterList = parameterList;
}
public void getMetaDataForFltr(final ArrayList<String> parameterList)
{
final ArrayList<FilterInfo> filterList = new MetaDataDtl().getFilters(metaDataJsnObj);
//final E12PopupPanel mainPopupPnl = new E12PopupPanel(true);
final PopupPanel mainPopupPnl=new PopupPanel(true);
/*final DialogBox mainPopupPnl=new DialogBox(true);
mainPopupPnl.setText("Application");
*/
final PopupPanel mainPopupPnl = new PopupPanel(true);
VerticalPanel homePgFltrPopupVPnl = new VerticalPanel();
HorizontalPanel finishCancelBtnsHPnl = new HorizontalPanel();
Label headinglable = new Label("Analysis Scope");
Image analysisImage = new Image("FusionChart/images/analysis_scope.png");
/*Button cancelBtn = new Button("Cancel");
Button finishBtn = new Button("Finish");*/
Image finishimage = new Image("FusionChart/images/check.png");
Image cancelimage = new Image("FusionChart/images/close.png");
TextBox inputTxtBox = null;
String[] fltrParmtrArray = null;
String filtrString = "";
......@@ -142,8 +137,14 @@ public class FilterCreator extends Composite
int noOfFiltr = 0;
Label columnNameLbl = null;
popUpHPnl.setSpacing(5);
homePgFltrPopupVPnl.setStylePrimaryName("fltrPopupVPnl");
if(parameterList.size()<=4)
{
homePgFltrPopupVPnl.setStylePrimaryName("fltrPopupVPnlWidthFixed");
}
else
{
homePgFltrPopupVPnl.setStylePrimaryName("fltrPopupVPnl");
}
for (int scrlPnlCnt = 0; scrlPnlCnt < popUpHPnl.getWidgetCount(); scrlPnlCnt++)
{
if (!(popUpHPnl.getWidget(scrlPnlCnt) instanceof Label))
......@@ -170,25 +171,22 @@ public class FilterCreator extends Composite
}
if (filterInfo.filterType.equals("1"))
{
/*columnNameLbl = new Label();
columnNameLbl.setText(filterInfo.getColName());*/
inputTxtBox = new TextBox();
inputTxtBox.setTitle(filterInfo.getColName());
inputTxtBox.setStylePrimaryName("textBoxCss");
VerticalPanel outerVPanel = new VerticalPanel();
/*outerVPanel.setHeight("200px");*/
/* outerVPanel.setHeight("200px"); */
HorizontalPanel Hpanel = new HorizontalPanel();
VerticalPanel Vpanel = new VerticalPanel();
columnNameLbl = new Label(""+filterInfo.getColName());
columnNameLbl = new Label("" + filterInfo.getColName());
Vpanel.add(columnNameLbl);
columnNameLbl.setStyleName("filterHeaderLabel");
Vpanel.setStyleName("filterHeaderPanel");
Hpanel.add(inputTxtBox);
outerVPanel.add(Vpanel);
outerVPanel.add(Hpanel);
if (fltrParmtrArray != null)
{
for (int arrayCnt = 0; arrayCnt < fltrParmtrArray.length; arrayCnt++)
......@@ -196,8 +194,9 @@ public class FilterCreator extends Composite
inputTxtBox.setText(fltrParmtrArray[arrayCnt]);
}
}
/*popUpHPnl.add(columnNameLbl);
popUpHPnl.add(inputTxtBox);*/
/*
* popUpHPnl.add(columnNameLbl); popUpHPnl.add(inputTxtBox);
*/
popUpHPnl.add(outerVPanel);
}
if (filterInfo.filterType.equals("2"))
......@@ -210,9 +209,7 @@ public class FilterCreator extends Composite
}
}
}
/*cancelBtn.setStylePrimaryName("button red-Btn");
finishBtn.setStylePrimaryName("button green-Btn");*/
headinglable.setStyleName("filterDivHeadingName"); //Dhanendra 12-09-2014
HorizontalPanel analysispanel = new HorizontalPanel();
finishCancelBtnsHPnl.setWidth("100%");
......@@ -221,18 +218,11 @@ public class FilterCreator extends Composite
analysisImage.setHeight("30px");
analysispanel.add(analysisImage);
analysispanel.add(headinglable);
finishCancelBtnsHPnl.add(analysispanel);
HorizontalPanel hpanelforbutton = new HorizontalPanel();
/*hpanelforbutton.add(finishBtn);
hpanelforbutton.add(cancelBtn);*/
/*finishCancelBtnsHPnl.setCellHorizontalAlignment(finishimage, HasHorizontalAlignment.ALIGN_CENTER);
finishCancelBtnsHPnl.setCellHorizontalAlignment(cancelimage, HasHorizontalAlignment.ALIGN_CENTER);*/
hpanelforbutton.getElement().setAttribute("align", "right");
finishimage.setHeight("25px");
cancelimage.setHeight("25px");
......@@ -240,32 +230,19 @@ public class FilterCreator extends Composite
hpanelforbutton.add(cancelimage);
cancelimage.setStyleName("imgalignment");
finishCancelBtnsHPnl.setCellHorizontalAlignment(hpanelforbutton, HasHorizontalAlignment.ALIGN_RIGHT);
finishCancelBtnsHPnl.add(hpanelforbutton);
/*finishCancelBtnsHPnl.add(finishBtn);
finishCancelBtnsHPnl.add(cancelBtn);*/
/*finishCancelBtnsHPnl.setCellHorizontalAlignment(finishBtn, HasHorizontalAlignment.ALIGN_RIGHT);
finishCancelBtnsHPnl.setCellHorizontalAlignment(cancelBtn, HasHorizontalAlignment.ALIGN_RIGHT);*/
//finishCancelBtnsHPnl.setCellVerticalAlignment(cancelBtn, HasVerticalAlignment.ALIGN_MIDDLE);
finishCancelBtnsHPnl.setStyleName("filterdivHeading");
/*finishCancelBtnsHPnl.add(finishBtn);
finishCancelBtnsHPnl.setCellHorizontalAlignment(finishBtn, HasHorizontalAlignment.ALIGN_LEFT);
finishCancelBtnsHPnl.setCellVerticalAlignment(finishBtn, HasVerticalAlignment.ALIGN_MIDDLE);*/
finishCancelBtnsHPnl.setSpacing(2);
homePgFltrPopupVPnl.add(finishCancelBtnsHPnl);
homePgFltrPopupVPnl.add(popUpHPnl);
mainPopupPnl.setPopupPosition(100, 60);
mainPopupPnl.getElement().setId("filterMainOuterDiv");
mainPopupPnl.add(homePgFltrPopupVPnl);
mainPopupPnl.getElement().setId("filterMainOuterDiv");
mainPopupPnl.add(homePgFltrPopupVPnl);
mainPopupPnl.show();
//cancelBtn.addClickHandler(new ClickHandler()
cancelimage.addClickHandler(new ClickHandler()
{
@Override
......@@ -291,38 +268,22 @@ public class FilterCreator extends Composite
FilterInfo fltrInfo = null;
String colName = "";
popUpSendDtatList.add(xmlName);
//Window.alert("Filter List Size= "+filterList.size());
//Window.alert("popUpHPnl.getWidgetCount()==== "+popUpHPnl.getWidgetCount());
for (int i = 0; i < filterList.size(); i++)
{
fltrInfo = filterList.get(i);
colName = fltrInfo.getColName();
//Window.alert("colName===: "+colName);
for (int scrlPnlCnt = 0; scrlPnlCnt < popUpHPnl.getWidgetCount(); scrlPnlCnt++)
{
if (popUpHPnl.getWidget(scrlPnlCnt) instanceof VerticalPanel)
{
//Window.alert("In VerticalPanel");
VerticalPanel verticalPanel=(VerticalPanel)popUpHPnl.getWidget(scrlPnlCnt);
//Window.alert("VerticalPanel===: "+verticalPanel.getTitle());
if(verticalPanel.getWidget(1) instanceof HorizontalPanel)
VerticalPanel verticalPanel = (VerticalPanel) popUpHPnl.getWidget(scrlPnlCnt);
if (verticalPanel.getWidget(1) instanceof HorizontalPanel)
{
//Window.alert("In HorizontalPanel");
//Window.alert("=verticalPanel.getWidgetCount()="+verticalPanel.getWidgetCount());
HorizontalPanel horizontalPanel=(HorizontalPanel)verticalPanel.getWidget(1);
//Window.alert("horizontalPanel.getWidget(0)===="+horizontalPanel);
//Window.alert("HorizontalPanel===: "+horizontalPanel.getTitle());
if(horizontalPanel.getWidget(0) instanceof ScrollPanel)
HorizontalPanel horizontalPanel = (HorizontalPanel) verticalPanel.getWidget(1);
if (horizontalPanel.getWidget(0) instanceof ScrollPanel)
{
//Window.alert("In scrollPanel");
scrollPnl = (ScrollPanel) horizontalPanel.getWidget(0);
//Window.alert("scrollPnl.getTitle()======="+scrollPnl.getTitle());
//Window.alert("List==: "+scrollPnl);
StringBuffer selectedChkBoxBuffer = new StringBuffer();
// add here 21 july14
grid = (FlexTable) scrollPnl.getWidget();
row = grid.getRowCount();
for (int rowCnt = 1; rowCnt < row; rowCnt++)
......@@ -332,29 +293,21 @@ public class FilterCreator extends Composite
{
if (selectedChkBoxBuffer.length() != 0)
{
selectedChkBoxBuffer.append(", " + grid.getText(rowCnt, 1));
selectedChkBoxBuffer.append("," + grid.getText(rowCnt, 1).trim());
} else
{
selectedChkBoxBuffer.append(grid.getText(rowCnt, 1));
selectedChkBoxBuffer.append(grid.getText(rowCnt, 1).trim());
}
//Window.alert("selectedChkBoxBuffer.toString(Value)["+selectedChkBoxBuffer.toString()+"]");
}
}
//Window.alert("colName["+colName +"], scrollPnlName["+scrollPnl.getTitle()+"]");
if (scrollPnl.getTitle().equals(colName))
{
popUpSendDtatList.add(selectedChkBoxBuffer.toString());
//Window.alert("popUpSendDtatList["+popUpSendDtatList+"]");
}
}
else if(horizontalPanel.getWidget(0) instanceof TextBox)
} else if (horizontalPanel.getWidget(0) instanceof TextBox)
{
//Window.alert("In TextBox");
fltrTxtBox = (TextBox) horizontalPanel.getWidget(0);
//Window.alert("scrollPnl.getTitle()======="+fltrTxtBox.getTitle());
//Window.alert("colName["+colName +"], scrollPnlName["+fltrTxtBox.getTitle()+"]");
if (fltrTxtBox.getTitle().equals(colName))
{
if (!fltrTxtBox.getText().isEmpty())
......@@ -365,7 +318,7 @@ public class FilterCreator extends Composite
Window.alert(fltrInfo.getColName() + "Can't Be Empty");
}
}
}else if (popUpHPnl.getWidget(scrlPnlCnt) instanceof SuggestBox)
} else if (popUpHPnl.getWidget(scrlPnlCnt) instanceof SuggestBox)
{
suggestBox = (SuggestBox) popUpHPnl.getWidget(scrlPnlCnt);
......@@ -381,19 +334,19 @@ public class FilterCreator extends Composite
}
}
}
}
}
}
}
mainPopupPnl.hide();
if (title.size() > 1)
/*if (title.size() > 1)
{
label.setText(title.get(0) + " " + getMonth(popUpSendDtatList.get(1)) + title.get(1) + getMonth(popUpSendDtatList.get(2)));
} else
{
//this will depend on client requirement OTC
label.setText(title.get(0) + popUpSendDtatList.get(2) +"-"+popUpSendDtatList.get(3));
}
// label.setText(title+" "+getMonth(popUpSendDtatList.get(1)));
label.setText(title.get(0) + popUpSendDtatList.get(2) + "-" + popUpSendDtatList.get(3));
}*/
popUpSendDtatList.add(selectedView);
setParameterList(popUpSendDtatList);
E12DashBoardPage.initaliseGraphNGrid(popUpSendDtatList);
}
});
......@@ -401,9 +354,7 @@ public class FilterCreator extends Composite
public void getPopHelpString(final HorizontalPanel popUpHPnl, final FilterInfo filterInfo, final String[] splitedArray)
{
String objActionPath = "/ibase/DashboardFilterServlet?FIELDNAME=" + filterInfo.getColNameId() + "&MODNAME=" + filterInfo.getColModuleName();
try
{
RequestBuilder reqBuilder = new RequestBuilder(RequestBuilder.POST, objActionPath);
......@@ -418,7 +369,7 @@ public class FilterCreator extends Composite
outerVPanel.setHeight("200px");
HorizontalPanel Hpanel = new HorizontalPanel();
VerticalPanel Vpanel = new VerticalPanel();
Label labelTh = new Label(""+filterInfo.getColName());
Label labelTh = new Label("" + filterInfo.getColName());
Vpanel.add(labelTh);
labelTh.setStyleName("filterHeaderLabel");
Vpanel.setStyleName("filterHeaderPanel");
......@@ -433,8 +384,7 @@ public class FilterCreator extends Composite
outerVPanel.setHeight("200px");
HorizontalPanel Hpanel = new HorizontalPanel();
VerticalPanel Vpanel = new VerticalPanel();
Label labelTh = new Label(""+filterInfo.getColName());
Label labelTh = new Label("" + filterInfo.getColName());
Vpanel.add(labelTh);
labelTh.setStyleName("filterHeaderLabel");
Vpanel.setStyleName("filterHeaderPanel");
......@@ -442,11 +392,9 @@ public class FilterCreator extends Composite
outerVPanel.add(Vpanel);
outerVPanel.add(Hpanel);
popUpHPnl.add(outerVPanel);
//popUpHPnl.add(popHelpGridRadioBtn(getPopUpDataMap(response.getText()), filterInfo, splitedArray));
}
}
@Override
public void onError(com.google.gwt.http.client.Request request, Throwable exception)
{
......@@ -535,7 +483,7 @@ public class FilterCreator extends Composite
//flexTable.setBorderWidth(1);
flexTable.setStyleName("flexTable");
final CheckBox selectAllChkBox = new CheckBox();
for (int colNo = 0; colNo < columnCnt + 1; colNo++)
{
if (colNo == 0)
......@@ -546,7 +494,6 @@ public class FilterCreator extends Composite
} else
{
flexTable.setText(0, 1, filterInfo.getColDescr());
//flexTable.setText(0, 2, filterInfo.getColName());
flexTable.setText(0, 2, "All");
flexTable.getCellFormatter().addStyleName(0, 2, "flexTable-cell");
flexTable.getCellFormatter().setVisible(0, 1, false);
......@@ -646,10 +593,6 @@ public class FilterCreator extends Composite
//flexTable.setBorderWidth(1);
try
{
/*flexTable.setText(0, 1, filterInfo.getColDescr());
flexTable.setText(0, 2, filterInfo.getColName());
flexTable.getCellFormatter().addStyleName(0, 2, "flexTable-cell");
flexTable.getCellFormatter().setVisible(0, 1, false);*/
for (Map.Entry<String, ArrayList<String>> entry : hashMap.entrySet())
{
row = entry.getKey();
......@@ -706,7 +649,7 @@ public class FilterCreator extends Composite
public void getPopHlpStrgFrAutoComp(final FilterInfo filterInfo, final HorizontalPanel popUpHPnl, final String[] splitedArray)
{
String objActionPath = "/ibase/DashboardFilterServlet?FIELDNAME=" + filterInfo.getColNameId() + "&MODNAME=" + filterInfo.getColModuleName();
try
{
......@@ -800,40 +743,41 @@ public class FilterCreator extends Composite
monthInChar = year + " - " + monthInChar;
return monthInChar;
}
@SuppressWarnings("serial")
public ScrollPanel getViewFilter( final ArrayList<String> parameterList,JSONObject metaDataJsnObj)
public ScrollPanel getViewFilter(final ArrayList<String> parameterList, JSONObject metaDataJsnObj)
{
final ScrollPanel viewPanel = new ScrollPanel();
String xmlMetadata = null;
Document document = null;
NodeList rootNodeList = null;
Node rootNode = null;
NodeList viewNodeList = null;
Node viewNode = null;
// NodeList viewNodeList = null;
// Node viewNode = null;
// String view=null;
final String image = "<img align='top' src='FusionChart/images/menu_button.png' height='18px' width='25px'/>";
viewPanel.setWidth("100%");
MenuBar menu = new MenuBar();
try
{
// (new CustomGrid(10)).showOptionMenu();
// (new CustomGrid(10)).showOptionMenu();
xmlMetadata = metaDataJsnObj.get("metaData").toString();
xmlMetadata = metaDataJsnObj.get("metaData").toString().replace("\\", "").trim();
xmlMetadata = xmlMetadata.replace('"', ' ').trim();
document = XMLParser.parse(xmlMetadata);
XMLParser.removeWhitespace(document);
MenuBar fileMenu = new MenuBar(true);
fileMenu.setStyleName("popupMenuBar");
fileMenu.setAnimationEnabled(true);
menu.setStyleName("menuCSS");
SafeHtml addActivityImagePath = new SafeHtml() {
public String asString() {
return image;
}
};
XMLParser.removeWhitespace(document);
MenuBar fileMenu = new MenuBar(true);
fileMenu.setStyleName("popupMenuBar");
fileMenu.setAnimationEnabled(true);
menu.setStyleName("menuCSS");
SafeHtml addActivityImagePath = new SafeHtml()
{
public String asString()
{
return image;
}
};
if (document != null)
{
rootNodeList = document.getElementsByTagName("Root").item(0).getChildNodes();
......@@ -842,27 +786,27 @@ public class FilterCreator extends Composite
rootNode = rootNodeList.item(rootCtr);
if ("view".equals(rootNode.getNodeName()))
{
final String view = rootNode.getAttributes().getNamedItem("name").getNodeValue();
// final String view1 = view;
MenuItem actionItem= new MenuItem( view, new Command()
{
public void execute()
{
parameterList.add(view);
E12DashBoardPage.initaliseGraphNGrid(parameterList);
}
final String view = rootNode.getAttributes().getNamedItem("name").getNodeValue();
MenuItem actionItem = new MenuItem(view, new Command()
{
public void execute()
{
ArrayList<String> selectedParamList = getParameterList();
selectedView = view;
selectedParamList.remove(parameterList.size()-1);
selectedParamList.add(view);
E12DashBoardPage.initaliseGraphNGrid(selectedParamList);
}
});
fileMenu.addItem(actionItem);
actionItem.setStyleName("popupMenuItem");
fileMenu.addItem(actionItem);
actionItem.setStyleName("popupMenuItem");
}
}
menu.addItem(new MenuItem(addActivityImagePath, fileMenu));
menu.addItem(new MenuItem(addActivityImagePath, fileMenu));
viewPanel.add(menu);
viewPanel.setStyleName("scrllPnlMenuBar");
//contextMenuPanel.add(viewPanel);
}
}
catch (Exception e)
} catch (Exception e)
{
Window.alert("Exception in Class FilterCreator:getViewFilter():" + e.getMessage());
}
......
......@@ -7,6 +7,10 @@ import com.google.gwt.json.client.JSONObject;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.RootPanel;
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;
/**
* Entry point classes define <code>onModuleLoad()</code>.
......@@ -22,6 +26,9 @@ public class GWTDashBoardReport implements EntryPoint
public void onModuleLoad()
{
metadataname = Window.Location.getParameter("metadataname") == null ? "" : Window.Location.getParameter("metadataname");
if (metadataname.trim().length() != 0)
{
parameterList.add(metadataname);
E12DashBoardPage.getJsonForFilterData(new Callback<JSONObject, String>()
{
......@@ -36,6 +43,10 @@ public class GWTDashBoardReport implements EntryPoint
Window.alert("Exception :: onModuleLoad() [" + result + "]");
}
}, metadataname);
} else
{
Window.alert("Please Enter Metadata name");
}
}
public void getParameterList(JSONObject metaDataJsnObj)
......@@ -71,8 +82,48 @@ public class GWTDashBoardReport implements EntryPoint
{
parameterList.add(Window.Location.getParameter("metadataname"));
}
parameterList.add(this.getDefaultView(metaDataJsnObj));
E12DashBoardPage e12DashBoardPage = new E12DashBoardPage(parameterList,metaDataJsnObj);
RootPanel.get("filterDiv").add(e12DashBoardPage);
}
public String getDefaultView(JSONObject metaDataJsnObj)
{
String xmlMetadata = null;
Document document = null;
NodeList rootNodeList = null;
Node rootNode = null;
String defaultView = "";
String id = "";
try
{
xmlMetadata = metaDataJsnObj.get("metaData").toString();
xmlMetadata = metaDataJsnObj.get("metaData").toString().replace("\\", "").trim();
xmlMetadata = xmlMetadata.replace('"', ' ').trim();
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 ("view".equals(rootNode.getNodeName()))
{
id = rootNode.getAttributes().getNamedItem("id").getNodeValue();
if (id.equalsIgnoreCase("1"))
{
defaultView = rootNode.getAttributes().getNamedItem("name").getNodeValue();
break;
}
}
}
}
} catch (Exception e)
{
Window.alert("Exception in Class GWTDashBoardReport:()getDefaultView" + e.getMessage());
}
return defaultView;
}
}
......@@ -64,7 +64,7 @@ public class GraphComponent extends Composite
}
@SuppressWarnings("unchecked")
public void buildChart(final LinkedHashMap<String, JSONObject> dataMap)
{
{
JSONObject jsonObjFrGraph = null;
String height = null;
String width = null;
......@@ -166,10 +166,10 @@ public class GraphComponent extends Composite
/*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());
//horizontalPnl.add(ibase.client.tabletoexcel.TableToExcelClientBuilder.fromTable(flexTable).withWidget(excelBtn).buildExportFormWidget());
//End Block for Export to excel and PDF formate
RootPanel.get("chartContainer"+componentId).add(flexTable);
RootPanel.get("chartContainer"+componentId).add(horizontalPnl);
//RootPanel.get("chartContainer"+componentId).add(horizontalPnl);
}
}
}
......@@ -187,6 +187,7 @@ public class GraphComponent extends Composite
@SuppressWarnings("unchecked")
public void getData(final Callback<JSONObject, String> callback, ArrayList<String> parameterList)
{
this.parameterList=parameterList;
String viewOptionSelectd = parameterList.get(parameterList.size()-1);
MetaDataDtl dataDtl = new MetaDataDtl();
ArrayList<FilterInfo> filterList = new ArrayList<FilterInfo>();
......@@ -197,10 +198,9 @@ public class GraphComponent extends Composite
public void getDataMap(final LinkedHashMap<String, ArrayList<String>> datsSourceDtlMap)
{
int count=0;
final LinkedHashMap<String, JSONObject> componentDataMap = new LinkedHashMap<String, JSONObject>();
for (Map.Entry<String, ArrayList<String>> entry : datsSourceDtlMap.entrySet())
{
count++;
final String key = entry.getKey();
List<String> values = entry.getValue();
String dbDataSource = values.get(0);
......@@ -259,7 +259,10 @@ public class GraphComponent extends Composite
{
objActionPath = "/ibase/" + servletname + "?salesperson=" + parameterList.get(1) + "&month=" + parameterList.get(2) + "&year=" + parameterList.get(3) + "&dataSourceName=" + dbDataSource + "&reportName="+page;
}
else if (page.equals("customerinfo"))
{
objActionPath = "/ibase/" + servletname + "?custCode=" + parameterList.get(1) + "&prdCode=" + parameterList.get(2) + "&dataSourceName=" + dbDataSource+"&reportName="+page;
}
//end Add dashboard mapping for OTC dashboard on dated 15-oct-2004
......@@ -278,10 +281,10 @@ public class GraphComponent extends Composite
JSONObject servletJsnObj = (JSONObject) JSONParser.parseStrict(response.getText());
JSONObject jsonObjData = new JSONObject();
jsonObjData.put(key, servletJsnObj);
dataMap.put(key, jsonObjData);
if (dataMap.size() == datsSourceDtlMap.size())
componentDataMap.put(key, jsonObjData);
if (componentDataMap.size() == datsSourceDtlMap.size())
{
buildChart(dataMap);
buildChart(componentDataMap);
}
}
} else
......
......@@ -59,6 +59,7 @@ public class MetaDataDtl
LinkedHashMap<String, ArrayList<String>> gridMeataDataMap = null;
LinkedHashMap<String, ArrayList<String>> gridNameDataMap = null;
LinkedHashMap<String, String> gridSizeDataMap = null;
LinkedHashMap<String, String> gridCaptionDataMap = null;
LinkedHashMap<String, String> gridAlignDataMap = null;
LinkedHashMap<String, String> typeGridMap= null;
LinkedHashMap<String, String> typeGraphMap= null;
......@@ -108,6 +109,7 @@ public class MetaDataDtl
gridMeataDataMap = new LinkedHashMap<String, ArrayList<String>>();
gridNameDataMap = new LinkedHashMap<String, ArrayList<String>>();
gridSizeDataMap = new LinkedHashMap<String, String>();
gridCaptionDataMap= new LinkedHashMap<String, String>();
gridAlignDataMap = new LinkedHashMap<String, String>();
divIdGrpMap= new LinkedHashMap<String, String>();
componentTypeMap = new LinkedHashMap<String, String>();
......@@ -141,22 +143,25 @@ public class MetaDataDtl
if ("view".equals(rootNode.getNodeName()))
{
viewNodeList = rootNode.getChildNodes();
if(viewOptionSelectd.equals(rootNode.getAttributes().getNamedItem("name").getNodeValue()))
if(!viewOptionSelectd.equals(rootNode.getAttributes().getNamedItem("name").getNodeValue()))
{
}
if( viewOptionSelectd !=null && viewOptionSelectd.equals(rootNode.getAttributes().getNamedItem("name").getNodeValue()))
{
for (int viewCtr = 0; viewCtr < viewNodeList.getLength(); viewCtr++)
{
viewNode = viewNodeList.item(viewCtr);
if ("grid".equals(viewNode.getNodeName()))
{
gridNameDataMap=new LinkedHashMap<String, ArrayList<String>>();
gridNameDataMap=new LinkedHashMap<String, ArrayList<String>>();
gridMeataDataMap=new LinkedHashMap<String, ArrayList<String>>();
gridSizeDataMap=new LinkedHashMap<String, String>();
gridCaptionDataMap=new LinkedHashMap<String, String>();
gridAlignDataMap=new LinkedHashMap<String, String>();
typeGridMap = new LinkedHashMap<String, String>();
gridDataSourceMap= new LinkedHashMap<String, String>();
gridCompTypeMap = new LinkedHashMap<String, String>();
gridCompTypeMap = new LinkedHashMap<String, String>();
graphID = viewNode.getAttributes().getNamedItem("id").getNodeValue();
dataSource = viewNode.getAttributes().getNamedItem("datasource").getNodeValue();
type= viewNode.getAttributes().getNamedItem("type").getNodeValue();
......@@ -164,13 +169,20 @@ public class MetaDataDtl
typeGridMap.put("type"+graphID, type);
gridNodeList = viewNode.getChildNodes();
String componentType = "";
String componentCaption="";
for (int gridCtr = 0; gridCtr < gridNodeList.getLength(); gridCtr++)
{
columnGrpNode = gridNodeList.item(gridCtr);
if (columnGrpNode.getNodeName().equals("component_type"))
{
componentType = columnGrpNode.getChildNodes().item(0).getNodeValue();
} else
}
else if (columnGrpNode.getNodeName().equals("component_caption"))
{
componentCaption = columnGrpNode.getChildNodes().item(0).getNodeValue();
}
else
{
columnGrpId = columnGrpNode.getAttributes().getNamedItem("id").getNodeValue();
columnGrpNodeList = columnGrpNode.getChildNodes();
......@@ -213,18 +225,20 @@ public class MetaDataDtl
gridAlignDataMap.put(title, columnAlign);
}
}
gridCaptionDataMap.put("componentCaption"+graphID,componentCaption );
gridCompTypeMap.put("buildComponent"+graphID, componentType);
gridNGraphMeataDataMap.put("componentType"+graphID, gridCompTypeMap);
gridNGraphMeataDataMap.put(graphID, gridMeataDataMap);
gridNGraphMeataDataMap.put("columnName"+graphID, gridNameDataMap);
gridNGraphMeataDataMap.put("columnSize"+graphID, gridSizeDataMap);
gridNGraphMeataDataMap.put("componentCaption"+graphID, gridCaptionDataMap);
gridNGraphMeataDataMap.put("columnAlign"+graphID, gridAlignDataMap);
gridNGraphMeataDataMap.put("type"+graphID, typeGridMap);
gridNGraphMeataDataMap.put("datasource"+graphID, gridDataSourceMap);
columnIDList.clear();
columnNameList.clear();
}
if ("graph".equals(viewNode.getNodeName()))
{
......@@ -328,7 +342,7 @@ public class MetaDataDtl
}
if (flag.equals("false"))
{
metaDataMap.put(new JSONString("lineAlpha"), new JSONString("1"));
//metaDataMap.put(new JSONString("lineAlpha"), new JSONString("1"));
metaDataMap.put(new JSONString("anchorBorderThickness"), new JSONString("3"));
}
}
......@@ -547,6 +561,7 @@ public class MetaDataDtl
public ArrayList<String> getTitle(JSONObject jsonObjMetadata)
{
Document document = null;
String xmlMetadata = null;
Node rootNode = null;
......
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