1 26 27 package org.nightlabs.editor2d.render; 28 29 import java.awt.image.BufferedImage ; 30 import java.util.Locale ; 31 32 import org.nightlabs.i18n.I18nText; 33 import org.nightlabs.i18n.I18nTextBuffer; 34 35 41 public class RenderModeDescriptor 42 { 43 44 public RenderModeDescriptor(int renderMode, String localizedText) 45 { 46 this(renderMode, localizedText, null, null); 47 } 48 49 public RenderModeDescriptor(int renderMode, String localizedText, String localizedDesc) 50 { 51 this(renderMode, localizedText, localizedDesc, null); 52 } 53 54 public RenderModeDescriptor(int renderMode, String localizedText, String localizedDesc, 55 BufferedImage img) 56 { 57 this.renderMode = renderMode; 58 setLocalizedText(localizedText); 59 setLocalizedDescription(localizedDesc); 60 this.image = img; 61 } 62 63 public RenderModeDescriptor(int renderMode, I18nText text) { 64 this(renderMode, text, null, null); 65 } 66 67 public RenderModeDescriptor(int renderMode, I18nText text, I18nText description) { 68 this(renderMode, text, description, null); 69 } 70 71 public RenderModeDescriptor(int renderMode, I18nText text, I18nText description, BufferedImage img) { 72 super(); 73 this.renderMode = renderMode; 74 this.text = text; 75 this.image = img; 76 } 77 78 protected int renderMode = RenderConstants.DEFAULT_MODE; 79 83 public int getRenderMode() { 84 return renderMode; 85 } 86 87 protected String getLanguageID() { 88 return Locale.getDefault().getLanguage(); 89 } 90 91 protected I18nText text = null; 92 96 public I18nText getText() 97 { 98 if (text == null) 99 text = new I18nTextBuffer(); 100 101 return text; 102 } 103 public void setText(I18nText text) { 104 this.text = text; 105 } 106 107 112 public void setLocalizedText(String text) { 113 getText().setText(getLanguageID(), text); 114 } 115 116 public String getLocalizedText() { 117 return getText().getText(getLanguageID()); 118 } 119 120 121 protected I18nText description = null; 122 126 public I18nText getDescription() 127 { 128 if (description == null) 129 description = new I18nTextBuffer(); 130 131 return description; 132 } 133 public void setDescription(I18nText description) { 134 this.description = description; 135 } 136 137 142 public void setLocalizedDescription(String desc) { 143 getDescription().setText(getLanguageID(), desc); 144 } 145 146 public String getLocalizedDescription() { 147 return getDescription().getText(getLanguageID()); 148 } 149 150 protected BufferedImage image; 151 155 public BufferedImage getImage() { 156 return image; 157 } 158 162 public void setImage(BufferedImage image) { 163 this.image = image; 164 } 165 166 } 167 | Popular Tags |