Commit 8c8d30ad authored by sbade's avatar sbade

Added GWT component which contains all the gwt aource code along with Css ,...

Added GWT component which contains all the gwt aource code along with Css , images and compiled war folder


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98223 ce508802-f39f-4f6c-b175-0d175dae99d5
parent b75e40a5
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='gwtdashboardreport'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<add-linker name='xs' />
<extend-property name="locale" values="ru"/>
<inherits name='com.google.gwt.user.theme.standard.Standard'/>
<inherits name="com.google.gwt.xml.XML" />
<inherits name='com.google.gwt.widgetideas.WidgetIdeas'/>
<inherits name='com.google.gwt.widgetideas.ScrollTable'/>
<inherits name='com.google.gwt.gen2.table.ScrollTable'/>
<inherits name='com.google.gwt.gen2.table.FixedWidthFlexTable'/>
<inherits name='com.google.gwt.gen2.table.FixedWidthGrid'/>
<inherits name='com.google.gwt.uibinder.UiBinder'/>
<inherits name="com.google.gwt.http.HTTP"/>
<inherits name='com.google.code.gwt.storage.Html5Storage'/>
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> -->
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- Other module inherits -->
<inherits name='org.gwt.mosaic.Mosaic' />
<inherits name="org.gwt.mosaic.actions.Actions"/>
<inherits name="org.gwt.mosaic.theme.aegean.AegeanResources" />
<inherits name='org.gwt.mosaic.theme.aegean.Aegean' />
<inherits name="org.helios.gwt.fonts.GwtWebFonts"/>
<inherits name="com.google.gwt.xml.XML" />
<inherits name="com.google.gwt.json.JSON" />
<inherits name="ibase.e12ria.e12table.E12Table" />
<inherits name="ibase.e12ria.e12widgets.E12Widgets" />
<!-- <inherits name='com.google.gwt.visualization.Visualization' />
<inherits name="com.googlecode.gwtTableToExcel.gwtTableToExcel" /> -->
<!-- set-property name="user.agent" value="safari" /-->
<!-- Specify the app entry point class. -->
<entry-point class='ibase.client.GWTDashBoardReport' />
<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />
</module>
[Dolphin]
Timestamp=2014,8,22,16,52,11
Version=3
ViewMode=2
package ibase.client;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.ComplexPanel;
import com.google.gwt.user.client.ui.Widget;
public class BulletList extends ComplexPanel {
public BulletList() {
setElement(DOM.createElement("UL"));
}
public void add(Widget w) {
super.add(w, getElement());
}
public void insert(Widget w, int beforeIndex) {
super.insert(w, getElement(), beforeIndex, true);
}
}
package ibase.client;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import com.google.gwt.dom.client.Element;
import com.google.gwt.event.logical.shared.AttachEvent;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.user.cellview.client.CellTable;
import com.google.gwt.user.cellview.client.ColumnSortEvent;
import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.view.client.ListDataProvider;
import ibase.client.resources.Resources;
/**
* This class is used to show the data in paged format.
*
* @author base
*/
public class CellTableGridCreator
{
public CellTableGridCreator() {
// TODO Auto-generated constructor stub
}
ListDataProvider<CellTableGridInfo> dataProvider = new ListDataProvider<CellTableGridInfo>();
@SuppressWarnings("unchecked")
public ScrollPanel buildCustomGrid(final HashMap<String, HashMap> gridNGraphMeataDataMap,JSONObject jsonObjGridData)
{
ScrollPanel sp = new ScrollPanel();
gridNGraphMeataDataMap.toString().replace('=', ':');
HashMap<String, ArrayList<String>> graphDataMap = null;
ArrayList<String> graphDtlList = null;
LinkedHashMap<String, List<String>> gridIDMap = null;
final LinkedHashMap<String, List<String>> gridNameMap = null;
LinkedHashMap<String, List<String>> gridNameMap1 = null;
JSONObject tempObj= new JSONObject();
ArrayList<String> paramDtlList = new ArrayList<String>();
final CellTable<CellTableGridInfo> table = new CellTable<CellTableGridInfo>();
List<CellTableGridInfo> CONTACTS = null;
try
{
graphDataMap=gridNGraphMeataDataMap.get("grid");
JSONObject jsonObjData =(JSONObject) jsonObjGridData.get("grid");
//set data into list : list of class objects
CellTableGridInfo cInfo = new CellTableGridInfo();
CONTACTS = (cInfo.getDataInfo(gridNGraphMeataDataMap,jsonObjGridData));
/******start of To create header with colspan********/
for (String dataSource : gridNGraphMeataDataMap.keySet())
{
if (dataSource == "grid")
{
gridIDMap = (LinkedHashMap<String, List<String>>) gridNGraphMeataDataMap.get(dataSource);
tempObj=(JSONObject) jsonObjData.get(dataSource);
/**start of - To add header with colspan: first row of table**/
table.addAttachHandler( new AttachEvent.Handler()
{
@Override
public void onAttachOrDetach(AttachEvent event)
{
LinkedHashMap<String, List<String>> gridNameMap = null;
try
{
gridNameMap = (LinkedHashMap<String, List<String>>) gridNGraphMeataDataMap.get("columnName");
Element elmnt = table.getElement();
Element elementTr = DOM.createTHead();
for (Map.Entry<String, List<String>> entry : gridNameMap.entrySet())
{
String key = entry.getKey();
List<String> values = entry.getValue();
Element elementTd=null;
if(values.size()==1)
{
elementTd = DOM.createTH();
elementTd.setAttribute( "colspan" , "1" );
elementTd.setInnerText( "" );
}
if(values.size()>1)
{
elementTd = DOM.createTH();
elementTd.setAttribute( "colspan" , ""+values.size() );
elementTd.setAttribute("id","");
elementTd.setInnerText( key );
}
elementTr.appendChild( elementTd );
}
elmnt.insertFirst( elementTr );
}
catch (Exception e)
{
Window.alert( "Excpetion CellTableGridCreator:buildCustomGrid():for loop dataSource:["+e.getMessage()+"]" );
}
}
});
/**End of - To add header with colspan: first row of table**/
/**start of - To add header with colspan: second row of table**/
paramDtlList= cInfo.getClassParameters(gridNGraphMeataDataMap);
cInfo.setCellTableColumn(paramDtlList,table);
/**end of - To add header with colspan: second row of table**/
}
}
table.setStyleName("celDataCSS");
// table.setWidth(Window.getClientWidth()+ "px" );
// Create a data provider.
final ListHandler<CellTableGridInfo> sortHandler = new ListHandler<CellTableGridInfo>( dataProvider.getList())
{
@Override
public void onColumnSort(ColumnSortEvent event) {
super.onColumnSort(event);
dataProvider.refresh();
}
};
table.addColumnSortHandler(sortHandler);
// Connect the table to the data provider.
dataProvider.addDataDisplay(table);
// Add the data to the data provider, which automatically pushes it to the
// widget.
List<CellTableGridInfo> list = dataProvider.getList();
for (CellTableGridInfo contact : CONTACTS) {
list.add(contact);
}
/******end of To create header with colspan********/
sp.add(table);
sp.setStyleName("scrollCSS");
}
catch(Exception e)
{
Window.alert( "Excpetion CellTableGridCreator:buildCustomGrid():["+e.getMessage()+"]" );
}
return sp;
}
}
package ibase.client;
import java.util.ArrayList;
import java.util.HashMap;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import ibase.e12ria.e12table.client.E12CustomTextCell;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;
public class CustomFlxTable
{
private static final int HeaderRowIndex = 0;
int rowIndex = 1;
String tltStr = "Total";
final String LEFT = "left";
final String RIGHT = "right";
private void addColumn(Object columnHeading, FlexTable flexTable)
{
Widget widget = createCellWidget(columnHeading);
int cell = flexTable.getCellCount(HeaderRowIndex);
widget.setWidth("100%");
widget.addStyleName("FlexTable-ColumnLabel");
flexTable.setWidget(HeaderRowIndex, cell, widget);
flexTable.getCellFormatter().addStyleName(HeaderRowIndex, cell, "FlexTable-ColumnLabelCell");
}
private Widget createCellWidget(Object cellObject)
{
Widget widget = null;
if (cellObject instanceof Widget)
widget = (Widget) cellObject;
else
widget = new Label(cellObject.toString());
return widget;
}
private void addRowToTbl(ArrayList<String> cellDataList, final FlexTable flexTable, ArrayList<String> cellAlignList)
{
boolean isTotalRow = false;
Widget cellWidget = null;
String data = "";
for (int cell = 0; cell < cellDataList.size(); cell++)
{
cellWidget = createCellWidget(cellDataList.get(cell));
flexTable.setWidget(rowIndex, cell, cellWidget);
data = cellDataList.get(cell);
if (data.indexOf(tltStr) != -1)
{
isTotalRow = true;
}
if (isTotalRow)
{
if (LEFT.equalsIgnoreCase(cellAlignList.get(cell)))
{
flexTable.getCellFormatter().addStyleName(rowIndex, cell, "FlexTable-LblCell-Left");
} else if (RIGHT.equalsIgnoreCase(cellAlignList.get(cell)))
{
flexTable.getCellFormatter().addStyleName(rowIndex, cell, "FlexTable-LblCell-Right");
}
} else
{
if (LEFT.equalsIgnoreCase(cellAlignList.get(cell)))
{
flexTable.getCellFormatter().addStyleName(rowIndex, cell, "FlexTable-Even-Cell-Left");
} else if (RIGHT.equalsIgnoreCase(cellAlignList.get(cell)))
{
flexTable.getCellFormatter().addStyleName(rowIndex, cell, "FlexTable-Even-Cell-Right");
}
}
}
rowIndex++;
}
@SuppressWarnings("unchecked")
public FlexTable createFlxTbl(FlexTable flexTable, HashMap<String, HashMap> gridNGraphMeataDataMap, JSONObject jsonObjGridData,String componentId)
{
flexTable.insertRow(HeaderRowIndex);
flexTable.setCellSpacing(0);
flexTable.addStyleName("FlexTable");
gridNGraphMeataDataMap.toString().replace('=', ':');
HashMap<String, ArrayList<String>> graphDataMap = null;
ArrayList<String> graphDtlList = null;
try
{
graphDataMap = gridNGraphMeataDataMap.get("columnName"+componentId);
for (String graphKey : graphDataMap.keySet())
{
graphDtlList = graphDataMap.get(graphKey);
for (int jDataCtr = 0; jDataCtr < graphDtlList.size(); jDataCtr++)
{
addColumn(graphDtlList.get(jDataCtr), flexTable);
}
}
buildEachRowData(gridNGraphMeataDataMap, jsonObjGridData, flexTable,componentId);
} catch (Exception e)
{
Window.alert(" Exception : CustomFlxTable : creatFlxTbl(): [" + e.getMessage() + "]");
}
return flexTable;
}
@SuppressWarnings("unchecked")
public void buildEachRowData(HashMap<String, HashMap> gridNGraphMetaDataMap, JSONObject jsonObjGridData, FlexTable flexTable,String componentId)
{
gridNGraphMetaDataMap.toString().replace('=', ':');
ArrayList<String> graphDtlList = null;
JSONObject jsonEachRow = null;
String cellText = "";
String align = "";
HashMap<String, String> coloumAlignMap = null;
HashMap<String, ArrayList<String>> graphDataMap = null;
HashMap<Integer, E12CustomTextCell.CellData> rowData = null;
ArrayList<String> cellDataList = new ArrayList<String>();
graphDataMap = gridNGraphMetaDataMap.get(componentId);
coloumAlignMap = gridNGraphMetaDataMap.get("columnAlign"+componentId);
JSONObject jsonObjData = (JSONObject) jsonObjGridData.get(componentId);
ArrayList<String> cellAlignList = new ArrayList<String>();
for (String graphKey : coloumAlignMap.keySet())
{
align = coloumAlignMap.get(graphKey);
cellAlignList.add(align);
}
for (int jRowCtr = 0; jRowCtr < jsonObjData.size(); jRowCtr++)
{
rowData = new HashMap<Integer, E12CustomTextCell.CellData>();
cellDataList = new ArrayList<String>();
for (String graphKey : graphDataMap.keySet())
{
graphDtlList = graphDataMap.get(graphKey);
jsonEachRow = new JSONObject();
jsonEachRow = (JSONObject) jsonObjData.get("" + jRowCtr);
for (int jDataCtr = 0; jDataCtr < graphDtlList.size(); jDataCtr++)
{
cellText = "" + jsonEachRow.get("" + graphDtlList.get(jDataCtr));
cellText = cellText.replace('"', ' ').trim();
cellDataList.add(cellText);
}
}
addRowToTbl(cellDataList, flexTable, cellAlignList);
}
this.expandCollapseTbl(flexTable);
}
private void expandCollapseTbl(final FlexTable flexTable)
{
int rows = flexTable.getRowCount();
int lastTotalRow = 0;
int firstRow = 1;
Widget widget = null;
String total = "";
for (int i = 1; i < rows; i++)
{
widget = flexTable.getWidget(i, 0);
{
total = ((Label) widget).getText();
final Label testLbl = (Label) widget;
if (total.indexOf(tltStr) != -1)
{
lastTotalRow = i;
final int firstRow1 = firstRow;
final int lastTotalRow1 = lastTotalRow;
testLbl.addClickHandler(new ClickHandler()
{
boolean visibleFlag = false;
@Override
public void onClick(ClickEvent event)
{
for (int i = firstRow1; i < lastTotalRow1; i++)
{
flexTable.getRowFormatter().setVisible(i, visibleFlag);
}
if (visibleFlag)
{
visibleFlag = false;
} else
{
visibleFlag = true;
}
}
});
firstRow = lastTotalRow + 1;
}
}
}
}
//add method for flex table heading fixed
/*Method for flextable heading fix Dhanendra 09-10-2014*/
/*public FlexTable addColumnGrid(HashMap<String, HashMap> gridNGraphMeataDataMap, FlexTable flexTable)
{
flexTable.setCellSpacing(0);
flexTable.setCellPadding(0);
flexTable.addStyleName("FlexTable-ColumnLabel");
flexTable.setWidth("100%");
gridNGraphMeataDataMap.toString().replace('=', ':');
HashMap<String, ArrayList<String>> graphDataMap = null;
ArrayList<String> graphDtlList = null;
HashMap<String, String> coloumSizeMap = null;
coloumSizeMap = gridNGraphMeataDataMap.get("columnSize");
ArrayList<String> cellSizeList = new ArrayList<String>();
String size = "";
for (String graphKey : coloumSizeMap.keySet())
{
size = coloumSizeMap.get(graphKey);
cellSizeList.add(size);
}
graphDataMap = gridNGraphMeataDataMap.get("columnName");
int coloumCount=0;
for (String graphKey : graphDataMap.keySet())
{
graphDtlList = graphDataMap.get(graphKey);
for (int jDataCtr = 0; jDataCtr < graphDtlList.size(); jDataCtr++)
{
flexTable.setText(0, coloumCount, graphDtlList.get(jDataCtr));
flexTable.getCellFormatter().addStyleName(HeaderRowIndex, coloumCount, "FlexTable-ColumnLabelCell");
flexTable.getCellFormatter().setWidth(HeaderRowIndex, coloumCount, ""+cellSizeList.get(coloumCount));
}
coloumCount++;
}
return flexTable;
}*/
}
package ibase.client;
import ibase.e12ria.e12table.client.ColumnInfoBean;
import com.google.gwt.cell.client.AbstractCell;
import com.google.gwt.cell.client.Cell.Context;
import com.google.gwt.cell.client.EditTextCell;
import com.google.gwt.dom.builder.shared.TableCellBuilder;
import com.google.gwt.dom.builder.shared.TableRowBuilder;
import com.google.gwt.dom.client.Style.Cursor;
import com.google.gwt.user.cellview.client.AbstractCellTable;
import com.google.gwt.user.cellview.client.AbstractHeaderOrFooterBuilder;
import com.google.gwt.user.cellview.client.Column;
import com.google.gwt.user.cellview.client.ColumnSortList;
import com.google.gwt.user.cellview.client.ColumnSortList.ColumnSortInfo;
import com.google.gwt.user.cellview.client.Header;
import com.google.gwt.user.cellview.client.TextHeader;
public class CustomHeaderBuilder extends AbstractHeaderOrFooterBuilder<ColumnInfoBean> {
public CustomHeaderBuilder(AbstractCellTable<ColumnInfoBean> table,boolean isFooter)
{
super(table, isFooter);
// TODO Auto-generated constructor stub
}
private Header<String> firstNameHeader = new TextHeader("Name");
protected boolean buildHeaderOrFooterImpl()
{
Column<ColumnInfoBean, String> firstNameColumn = new Column<ColumnInfoBean, String>(new EditTextCell()) {
@Override
public String getValue(ColumnInfoBean object) {
return object.getDisplayNameOfCol();
}
};
TableRowBuilder tr = startRow();
tr.startTH().colSpan(2).rowSpan(2);
tr.endTH();
TableCellBuilder th = tr.startTH().colSpan(2);
th.style().trustedProperty("border-right", "10px solid white").cursor(Cursor.POINTER).endStyle();
th.text("Current Year").endTH();
// Information group header.
th = tr.startTH().colSpan(3);
th.text("Previous Year").endTH();
// Get information about the sorted column.
ColumnSortList sortList = null;
ColumnSortInfo sortedInfo = (sortList.size() == 0) ? null : sortList.get(0);
Column<?, ?> sortedColumn = (sortedInfo == null) ? null : sortedInfo.getColumn();
boolean isSortAscending = (sortedInfo == null) ? false : sortedInfo.isAscending();
tr = startRow();
buildHeader(tr, firstNameHeader, firstNameColumn, sortedColumn, isSortAscending, false, false);
return true;
}
private void buildHeader(TableRowBuilder out, Header<?> header, Column<ColumnInfoBean, ?> column,
Column<?, ?> sortedColumn, boolean isSortAscending, boolean isFirst, boolean isLast) {
// Choose the classes to include with the element.
boolean isSorted = true;
// Create the table cell.
TableCellBuilder th = out.startTH();
// Associate the cell with the column to enable sorting of the column.
enableColumnHandlers(th, column);
// Render the header.
Context context = new Context(0, 2, header.getKey());
renderSortableHeader(th, context, header, isSorted, isSortAscending);
// End the table cell.
th.endTH();
}
}
package ibase.client;
import com.google.gwt.animation.client.Animation;
import com.google.gwt.dom.client.Style;
import com.google.gwt.user.client.Element;
public class E12CustomAnimation extends Animation
{
private final Element element;
private int startX;
private int startY;
private int finalX;
private int finalY;
public E12CustomAnimation(Element element)
{
this.element = element;
}
public void scrollTo(int x, int y, int milliseconds)
{
this.finalX = x;
this.finalY = y;
startX = element.getOffsetLeft();
startY = element.getOffsetTop();
if (milliseconds == 0)
{
onComplete();
return;
}
run(milliseconds);
}
public void scrollFromAndTo(int startX, int startY, int finalX, int finalY, int milliseconds)
{
this.finalX = finalX;
this.finalY = finalY;
this.startX = startX;
this.startY = startY;
if (milliseconds == 0)
{
onComplete();
return;
}
run(milliseconds);
}
@Override
protected void onUpdate(double progress)
{
double positionX = startX + (progress * (this.finalX - startX));
double positionY = startY + (progress * (this.finalY - startY));
this.element.getStyle().setLeft(positionX, Style.Unit.PX);
this.element.getStyle().setTop(positionY, Style.Unit.PX);
}
@Override
protected void onComplete()
{
super.onComplete();
this.element.getStyle().setLeft(this.finalX, Style.Unit.PX);
this.element.getStyle().setTop(this.finalY, Style.Unit.PX);
}
}
package ibase.client;
import java.util.ArrayList;
import java.util.ArrayList;
import com.google.gwt.core.client.Callback;
import com.google.gwt.http.client.Request;
import com.google.gwt.http.client.RequestBuilder;
import com.google.gwt.http.client.RequestCallback;
import com.google.gwt.http.client.RequestException;
import com.google.gwt.http.client.Response;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONParser;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.VerticalPanel;
/**
* This class is main class for create a dynamic E12DashBoard page. <BR>
* Parse the xml value and create a DataSet. <BR>
* This class hold the FilterContainer and GroupComponentContainer.
*/
/**
* @author sachin shinde
*/
public class E12DashBoardPage extends Composite
{
/** This is main container for show the GWTDashbaordReport */
public VerticalPanel mainReportContainer = new VerticalPanel();
private static GraphComponent graphComponent = null;
public JSONObject metaDataJsnObj = null;
public E12DashBoardPage(ArrayList<String> parameterList, JSONObject metaDataJsnObj)
{
try
{
this.metaDataJsnObj = metaDataJsnObj;
graphComponent = new GraphComponent(parameterList,metaDataJsnObj,"Y");
graphComponent.setWidth("100%");
mainReportContainer.setWidth("100%");
mainReportContainer.add(graphComponent);
initWidget(mainReportContainer);
initaliseGraphNGrid(parameterList);
} catch (Exception e)
{
Window.alert("Exception :: E12DashBoardPage parametarized constructor [" + e.getMessage() + "]");
}
}
public static void initaliseGraphNGrid(ArrayList<String> parameterList)
{
graphComponent.getData(new Callback<JSONObject, String>()
{
@Override
public void onSuccess(JSONObject jsnObj)
{
}
@Override
public void onFailure(String result)
{
Window.alert("Exception in initaliseGraphNGrid():: E12DashBoardPage [" + result + "]");
}
}, parameterList);
}
public static void getJsonForFilterData(final Callback<JSONObject, String> callback, String fileName)
{
String objActionPath = null;
final int STATUS_CODE_OK = 200;
objActionPath = "/ibase/ParentMetaDataServlet?fileName=" + fileName;
try
{
RequestBuilder reqBuilder = new RequestBuilder(RequestBuilder.POST, objActionPath);
reqBuilder.sendRequest(null, new RequestCallback()
{
@Override
public void onResponseReceived(Request request, Response response)
{
if (STATUS_CODE_OK == response.getStatusCode())
{
JSONObject jsonObjMetaData = null;
jsonObjMetaData = (JSONObject) JSONParser.parseStrict(response.getText());
callback.onSuccess(jsonObjMetaData);
} else
{
Window.alert("Responce is null,case of metadata reading");
}
}
@Override
public void onError(com.google.gwt.http.client.Request request, Throwable exception)
{
Window.alert("Error occured in getJsonForFilterData() :E12DashBoardPage:" + exception.getMessage());
}
});
} catch (RequestException e)
{
e.printStackTrace();
}
}
}
package ibase.client;
import ibase.client.resources.Resources;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.HasAlignment;
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.user.client.ui.VerticalPanel;
public class E12LoadingInterface {
private PopupPanel loadingPnl = null;
private Label loadingInfo = new Label( "" );
private static final ImageResource LOAD_IMG = Resources.INSTANCE.loadingImg();
public E12LoadingInterface(){
setLoading(false);
}
public void setLoading( boolean flag )
{
if( loadingPnl == null )
{
loadingInfo.setStyleName( "busyIndicatorMessage" );
loadingInfo.setText( "Loading..." );
loadingPnl = new PopupPanel();
loadingPnl.setStyleName( "loadingPnl" );
Image loadingImg = new Image();
loadingImg.setResource( LOAD_IMG );
VerticalPanel container = new VerticalPanel();
container.setStyleName( "busyIndicatorContainer" );
container.setSpacing( 5 );
container.add( loadingImg );
container.add( loadingInfo );
container.setCellHorizontalAlignment(loadingImg, HasAlignment.ALIGN_CENTER);
container.setCellHorizontalAlignment(loadingInfo, HasAlignment.ALIGN_CENTER);
loadingPnl.add( container );
loadingPnl.setModal(true);
loadingPnl.setGlassEnabled(true);
loadingPnl.center();
}
if( flag )
{
loadingPnl.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
public void setPosition(int offsetWidth, int offsetHeight)
{
int clientWidth = Window.getClientWidth() ;
int left = ( ( clientWidth - offsetWidth ) / 2 ) ;
int top = loadingPnl.getPopupTop();
loadingPnl.setPopupPosition( left, top );
}
});
}
else
{
loadingPnl.hide();
}
}
public void setLoadingImg( boolean flag )
{
if( loadingPnl == null )
{
//loadingInfo.setStyleName( "busyIndicatorMessage" );
loadingInfo.setText( "Loading..." );
loadingPnl = new PopupPanel();
//loadingPnl.setStyleName( "loadingPnl" );
Image loadingImg = new Image();
loadingImg.setResource( LOAD_IMG );
VerticalPanel container = new VerticalPanel();
//container.setStyleName( "busyIndicatorContainer" );
container.setSpacing( 5 );
container.add( loadingImg );
container.add( loadingInfo );
container.setCellHorizontalAlignment(loadingImg, HasAlignment.ALIGN_CENTER);
container.setCellHorizontalAlignment(loadingInfo, HasAlignment.ALIGN_CENTER);
loadingPnl.add( container );
loadingPnl.setModal(true);
loadingPnl.setGlassEnabled(true);
loadingPnl.center();
}
if( flag )
{
loadingPnl.show();
}
else
{
loadingPnl.hide();
}
}
public void setLoadingInfo( String loadingInfoStr )
{
loadingInfo.setText( loadingInfoStr );
}
}
/**
*
*/
package ibase.client;
/**
* @author user
*
*/
public class FilterInfo
{
public FilterInfo()
{
// TODO Auto-generated constructor stub
}
String colTitle = "";
String colName = "";
String colDescr = "";
String colDescrId = "";
String colNameId = "";
String colModuleName = "";
String filterType = "";
String mandatory = "";
String name = "";
// added for multiple parameter in filter
String headingDisplay="";
String filterText="";
//ended for multiple filter parametere
public String getColTitle()
{
return colTitle;
}
public void setColTitle(String colTitle)
{
this.colTitle = colTitle;
}
public String getFiltertype()
{
return filterType;
}
public void setFiltertype(String filtertype)
{
this.filterType = filtertype;
}
public String getColName()
{
return colName;
}
public void setColName(String colName)
{
this.colName = colName;
}
public String getColDescr()
{
return colDescr;
}
public void setColDescr(String colDescr)
{
this.colDescr = colDescr;
}
public String getColDescrId()
{
return colDescrId;
}
public void setColDescrId(String colDescrId)
{
this.colDescrId = colDescrId;
}
public String getColNameId()
{
return colNameId;
}
public void setColNameId(String colNameId)
{
this.colNameId = colNameId;
}
public String getColModuleName()
{
return colModuleName;
}
public void setColModuleName(String colModuleName)
{
this.colModuleName = colModuleName;
}
public String getMandatory()
{
return mandatory;
}
public void setMandatory(String mandatory)
{
this.mandatory = mandatory;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
/**Start : to add multiple parameter in title date: 12/June/2015**/
public String getHeadingDisplay()
{
return headingDisplay;
}
public String getFilterText()
{
return filterText;
}
public void setHeadingDisplay(String headingDisplay)
{
this.headingDisplay = headingDisplay;
}
public void setFilterText(String filterText)
{
this.filterText = filterText;
}
/**End : to add multiple parameter in title**/
}
package ibase.client;
import java.util.ArrayList;
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;
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>.
*/
public class GWTDashBoardReport implements EntryPoint
{
ArrayList<String> parameterList = new ArrayList<String>();
public ArrayList<FilterInfo> filterList = new ArrayList<FilterInfo>();
HorizontalPanel hpanel= new HorizontalPanel();
String metadataname = "";
public String prdFilterName= "";
@SuppressWarnings("unchecked")
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>()
{
@Override
public void onSuccess(JSONObject 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");
}
}
public void getParameterList(JSONObject metaDataJsnObj)
{
Date date = new Date();
MetaDataDtl dataDtl = new MetaDataDtl();
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;
}
monthYear=year+month;
int count =0;
if(filterList.size()>0)
{
for (FilterInfo filterInfo : filterList)
{
count++;
//if(count==1)
if(filterInfo.getColNameId().equals("PRD_SALESDASH"))
{
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()));
}
}
}
else
{
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;
}
}
package ibase.client;
import ibase.client.resources.Resources;
public class GridThemes {
public static String userTheme;
public static void applyDatagridThemes()
{
//printOnConsole(" Apply Datagrid Themes :" + E12Constants.userTheme );
//Window.alert("E12Constants.userTheme:"+E12Constants.userTheme);
Resources.DATAGRID_RES.blueThemeCSS().ensureInjected();
//Resources.DATAGRID_RES.grayThemeCSS().ensureInjected();
//Resources.DATAGRID_RES.orangeThemeCSS().ensureInjected();
//Resources.DATAGRID_RES.greenThemeCSS().ensureInjected();
}
public native static int getBrowserVersion()
/*-{
var version = -1; //NON IE Browser version
var broserName = navigator.appName;
if(broserName == 'Microsoft Internet Explorer')
{
var browserInfo = navigator.userAgent;
var substrValue = browserInfo.substring( browserInfo.indexOf("MSIE") );
var browserVersion = substrValue.substring( 0, substrValue.indexOf(";") );
version = parseInt( browserVersion.substring( browserVersion.indexOf(" ") ) );
}
return version;
}-*/;
}
package ibase.client;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.BlurEvent;
import com.google.gwt.event.dom.client.BlurHandler;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.event.dom.client.HasBlurHandlers;
import com.google.gwt.event.dom.client.HasKeyDownHandlers;
import com.google.gwt.event.dom.client.KeyDownEvent;
import com.google.gwt.event.dom.client.KeyDownHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.ComplexPanel;
import com.google.gwt.user.client.ui.HasHTML;
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.Widget;
public class ListItem extends ComplexPanel implements HasText, HasHTML, HasClickHandlers, HasKeyDownHandlers, HasBlurHandlers {
HandlerRegistration clickHandler;
public ListItem() {
setElement(DOM.createElement("LI"));
}
public void add(Widget w) {
super.add(w, getElement());
}
public void insert(Widget w, int beforeIndex) {
super.insert(w, getElement(), beforeIndex, true);
}
public String getText() {
return DOM.getInnerText(getElement());
}
public void setText(String text) {
DOM.setInnerText(getElement(), (text == null) ? "" : text);
}
public void setId(String id) {
DOM.setElementAttribute(getElement(), "id", id);
}
public String getHTML() {
return DOM.getInnerHTML(getElement());
}
public void setHTML(String html) {
DOM.setInnerHTML(getElement(), (html == null) ? "" : html);
}
public HandlerRegistration addClickHandler(ClickHandler handler) {
return addDomHandler(handler, ClickEvent.getType());
}
public HandlerRegistration addKeyDownHandler(KeyDownHandler handler) {
return addDomHandler(handler, KeyDownEvent.getType());
}
public HandlerRegistration addBlurHandler(BlurHandler handler) {
return addDomHandler(handler, BlurEvent.getType());
}
}
\ No newline at end of file
package ibase.client;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.Widget;
/**
* This widget is to create <p> elements in a page.
*/
public class Paragraph extends Widget implements HasText {
public Paragraph() {
setElement(DOM.createElement("p"));
}
public Paragraph(String text) {
this();
setText(text);
}
public String getText() {
return getElement().getInnerText();
}
public void setText(String text) {
getElement().setInnerText(text);
}
}
package ibase.client;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasText;
/**
* This widget is to create <span> elements in a page.
*/
public class Span extends HTML implements HasText {
public Span() {
super(DOM.createElement("span"));
}
public Span(String text) {
this();
setText(text);
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment