• R/O
  • SSH
  • HTTPS

smart-gs: コミット


コミットメタ情報

リビジョン1206 (tree)
日時2017-05-08 12:33:11
作者ohura

ログメッセージ

[editor-simplyhtml-merge] PreferenceFrameの更新
TextMarkupPanelとXMLPanelの追加。

変更サマリ

差分

--- branches/editor-simplyhtml-merge/src/smart_gs/menu/GSMenuBar.java (revision 1205)
+++ branches/editor-simplyhtml-merge/src/smart_gs/menu/GSMenuBar.java (revision 1206)
@@ -1,28 +1,41 @@
11 /* $Id$ */
22 package smart_gs.menu;
33
4-import java.util.Locale;
5-import java.util.ResourceBundle;
6-
4+import java.awt.Dimension;
5+import java.awt.event.ActionEvent;
6+import java.awt.event.ActionListener;
7+import javax.swing.JButton;
78 import javax.swing.JMenu;
89 import javax.swing.JMenuBar;
910
10-import smart_gs.smleditor.swingui.GSEditorTextPane;
1111 import smart_gs.swingui.AbstractGSWindow;
12-import smart_gs.swingui.WorkspaceWindow;
1312 import smart_gs.swingui.toolbar.GSEditorToolBar;
1413 import smart_gs.util.MessageProperties;
15-import sml_editor.swingui.EditorTextPane;
14+import smart_gs.menu.preference.PreferenceFrame;
1615 import smart_gs.network.RepositoryMenu;
1716
1817 @SuppressWarnings("serial")
1918 public class GSMenuBar extends JMenuBar{
2019 private EditMenu editMenu;
21- private GSEditorTextPane textPane;
2220 private JMenu fileMenu;
21+ private JButton preference;
2322
2423 //2007/11/1 kazuhiro kobayashi
2524 public GSMenuBar(AbstractGSWindow parent,GSEditorToolBar gsEditorToolBar){
25+// this.preference = new JButton(new ImageIcon(GSConstants.iconPath() + "SGS_icon.gif"));
26+ this.preference = new JButton("p");
27+ this.preference.setMaximumSize(new Dimension(20, 20));
28+ this.preference.setSize(20, 20);
29+ this.preference.addActionListener(new ActionListener(){
30+
31+ @Override
32+ public void actionPerformed(ActionEvent e) {
33+ PreferenceFrame.getInstance().setVisible(true);
34+
35+ }
36+
37+ });
38+ this.add(preference);
2639 this.fileMenu = new FileMenu("File");
2740 // 譌・譛ャ隱槭Γ繝�繧サ繝シ繧クresource bundle縺ョ蜿門セ�
2841 MessageProperties mp = MessageProperties.getInstance();
--- branches/editor-simplyhtml-merge/src/smart_gs/menu/action/SchemaFileAction.java (revision 0)
+++ branches/editor-simplyhtml-merge/src/smart_gs/menu/action/SchemaFileAction.java (revision 1206)
@@ -0,0 +1,30 @@
1+package smart_gs.menu.action;
2+
3+import java.awt.event.ActionListener;
4+
5+import javax.swing.JFileChooser;
6+
7+import smart_gs.logical.Preference;
8+import smart_gs.menu.preference.XMLPanel;
9+
10+public class SchemaFileAction extends SetDirectoryPathAction implements ActionListener{
11+
12+ public SchemaFileAction() {
13+ super();
14+ this.chooser.setDialogTitle("Schema File");
15+ chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
16+ }
17+
18+ @Override
19+ protected String getOldPath() {
20+ // TODO Auto-generated method stub
21+ return Preference.getInstance().getSchemaFile();
22+ }
23+
24+ @Override
25+ protected void validateNewPath(String newPath) {
26+ XMLPanel.getInstance().setSchemaFileField(newPath);
27+
28+ }
29+
30+}
--- branches/editor-simplyhtml-merge/src/smart_gs/menu/preference/PreferenceFrame.java (revision 1205)
+++ branches/editor-simplyhtml-merge/src/smart_gs/menu/preference/PreferenceFrame.java (revision 1206)
@@ -7,6 +7,9 @@
77 import smart_gs.drawing_tool.state.UniSelectedState;
88 import smart_gs.image_search.GSSearchEngine;
99 import smart_gs.logical.Preference;
10+import smart_gs.smleditor.swingui.GSEditorTextPane;
11+import smart_gs.smleditor.swingui.GSTabbedPane;
12+import smart_gs.smleditor.swingui.IDATPanel;
1013 import smart_gs.swingui.ButtonFrame;
1114 import smart_gs.swingui.WorkspaceWindow;
1215
@@ -26,7 +29,7 @@
2629 private TextMarkupPanel textmarkup;
2730 private NetworkPanel network;
2831 private DisplayPanel display;
29- private XMLPanel xml;
32+ private static XMLPanel xml = new XMLPanel();
3033
3134
3235 private PreferenceFrame(){
@@ -40,7 +43,7 @@
4043 textmarkup = new TextMarkupPanel();
4144 network = new NetworkPanel();
4245 display = new DisplayPanel();
43- xml = new XMLPanel();
46+ xml = XMLPanel.getInstance();
4447
4548 tp.addTab("Basic", basic);
4649 tp.addTab("Files", files);
@@ -69,7 +72,7 @@
6972 pref.setFirstIDATName(basic.getFirstIDATName());
7073 pref.setSecondIDATName(basic.getSecondIDATName());
7174 pref.setThirdIDATName(basic.getThirdIDATName());
72- pref.setBrowser(basic.getEditor());
75+ pref.setEditor(basic.getEditor());
7376
7477 String message[] = files.checkPath();
7578 String errowMessage = message[0];
@@ -102,7 +105,19 @@
102105 pref.setBookmarkSize(imagemarkup.getBookmarkSize());
103106 pref.setResourceBasketSaveOption(imagemarkup.getResourceBasketSaveOption());
104107 pref.setTempRegionOn(imagemarkup.getTempRegionOn());
108+
109+ pref.setGTColor("reference", textmarkup.getGTColor("reference"));
110+ pref.setGTColor("dubious", textmarkup.getGTColor("dubious"));
111+ pref.setGTColor("addition", textmarkup.getGTColor("addition"));
112+ pref.setGTColor("deletion", textmarkup.getGTColor("deletion"));
113+ pref.setGTColor("comment", textmarkup.getGTColor("comment"));
105114
115+ pref.setGTWidth("reference", textmarkup.getGTWidth("reference"));
116+ pref.setGTWidth("dubious", textmarkup.getGTWidth("dubious"));
117+ pref.setGTWidth("addition", textmarkup.getGTWidth("addition"));
118+ pref.setGTWidth("deletion", textmarkup.getGTWidth("deletion"));
119+ pref.setGTWidth("comment", textmarkup.getGTWidth("comment"));
120+
106121 pref.setWebdavServerPathString(network.getWebdavServerPathString());
107122 pref.setWebdavUserName(network.getWebdavUserName());
108123 pref.setWebdavPassword(network.getWebdavPassword());
@@ -125,9 +140,22 @@
125140 window.displayWorksapceWindow(windowmode);
126141 }
127142 pref.setImagePostion(display.getImagePosition());
128-
143+
144+ pref.setSchemaFile(xml.getSchemaFile());
145+ pref.setSchemaType(xml.getSchemaType());
146+
129147 pref.save();
130-
148+ GSTabbedPane tabbedPane = window.getTabbedPane();
149+ if(tabbedPane != null){
150+ IDATPanel idatPanel = tabbedPane.getFirstIDATPanel();
151+ if(idatPanel != null){
152+ tabbedPane.getFirstIDAT().getSGSDocumentPane().updateHighlight();
153+ tabbedPane.getSecondIDAT().getSGSDocumentPane().updateHighlight();
154+ tabbedPane.getThirdIDAT().getSGSDocumentPane().updateHighlight();
155+ }
156+ }
157+
158+
131159 this.dispose();
132160 }
133161 @Override
--- branches/editor-simplyhtml-merge/src/smart_gs/menu/preference/XMLPanel.java (revision 1205)
+++ branches/editor-simplyhtml-merge/src/smart_gs/menu/preference/XMLPanel.java (revision 1206)
@@ -2,13 +2,141 @@
22
33 import javax.swing.JPanel;
44
5+import java.awt.GridBagLayout;
6+
7+import javax.swing.JLabel;
8+
9+import java.awt.GridBagConstraints;
10+
11+import javax.swing.JTextField;
12+
13+import java.awt.Insets;
14+
15+import javax.swing.JButton;
16+
17+import smart_gs.logical.Preference;
18+import smart_gs.menu.action.SchemaFileAction;
19+import javax.swing.JRadioButton;
20+import javax.swing.ButtonGroup;
21+
522 public class XMLPanel extends JPanel {
23+ private static XMLPanel singleton = new XMLPanel();
24+ private JTextField textField_schemaFile;
25+ private final JButton btnSelect_SchemaFile = new JButton("Select");
26+ private final ButtonGroup buttonGroup = new ButtonGroup();
27+ private JRadioButton rdbtnXmlSchema;
28+ private JRadioButton rdbtnRelaxng;
29+ private JRadioButton rdbtnDtd;
630
731 /**
832 * Create the panel.
933 */
1034 public XMLPanel() {
35+ GridBagLayout gridBagLayout = new GridBagLayout();
36+ gridBagLayout.columnWidths = new int[]{30, 140, 159, 76, 0};
37+ gridBagLayout.rowHeights = new int[]{30, 26, 16, 0, 0, 0};
38+ gridBagLayout.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
39+ gridBagLayout.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
40+ setLayout(gridBagLayout);
41+
42+ JLabel lblSchemaFile = new JLabel("Default Schema File:");
43+ GridBagConstraints gbc_lblSchemaFile = new GridBagConstraints();
44+ gbc_lblSchemaFile.anchor = GridBagConstraints.EAST;
45+ gbc_lblSchemaFile.insets = new Insets(0, 0, 5, 5);
46+ gbc_lblSchemaFile.gridx = 1;
47+ gbc_lblSchemaFile.gridy = 1;
48+ add(lblSchemaFile, gbc_lblSchemaFile);
49+
50+ textField_schemaFile = new JTextField();
51+ GridBagConstraints gbc_textField_schemaFile = new GridBagConstraints();
52+ gbc_textField_schemaFile.fill = GridBagConstraints.HORIZONTAL;
53+ gbc_textField_schemaFile.insets = new Insets(0, 0, 5, 5);
54+ gbc_textField_schemaFile.gridx = 2;
55+ gbc_textField_schemaFile.gridy = 1;
56+ add(textField_schemaFile, gbc_textField_schemaFile);
57+ textField_schemaFile.setColumns(10);
58+
59+
60+ JLabel lblSchemaType = new JLabel("Schema Type:");
61+ GridBagConstraints gbc_lblSchemaType = new GridBagConstraints();
62+ gbc_lblSchemaType.insets = new Insets(0, 0, 5, 5);
63+ gbc_lblSchemaType.gridx = 1;
64+ gbc_lblSchemaType.gridy = 2;
65+ add(lblSchemaType, gbc_lblSchemaType);
66+
67+ rdbtnXmlSchema = new JRadioButton("XML Schema");
68+ buttonGroup.add(rdbtnXmlSchema);
69+ GridBagConstraints gbc_rdbtnXmlSchema = new GridBagConstraints();
70+ gbc_rdbtnXmlSchema.insets = new Insets(0, 0, 5, 5);
71+ gbc_rdbtnXmlSchema.gridx = 2;
72+ gbc_rdbtnXmlSchema.gridy = 2;
73+ add(rdbtnXmlSchema, gbc_rdbtnXmlSchema);
74+
75+ rdbtnRelaxng = new JRadioButton("RELAX NG");
76+ buttonGroup.add(rdbtnRelaxng);
77+ GridBagConstraints gbc_rdbtnRelaxng = new GridBagConstraints();
78+ gbc_rdbtnRelaxng.insets = new Insets(0, 0, 5, 5);
79+ gbc_rdbtnRelaxng.gridx = 2;
80+ gbc_rdbtnRelaxng.gridy = 3;
81+ add(rdbtnRelaxng, gbc_rdbtnRelaxng);
82+
83+ rdbtnDtd = new JRadioButton("DTD");
84+ buttonGroup.add(rdbtnDtd);
85+ GridBagConstraints gbc_rdbtnDtd = new GridBagConstraints();
86+ gbc_rdbtnDtd.insets = new Insets(0, 0, 0, 5);
87+ gbc_rdbtnDtd.gridx = 2;
88+ gbc_rdbtnDtd.gridy = 4;
89+ add(rdbtnDtd, gbc_rdbtnDtd);
1190
91+ GridBagConstraints gbc_btnSelect_SchemaFile = new GridBagConstraints();
92+ gbc_btnSelect_SchemaFile.insets = new Insets(0, 0, 5, 0);
93+ gbc_btnSelect_SchemaFile.gridx = 3;
94+ gbc_btnSelect_SchemaFile.gridy = 1;
95+ add(btnSelect_SchemaFile, gbc_btnSelect_SchemaFile);
96+ SchemaFileAction SchemaFileAction = new SchemaFileAction();
97+ btnSelect_SchemaFile.addActionListener(SchemaFileAction);
98+
99+ // Default Settings
100+ this.textField_schemaFile.setText(Preference.getInstance().getSchemaFile());
101+ String schemaType = Preference.getInstance().getSchemaType();
102+ switch(schemaType){
103+ case "relaxng":
104+ this.rdbtnRelaxng.setSelected(true);
105+ break;
106+ case "xmlschema":
107+ this.rdbtnXmlSchema.setSelected(true);
108+ break;
109+ case "dtd":
110+ this.rdbtnDtd.setSelected(true);
111+ break;
112+ }
12113 }
13114
115+
116+ public static XMLPanel getInstance() {
117+ return singleton;
118+ }
119+
120+
121+ public void setSchemaFileField(String newPath) {
122+ this.textField_schemaFile.setText(newPath);
123+
124+ }
125+
126+
127+ public String getSchemaFile() {
128+ return this.textField_schemaFile.getText();
129+ }
130+
131+
132+ public String getSchemaType() {
133+ if(this.rdbtnRelaxng.isSelected()){
134+ return "relaxng";
135+ } else if(this.rdbtnXmlSchema.isSelected()) {
136+ return "xmlschema";
137+ } else if(this.rdbtnDtd.isSelected()) {
138+ return "dtd";
139+ }
140+ return "relaxng";
141+ }
14142 }
--- branches/editor-simplyhtml-merge/src/smart_gs/menu/preference/TextMarkupPanel.java (revision 1205)
+++ branches/editor-simplyhtml-merge/src/smart_gs/menu/preference/TextMarkupPanel.java (revision 1206)
@@ -1,14 +1,588 @@
11 package smart_gs.menu.preference;
22
33 import javax.swing.JPanel;
4+import javax.swing.JLabel;
45
6+import java.awt.Color;
7+import java.awt.GridBagLayout;
8+import java.awt.GridBagConstraints;
9+
10+import javax.swing.JRadioButton;
11+
12+import java.awt.Insets;
13+
14+import javax.swing.ButtonGroup;
15+
16+import smart_gs.logical.Preference;
17+
18+import javax.swing.JTextArea;
19+import javax.swing.JTextField;
20+
521 public class TextMarkupPanel extends JPanel {
22+ private final ButtonGroup buttonGroup = new ButtonGroup();
23+ private JRadioButton rdbtnRed;
24+ private JRadioButton rdbtnBlue;
25+ private JRadioButton rdbtnYellow;
26+ private JRadioButton rdbtnGreen;
27+ private JTextField textField;
628
29+ private JLabel lblAddition;
30+ private JLabel lblDeletion;
31+ private JLabel lblComment;
32+ private JRadioButton rdbtnRed_2;
33+ private JRadioButton rdbtnBlue_2;
34+ private JRadioButton rdbtnYellow_2;
35+ private JRadioButton rdbtnGreen_2;
36+ private JTextField textField_2;
37+ private JRadioButton rdbtnRed_3;
38+ private JRadioButton rdbtnBlue_3;
39+ private JRadioButton rdbtnYellow_3;
40+ private JRadioButton rdbtnGreen_3;
41+ private JTextField textField_3;
42+ private JRadioButton rdbtnRed_4;
43+ private JRadioButton rdbtnBlue_4;
44+ private JRadioButton rdbtnYellow_4;
45+ private JRadioButton rdbtnGreen_4;
46+ private JTextField textField_4;
47+ private final ButtonGroup buttonGroup_2 = new ButtonGroup();
48+ private final ButtonGroup buttonGroup_3 = new ButtonGroup();
49+ private final ButtonGroup buttonGroup_4 = new ButtonGroup();
50+ private JRadioButton rdbtnGray;
51+ private JRadioButton rdbtnGray_2;
52+ private JRadioButton rdbtnGray_3;
53+ private JRadioButton rdbtnGray_4;
54+ private JRadioButton rdbtnRed_1;
55+ private JRadioButton rdbtnBlue_1;
56+ private JRadioButton rdbtnYellow_1;
57+ private JRadioButton rdbtnGreen_1;
58+ private JRadioButton rdbtnGray_1;
59+ private JTextField textField_1;
60+ private final ButtonGroup buttonGroup_1 = new ButtonGroup();
61+ private JLabel lblWidth;
62+
763 /**
864 * Create the panel.
965 */
1066 public TextMarkupPanel() {
67+ GridBagLayout gridBagLayout = new GridBagLayout();
68+ gridBagLayout.columnWidths = new int[]{30, 0, 0, 0, 0, 0, 0, 30, 40, 0, 0};
69+ gridBagLayout.rowHeights = new int[]{0, 30, 0, 0, 0, 0, 0, 0};
70+ gridBagLayout.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE};
71+ gridBagLayout.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
72+ setLayout(gridBagLayout);
73+
74+ lblWidth = new JLabel("Width (1-5)");
75+ GridBagConstraints gbc_lblWidth = new GridBagConstraints();
76+ gbc_lblWidth.insets = new Insets(0, 0, 5, 5);
77+ gbc_lblWidth.gridx = 8;
78+ gbc_lblWidth.gridy = 1;
79+ add(lblWidth, gbc_lblWidth);
80+
81+ JLabel lblReference = new JLabel("Reference:");
82+ GridBagConstraints gbc_lblReference = new GridBagConstraints();
83+ gbc_lblReference.insets = new Insets(0, 0, 5, 5);
84+ gbc_lblReference.gridx = 1;
85+ gbc_lblReference.gridy = 2;
86+ add(lblReference, gbc_lblReference);
87+
88+ rdbtnRed = new JRadioButton("Red");
89+ buttonGroup.add(rdbtnRed);
90+ GridBagConstraints gbc_rdbtnRed = new GridBagConstraints();
91+ gbc_rdbtnRed.insets = new Insets(0, 0, 5, 5);
92+ gbc_rdbtnRed.gridx = 3;
93+ gbc_rdbtnRed.gridy = 2;
94+ add(rdbtnRed, gbc_rdbtnRed);
95+
96+ rdbtnBlue = new JRadioButton("Blue");
97+ buttonGroup.add(rdbtnBlue);
98+ GridBagConstraints gbc_rdbtnBlue = new GridBagConstraints();
99+ gbc_rdbtnBlue.insets = new Insets(0, 0, 5, 5);
100+ gbc_rdbtnBlue.gridx = 4;
101+ gbc_rdbtnBlue.gridy = 2;
102+ add(rdbtnBlue, gbc_rdbtnBlue);
103+
104+ rdbtnYellow = new JRadioButton("Yellow");
105+ buttonGroup.add(rdbtnYellow);
106+ GridBagConstraints gbc_rdbtnYellow = new GridBagConstraints();
107+ gbc_rdbtnYellow.insets = new Insets(0, 0, 5, 5);
108+ gbc_rdbtnYellow.gridx = 5;
109+ gbc_rdbtnYellow.gridy = 2;
110+ add(rdbtnYellow, gbc_rdbtnYellow);
111+
112+ rdbtnGreen = new JRadioButton("Green");
113+ buttonGroup.add(rdbtnGreen);
114+ GridBagConstraints gbc_rdbtnGreen = new GridBagConstraints();
115+ gbc_rdbtnGreen.insets = new Insets(0, 0, 5, 5);
116+ gbc_rdbtnGreen.gridx = 6;
117+ gbc_rdbtnGreen.gridy = 2;
118+ add(rdbtnGreen, gbc_rdbtnGreen);
119+
120+ rdbtnGray = new JRadioButton("Gray");
121+ buttonGroup.add(rdbtnGray);
122+ GridBagConstraints gbc_rdbtnGray = new GridBagConstraints();
123+ gbc_rdbtnGray.insets = new Insets(0, 0, 5, 5);
124+ gbc_rdbtnGray.gridx = 7;
125+ gbc_rdbtnGray.gridy = 2;
126+ add(rdbtnGray, gbc_rdbtnGray);
127+
128+ textField = new JTextField();
129+ GridBagConstraints gbc_textField = new GridBagConstraints();
130+ gbc_textField.insets = new Insets(0, 0, 5, 5);
131+ gbc_textField.gridx = 8;
132+ gbc_textField.gridy = 2;
133+ add(textField, gbc_textField);
134+ textField.setColumns(10);
135+
136+ JLabel lblDubious = new JLabel("Dubious:");
137+ GridBagConstraints gbc_lblDubious = new GridBagConstraints();
138+ gbc_lblDubious.insets = new Insets(0, 0, 5, 5);
139+ gbc_lblDubious.gridx = 1;
140+ gbc_lblDubious.gridy = 3;
141+ add(lblDubious, gbc_lblDubious);
142+
143+ rdbtnRed_1 = new JRadioButton("Red");
144+ buttonGroup_1.add(rdbtnRed_1);
145+ GridBagConstraints gbc_rdbtnRed_1 = new GridBagConstraints();
146+ gbc_rdbtnRed_1.insets = new Insets(0, 0, 5, 5);
147+ gbc_rdbtnRed_1.gridx = 3;
148+ gbc_rdbtnRed_1.gridy = 3;
149+ add(rdbtnRed_1, gbc_rdbtnRed_1);
150+
151+ rdbtnBlue_1 = new JRadioButton("Blue");
152+ buttonGroup_1.add(rdbtnBlue_1);
153+ GridBagConstraints gbc_rdbtnBlue_1 = new GridBagConstraints();
154+ gbc_rdbtnBlue_1.insets = new Insets(0, 0, 5, 5);
155+ gbc_rdbtnBlue_1.gridx = 4;
156+ gbc_rdbtnBlue_1.gridy = 3;
157+ add(rdbtnBlue_1, gbc_rdbtnBlue_1);
158+
159+ rdbtnYellow_1 = new JRadioButton("Yellow");
160+ buttonGroup_1.add(rdbtnYellow_1);
161+ GridBagConstraints gbc_rdbtnYellow_1 = new GridBagConstraints();
162+ gbc_rdbtnYellow_1.insets = new Insets(0, 0, 5, 5);
163+ gbc_rdbtnYellow_1.gridx = 5;
164+ gbc_rdbtnYellow_1.gridy = 3;
165+ add(rdbtnYellow_1, gbc_rdbtnYellow_1);
166+
167+ rdbtnGreen_1 = new JRadioButton("Green");
168+ buttonGroup_1.add(rdbtnGreen_1);
169+ GridBagConstraints gbc_rdbtnGreen_1 = new GridBagConstraints();
170+ gbc_rdbtnGreen_1.insets = new Insets(0, 0, 5, 5);
171+ gbc_rdbtnGreen_1.gridx = 6;
172+ gbc_rdbtnGreen_1.gridy = 3;
173+ add(rdbtnGreen_1, gbc_rdbtnGreen_1);
174+
175+ rdbtnGray_1 = new JRadioButton("Gray");
176+ buttonGroup_1.add(rdbtnGray_1);
177+ GridBagConstraints gbc_rdbtnGray_1 = new GridBagConstraints();
178+ gbc_rdbtnGray_1.insets = new Insets(0, 0, 5, 5);
179+ gbc_rdbtnGray_1.gridx = 7;
180+ gbc_rdbtnGray_1.gridy = 3;
181+ add(rdbtnGray_1, gbc_rdbtnGray_1);
182+
183+ textField_1 = new JTextField();
184+ GridBagConstraints gbc_textField_1 = new GridBagConstraints();
185+ gbc_textField_1.insets = new Insets(0, 0, 5, 5);
186+ gbc_textField_1.gridx = 8;
187+ gbc_textField_1.gridy = 3;
188+ add(textField_1, gbc_textField_1);
189+ textField_1.setColumns(10);
190+
191+ lblAddition = new JLabel("Addition:");
192+ GridBagConstraints gbc_lblAddition = new GridBagConstraints();
193+ gbc_lblAddition.insets = new Insets(0, 0, 5, 5);
194+ gbc_lblAddition.gridx = 1;
195+ gbc_lblAddition.gridy = 4;
196+ add(lblAddition, gbc_lblAddition);
197+
198+ rdbtnRed_2 = new JRadioButton("Red");
199+ buttonGroup_2.add(rdbtnRed_2);
200+ GridBagConstraints gbc_rdbtnRed_2 = new GridBagConstraints();
201+ gbc_rdbtnRed_2.insets = new Insets(0, 0, 5, 5);
202+ gbc_rdbtnRed_2.gridx = 3;
203+ gbc_rdbtnRed_2.gridy = 4;
204+ add(rdbtnRed_2, gbc_rdbtnRed_2);
205+
206+ rdbtnBlue_2 = new JRadioButton("Blue");
207+ buttonGroup_2.add(rdbtnBlue_2);
208+ GridBagConstraints gbc_rdbtnBlue_2 = new GridBagConstraints();
209+ gbc_rdbtnBlue_2.insets = new Insets(0, 0, 5, 5);
210+ gbc_rdbtnBlue_2.gridx = 4;
211+ gbc_rdbtnBlue_2.gridy = 4;
212+ add(rdbtnBlue_2, gbc_rdbtnBlue_2);
213+
214+ rdbtnYellow_2 = new JRadioButton("Yellow");
215+ buttonGroup_2.add(rdbtnYellow_2);
216+ GridBagConstraints gbc_rdbtnYellow_2 = new GridBagConstraints();
217+ gbc_rdbtnYellow_2.insets = new Insets(0, 0, 5, 5);
218+ gbc_rdbtnYellow_2.gridx = 5;
219+ gbc_rdbtnYellow_2.gridy = 4;
220+ add(rdbtnYellow_2, gbc_rdbtnYellow_2);
221+
222+ rdbtnGreen_2 = new JRadioButton("Green");
223+ buttonGroup_2.add(rdbtnGreen_2);
224+ GridBagConstraints gbc_rdbtnGreen_2 = new GridBagConstraints();
225+ gbc_rdbtnGreen_2.insets = new Insets(0, 0, 5, 5);
226+ gbc_rdbtnGreen_2.gridx = 6;
227+ gbc_rdbtnGreen_2.gridy = 4;
228+ add(rdbtnGreen_2, gbc_rdbtnGreen_2);
229+
230+ rdbtnGray_2 = new JRadioButton("Gray");
231+ buttonGroup_2.add(rdbtnGray_2);
232+ GridBagConstraints gbc_rdbtnGray_2 = new GridBagConstraints();
233+ gbc_rdbtnGray_2.insets = new Insets(0, 0, 5, 5);
234+ gbc_rdbtnGray_2.gridx = 7;
235+ gbc_rdbtnGray_2.gridy = 4;
236+ add(rdbtnGray_2, gbc_rdbtnGray_2);
237+
238+ textField_2 = new JTextField();
239+ GridBagConstraints gbc_textField_2 = new GridBagConstraints();
240+ gbc_textField_2.insets = new Insets(0, 0, 5, 5);
241+ gbc_textField_2.gridx = 8;
242+ gbc_textField_2.gridy = 4;
243+ add(textField_2, gbc_textField_2);
244+ textField_2.setColumns(10);
245+
246+ lblDeletion = new JLabel("Deletion:");
247+ GridBagConstraints gbc_lblDeletion = new GridBagConstraints();
248+ gbc_lblDeletion.insets = new Insets(0, 0, 5, 5);
249+ gbc_lblDeletion.gridx = 1;
250+ gbc_lblDeletion.gridy = 5;
251+ add(lblDeletion, gbc_lblDeletion);
252+
253+ rdbtnRed_3 = new JRadioButton("Red");
254+ buttonGroup_3.add(rdbtnRed_3);
255+ GridBagConstraints gbc_rdbtnRed_3 = new GridBagConstraints();
256+ gbc_rdbtnRed_3.insets = new Insets(0, 0, 5, 5);
257+ gbc_rdbtnRed_3.gridx = 3;
258+ gbc_rdbtnRed_3.gridy = 5;
259+ add(rdbtnRed_3, gbc_rdbtnRed_3);
260+
261+ rdbtnBlue_3 = new JRadioButton("Blue");
262+ buttonGroup_3.add(rdbtnBlue_3);
263+ GridBagConstraints gbc_rdbtnBlue_3 = new GridBagConstraints();
264+ gbc_rdbtnBlue_3.insets = new Insets(0, 0, 5, 5);
265+ gbc_rdbtnBlue_3.gridx = 4;
266+ gbc_rdbtnBlue_3.gridy = 5;
267+ add(rdbtnBlue_3, gbc_rdbtnBlue_3);
268+
269+ rdbtnYellow_3 = new JRadioButton("Yellow");
270+ buttonGroup_3.add(rdbtnYellow_3);
271+ GridBagConstraints gbc_rdbtnYellow_3 = new GridBagConstraints();
272+ gbc_rdbtnYellow_3.insets = new Insets(0, 0, 5, 5);
273+ gbc_rdbtnYellow_3.gridx = 5;
274+ gbc_rdbtnYellow_3.gridy = 5;
275+ add(rdbtnYellow_3, gbc_rdbtnYellow_3);
276+
277+ rdbtnGreen_3 = new JRadioButton("Green");
278+ buttonGroup_3.add(rdbtnGreen_3);
279+ GridBagConstraints gbc_rdbtnGreen_3 = new GridBagConstraints();
280+ gbc_rdbtnGreen_3.insets = new Insets(0, 0, 5, 5);
281+ gbc_rdbtnGreen_3.gridx = 6;
282+ gbc_rdbtnGreen_3.gridy = 5;
283+ add(rdbtnGreen_3, gbc_rdbtnGreen_3);
284+
285+ rdbtnGray_3 = new JRadioButton("Gray");
286+ buttonGroup_3.add(rdbtnGray_3);
287+ GridBagConstraints gbc_rdbtnGray_3 = new GridBagConstraints();
288+ gbc_rdbtnGray_3.insets = new Insets(0, 0, 5, 5);
289+ gbc_rdbtnGray_3.gridx = 7;
290+ gbc_rdbtnGray_3.gridy = 5;
291+ add(rdbtnGray_3, gbc_rdbtnGray_3);
292+
293+ textField_3 = new JTextField();
294+ GridBagConstraints gbc_textField_3 = new GridBagConstraints();
295+ gbc_textField_3.insets = new Insets(0, 0, 5, 5);
296+ gbc_textField_3.gridx = 8;
297+ gbc_textField_3.gridy = 5;
298+ add(textField_3, gbc_textField_3);
299+ textField_3.setColumns(10);
300+
301+ lblComment = new JLabel("Comment:");
302+ GridBagConstraints gbc_lblComment = new GridBagConstraints();
303+ gbc_lblComment.insets = new Insets(0, 0, 0, 5);
304+ gbc_lblComment.gridx = 1;
305+ gbc_lblComment.gridy = 6;
306+ add(lblComment, gbc_lblComment);
307+
308+ rdbtnRed_4 = new JRadioButton("Red");
309+ buttonGroup_4.add(rdbtnRed_4);
310+ GridBagConstraints gbc_rdbtnRed_4 = new GridBagConstraints();
311+ gbc_rdbtnRed_4.insets = new Insets(0, 0, 0, 5);
312+ gbc_rdbtnRed_4.gridx = 3;
313+ gbc_rdbtnRed_4.gridy = 6;
314+ add(rdbtnRed_4, gbc_rdbtnRed_4);
315+
316+ rdbtnBlue_4 = new JRadioButton("Blue");
317+ buttonGroup_4.add(rdbtnBlue_4);
318+ GridBagConstraints gbc_rdbtnBlue_4 = new GridBagConstraints();
319+ gbc_rdbtnBlue_4.insets = new Insets(0, 0, 0, 5);
320+ gbc_rdbtnBlue_4.gridx = 4;
321+ gbc_rdbtnBlue_4.gridy = 6;
322+ add(rdbtnBlue_4, gbc_rdbtnBlue_4);
323+
324+ rdbtnYellow_4 = new JRadioButton("Yellow");
325+ buttonGroup_4.add(rdbtnYellow_4);
326+ GridBagConstraints gbc_rdbtnYellow_4 = new GridBagConstraints();
327+ gbc_rdbtnYellow_4.insets = new Insets(0, 0, 0, 5);
328+ gbc_rdbtnYellow_4.gridx = 5;
329+ gbc_rdbtnYellow_4.gridy = 6;
330+ add(rdbtnYellow_4, gbc_rdbtnYellow_4);
331+
332+ rdbtnGreen_4 = new JRadioButton("Green");
333+ buttonGroup_4.add(rdbtnGreen_4);
334+ GridBagConstraints gbc_rdbtnGreen_4 = new GridBagConstraints();
335+ gbc_rdbtnGreen_4.insets = new Insets(0, 0, 0, 5);
336+ gbc_rdbtnGreen_4.gridx = 6;
337+ gbc_rdbtnGreen_4.gridy = 6;
338+ add(rdbtnGreen_4, gbc_rdbtnGreen_4);
339+
340+ rdbtnGray_4 = new JRadioButton("Gray");
341+ buttonGroup_4.add(rdbtnGray_4);
342+ GridBagConstraints gbc_rdbtnGray_4 = new GridBagConstraints();
343+ gbc_rdbtnGray_4.insets = new Insets(0, 0, 0, 5);
344+ gbc_rdbtnGray_4.gridx = 7;
345+ gbc_rdbtnGray_4.gridy = 6;
346+ add(rdbtnGray_4, gbc_rdbtnGray_4);
347+
348+ textField_4 = new JTextField();
349+ GridBagConstraints gbc_textField_4 = new GridBagConstraints();
350+ gbc_textField_4.insets = new Insets(0, 0, 0, 5);
351+ gbc_textField_4.gridx = 8;
352+ gbc_textField_4.gridy = 6;
353+ add(textField_4, gbc_textField_4);
354+ textField_4.setColumns(10);
11355
356+ // Default Settings
357+ Color referenceColor = Preference.getInstance().getGTColor("reference");
358+ if(referenceColor.equals(Color.RED)){
359+ rdbtnRed.setSelected(true);
360+ } else if(referenceColor.equals(Color.BLUE)){
361+ rdbtnBlue.setSelected(true);
362+ } else if(referenceColor.equals(Color.YELLOW)){
363+ rdbtnYellow.setSelected(true);
364+ } else if(referenceColor.equals(Color.GREEN)){
365+ rdbtnGreen.setSelected(true);
366+ } else if(referenceColor.equals(Color.GRAY)){
367+ rdbtnGray.setSelected(true);
368+ } else {
369+ rdbtnRed.setSelected(true);
370+ }
371+ this.textField.setText(Preference.getInstance().getReferenceWidth());
372+
373+ Color dubiousColor = Preference.getInstance().getGTColor("dubious");
374+ if(dubiousColor.equals(Color.RED)){
375+ rdbtnRed_1.setSelected(true);
376+ } else if(dubiousColor.equals(Color.BLUE)){
377+ rdbtnBlue_1.setSelected(true);
378+ } else if(dubiousColor.equals(Color.YELLOW)){
379+ rdbtnYellow_1.setSelected(true);
380+ } else if(dubiousColor.equals(Color.GREEN)){
381+ rdbtnGreen_1.setSelected(true);
382+ } else if(dubiousColor.equals(Color.GRAY)){
383+ rdbtnGray_1.setSelected(true);
384+ } else {
385+ rdbtnRed_1.setSelected(true);
386+ }
387+ this.textField_1.setText(Preference.getInstance().getDubiousWidth());
388+
389+ Color additionColor = Preference.getInstance().getGTColor("addition");
390+ if(additionColor.equals(Color.RED)){
391+ rdbtnRed_2.setSelected(true);
392+ } else if(additionColor.equals(Color.BLUE)){
393+ rdbtnBlue_2.setSelected(true);
394+ } else if(additionColor.equals(Color.YELLOW)){
395+ rdbtnYellow_2.setSelected(true);
396+ } else if(additionColor.equals(Color.GREEN)){
397+ rdbtnGreen_2.setSelected(true);
398+ } else if(additionColor.equals(Color.GRAY)){
399+ rdbtnGray_2.setSelected(true);
400+ } else {
401+ rdbtnRed_2.setSelected(true);
402+ }
403+ this.textField_2.setText(Preference.getInstance().getAdditionWidth());
404+
405+ Color deletionColor = Preference.getInstance().getGTColor("deletion");
406+ if(deletionColor.equals(Color.RED)){
407+ rdbtnRed_3.setSelected(true);
408+ } else if(deletionColor.equals(Color.BLUE)){
409+ rdbtnBlue_3.setSelected(true);
410+ } else if(deletionColor.equals(Color.YELLOW)){
411+ rdbtnYellow_3.setSelected(true);
412+ } else if(deletionColor.equals(Color.GREEN)){
413+ rdbtnGreen_3.setSelected(true);
414+ } else if(deletionColor.equals(Color.GRAY)){
415+ rdbtnGray_3.setSelected(true);
416+ } else {
417+ rdbtnRed_3.setSelected(true);
418+ }
419+ this.textField_3.setText(Preference.getInstance().getDeletionWidth());
420+
421+ Color commentColor = Preference.getInstance().getGTColor("comment");
422+ if(commentColor.equals(Color.RED)){
423+ rdbtnRed_4.setSelected(true);
424+ } else if(commentColor.equals(Color.BLUE)){
425+ rdbtnBlue_4.setSelected(true);
426+ } else if(commentColor.equals(Color.YELLOW)){
427+ rdbtnYellow_4.setSelected(true);
428+ } else if(commentColor.equals(Color.GREEN)){
429+ rdbtnGreen_4.setSelected(true);
430+ } else if(commentColor.equals(Color.GRAY)){
431+ rdbtnGray_4.setSelected(true);
432+ } else {
433+ rdbtnRed_4.setSelected(true);
434+ }
435+ this.textField_4.setText(Preference.getInstance().getCommentWidth());
436+
12437 }
13438
439+ public String getGTColor(String gtTag) {
440+ switch(gtTag){
441+ case "reference":
442+ if(this.rdbtnRed.isSelected()){
443+ return "red";
444+ } else if(this.rdbtnBlue.isSelected()){
445+ return "blue";
446+ } else if(this.rdbtnYellow.isSelected()){
447+ return "yellow";
448+ } else if(this.rdbtnGreen.isSelected()){
449+ return "green";
450+ } else if(this.rdbtnGray.isSelected()){
451+ return "gray";
452+ } else {
453+ return "red";
454+ }
455+ case "dubious":
456+ if(this.rdbtnRed_3.isSelected()){
457+ return "red";
458+ } else if(this.rdbtnBlue_3.isSelected()){
459+ return "blue";
460+ } else if(this.rdbtnYellow_3.isSelected()){
461+ return "yellow";
462+ } else if(this.rdbtnGreen_3.isSelected()){
463+ return "green";
464+ } else if(this.rdbtnGray_3.isSelected()){
465+ return "gray";
466+ } else {
467+ return "red";
468+ }
469+ case "addition":
470+ if(this.rdbtnRed_2.isSelected()){
471+ return "red";
472+ } else if(this.rdbtnBlue_2.isSelected()){
473+ return "blue";
474+ } else if(this.rdbtnYellow_2.isSelected()){
475+ return "yellow";
476+ } else if(this.rdbtnGreen_2.isSelected()){
477+ return "green";
478+ } else if(this.rdbtnGray_2.isSelected()){
479+ return "gray";
480+ } else {
481+ return "red";
482+ }
483+ case "deletion":
484+ if(this.rdbtnRed_3.isSelected()){
485+ return "red";
486+ } else if(this.rdbtnBlue_3.isSelected()){
487+ return "blue";
488+ } else if(this.rdbtnYellow_3.isSelected()){
489+ return "yellow";
490+ } else if(this.rdbtnGreen_3.isSelected()){
491+ return "green";
492+ } else if(this.rdbtnGray_3.isSelected()){
493+ return "gray";
494+ } else {
495+ return "red";
496+ }
497+ case "comment":
498+ if(this.rdbtnRed_4.isSelected()){
499+ return "red";
500+ } else if(this.rdbtnBlue_4.isSelected()){
501+ return "blue";
502+ } else if(this.rdbtnYellow_4.isSelected()){
503+ return "yellow";
504+ } else if(this.rdbtnGreen_4.isSelected()){
505+ return "green";
506+ } else if(this.rdbtnGray_4.isSelected()){
507+ return "gray";
508+ } else {
509+ return "red";
510+ }
511+ }
512+ return null;
513+ }
514+
515+ public String getGTWidth(String string) {
516+ String width;
517+ int i;
518+ switch(string){
519+ case "reference":
520+ width = this.textField.getText();
521+ try {
522+ i = Integer.parseInt(width);
523+ } catch (NumberFormatException e) {
524+ this.textField.setText("1");
525+ return "1";
526+ }
527+ if(i>5){
528+ this.textField.setText("5");
529+ return "5";
530+ }
531+ return width;
532+ case "dubious":
533+ width = this.textField_1.getText();
534+ try {
535+ i = Integer.parseInt(width);
536+ } catch (NumberFormatException e) {
537+ this.textField_1.setText("1");
538+ return "1";
539+ }
540+ if(i>5){
541+ this.textField_1.setText("5");
542+ return "5";
543+ }
544+ return width;
545+ case "addition":
546+ width = this.textField_2.getText();
547+ try {
548+ i = Integer.parseInt(width);
549+ } catch (NumberFormatException e) {
550+ this.textField_2.setText("1");
551+ return "1";
552+ }
553+ if(i>5){
554+ this.textField_2.setText("5");
555+ return "5";
556+ }
557+ return width;
558+ case "deletion":
559+ width = this.textField_3.getText();
560+ try {
561+ i = Integer.parseInt(width);
562+ } catch (NumberFormatException e) {
563+ this.textField_3.setText("1");
564+ return "1";
565+ }
566+ if(i>5){
567+ this.textField_3.setText("5");
568+ return "5";
569+ }
570+ return width;
571+ case "comment":
572+ width = this.textField_4.getText();
573+ try {
574+ i = Integer.parseInt(width);
575+ } catch (NumberFormatException e) {
576+ this.textField_4.setText("1");
577+ return "1";
578+ }
579+ if(i>5){
580+ this.textField_4.setText("5");
581+ return "5";
582+ }
583+ return width;
584+ }
585+ return null;
586+ }
587+
14588 }
旧リポジトリブラウザで表示