├── filteringtable-demo
├── src
│ └── main
│ │ ├── resources
│ │ ├── .gitignore
│ │ └── org
│ │ │ └── tepi
│ │ │ └── filtertable
│ │ │ └── demo
│ │ │ └── FilterTableDemoWidgetset.gwt.xml
│ │ ├── webapp
│ │ └── META-INF
│ │ │ ├── MANIFEST.MF
│ │ │ └── context.xml
│ │ └── java
│ │ └── org
│ │ └── tepi
│ │ └── filtertable
│ │ └── demo
│ │ ├── DemoFilterGenerator.java
│ │ ├── DemoFilterDecorator.java
│ │ └── FilterTableDemoUI.java
├── .gitignore
└── pom.xml
├── .gitignore
├── filteringtable-addon
├── .gitignore
├── src
│ └── main
│ │ ├── resources
│ │ └── org
│ │ │ └── tepi
│ │ │ └── filtertable
│ │ │ ├── WidgetSet.gwt.xml
│ │ │ └── public
│ │ │ └── filteringtable
│ │ │ └── styles.css
│ │ └── java
│ │ └── org
│ │ └── tepi
│ │ └── filtertable
│ │ ├── paged
│ │ ├── PagedTableChangeEvent.java
│ │ ├── PagedFilterControlConfig.java
│ │ ├── PagedFilterTableContainer.java
│ │ └── PagedFilterTable.java
│ │ ├── datefilter
│ │ ├── DateInterval.java
│ │ └── DateFilterPopup.java
│ │ ├── numberfilter
│ │ ├── NumberInterval.java
│ │ ├── NumberFilterPopupConfig.java
│ │ └── NumberFilterPopup.java
│ │ ├── FilterGenerator.java
│ │ ├── client
│ │ └── ui
│ │ │ ├── FilterTreeTableConnector.java
│ │ │ ├── FilterTableConnector.java
│ │ │ ├── VFilterTable.java
│ │ │ └── VFilterTreeTable.java
│ │ ├── FilterDecorator.java
│ │ ├── FilterTable.java
│ │ ├── FilterTreeTable.java
│ │ └── FilterFieldGenerator.java
├── assembly
│ ├── MANIFEST.MF
│ └── assembly.xml
└── pom.xml
├── pom.xml
├── README.md
└── LICENSE.txt
/filteringtable-demo/src/main/resources/.gitignore:
--------------------------------------------------------------------------------
1 | rebel.xml
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | .settings
3 | .project
4 | .classpath
5 | .DS_Store
6 | **/rebel.xml
7 |
--------------------------------------------------------------------------------
/filteringtable-demo/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | .settings
3 | .project
4 | .classpath
5 | .DS_Store
6 |
--------------------------------------------------------------------------------
/filteringtable-addon/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | .settings
3 | .project
4 | .classpath
5 | .DS_Store
6 |
--------------------------------------------------------------------------------
/filteringtable-demo/src/main/webapp/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Class-Path:
3 |
4 |
--------------------------------------------------------------------------------
/filteringtable-demo/src/main/webapp/META-INF/context.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/filteringtable-addon/src/main/resources/org/tepi/filtertable/WidgetSet.gwt.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/filteringtable-addon/assembly/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Vaadin-Package-Version: 1
3 | Vaadin-Addon: ${Vaadin-Addon}
4 | Vaadin-License-Title: ${Vaadin-License-Title}
5 | Implementation-Vendor: ${Implementation-Vendor}
6 | Implementation-Title: ${Implementation-Title}
7 | Implementation-Version: ${Implementation-Version}
8 |
--------------------------------------------------------------------------------
/filteringtable-demo/src/main/resources/org/tepi/filtertable/demo/FilterTableDemoWidgetset.gwt.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 | org.tepi.filteringtable
6 | filteringtable-root
7 | pom
8 | 1.0.1.v8
9 | FilteringTable Add-on Root Project
10 |
11 |
12 | 3
13 |
14 |
15 |
16 | filteringtable-addon
17 | filteringtable-demo
18 |
19 |
20 |
--------------------------------------------------------------------------------
/filteringtable-addon/src/main/java/org/tepi/filtertable/paged/PagedTableChangeEvent.java:
--------------------------------------------------------------------------------
1 | package org.tepi.filtertable.paged;
2 |
3 | import java.io.Serializable;
4 |
5 | @SuppressWarnings("serial")
6 | public class PagedTableChangeEvent implements Serializable {
7 | private final PagedFilterTable> table;
8 |
9 | public PagedTableChangeEvent(PagedFilterTable> table) {
10 | this.table = table;
11 | }
12 |
13 | public PagedFilterTable> getTable() {
14 | return table;
15 | }
16 |
17 | public int getCurrentPage() {
18 | return table.getCurrentPage();
19 | }
20 |
21 | public int getTotalAmountOfPages() {
22 | return table.getTotalAmountOfPages();
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/filteringtable-addon/src/main/java/org/tepi/filtertable/datefilter/DateInterval.java:
--------------------------------------------------------------------------------
1 | package org.tepi.filtertable.datefilter;
2 |
3 | import java.io.Serializable;
4 | import java.util.Date;
5 |
6 | /**
7 | * Simple date interval providing isBetween comparison for other Date objects.
8 | *
9 | * @author Teppo Kurki
10 | *
11 | */
12 | @SuppressWarnings("serial")
13 | public class DateInterval implements Serializable {
14 | private final Date from;
15 | private final Date to;
16 |
17 | public DateInterval(Date from, Date to) {
18 | this.from = from;
19 | this.to = to;
20 | }
21 |
22 | public Date getFrom() {
23 | return from;
24 | }
25 |
26 | public Date getTo() {
27 | return to;
28 | }
29 |
30 | public boolean isNull() {
31 | return from == null && to == null;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/filteringtable-addon/src/main/java/org/tepi/filtertable/numberfilter/NumberInterval.java:
--------------------------------------------------------------------------------
1 | package org.tepi.filtertable.numberfilter;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * @author Vimukthi
7 | *
8 | */
9 | @SuppressWarnings("serial")
10 | public class NumberInterval implements Serializable {
11 |
12 | private final String lessThanValue;
13 | private final String greaterThanValue;
14 | private final String equalsValue;
15 |
16 | public NumberInterval(String lessThanValue, String greaterThanValue, String equalsValue) {
17 | this.lessThanValue = lessThanValue;
18 | this.greaterThanValue = greaterThanValue;
19 | this.equalsValue = equalsValue;
20 | }
21 |
22 | public String getLessThanValue() {
23 | return lessThanValue;
24 | }
25 |
26 | public String getGreaterThanValue() {
27 | return greaterThanValue;
28 | }
29 |
30 | public String getEqualsValue() {
31 | return equalsValue;
32 | }
33 | }
--------------------------------------------------------------------------------
/filteringtable-addon/assembly/assembly.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 | addon
7 |
8 |
10 |
11 |
12 | zip
13 |
14 |
15 |
16 | false
17 |
18 |
19 |
20 | ..
21 |
22 | LICENSE.txt
23 | README.md
24 |
25 |
26 |
27 | target
28 |
29 |
30 | *.jar
31 | *.pdf
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | assembly/MANIFEST.MF
40 | META-INF
41 | true
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/filteringtable-addon/src/main/java/org/tepi/filtertable/numberfilter/NumberFilterPopupConfig.java:
--------------------------------------------------------------------------------
1 | package org.tepi.filtertable.numberfilter;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | *
7 | * Provides way to set decorative configurations for the
8 | * {@link NumberFilterPopup}
9 | *
10 | * @author Vimukthi
11 | *
12 | */
13 | @SuppressWarnings("serial")
14 | public class NumberFilterPopupConfig implements Serializable {
15 | private String ltPrompt;
16 | private String gtPrompt;
17 | private String eqPrompt;
18 | private String okCaption;
19 | private String resetCaption;
20 | private String valueMarker;
21 |
22 | public String getLtPrompt() {
23 | return ltPrompt;
24 | }
25 |
26 | public void setLtPrompt(String ltPrompt) {
27 | this.ltPrompt = ltPrompt;
28 | }
29 |
30 | public String getGtPrompt() {
31 | return gtPrompt;
32 | }
33 |
34 | public void setGtPrompt(String gtPrompt) {
35 | this.gtPrompt = gtPrompt;
36 | }
37 |
38 | public String getEqPrompt() {
39 | return eqPrompt;
40 | }
41 |
42 | public void setEqPrompt(String eqPrompt) {
43 | this.eqPrompt = eqPrompt;
44 | }
45 |
46 | public String getOkCaption() {
47 | return okCaption;
48 | }
49 |
50 | public void setOkCaption(String okCaption) {
51 | this.okCaption = okCaption;
52 | }
53 |
54 | public String getResetCaption() {
55 | return resetCaption;
56 | }
57 |
58 | public void setResetCaption(String resetCaption) {
59 | this.resetCaption = resetCaption;
60 | }
61 |
62 | public String getValueMarker() {
63 | return valueMarker;
64 | }
65 |
66 | public void setValueMarker(String valueMarker) {
67 | this.valueMarker = valueMarker;
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/filteringtable-addon/src/main/java/org/tepi/filtertable/paged/PagedFilterControlConfig.java:
--------------------------------------------------------------------------------
1 | package org.tepi.filtertable.paged;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | public class PagedFilterControlConfig {
7 |
8 | private String itemsPerPage = "Items per page:";
9 | private String page = "Page:";
10 |
11 | private String first = "<<";
12 | private String last = ">>";
13 |
14 | private String previous = "<";
15 | private String next = ">";
16 |
17 | private List pageLengths;
18 |
19 | public String getItemsPerPage() {
20 | return itemsPerPage;
21 | }
22 |
23 | public void setItemsPerPage(String itemsPerPage) {
24 | this.itemsPerPage = itemsPerPage;
25 | }
26 |
27 | public String getPage() {
28 | return page;
29 | }
30 |
31 | public void setPage(String page) {
32 | this.page = page;
33 | }
34 |
35 | public String getFirst() {
36 | return first;
37 | }
38 |
39 | public void setFirst(String first) {
40 | this.first = first;
41 | }
42 |
43 | public String getLast() {
44 | return last;
45 | }
46 |
47 | public void setLast(String last) {
48 | this.last = last;
49 | }
50 |
51 | public String getPrevious() {
52 | return previous;
53 | }
54 |
55 | public void setPrevious(String previous) {
56 | this.previous = previous;
57 | }
58 |
59 | public String getNext() {
60 | return next;
61 | }
62 |
63 | public void setNext(String next) {
64 | this.next = next;
65 | }
66 |
67 | public List getPageLengths() {
68 | return pageLengths;
69 | }
70 |
71 | public void setPageLengthsAndCaptions(List pageLengths) {
72 | this.pageLengths = pageLengths;
73 | }
74 |
75 | public PagedFilterControlConfig() {
76 | pageLengths = new ArrayList();
77 | pageLengths.add(5);
78 | pageLengths.add(10);
79 | pageLengths.add(25);
80 | pageLengths.add(50);
81 | pageLengths.add(100);
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://vaadin.com/directory/component/filteringtable)
2 | [](https://vaadin.com/directory/component/filteringtable)
3 |
4 | FilteringTable
5 | ==============
6 |
7 | FilterTable is an extension of the Table component in Vaadin. FilterTable is available for Vaadin 6, Vaadin 7 (versions postfixed with '.v7') and Vaadin 8 (versions postfixed with '.v8').
8 |
9 | ##### Added features:
10 | * Provides automatically generated filter components between the table header and body
11 | * Automatically filters enum, boolean and date properties
12 | * Other properties are filtered as a string
13 | * Numeric properties can optionally be filtered with a comparator popup
14 | * Allows developer to provide own filter implementation for any property
15 | * Allows developer to decorate the numeric, date, enum and boolean filter components with custom captions and icons
16 | * Provides integration of PagedTable add-on with the filter bar
17 | * Provides integration of TreeTable with the filter bar
18 |
19 | ## Please always use the latest version of FilteringTable add-on. Bugfixes will only be done for the latest versions of each branch, and the Vaadin 8 version has priority. The Vaadin 6 version will no longer receive any fixes.
20 |
21 | A big thanks goes to the numerous contributors providing ideas, bug fixes and new features for FilteringTable.
22 |
23 | License
24 | =======
25 |
26 | Copyright 2012 - 2019 Teppo Kurki / Vaadin Ltd.
27 |
28 | Licensed under the Apache License, Version 2.0 (the "License");
29 | you may not use this file except in compliance with the License.
30 | You may obtain a copy of the License at
31 |
32 | http://www.apache.org/licenses/LICENSE-2.0
33 |
34 | Unless required by applicable law or agreed to in writing, software
35 | distributed under the License is distributed on an "AS IS" BASIS,
36 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
37 | See the License for the specific language governing permissions and
38 | limitations under the License.
39 |
--------------------------------------------------------------------------------
/filteringtable-demo/src/main/java/org/tepi/filtertable/demo/DemoFilterGenerator.java:
--------------------------------------------------------------------------------
1 | package org.tepi.filtertable.demo;
2 |
3 | import java.io.Serializable;
4 |
5 | import org.tepi.filtertable.FilterGenerator;
6 |
7 | import com.vaadin.server.Page;
8 | import com.vaadin.ui.Notification;
9 | import com.vaadin.v7.data.Container.Filter;
10 | import com.vaadin.v7.data.util.filter.Compare;
11 | import com.vaadin.v7.data.util.filter.Or;
12 | import com.vaadin.v7.ui.AbstractField;
13 | import com.vaadin.v7.ui.CheckBox;
14 | import com.vaadin.v7.ui.Field;
15 |
16 | @SuppressWarnings("serial")
17 | class DemoFilterGenerator implements FilterGenerator, Serializable {
18 |
19 | @Override
20 | public Filter generateFilter(Object propertyId, Object value) {
21 | if ("id".equals(propertyId)) {
22 | /* Create an 'equals' filter for the ID field */
23 | if (value != null && value instanceof String) {
24 | try {
25 | return new Compare.Equal(propertyId, Integer.parseInt((String) value));
26 | } catch (NumberFormatException ignored) {
27 | // If no integer was entered, just generate default filter
28 | }
29 | }
30 | } else if ("checked".equals(propertyId)) {
31 | if (value != null && value instanceof Boolean) {
32 | if (Boolean.TRUE.equals(value)) {
33 | return new Compare.Equal(propertyId, value);
34 | } else {
35 | return new Or(new Compare.Equal(propertyId, true), new Compare.Equal(propertyId, false));
36 | }
37 | }
38 | }
39 | // For other properties, use the default filter
40 | return null;
41 | }
42 |
43 | @Override
44 | public Filter generateFilter(Object propertyId, Field> originatingField) {
45 | // Use the default filter
46 | return null;
47 | }
48 |
49 | @Override
50 | public AbstractField> getCustomFilterComponent(Object propertyId) {
51 | // removed custom filter component for id
52 | if ("checked".equals(propertyId)) {
53 | CheckBox box = new CheckBox();
54 | return box;
55 | }
56 | return null;
57 | }
58 |
59 | @Override
60 | public void filterRemoved(Object propertyId) {
61 | Notification n = new Notification("Filter removed from: " + propertyId, Notification.Type.TRAY_NOTIFICATION);
62 | n.setDelayMsec(800);
63 | n.show(Page.getCurrent());
64 | }
65 |
66 | @Override
67 | public void filterAdded(Object propertyId, Class extends Filter> filterType, Object value) {
68 | Notification n = new Notification("Filter added to: " + propertyId, Notification.Type.TRAY_NOTIFICATION);
69 | n.setDelayMsec(800);
70 | n.show(Page.getCurrent());
71 | }
72 |
73 | @Override
74 | public Filter filterGeneratorFailed(Exception reason, Object propertyId, Object value) {
75 | /* Return null -> Does not add any filter on failure */
76 | return null;
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/filteringtable-addon/src/main/java/org/tepi/filtertable/FilterGenerator.java:
--------------------------------------------------------------------------------
1 | package org.tepi.filtertable;
2 |
3 | import java.io.Serializable;
4 |
5 | import com.vaadin.v7.data.Container.Filter;
6 | import com.vaadin.v7.ui.AbstractField;
7 | import com.vaadin.v7.ui.Field;
8 |
9 | /**
10 | * Interface for generating custom Filters from values entered to the filtering
11 | * fields by the user.
12 | *
13 | * @author tepi
14 | *
15 | */
16 | @SuppressWarnings({ "deprecation" })
17 | public interface FilterGenerator extends Serializable {
18 |
19 | /**
20 | * Generates a new Filter for the property with the given ID, using the
21 | * Value object as basis for the filtering.
22 | *
23 | * @param propertyId
24 | * ID of the filtered property.
25 | * @param value
26 | * Value entered by the user. Type of the value will depend on
27 | * the type this property has in the underlying container. Date,
28 | * Boolean and enum types will be provided as themselves. All
29 | * other types of properties will result in a String-typed
30 | * filtering value.
31 | * @return A generated Filter object, or NULL if you want to allow
32 | * FilterTable to generate the default Filter for this property.
33 | */
34 | public Filter generateFilter(Object propertyId, Object value);
35 |
36 | /**
37 | * Generates a new Filter for the property with the given ID, using the
38 | * Field object and its value as basis for the filtering.
39 | *
40 | * @param propertyId
41 | * ID of the filtered property.
42 | * @param originatingField
43 | * Reference to the field that triggered this filter generating
44 | * request.
45 | * @return A generated Filter object, or NULL if you want to allow
46 | * FilterTable to generate the default Filter for this property.
47 | */
48 | public Filter generateFilter(Object propertyId, Field> originatingField);
49 |
50 | /**
51 | * Allows you to provide a custom filtering field for the properties as
52 | * needed.
53 | *
54 | * @param propertyId
55 | * ID of the property for for which the field is asked for
56 | * @return a custom filtering field OR null if you want to use the generated
57 | * default field.
58 | */
59 | public AbstractField> getCustomFilterComponent(Object propertyId);
60 |
61 | /**
62 | * This method is called when a filter has been removed from the container
63 | * by the FilterTable.
64 | *
65 | * @param propertyId
66 | * ID of the property from which the filter was removed
67 | */
68 | public void filterRemoved(Object propertyId);
69 |
70 | /**
71 | * This method is called when a filter has been added to the container by
72 | * the FilterTable
73 | *
74 | * @param propertyId
75 | * ID of the property to which the filter was added
76 | * @param filterType
77 | * Type of the filter (class)
78 | * @param value
79 | * Value the filter was based on
80 | */
81 | public void filterAdded(Object propertyId, Class extends Filter> filterType, Object value);
82 |
83 | /**
84 | * This method is called when Filter generator fails for any reason. You may
85 | * handle the error and return any Filter or null as the result.
86 | *
87 | * @param reason
88 | * Root exception
89 | * @param propertyId
90 | * ID of the property to which the filter was to be added
91 | * @param value
92 | * Value the filter was to be based on
93 | * @return A Filter or null
94 | */
95 | public Filter filterGeneratorFailed(Exception reason, Object propertyId, Object value);
96 | }
97 |
--------------------------------------------------------------------------------
/filteringtable-addon/src/main/resources/org/tepi/filtertable/public/filteringtable/styles.css:
--------------------------------------------------------------------------------
1 | .filters-panel {
2 | background-color: #f4f4f4;
3 | width: 90000px;
4 | overflow: hidden;
5 | height: 37px;
6 | }
7 |
8 | .filters-panel .v-label,
9 | .filters-panel .filterplaceholder {
10 | height: 37px;
11 | }
12 |
13 | .v-app .v-table .filters-panel input.v-textfield.v-widget,
14 | .v-window .v-table .filters-panel input.v-textfield.v-widget {
15 | height: 37px;
16 | border-radius: 0px;
17 | -webkit-border-radius: 0px;
18 | -moz-border-radius: 0px;
19 | -o-border-radius: 0px;
20 | }
21 |
22 | .datefilterpopup .v-button.v-popupbutton,
23 | .datefilterpopup .v-button.v-popupbutton:focus,
24 | .datefilterpopup .v-button.v-popupbutton:active,
25 | .datefilterpopup .v-button.v-popupbutton.v-pressed,
26 | .numberfilterpopup .v-button.v-popupbutton,
27 | .numberfilterpopup .v-button.v-popupbutton:focus,
28 | .numberfilterpopup .v-button.v-popupbutton:active,
29 | .numberfilterpopup .v-button.v-popupbutton.v-pressed {
30 | background: #fff none repeat-x 0 100%;
31 | height: 37px;
32 | border-radius: 0;
33 | border: 1px solid #c5c5c5;
34 | position: relative;
35 | text-align: left;
36 | box-shadow: none;
37 | }
38 |
39 | .datefilterpopup .v-button.v-popupbutton:focus,
40 | .datefilterpopup .v-button.v-popupbutton:active,
41 | .datefilterpopup .v-button.v-popupbutton.v-pressed,
42 | .numberfilterpopup .v-button.v-popupbutton:focus,
43 | .numberfilterpopup .v-button.v-popupbutton:active,
44 | .numberfilterpopup .v-button.v-popupbutton.v-pressed {
45 | border-color: #4F83B4 #5B97D0 #5CA0DF;
46 | }
47 |
48 | .datefilterpopup .v-button.v-popupbutton .v-button-wrap,
49 | .datefilterpopup .v-button.v-popupbutton:focus .v-button-wrap,
50 | .datefilterpopup .v-button.v-popupbutton:active .v-button-wrap,
51 | .datefilterpopup .v-button.v-popupbutton.v-pressed .v-button-wrap,
52 | .numberfilterpopup .v-button.v-popupbutton .v-button-wrap,
53 | .numberfilterpopup .v-button.v-popupbutton:focus .v-button-wrap,
54 | .numberfilterpopup .v-button.v-popupbutton:active .v-button-wrap,
55 | .numberfilterpopup .v-button.v-popupbutton.v-pressed .v-button-wrap {
56 | background: none;
57 | overflow: hidden;
58 | padding: 0;
59 | padding-top: 1px;
60 | }
61 |
62 |
63 | .datefilterpopup .v-button.v-popupbutton .v-popup-indicator,
64 | .numberfilterpopup .v-button.v-popupbutton .v-popup-indicator {
65 | height: 100%;
66 | width: 37px;
67 | position: absolute;
68 | right: 0;
69 | top: 0;
70 | zoom: 1;
71 | border-left: 1px solid #e4e4e4;
72 | padding-top: 2px;
73 | font-size: 20px;
74 | color: #a3a3a3;
75 | text-align: center;
76 | }
77 |
78 | .datefilterpopup .v-button.v-popupbutton .v-popup-indicator::before,
79 | .numberfilterpopup .v-button.v-popupbutton .v-popup-indicator::before {
80 | opacity: 1;
81 | margin: 0;
82 | }
83 |
84 | .v-ie .datefilterpopup .v-button.v-popupbutton .v-popup-indicator,
85 | .v-ie .numberfilterpopup .v-button.v-popupbutton .v-popup-indicator {
86 | display: inline;
87 | }
88 |
89 | .datefilterpopup .v-button.v-popupbutton .v-button-caption,
90 | .numberfilterpopup .v-button.v-popupbutton .v-button-caption {
91 | display: inline-block;
92 | background: none;
93 | height: 12px;
94 | padding: 0;
95 | padding-top: 2px;
96 | font-weight: 400;
97 | color: #474747;
98 | }
99 |
100 | .filterwrapper {
101 | overflow: hidden !important;
102 | border-left: 1px solid #d4d4d4;
103 | }
104 | .filterwrapper-first {
105 | border-left: none;
106 | }
107 |
108 | .filters-panel .v-checkbox {
109 | margin-top: 9px;
110 | margin-left: 14px;
111 | }
112 |
113 | .filters-panel .v-filterselect.v-widget {
114 | border-radius: 0;
115 | }
--------------------------------------------------------------------------------
/filteringtable-addon/src/main/java/org/tepi/filtertable/client/ui/FilterTreeTableConnector.java:
--------------------------------------------------------------------------------
1 | package org.tepi.filtertable.client.ui;
2 |
3 | import java.util.HashMap;
4 | import java.util.Iterator;
5 | import java.util.Map;
6 |
7 | import org.tepi.filtertable.FilterTreeTable;
8 |
9 | import com.google.gwt.user.client.ui.Widget;
10 | import com.vaadin.client.ApplicationConnection;
11 | import com.vaadin.client.ComponentConnector;
12 | import com.vaadin.client.UIDL;
13 | import com.vaadin.shared.ui.Connect;
14 | import com.vaadin.v7.client.ui.treetable.TreeTableConnector;
15 |
16 | /**
17 | * Class FilterTableConnector.
18 | *
19 | * @author Teppo Kurki
20 | * @since 27.10.2014
21 | */
22 | @SuppressWarnings("serial")
23 | @Connect(FilterTreeTable.class)
24 | public class FilterTreeTableConnector extends TreeTableConnector {
25 |
26 | public static final String TAG_FILTERS = "filters";
27 | public static final String TAG_FILTER_COMPONENT = "filtercomponent-";
28 | public static final String ATTRIBUTE_FILTERS_VISIBLE = "filtersvisible";
29 | public static final String ATTRIBUTE_FORCE_RENDER = "forceRender";
30 | public static final String ATTRIBUTE_COLUMN_ID = "columnid";
31 | public static final String ATTRIBUTE_CACHED = "cached";
32 | public static final String ATTRIBUTE_COLUMN_HEADER_STYLE_NAMES = "columnheaderstylenames";
33 |
34 | @Override
35 | public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
36 | super.updateFromUIDL(uidl, client);
37 | updateFiltersFromUIDL(uidl.getChildByTagName(FilterTreeTableConnector.TAG_FILTERS), client);
38 | }
39 |
40 | @Override
41 | public VFilterTreeTable getWidget() {
42 | return (VFilterTreeTable) super.getWidget();
43 | }
44 |
45 | @SuppressWarnings("deprecation")
46 | private void updateFiltersFromUIDL(UIDL uidl, ApplicationConnection client) {
47 | VFilterTreeTable filterTable = getWidget();
48 |
49 | boolean filtersVisible = uidl.hasAttribute(ATTRIBUTE_FILTERS_VISIBLE)
50 | ? uidl.getBooleanAttribute(ATTRIBUTE_FILTERS_VISIBLE) : false;
51 | filterTable.setFiltersVisible(filtersVisible);
52 |
53 | /* If filters are not set visible, clear and hide filter panel */
54 | if (filtersVisible == false) {
55 | filterTable.filters.clear();
56 | } else {
57 | if (uidl.hasAttribute(ATTRIBUTE_COLUMN_HEADER_STYLE_NAMES)) {
58 | getWidget().setColumnHeaderStylenames(uidl.getMapAttribute(ATTRIBUTE_COLUMN_HEADER_STYLE_NAMES));
59 | }
60 | /* Prepare and paint filter components */
61 | Map newWidgets = new HashMap();
62 | boolean allCached = true;
63 | for (final Iterator