001: // @@
002: // @@
003: /*
004: * Wi.Ser Framework
005: *
006: * Version: 1.8.1, 20-September-2007
007: * Copyright (C) 2005 Dirk von der Weiden <dvdw@imail.de>
008: *
009: * This library is free software; you can redistribute it and/or
010: * modify it under the terms of the GNU Lesser General Public
011: * License as published by the Free Software Foundation; either
012: * version 2 of the License, or (at your option) any later version.
013: *
014: * This library is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
017: * Lesser General Public License for more details.
018: *
019: * You should have received a copy of the GNU Lesser General Public
020: * License along with this library located in LGPL.txt in the
021: * license directory; if not, write to the
022: * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
023: * Boston, MA 02111-1307, USA.
024: *
025: * If this agreement does not cover your requirements, please contact us
026: * via email to get detailed information about the commercial license
027: * or our service offerings!
028: *
029: */
030: // @@
031: package de.ug2t.channel.markup.generic;
032:
033: import de.ug2t.channel.markup.html.renderer.*;
034: import de.ug2t.connector.*;
035: import de.ug2t.kernel.*;
036: import de.ug2t.unifiedGui.interfaces.*;
037:
038: public final class MuGenericImage extends MuGenericComponent implements
039: IUnImage, IKePoolable {
040: private IKeView pem_view = new HtmlImageRenderer();
041:
042: public MuGenericImage(String xID, String xValue,
043: ACoDataGetter xTplGetter, Object xTplName,
044: MuGenericApplication xAppl) throws Exception {
045: super (xID, xTplGetter, xTplName, xAppl);
046:
047: this .pcmf_setView(pem_view);
048: this .pcmf_setValue(xValue);
049:
050: return;
051: };
052:
053: public IUnImage pcmf_clone() {
054: return (this .pcmf_getAppl().pcmf_getComponentFactory()
055: .pcmf_createImage(this .pcmf_getAppl()
056: .pcmf_getApplType(), this .pcmf_getName(),
057: (String) this .pcmf_getValue(), this
058: .pcmf_getAppl()));
059: }
060:
061: // @@
062:
063: private int pem_refcount = 0;
064:
065: public final void pcmf_attach() {
066: synchronized (this ) {
067: if (this .pdm_deleted)
068: KeLog
069: .pcmf_log(
070: "ug2t",
071: "attach a deleted ressource, error in synchronisation",
072: this , KeLog.FATAL);
073:
074: this .pem_refcount++;
075: }
076: }
077:
078: public final void pcmf_detach() {
079: synchronized (this ) {
080: if (this .pem_refcount > 0)
081: this .pem_refcount--;
082: }
083: }
084:
085: public void pcmf_forceDetach() {
086: synchronized (this ) {
087: this .pem_refcount = 0;
088: }
089: }
090:
091: public void pcmf_delete() throws Exception {
092: synchronized (this ) {
093: if (this .pdm_deleted == true || this .pem_refcount > 0)
094: return;
095:
096: super .pcmf_delete();
097: }
098: };
099:
100: public void pcmf_attachImage() {
101: this .pcmf_attach();
102: }
103:
104: public void pcmf_detachImage() {
105: this .pcmf_detach();
106: }
107:
108: /**
109: * <p>
110: * Releases an image for beeing deleted when not in use - delegate to fit
111: * interface
112: * </p>
113: * <p>
114: *
115: * </p>
116: * <p>
117: * </p>
118: */
119: public void pcmf_attachExtern() {
120: this .pcmf_attachImage();
121: }
122:
123: /**
124: * <p>
125: * Releases an image for beeing deleted when not in use - delegate to fit
126: * interface
127: * </p>
128: * <p>
129: *
130: * </p>
131: * <p>
132: * </p>
133: */
134: public void pcmf_detachExtern() {
135: this .pcmf_detachImage();
136: }
137:
138: // @@
139:
140: }
|