Skip to content

Commit

Permalink
#16 : fixed height of first Header. Solved the pager problem.
Browse files Browse the repository at this point in the history
  • Loading branch information
wbalcaen committed Nov 22, 2012
1 parent 03761c1 commit 58411c7
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 30 deletions.
Expand Up @@ -43,6 +43,7 @@
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.view.client.ListDataProvider;
import com.google.gwt.view.client.RangeChangeEvent;
import com.tinsys.itc_reporting.client.service.SalesReportService;
import com.tinsys.itc_reporting.client.service.SalesReportServiceAsync;
import com.tinsys.itc_reporting.client.widgets.utils.CellTableRes;
Expand Down Expand Up @@ -76,7 +77,11 @@ public class MonthlySalesReport extends Composite implements
@UiField
SimplePager pager = new SimplePager(SimplePager.TextLocation.CENTER,
pagerResources, false, 0, true);


@UiField
SimplePager hiddenPager = new SimplePager(SimplePager.TextLocation.CENTER,
pagerResources, false, 0, true);

ListDataProvider<ZoneReportSummary> provider = new ListDataProvider<ZoneReportSummary>();

@UiField
Expand Down Expand Up @@ -254,20 +259,21 @@ public String getValue(ZoneReportSummary object) {
salesFixedColumn.setHeaderBuilder(new CustomHeaderBuilderBis());
}
salesFixedColumn.setRowCount(result.size(), true);
if (pager.getDisplay() == null) {
pager.setDisplay(salesFixedColumn);
if (hiddenPager.getDisplay() == null) {
hiddenPager.setDisplay(salesDataGrid);
}
if (pager.getDisplay() == null) {
pager.setDisplay(salesFixedColumn);
}
pager.setRangeLimited(true);
hiddenPager.setRangeLimited(true);
provider.getList().clear();
if (provider.getDataDisplays().contains(salesFixedColumn)) {
provider.removeDataDisplay(salesFixedColumn);
}
provider.addDataDisplay(salesFixedColumn);
salesDataGrid.setRowCount(result.size(), true);
if (pager.getDisplay() == null) {
pager.setDisplay(salesDataGrid);
}
pager.setRangeLimited(true);

provider.getList().clear();
if (provider.getDataDisplays().contains(salesDataGrid)) {
provider.removeDataDisplay(salesDataGrid);
Expand All @@ -276,6 +282,20 @@ public String getValue(ZoneReportSummary object) {

provider.refresh();
provider.getList().addAll(result);
RangeChangeEvent.Handler handler = new RangeChangeEvent.Handler() {

@Override
public void onRangeChange(RangeChangeEvent event) {
if (event.getSource()==salesFixedColumn){
Window.alert(" range change "+event.getNewRange());
hiddenPager.setPage(pager.getPage());
hiddenPager.setPageSize(pager.getPageSize());
hiddenPager.setPageStart(pager.getPageStart());
}
}
};
salesFixedColumn.addRangeChangeHandler(handler);

Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
Expand All @@ -285,7 +305,6 @@ public void execute() {
+ (widgetRootPanel.getOffsetWidth() - 180) + "px");
}
});

}

private void generateColumn(final String col,
Expand Down Expand Up @@ -400,7 +419,7 @@ protected boolean buildHeaderOrFooterImpl() {
* tr.startTH().colSpan(1).rowSpan(1); tr.endTH();
*/

String styleDescription = "border-bottom: 2px solid #6f7277;padding: 3px 15px;text-align: left;color: #4b4a4a;text-shadow: #ddf 1px 1px 0;overflow: hidden;";
String styleDescription = "border-bottom: 2px solid #6f7277;padding: 3px 15px;text-align: left;color: #4b4a4a;text-shadow: #ddf 1px 1px 0;overflow: hidden;height: 60px;";
TableCellBuilder th = tr.startTH().colSpan(3)
.attribute("style", styleDescription);
for (int i = 0; i < headers.size(); i++) {
Expand Down Expand Up @@ -540,7 +559,7 @@ public CustomHeaderBuilderBis() {
protected boolean buildHeaderOrFooterImpl() {
if (salesFixedColumn.getColumnCount() > 0) {
TableRowBuilder tr = startRow();
String styleDescription = "border-bottom: 2px solid #6f7277;padding: 3px 15px;text-align: left;color: #4b4a4a;text-shadow: #ddf 1px 1px 0;overflow: hidden;";
String styleDescription = "border-bottom: 2px solid #6f7277;padding: 3px 15px;text-align: left;color: #4b4a4a;text-shadow: #ddf 1px 1px 0;overflow: hidden;height: 60px;";
TableCellBuilder th = tr.startTH().attribute("style",
styleDescription);

Expand Down
Expand Up @@ -4,7 +4,7 @@
xmlns:dp="urn:import:com.google.gwt.user.datepicker.client">
<ui:style src="../mainStyles.css" />

<g:HorizontalPanel width="99%" ui:field="widgetRootPanel" styleName="{style.noVerticalScroll}">
<g:HorizontalPanel width="99%" ui:field="widgetRootPanel">

<g:VerticalPanel width="100%" styleName="{style.marge}">
<g:HorizontalPanel>
Expand All @@ -16,29 +16,34 @@
<g:ListBox ui:field="yearPeriodListBox" styleName="{style.marge}" />
</g:HorizontalPanel>

<g:HorizontalPanel width="100%" styleName="{style.noVerticalScroll}">
<g:HorizontalPanel width="100%">

<g:HorizontalPanel width = "150px" height = "100px">
<g:ScrollPanel>
<c:CellTable ui:field="salesFixedColumn"
tableLayoutFixed="false" height="90%" />
</g:ScrollPanel>
</g:HorizontalPanel>
<g:HorizontalPanel width="150px" height="100px">
<g:ScrollPanel>
<c:CellTable ui:field="salesFixedColumn"
tableLayoutFixed="false" height="90%" />
</g:ScrollPanel>
</g:HorizontalPanel>

<g:HorizontalPanel styleName="{style.noVerticalScroll}">

<g:ResizeLayoutPanel ui:field="resizablePanel" height = "100%" styleName="{style.noVerticalScroll}">
<g:CustomScrollPanel styleName="{style.noVerticalScroll}">
<c:CellTable ui:field="salesDataGrid"
tableLayoutFixed="false" width="100%" height="100%" styleName="{style.noVerticalScroll}"/>
</g:CustomScrollPanel>
</g:ResizeLayoutPanel>
</g:HorizontalPanel>

<g:HorizontalPanel styleName="{style.noVerticalScroll}">

<g:ResizeLayoutPanel ui:field="resizablePanel"
height="100%" styleName="{style.noVerticalScroll}">
<g:CustomScrollPanel styleName="{style.noVerticalScroll}">
<c:CellTable ui:field="salesDataGrid"
tableLayoutFixed="false" width="100%" height="100%"
styleName="{style.noVerticalScroll}" />
</g:CustomScrollPanel>
</g:ResizeLayoutPanel>
</g:HorizontalPanel>

</g:HorizontalPanel>

<c:SimplePager ui:field='pager' location='CENTER' />
</g:HorizontalPanel>
<g:HorizontalPanel width="100%" styleName="{style.noVerticalScroll}">
<c:SimplePager ui:field='pager' location='CENTER' />
<c:SimplePager ui:field='hiddenPager' location='CENTER'
visible="false" />
</g:HorizontalPanel>


<g:HTMLPanel>
Expand Down
5 changes: 5 additions & 0 deletions src/main/webapp/WEB-INF/web.xml
Expand Up @@ -23,6 +23,11 @@
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>

<context-param>
<param-name>webAppRootKey</param-name>
<param-value>itcReporting</param-value>
</context-param>

<!-- GWT Spring -->
<servlet>
<servlet-name>springGwtRemoteServiceServlet</servlet-name>
Expand Down

0 comments on commit 58411c7

Please sign in to comment.