Skip to content

Commit c93139b

Browse files
authored
Merge pull request #216 from GwtMaterialDesign/release_2.7.0
Release 2.7.0
2 parents 0bff183 + 320c180 commit c93139b

24 files changed

+592
-54
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ cache:
88
- $HOME/.m2
99
before_install:
1010
# install the gwt-material-jquery library before we build the demo
11-
- git clone -b release_2.6.1 https://github.com/GwtMaterialDesign/gwt-material-jquery.git
11+
- git clone -b release_2.7.0 https://github.com/GwtMaterialDesign/gwt-material-jquery.git
1212
- cd gwt-material-jquery
1313
- mvn install -DskipTests=true -DdryRun=true
1414
- cd ..
1515
# install the gwt-material library before we build the demo
16-
- git clone -b release_2.6.1 https://github.com/GwtMaterialDesign/gwt-material.git
16+
- git clone -b release_2.7.0 https://github.com/GwtMaterialDesign/gwt-material.git
1717
- cd gwt-material
1818
- mvn install -DskipTests=true -DdryRun=true
1919
- cd ..

.utility/deploy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
set -ev
3-
if [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "release_2.6.1" ]; then
3+
if [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "release_2.7.0" ]; then
44
echo "<settings><servers><server><id>ossrh</id><username>\${env.OSSRH_USER}</username><password>\${env.OSSRH_PASS}</password></server></servers></settings>" > ~/settings.xml
55
mvn deploy -DskipTests --settings ~/settings.xml
66
fi

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@ A complex table component designed for the material design specifications!
1111
Support documentation can be found [here](https://github.com/GwtMaterialDesign/gwt-material-table/wiki)
1212

1313
## Maven
14-
Current Version 2.6.1
14+
Current Version 2.7.0
1515
```xml
1616
<dependency>
1717
<groupId>com.github.gwtmaterialdesign</groupId>
1818
<artifactId>gwt-material-table</artifactId>
19-
<version>2.6.1</version>
19+
<version>2.7.0</version>
2020
</dependency>
2121
```
2222

2323
```xml
2424
<dependency>
2525
<groupId>com.github.gwtmaterialdesign</groupId>
2626
<artifactId>gwt-material-table</artifactId>
27-
<version>2.6.1</version>
27+
<version>2.7.0</version>
2828
</dependency>
2929
```
3030

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<artifactId>gwt-material-parent</artifactId>
88
<groupId>com.github.gwtmaterialdesign</groupId>
9-
<version>2.6.1</version>
9+
<version>2.7.0</version>
1010
</parent>
1111

1212
<artifactId>gwt-material-table</artifactId>

src/main/java/gwt/material/design/client/data/AbstractDataView.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,10 @@ public void renderColumn(Column<T, ?> column) {
537537
th.addStyleName(TableCssName.SORTABLE);
538538
accessibilityControl.registerHeaderControl(th);
539539
}
540-
540+
th.setResetSortCallback(() -> {
541+
resetSort();
542+
ColumnResetSortEvent.fire(this);
543+
});
541544
addHeader(index, th);
542545
th.setVisible(!column.isHidden());
543546
}
@@ -1146,7 +1149,7 @@ public boolean isHeaderVisible(int colIndex) {
11461149
}
11471150

11481151
@Override
1149-
public final Column<T, ?> addColumn(ColumnValueProvider<T> renderer, String columnName) {
1152+
public final Column<T, ?> addColumn(ColumnValueProvider<T, String> renderer, String columnName) {
11501153
return addColumn(columnName, new TextColumn<T>() {
11511154
@Override
11521155
public String getValue(T object) {
@@ -2649,6 +2652,18 @@ public void maybeApplyFrozenMargins() {
26492652
}
26502653
}
26512654

2655+
@Override
2656+
public void resetSort() {
2657+
for (TableHeader header : getHeaders()) {
2658+
if (header != null) {
2659+
if (header.getSortIcon() != null) {
2660+
header.getSortIcon().setIconType(IconType.DEFAULT);
2661+
}
2662+
header.getElement().removeClassName(TableCssName.SELECTED);
2663+
}
2664+
}
2665+
}
2666+
26522667
@Override
26532668
public int getLeftFrozenColumns() {
26542669
return leftFrozenColumns;

src/main/java/gwt/material/design/client/data/BaseRenderer.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import gwt.material.design.client.data.factory.Mode;
3838
import gwt.material.design.client.ui.MaterialCheckBox;
3939
import gwt.material.design.client.ui.MaterialIcon;
40+
import gwt.material.design.client.ui.MaterialToast;
4041
import gwt.material.design.client.ui.html.Div;
4142
import gwt.material.design.client.ui.table.TableData;
4243
import gwt.material.design.client.ui.table.TableHeader;
@@ -264,6 +265,10 @@ public ColumnContext<T> drawColumn(TableRow row, Context context, T rowValue, Co
264265
data.setMaxWidth(column.getMaxWidth() + "px");
265266
}
266267

268+
if (column.getClassName() != null && !column.getClassName().isEmpty()) {
269+
data.getElement().addClassName(column.getClassName());
270+
}
271+
267272
// Render the column cell
268273
if (column instanceof WidgetColumn) {
269274
wrapper.setStyleName(TableCssName.WIDGET_CELL);
@@ -322,14 +327,17 @@ public TableHeader drawColumnHeader(Widget container, Column<T, ?> column, Strin
322327
if (column.isHelpEnabled()) {
323328
th.updateHelp(column.help());
324329
}
330+
325331
HideOn hideOn = column.hideOn();
326332
if (hideOn != null) {
327333
th.setHideOn(hideOn);
328334
}
335+
329336
TextAlign textAlign = column.textAlign();
330337
if (textAlign != null) {
331338
th.setTextAlign(textAlign);
332339
}
340+
333341
if (column.numeric()) {
334342
th.addStyleName(TableCssName.NUMERIC);
335343
}
@@ -344,6 +352,10 @@ public TableHeader drawColumnHeader(Widget container, Column<T, ?> column, Strin
344352
th.setMaxWidth(column.getMaxWidth() + "px");
345353
}
346354

355+
if (column.getClassName() != null && !column.getClassName().isEmpty()) {
356+
th.getElement().addClassName(column.getClassName());
357+
}
358+
347359
// Apply the style properties
348360
Style style = th.getElement().getStyle();
349361
Map<StyleName, String> styleProps = column.getStyleProperties();
@@ -363,7 +375,7 @@ public TableHeader drawColumnHeader(Widget container, Column<T, ?> column, Strin
363375
int percent = (columnWidth * 100) / rowWidth;
364376
th.setWidth(percent + "%");
365377
}
366-
th.setVisible(true);
378+
th.setVisible(column.isHidden());
367379
return th;
368380
}
369381

src/main/java/gwt/material/design/client/data/DataView.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,4 +168,6 @@ public interface DataView<T> extends HasRows<T>, HasColumns<T>, HasDataSource<T>
168168
void setDefaultBlankPlaceholder(String defaultBlankPlaceholder);
169169

170170
String getBlankPlaceholder();
171+
172+
void resetSort();
171173
}

src/main/java/gwt/material/design/client/data/EventHandlers.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ public interface EventHandlers<T> {
8484
*/
8585
HandlerRegistration addColumnSortHandler(ColumnSortHandler<T> handler);
8686

87+
/**
88+
* Add a handler that triggers when we reset sort in a column
89+
*/
90+
HandlerRegistration addColumnResetSortHandler(ColumnResetSortHandler<T> handler);
91+
8792
/**
8893
* Add a handler that triggers when a category is opened.
8994
*/

src/main/java/gwt/material/design/client/data/HasColumns.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public interface HasColumns<T> {
5353
/**
5454
* Add a new column to the data view.
5555
*/
56-
Column<T, ?> addColumn(ColumnValueProvider<T> provider, String columnName);
56+
Column<T, ?> addColumn(ColumnValueProvider<T, String> provider, String columnName);
5757

5858
/**
5959
* Remove an existing column by index.

src/main/java/gwt/material/design/client/data/component/CategoryComponent.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,11 @@ public void buildColumns(List<Column<T, ?>> allColumns) {
214214
Column<T, ?> column = allColumns.get(i);
215215
if (column != null && !column.name().isEmpty()) {
216216
TableHeader th = new TableHeader();
217-
th.addStyleName("category");
217+
th.addStyleName("category " + column.name().replace(" ", "-"));
218+
String width = column.width();
219+
th.setWidth(column.width());
220+
if (width != null) th.setMinWidth(width);
221+
if (width != null) th.setMaxWidth(width);
218222
parentTh.add(th);
219223
tableHeaderMap.put(column.name(), th);
220224
}

0 commit comments

Comments
 (0)