2 * Copyright 2000-2018 Vaadin Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License. You may obtain a copy of
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
16 package com.vaadin.v7.client.widget.grid.events;
18 import com.google.gwt.event.shared.GwtEvent;
19 import com.vaadin.v7.client.widgets.Grid.Column;
22 * An event for notifying that the columns in the Grid's have changed
26 * The row type of the grid. The row type is the POJO type from where
27 * the data is retrieved into the column cells.
31 public class ColumnVisibilityChangeEvent<T>
32 extends GwtEvent<ColumnVisibilityChangeHandler<T>> {
34 private static final Type<ColumnVisibilityChangeHandler<?>> TYPE = new Type<ColumnVisibilityChangeHandler<?>>();
36 public static final Type<ColumnVisibilityChangeHandler<?>> getType() {
40 private final Column<?, T> column;
42 private final boolean userOriginated;
44 private final boolean hidden;
46 public ColumnVisibilityChangeEvent(Column<?, T> column, boolean hidden,
47 boolean userOriginated) {
50 this.userOriginated = userOriginated;
54 * Returns the column where the visibility change occurred.
56 * @return the column where the visibility change occurred.
58 public Column<?, T> getColumn() {
63 * Was the column set hidden or visible.
65 * @return <code>true</code> if the column was hidden <code>false</code> if
68 public boolean isHidden() {
73 * Is the visibility change triggered by user.
75 * @return <code>true</code> if the change was triggered by user,
76 * <code>false</code> if not
78 public boolean isUserOriginated() {
79 return userOriginated;
82 @SuppressWarnings({ "rawtypes", "unchecked" })
84 public com.google.gwt.event.shared.GwtEvent.Type<ColumnVisibilityChangeHandler<T>> getAssociatedType() {
89 protected void dispatch(ColumnVisibilityChangeHandler<T> handler) {
90 handler.onVisibilityChange(this);