Skip to content

Commit

Permalink
Merge pull request #214 from GwtMaterialDesign/release_2.6.1
Browse files Browse the repository at this point in the history
Release 2.6.1
  • Loading branch information
kevzlou7979 authored Aug 4, 2022
2 parents e23ef0e + 86fae02 commit 0bff183
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ cache:
- $HOME/.m2
before_install:
# install the gwt-material-jquery library before we build the demo
- git clone -b release_2.6.0 https://github.com/GwtMaterialDesign/gwt-material-jquery.git
- git clone -b release_2.6.1 https://github.com/GwtMaterialDesign/gwt-material-jquery.git
- cd gwt-material-jquery
- mvn install -DskipTests=true -DdryRun=true
- cd ..
# install the gwt-material library before we build the demo
- git clone -b release_2.6.0 https://github.com/GwtMaterialDesign/gwt-material.git
- git clone -b release_2.6.1 https://github.com/GwtMaterialDesign/gwt-material.git
- cd gwt-material
- mvn install -DskipTests=true -DdryRun=true
- cd ..
Expand Down
2 changes: 1 addition & 1 deletion .utility/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
set -ev
if [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "release_2.6.0" ]; then
if [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "release_2.6.1" ]; then
echo "<settings><servers><server><id>ossrh</id><username>\${env.OSSRH_USER}</username><password>\${env.OSSRH_PASS}</password></server></servers></settings>" > ~/settings.xml
mvn deploy -DskipTests --settings ~/settings.xml
fi
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ A complex table component designed for the material design specifications!
Support documentation can be found [here](https://github.com/GwtMaterialDesign/gwt-material-table/wiki)

## Maven
Current Version 2.6.0
Current Version 2.6.1
```xml
<dependency>
<groupId>com.github.gwtmaterialdesign</groupId>
<artifactId>gwt-material-table</artifactId>
<version>2.6.0</version>
<version>2.6.1</version>
</dependency>
```

```xml
<dependency>
<groupId>com.github.gwtmaterialdesign</groupId>
<artifactId>gwt-material-table</artifactId>
<version>2.6.0</version>
<version>2.6.1</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>gwt-material-parent</artifactId>
<groupId>com.github.gwtmaterialdesign</groupId>
<version>2.6.0</version>
<version>2.6.1</version>
</parent>

<artifactId>gwt-material-table</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down Expand Up @@ -48,12 +48,16 @@ public class MaterialDataPager<T> extends MaterialWidget implements HasPager {
protected MaterialDataTable<T> table;
protected DataSource<T> dataSource;

protected boolean rendered;
protected int offset = 0;
protected int limit = 0;
protected int currentPage = 1;
protected int totalRows = 0;
protected int[] limitOptions = new int[]{5, 10, 20};
protected DataPagerLocaleProvider localeProvider = new DataPagerLocaleProvider() {};
protected boolean enableRowSelection = true;
protected boolean enablePageSelection = true;
protected DataPagerLocaleProvider localeProvider = new DataPagerLocaleProvider() {
};

private MaterialPanel pagerWrapper = new MaterialPanel();
private ActionsPanel actionsPanel = new ActionsPanel(this);
Expand Down Expand Up @@ -86,6 +90,11 @@ public MaterialDataPager(MaterialDataTable<T> table, DataSource<T> dataSource, P
protected void onLoad() {
super.onLoad();

if (!rendered) {
render();
rendered = true;
}

load();
}

Expand All @@ -94,16 +103,33 @@ public void load() {
limit = limitOptions[0];
}

firstPage();
}

public void unload() {
offset = 0;
currentPage = 1;
totalRows = 0;
limitOptions = new int[]{10, 20, 30};
}

public void render() {
if (pageSelection == null) {
pageSelection = new PageNumberBox(this);
}
pagerWrapper.add(pageSelection);
pagerWrapper.add(rowSelection);
pagerWrapper.add(actionsPanel);

pagerWrapper.setFloat(Style.Float.RIGHT);
add(pagerWrapper);
firstPage();

if (enablePageSelection) {
pagerWrapper.add(pageSelection);
}

if (enableRowSelection) {
pagerWrapper.add(rowSelection);
}

pagerWrapper.add(actionsPanel);

// Register Accessibility Controls
DataTableAccessibilityControls accessibilityControl = getTable().getView().getAccessibilityControl();
Expand All @@ -112,17 +138,16 @@ public void load() {
}
}

public void unload() {
offset = 0;
currentPage = 1;
totalRows = 0;
limitOptions = new int[]{10, 20, 30};
clear();
public void reload(boolean redraw) {
unload();
if (redraw) {
render();
}
load();
}

public void reload() {
unload();
load();
reload(false);
}

public void updateRowsPerPage(int limit) {
Expand Down Expand Up @@ -242,7 +267,7 @@ public boolean isLastPage() {
protected void doLoad(int offset, int limit) {
DataView<T> dataView = table.getView();
dataSource.load(new LoadConfig<>(dataView, offset, limit, dataView.getSortContext(),
dataView.getOpenCategories()), new LoadCallback<T>() {
dataView.getOpenCategories()), new LoadCallback<T>() {
@Override
public void onSuccess(LoadResult<T> loadResult) {
setOffset(loadResult.getOffset());
Expand Down Expand Up @@ -344,6 +369,22 @@ public void setLocaleProvider(DataPagerLocaleProvider localeProvider) {
this.localeProvider = localeProvider;
}

public boolean isEnableRowSelection() {
return enableRowSelection;
}

public void setEnableRowSelection(boolean enableRowSelection) {
this.enableRowSelection = enableRowSelection;
}

public boolean isEnablePageSelection() {
return enablePageSelection;
}

public void setEnablePageSelection(boolean enablePageSelection) {
this.enablePageSelection = enablePageSelection;
}

@Override
public void setType(PagerType type) {
getTypeMixin().setType(type);
Expand Down

0 comments on commit 0bff183

Please sign in to comment.