001/** 002 * GRANITE DATA SERVICES 003 * Copyright (C) 2006-2013 GRANITE DATA SERVICES S.A.S. 004 * 005 * This file is part of the Granite Data Services Platform. 006 * 007 * *** 008 * 009 * Community License: GPL 3.0 010 * 011 * This file is free software: you can redistribute it and/or modify 012 * it under the terms of the GNU General Public License as published 013 * by the Free Software Foundation, either version 3 of the License, 014 * or (at your option) any later version. 015 * 016 * This file is distributed in the hope that it will be useful, but 017 * WITHOUT ANY WARRANTY; without even the implied warranty of 018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 019 * GNU General Public License for more details. 020 * 021 * You should have received a copy of the GNU General Public License 022 * along with this program. If not, see <http://www.gnu.org/licenses/>. 023 * 024 * *** 025 * 026 * Available Commercial License: GraniteDS SLA 1.0 027 * 028 * This is the appropriate option if you are creating proprietary 029 * applications and you are not prepared to distribute and share the 030 * source code of your application under the GPL v3 license. 031 * 032 * Please visit http://www.granitedataservices.com/license for more 033 * details. 034 */ 035package org.granite.client.persistence.collection.observable; 036 037import java.io.IOException; 038import java.io.ObjectInput; 039import java.io.ObjectOutput; 040 041import org.granite.client.collection.ObservableList; 042import org.granite.client.persistence.Loader; 043import org.granite.client.persistence.collection.PersistentCollection; 044import org.granite.client.persistence.collection.PersistentList; 045import org.granite.client.persistence.collection.UnsafePersistentCollection; 046 047/** 048 * @author William DRAI 049 */ 050public class ObservablePersistentList<E> extends ObservableList<E> implements UnsafePersistentCollection<PersistentList<E>> { 051 052 private static final long serialVersionUID = 1L; 053 054 public ObservablePersistentList(PersistentList<E> persistentList) { 055 super(persistentList); 056 } 057 058 @Override 059 public void writeExternal(ObjectOutput out) throws IOException { 060 internalPersistentCollection().writeExternal(out); 061 } 062 063 @Override 064 public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { 065 internalPersistentCollection().readExternal(in); 066 } 067 068 @Override 069 public boolean wasInitialized() { 070 return internalPersistentCollection().wasInitialized(); 071 } 072 073 @Override 074 public void uninitialize() { 075 internalPersistentCollection().uninitialize(); 076 } 077 078 @Override 079 public void initialize() { 080 internalPersistentCollection().initialize(); 081 } 082 083 @Override 084 public void initializing() { 085 internalPersistentCollection().initializing(); 086 } 087 088 @Override 089 public PersistentCollection clone(boolean uninitialize) { 090 return internalPersistentCollection().clone(uninitialize); 091 } 092 093 @Override 094 public Loader<PersistentCollection> getLoader() { 095 return internalPersistentCollection().getLoader(); 096 } 097 098 @Override 099 public void setLoader(Loader<PersistentCollection> loader) { 100 internalPersistentCollection().setLoader(loader); 101 } 102 103 @Override 104 public boolean isDirty() { 105 return internalPersistentCollection().isDirty(); 106 } 107 108 @Override 109 public void dirty() { 110 internalPersistentCollection().dirty(); 111 } 112 113 @Override 114 public void clearDirty() { 115 internalPersistentCollection().clearDirty(); 116 } 117 118 @Override 119 public void addListener(ChangeListener listener) { 120 internalPersistentCollection().addListener(listener); 121 } 122 123 @Override 124 public void removeListener(ChangeListener listener) { 125 internalPersistentCollection().removeListener(listener); 126 } 127 128 @Override 129 public void addListener(InitializationListener listener) { 130 internalPersistentCollection().addListener(listener); 131 } 132 133 @Override 134 public void removeListener(InitializationListener listener) { 135 internalPersistentCollection().removeListener(listener); 136 } 137 138 @Override 139 public void withInitialized(InitializationCallback callback) { 140 internalPersistentCollection().withInitialized(callback); 141 } 142 143 @Override 144 public PersistentList<E> internalPersistentCollection() { 145 return internalPersistentCollection(); 146 } 147 148}