001package org.hl7.fhir.utilities; 002 003/*- 004 * #%L 005 * org.hl7.fhir.utilities 006 * %% 007 * Copyright (C) 2014 - 2019 Health Level 7 008 * %% 009 * Licensed under the Apache License, Version 2.0 (the "License"); 010 * you may not use this file except in compliance with the License. 011 * You may obtain a copy of the License at 012 * 013 * http://www.apache.org/licenses/LICENSE-2.0 014 * 015 * Unless required by applicable law or agreed to in writing, software 016 * distributed under the License is distributed on an "AS IS" BASIS, 017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 018 * See the License for the specific language governing permissions and 019 * limitations under the License. 020 * #L% 021 */ 022 023 024public class ElementDecoration { 025 public enum DecorationType { TYPE, SLICE, HINT, WARNING, ERROR }; 026 027 private DecorationType type; 028 private String link; 029 private String text; 030 public ElementDecoration(DecorationType type, String link, String text) { 031 super(); 032 this.type = type; 033 this.link = link; 034 this.text = text; 035 } 036 public DecorationType getType() { 037 return type; 038 } 039 040 public boolean hasLink() { 041 return !Utilities.noString(link); 042 } 043 044 public String getLink() { 045 return link; 046 } 047 public String getText() { 048 return text; 049 } 050 public String getIcon() { 051 switch (type) { 052 case SLICE: return "icon_slice.png"; 053 case TYPE: return "icon_element.gif"; 054 case HINT: return "icon-hint.png"; 055 case ERROR: return "icon-wanning.png"; 056 case WARNING: return "icon-error.gif"; 057 default: return ""; 058 } 059 } 060 061 062}