[editor-simplyhtml-merge] PreferenceFrameの更新
TextMarkupPanelとXMLPanelの追加。
@@ -1,6 +1,7 @@ | ||
1 | 1 | /* $Id$ */ |
2 | 2 | package smart_gs.logical; |
3 | 3 | |
4 | +import java.awt.Color; | |
4 | 5 | import java.awt.Point; |
5 | 6 | import java.io.File; |
6 | 7 | import java.io.FileInputStream; |
@@ -8,6 +9,7 @@ | ||
8 | 9 | import java.io.FileOutputStream; |
9 | 10 | import java.io.IOException; |
10 | 11 | import java.util.Properties; |
12 | + | |
11 | 13 | import javax.swing.JOptionPane; |
12 | 14 | |
13 | 15 | import org.apache.commons.io.FileUtils; |
@@ -124,6 +126,21 @@ | ||
124 | 126 | |
125 | 127 | private int magnification; |
126 | 128 | |
129 | + private String referenceColor = ""; | |
130 | + private String dubiousColor = ""; | |
131 | + private String additionColor = ""; | |
132 | + private String deletionColor = ""; | |
133 | + private String commentColor = ""; | |
134 | + | |
135 | + private String referenceWidth; | |
136 | + private String dubiousWidth; | |
137 | + private String additionWidth; | |
138 | + private String deletionWidth; | |
139 | + private String commentWidth; | |
140 | + | |
141 | + private String schemaFile; | |
142 | + private String schemaType; | |
143 | + | |
127 | 144 | public static Preference getInstance(){ |
128 | 145 | return singleton; |
129 | 146 | } |
@@ -468,8 +485,50 @@ | ||
468 | 485 | this.magnification = 1; |
469 | 486 | } |
470 | 487 | |
488 | + this.referenceColor = properties.getProperty("referenceColor"); | |
489 | + if(this.referenceColor == null || this.referenceColor.isEmpty()){ | |
490 | + this.referenceColor = "red"; | |
491 | + } | |
492 | + this.dubiousColor = properties.getProperty("dubiousColor"); | |
493 | + if(this.dubiousColor == null || this.dubiousColor.isEmpty()){ | |
494 | + this.dubiousColor = "red"; | |
495 | + } | |
496 | + this.additionColor = properties.getProperty("additionColor"); | |
497 | + if(this.additionColor == null || this.additionColor.isEmpty()){ | |
498 | + this.additionColor = "red"; | |
499 | + } | |
500 | + this.deletionColor = properties.getProperty("deletionColor"); | |
501 | + if(this.deletionColor == null || this.deletionColor.isEmpty()){ | |
502 | + this.deletionColor = "red"; | |
503 | + } | |
504 | + this.commentColor = properties.getProperty("commentColor"); | |
505 | + if(this.commentColor == null || this.commentColor.isEmpty()){ | |
506 | + this.commentColor = "red"; | |
507 | + } | |
471 | 508 | |
509 | + this.referenceWidth = properties.getProperty("referenceWidth"); | |
510 | + if(this.referenceWidth == null || this.referenceWidth.isEmpty()){ | |
511 | + this.referenceWidth = "1"; | |
512 | + } | |
513 | + this.dubiousWidth = properties.getProperty("dubiousWidth"); | |
514 | + if(this.dubiousWidth == null || this.dubiousWidth.isEmpty()){ | |
515 | + this.dubiousWidth = "1"; | |
516 | + } | |
517 | + this.additionWidth = properties.getProperty("additionWitdth"); | |
518 | + if(this.additionWidth == null || this.additionWidth.isEmpty()){ | |
519 | + this.additionWidth = "1"; | |
520 | + } | |
521 | + this.deletionWidth = properties.getProperty("deletionWitdh"); | |
522 | + if(this.deletionWidth == null || this.deletionWidth.isEmpty()){ | |
523 | + this.deletionWidth = "1"; | |
524 | + } | |
525 | + this.commentWidth = properties.getProperty("commentWidth"); | |
526 | + if(this.commentWidth == null || this.commentWidth.isEmpty()){ | |
527 | + this.commentWidth = "1"; | |
528 | + } | |
472 | 529 | |
530 | + this.schemaFile = properties.getProperty("schemaFile"); | |
531 | + this.schemaType = properties.getProperty("schemaType"); | |
473 | 532 | // String gsEditorTypeString = properties.getProperty("gsEditorType"); |
474 | 533 | // if (gsEditorTypeString == null || gsEditorTypeString.equals("compact")) { |
475 | 534 | // this.gsEditorType = GSEditor.COMPACT; |
@@ -630,6 +689,72 @@ | ||
630 | 689 | |
631 | 690 | // properties.put("gsEditorType",gsEditorType==GSEditor.FULL?"full":"compact"); |
632 | 691 | |
692 | + if(this.referenceColor != null){ | |
693 | + properties.put("referenceColor", this.referenceColor); | |
694 | + } else { | |
695 | + properties.put("referenceColor", ""); | |
696 | + } | |
697 | + if(this.referenceWidth != null){ | |
698 | + properties.put("referenceWidth", this.referenceWidth); | |
699 | + } else { | |
700 | + properties.put("referenceWidth", "1"); | |
701 | + } | |
702 | + | |
703 | + if(this.dubiousColor != null){ | |
704 | + properties.put("dubiousColor", this.dubiousColor); | |
705 | + } else { | |
706 | + properties.put("dubiousColor", ""); | |
707 | + } | |
708 | + if(this.dubiousWidth != null){ | |
709 | + properties.put("dubiousWidth", this.dubiousWidth); | |
710 | + } else { | |
711 | + properties.put("dubiousWidth", "1"); | |
712 | + } | |
713 | + | |
714 | + if(this.additionColor != null){ | |
715 | + properties.put("additionColor", this.additionColor); | |
716 | + } else { | |
717 | + properties.put("additionColor", ""); | |
718 | + } | |
719 | + if(this.additionWidth != null){ | |
720 | + properties.put("additionWidth", this.additionWidth); | |
721 | + } else { | |
722 | + properties.put("additionWidth", "1"); | |
723 | + } | |
724 | + | |
725 | + if(this.deletionColor != null){ | |
726 | + properties.put("deletionColor", this.deletionColor); | |
727 | + } else { | |
728 | + properties.put("deletionColor", ""); | |
729 | + } | |
730 | + if(this.deletionWidth != null){ | |
731 | + properties.put("deletionWidth", this.deletionWidth); | |
732 | + } else { | |
733 | + properties.put("deletionWidth", "1"); | |
734 | + } | |
735 | + | |
736 | + if(this.commentColor != null){ | |
737 | + properties.put("commentColor", this.commentColor); | |
738 | + } else { | |
739 | + properties.put("commentColor", ""); | |
740 | + } | |
741 | + if(this.commentWidth != null){ | |
742 | + properties.put("commentWidth", this.commentWidth); | |
743 | + } else { | |
744 | + properties.put("commentWidth", "1"); | |
745 | + } | |
746 | + | |
747 | + if(this.schemaFile != null){ | |
748 | + properties.put("schemaFile", this.schemaFile); | |
749 | + } else { | |
750 | + properties.put("schemaFile", ""); | |
751 | + } | |
752 | + | |
753 | + if(this.schemaType != null){ | |
754 | + properties.put("schemaType", this.schemaType); | |
755 | + } else { | |
756 | + properties.put("schemaType", "relaxng"); | |
757 | + } | |
633 | 758 | try { |
634 | 759 | FileOutputStream outStream = new FileOutputStream(new File(preferenceFile)); |
635 | 760 | properties.storeToXML(outStream,"no comment"); |
@@ -1065,4 +1190,154 @@ | ||
1065 | 1190 | public int getMagnification() { |
1066 | 1191 | return this.magnification; |
1067 | 1192 | } |
1193 | + | |
1194 | + public Color getGTColor(String string) { | |
1195 | + switch(string){ | |
1196 | + case "reference": | |
1197 | + return s2color(this.referenceColor); | |
1198 | + case "dubious": | |
1199 | + return s2color(this.dubiousColor); | |
1200 | + case "addition": | |
1201 | + return s2color(this.additionColor); | |
1202 | + case "deletion": | |
1203 | + return s2color(this.deletionColor); | |
1204 | + case "comment": | |
1205 | + return s2color(this.commentColor); | |
1206 | + } | |
1207 | + return null; | |
1208 | + } | |
1209 | + | |
1210 | + public void setGTColor(String string, String gtColor) { | |
1211 | + switch(string){ | |
1212 | + case "reference": | |
1213 | + this.referenceColor = gtColor; | |
1214 | + break; | |
1215 | + case "dubious": | |
1216 | + this.dubiousColor = gtColor; | |
1217 | + break; | |
1218 | + case "addition": | |
1219 | + this.additionColor = gtColor; | |
1220 | + break; | |
1221 | + case "deletion": | |
1222 | + this.deletionColor = gtColor; | |
1223 | + break; | |
1224 | + case "comment": | |
1225 | + this.commentColor = gtColor; | |
1226 | + break; | |
1227 | + } | |
1228 | + | |
1229 | + } | |
1230 | + | |
1231 | + private Color s2color(String color) { | |
1232 | + if(color == null){ | |
1233 | + return null; | |
1234 | + } | |
1235 | + switch(color.toLowerCase()){ | |
1236 | + case "black": | |
1237 | + return Color.BLACK; | |
1238 | + case "blue": | |
1239 | + return Color.BLUE; | |
1240 | + case "cyan": | |
1241 | + return Color.CYAN; | |
1242 | + case "dark_gray": | |
1243 | + case "darkgray": | |
1244 | + return Color.DARK_GRAY; | |
1245 | + case "gray": | |
1246 | + return Color.GRAY; | |
1247 | + case "green": | |
1248 | + return Color.GREEN; | |
1249 | + case "light_gray": | |
1250 | + case "lightgray": | |
1251 | + return Color.LIGHT_GRAY; | |
1252 | + case "magenta": | |
1253 | + return Color.MAGENTA; | |
1254 | + case "orange": | |
1255 | + return Color.ORANGE; | |
1256 | + case "pink": | |
1257 | + return Color.PINK; | |
1258 | + case "red": | |
1259 | + return Color.RED; | |
1260 | + case "white": | |
1261 | + return Color.WHITE; | |
1262 | + case "yellow": | |
1263 | + return Color.YELLOW; | |
1264 | + } | |
1265 | + return null; | |
1266 | + } | |
1267 | + | |
1268 | + public String getSchemaFile() { | |
1269 | + return this.schemaFile; | |
1270 | + } | |
1271 | + | |
1272 | + public void setSchemaFile(String schemaFile) { | |
1273 | + this.schemaFile = schemaFile; | |
1274 | + } | |
1275 | + | |
1276 | + public String getReferenceWidth() { | |
1277 | + return this.referenceWidth; | |
1278 | + } | |
1279 | + | |
1280 | + public String getDubiousWidth() { | |
1281 | + return this.dubiousWidth; | |
1282 | + } | |
1283 | + | |
1284 | + public String getAdditionWidth() { | |
1285 | + return this.additionWidth; | |
1286 | + } | |
1287 | + | |
1288 | + public String getDeletionWidth() { | |
1289 | + return this.deletionWidth; | |
1290 | + } | |
1291 | + | |
1292 | + public String getCommentWidth() { | |
1293 | + return this.commentWidth; | |
1294 | + } | |
1295 | + | |
1296 | + public void setGTWidth(String string, String gtWidth) { | |
1297 | + switch(string){ | |
1298 | + case "reference": | |
1299 | + this.referenceWidth = gtWidth; | |
1300 | + break; | |
1301 | + case "dubious": | |
1302 | + this.dubiousWidth = gtWidth; | |
1303 | + break; | |
1304 | + case "addition": | |
1305 | + this.additionWidth = gtWidth; | |
1306 | + break; | |
1307 | + case "deletion": | |
1308 | + this.deletionWidth = gtWidth; | |
1309 | + break; | |
1310 | + case "comment": | |
1311 | + this.commentWidth = gtWidth; | |
1312 | + break; | |
1313 | + } | |
1314 | + | |
1315 | + } | |
1316 | + | |
1317 | + public int getGTWidth(String string) { | |
1318 | + switch(string){ | |
1319 | + case "reference": | |
1320 | + return Integer.parseInt(this.referenceWidth); | |
1321 | + case "dubious": | |
1322 | + return Integer.parseInt(this.dubiousWidth); | |
1323 | + case "addition": | |
1324 | + return Integer.parseInt(this.additionWidth); | |
1325 | + case "deletion": | |
1326 | + return Integer.parseInt(this.deletionWidth); | |
1327 | + case "comment": | |
1328 | + return Integer.parseInt(this.commentWidth); | |
1329 | + } | |
1330 | + return 1; | |
1331 | + } | |
1332 | + | |
1333 | + public String getSchemaType() { | |
1334 | + return this.schemaType; | |
1335 | + } | |
1336 | + | |
1337 | + public void setSchemaType(String schemaType) { | |
1338 | + this.schemaType = schemaType; | |
1339 | + | |
1340 | + } | |
1341 | + | |
1342 | + | |
1068 | 1343 | } |