| /* | 
|   fm - File management class library | 
|   Copyright (C) 2024  Ulrich Hilger | 
|   | 
|   This program is free software: you can redistribute it and/or modify | 
|   it under the terms of the GNU Affero General Public License as | 
|   published by the Free Software Foundation, either version 3 of the | 
|   License, or (at your option) any later version. | 
|   | 
|   This program is distributed in the hope that it will be useful, | 
|   but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|   GNU Affero General Public License for more details. | 
|   | 
|   You should have received a copy of the GNU Affero General Public License | 
|   along with this program.  If not, see <https://www.gnu.org/licenses/>. | 
|  */ | 
| package de.uhilger.fm; | 
|   | 
| /** | 
|  * Einfache Transportklasse fuer eine Datei-Referenz | 
|  *  | 
|  * @author Ulrich Hilger | 
|  * @version 1, 11. Mai 2021 | 
|  */ | 
| public class FileRef { | 
|    | 
|   public static final String TYP_DATEI = "datei"; | 
|   public static final String TYP_ORDNER = "ordner"; | 
|    | 
|   public static final String TK_DATEI = "icon-doc-inv"; | 
|   public static final String TK_ORDNER = "icon-folder"; | 
|    | 
|   /* | 
|    | 
|   Ergaenzt um Garfiken mit Data-URI | 
|   https://wiki.selfhtml.org/wiki/Grafik/Grafiken_mit_Data-URI | 
|    | 
|   src="data:image/gif;base64,R0lGODdhEAAQAMwAAPj7+FmhUYjNfGuxYY | 
|     DJdYTIeanOpT+DOTuANXi/bGOrWj6CONzv2sPjv2CmV1unU4zPgISg6DJnJ3ImTh8Mtbs00aNP1CZSGy0YqLEn47RgXW8amasW | 
|     7XWsmmvX2iuXiwAAAAAEAAQAAAFVyAgjmRpnihqGCkpDQPbGkNUOFk6DZqgHCNGg2T4QAQBoIiRSAwBE4VA4FACKgkB5NGReAS | 
|     FZEmxsQ0whPDi9BiACYQAInXhwOUtgCUQoORFCGt/g4QAIQA7" | 
|    | 
|     Schema | 
|     data:[<mime type>][;charset=<Zeichensatz>][;base64],<Daten> | 
|    | 
|   */ | 
|    | 
|   private String name; | 
|   //private String pfad; | 
|   private String typ; | 
|   private String typKlasse; | 
|   private boolean bild = false; | 
|   private String miniurl; | 
|   private String imgsrc; | 
|   | 
|   /** | 
|    * Den Ausdruck fuer <code>imgsrc</code> ermitteln, | 
|    * wenn es sich bei der Datei um eine Bilddatei handelt | 
|    *  | 
|    * @return den imgsrc-Ausdruck | 
|    */ | 
|   public String getImgSrc() { | 
|     return imgsrc; | 
|   } | 
|   | 
|   /** | 
|    * Den Ausdruck fuer <code>imgsrc</code> angeben, | 
|    * wenn es sich bei der Datei um eine Bilddatei handelt | 
|    *  | 
|    * @param imgSrc  der imgsrc-Ausdruck | 
|    */ | 
|   public void setImgSrc(String imgSrc) { | 
|     this.imgsrc = imgSrc; | 
|   } | 
|   | 
|   /** | 
|    * Den URL der Miniaturansicht ermitteln,  | 
|    * wenn es sich bei der Datei um eine Bilddatei handelt | 
|    *  | 
|    * @return URL der Miniaturansicht | 
|    */ | 
|   public String getMiniurl() { | 
|     return miniurl; | 
|   } | 
|   | 
|   /** | 
|    * Den URL der Miniaturansicht setzen,  | 
|    * wenn es sich bei der Datei um eine Bilddatei handelt | 
|    *  | 
|    * @param miniurl URL der Miniaturansicht | 
|    */ | 
|   public void setMiniurl(String miniurl) { | 
|     this.miniurl = miniurl; | 
|   } | 
|   | 
|   /** | 
|    * Die CSS-Typ-Klasse fuer diese Datei ermitteln | 
|    *  | 
|    * @return  die CSS-Typ-Klasse dieser Datei | 
|    */ | 
|   public String getTypKlasse() { | 
|     return typKlasse; | 
|   } | 
|   | 
|   /** | 
|    * Die CSS-Typ-Klasse fuer diese Datei setzen | 
|    *  | 
|    * @param typKlasse die CSS-Typ-Klasse dieser Datei | 
|    */ | 
|   public void setTypKlasse(String typKlasse) { | 
|     this.typKlasse = typKlasse; | 
|   } | 
|   | 
|   /** | 
|    * Den Namen dieser Datei ermitteln | 
|    *  | 
|    * @return Name dieser Datei  | 
|    */ | 
|   public String getName() { | 
|     return name; | 
|   } | 
|   | 
|   /** | 
|    * Den Namen dieser Datei setzen | 
|    *  | 
|    * @param name Name dieser Datei  | 
|    */ | 
|   public void setName(String name) { | 
|     this.name = name; | 
|   } | 
|   | 
|   /** | 
|    * Den Typ dieser Datei ermitteln | 
|    *  | 
|    * @return 'datei' oder 'ordner'  | 
|    */ | 
|   public String getTyp() { | 
|     return typ; | 
|   } | 
|   | 
|   /** | 
|    * Den Typ dieser Datei setzen | 
|    *  | 
|    * @param typ 'datei' oder 'ordner'  | 
|    */ | 
|   public void setTyp(String typ) { | 
|     this.typ = typ; | 
|     switch(typ) { | 
|       case TYP_DATEI: | 
|         setTypKlasse(TK_DATEI); | 
|         break; | 
|       case TYP_ORDNER: | 
|         setTypKlasse(TK_ORDNER); | 
|         break; | 
|       default: | 
|         setTypKlasse(TK_DATEI); | 
|         break; | 
|     } | 
|   } | 
|   | 
|   /** | 
|    * Ermitteln, ob es sich bei dieser Datei um ein Bild handelt | 
|    *  | 
|    * @return true, wenn diese Datei ein Bild ist, false wenn nicht  | 
|    */ | 
|   public boolean isBild() { | 
|     return bild; | 
|   } | 
|   | 
|   /** | 
|    * Den Bildindikator fuer diese Dateireferenz setzen | 
|    *  | 
|    * @param istBild true, wenn diese Datei ein Bild ist, false wenn nicht  | 
|    */ | 
|   public void setBild(boolean istBild) { | 
|     this.bild = istBild; | 
|   } | 
|   | 
|   //public String getPfad() { | 
|   //  return pfad; | 
|   //} | 
|   | 
|   //public void setPfad(String pfad) { | 
|   //  this.pfad = pfad; | 
|   //} | 
|    | 
|    | 
|    | 
|    | 
| } |