All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.gwt.advanced.client.datamodel.EditableModelEvent Maven / Gradle / Ivy

There is a newer version: 2.0.9
Show newest version
/*
 * Copyright 2008-2012 Sergey Skladchikov
 *
 * 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.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.gwt.advanced.client.datamodel;

/**
 * This class describes an event that is sent by the {@link org.gwt.advanced.client.datamodel.EditableGridDataModel}
 * or subclasses.

* Excepting a link to the source model it contains other firlds descrining what exactly happened and * additional parameters. * * @author Sergey Skladchikov * @since 1.4.7 */ public class EditableModelEvent { /** on update content */ public static final EventType UPDATE_ALL = new EventType(); /** on update paticular cell */ public static final EventType UPDATE_CELL = new EventType(); /** on update particular row */ public static final EventType UPDATE_ROW = new EventType(); /** on update particular column */ public static final EventType UPDATE_COLUMN = new EventType(); /** on add particular column */ public static final EventType ADD_COLUMN = new EventType(); /** on add particular row */ public static final EventType ADD_ROW = new EventType(); /** on remove particular column */ public static final EventType REMOVE_COLUMN = new EventType(); /** on remove particular row */ public static final EventType REMOVE_ROW = new EventType(); /** on remove all data */ public static final EventType CLEAN = new EventType(); /** on sort rows */ public static final EventType SORT_ALL = new EventType(); /** is a source model of the event */ private Editable source; /** row that produced this event (actual for {@link #UPDATE_CELL), {@link #UPDATE_ROW), {@link #ADD_ROW), {@link #REMOVE_ROW) */ private int row = -1; /** column that produced this event (actual for {@link #UPDATE_CELL), {@link #UPDATE_COLUMN}, {@link #ADD_COLUMN}, {@link #REMOVE_COLUMN}, {@link #SORT_ALL} */ private int column = -1; /** is a type of the event */ private EventType eventType; /** * Creates an instance of this class and initilizes mandatory fields. * * @param eventType is an event type, mustn't be null. */ public EditableModelEvent(EventType eventType) { this.eventType = eventType; } /** * Creates an instance of this class and initializes internal fields. * * @param eventType is an event type, mustn't be null. * @param row is a row number that produced this event (-1 of none). * @param column is a column number that produced this event (-1 of none). */ public EditableModelEvent(EventType eventType, int row, int column) { this(eventType); this.row = row; this.column = column; } /** * Gets an event type. * * @return never null */ public EventType getEventType() { return eventType; } /** * Gets an event source model. * * @return never null. */ public Editable getSource() { return source; } /** * Gets a number of row that produced this event. * * @return -1 if none. */ public int getRow() { return row; } /** * Gets a number of column that produced this event. * * @return -1 if none. */ public int getColumn() { return column; } /** * Sets the source model.

* This method MUST be invoked by the model before it's fired. * * @param source is a source model. */ protected void setSource(Editable source) { this.source = source; } /** * Sets the row that produced this event. * * @param row is a row number. */ protected void setRow(int row) { this.row = row; } /** * Sets the column that produced this event. * * @param column is a column number. */ protected void setColumn(int column) { this.column = column; } /** * This is an event safe type class. */ protected static class EventType { /** * Protected since used in subclasses. */ protected EventType(){ } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy