• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

テキストの各行をキーと値に分離し、複数テキストファイルを読み込み、キーを突き合わせ照合し、その結果を表示するGUIユーテリティです。


コミットメタ情報

リビジョン913f2b1ea4931337db081ebf515f62cd365693cb (tree)
日時2011-10-24 02:27:18
作者seraphy <seraphy@192....>
コミッターseraphy

ログメッセージ

・カラム削除の実装中

変更サマリ

差分

--- a/src/textkeymatcher/ui/TextKeyMatcherView.form
+++ b/src/textkeymatcher/ui/TextKeyMatcherView.form
@@ -133,6 +133,9 @@
133133 </MenuItem>
134134 <MenuItem class="javax.swing.JMenuItem" name="removeMenuItem">
135135 <Properties>
136+ <Property name="action" type="javax.swing.Action" editor="org.netbeans.modules.swingapp.ActionEditor">
137+ <action class="textkeymatcher.ui.TextKeyMatcherView" id="onRemoveColumn" methodName="onRemoveColumn"/>
138+ </Property>
136139 <Property name="mnemonic" type="int" value="82"/>
137140 <Property name="text" type="java.lang.String" resourceKey="removeMenuItem.text"/>
138141 <Property name="name" type="java.lang.String" value="removeMenuItem" noResource="true"/>
@@ -428,6 +431,46 @@
428431 <AuxValue name="JavaCodeGenerator_InitCodePre" type="java.lang.String" value="displayModeBinder.bindDataViewTableModel(dataViewTableModel);"/>
429432 </AuxValues>
430433 </Component>
434+ <Container class="javax.swing.JPanel" name="confirmRemoveColumnPanel">
435+ <Properties>
436+ <Property name="name" type="java.lang.String" value="confirmRemoveColumnPanel" noResource="true"/>
437+ </Properties>
438+
439+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
440+ <SubComponents>
441+ <Component class="javax.swing.JLabel" name="removeColumnLabel">
442+ <Properties>
443+ <Property name="horizontalAlignment" type="int" value="0"/>
444+ <Property name="text" type="java.lang.String" resourceKey="removeColumnLabel.text"/>
445+ <Property name="horizontalTextPosition" type="int" value="0"/>
446+ <Property name="name" type="java.lang.String" value="removeColumnLabel" noResource="true"/>
447+ </Properties>
448+ <Constraints>
449+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
450+ <BorderConstraints direction="North"/>
451+ </Constraint>
452+ </Constraints>
453+ </Component>
454+ <Component class="javax.swing.JComboBox" name="removeColumnComboBox">
455+ <Properties>
456+ <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
457+ <StringArray count="4">
458+ <StringItem index="0" value="Item 1"/>
459+ <StringItem index="1" value="Item 2"/>
460+ <StringItem index="2" value="Item 3"/>
461+ <StringItem index="3" value="Item 4"/>
462+ </StringArray>
463+ </Property>
464+ <Property name="name" type="java.lang.String" value="removeColumnComboBox" noResource="true"/>
465+ </Properties>
466+ <Constraints>
467+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
468+ <BorderConstraints direction="Center"/>
469+ </Constraint>
470+ </Constraints>
471+ </Component>
472+ </SubComponents>
473+ </Container>
431474 </NonVisualComponents>
432475 <Properties>
433476 <Property name="component" type="javax.swing.JComponent" editor="org.netbeans.modules.form.ComponentChooserEditor">
--- a/src/textkeymatcher/ui/TextKeyMatcherView.java
+++ b/src/textkeymatcher/ui/TextKeyMatcherView.java
@@ -22,8 +22,10 @@ import java.awt.event.ActionListener;
2222 import java.awt.event.InputEvent;
2323 import java.awt.event.KeyEvent;
2424 import java.io.File;
25+import java.util.ArrayList;
2526 import java.util.logging.Level;
2627 import java.util.logging.Logger;
28+import javax.swing.DefaultComboBoxModel;
2729 import javax.swing.Timer;
2830 import javax.swing.Icon;
2931 import javax.swing.InputMap;
@@ -39,6 +41,7 @@ import javax.swing.table.DefaultTableCellRenderer;
3941 import org.jdesktop.application.Application;
4042 import textkeymatcher.TextKeyMatcherApp;
4143 import textkeymatcher.entity.FilteredRowMap;
44+import textkeymatcher.entity.LineDataList;
4245 import textkeymatcher.io.DocArchive;
4346 import textkeymatcher.io.FileDocArchive;
4447 import textkeymatcher.service.LineDataBuilder;
@@ -341,6 +344,9 @@ public class TextKeyMatcherView extends FrameView implements ExitListener {
341344 dataViewTableModel = new textkeymatcher.ui.model.DataViewTableModel();
342345 keyMatcherBinder = new textkeymatcher.ui.model.KeyMatcherBinder();
343346 displayModeBinder = new textkeymatcher.ui.model.DisplayModeBinder();
347+ confirmRemoveColumnPanel = new javax.swing.JPanel();
348+ removeColumnLabel = new javax.swing.JLabel();
349+ removeColumnComboBox = new javax.swing.JComboBox();
344350
345351 mainPanel.setName("mainPanel"); // NOI18N
346352
@@ -407,6 +413,7 @@ public class TextKeyMatcherView extends FrameView implements ExitListener {
407413 jSeparator2.setName("jSeparator2"); // NOI18N
408414 dataMenu.add(jSeparator2);
409415
416+ removeMenuItem.setAction(actionMap.get("onRemoveColumn")); // NOI18N
410417 removeMenuItem.setMnemonic('R');
411418 removeMenuItem.setText(resourceMap.getString("removeMenuItem.text")); // NOI18N
412419 removeMenuItem.setName("removeMenuItem"); // NOI18N
@@ -596,6 +603,19 @@ public class TextKeyMatcherView extends FrameView implements ExitListener {
596603
597604 displayModeBinder.bindDataViewTableModel(dataViewTableModel);
598605
606+ confirmRemoveColumnPanel.setName("confirmRemoveColumnPanel"); // NOI18N
607+ confirmRemoveColumnPanel.setLayout(new java.awt.BorderLayout());
608+
609+ removeColumnLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
610+ removeColumnLabel.setText(resourceMap.getString("removeColumnLabel.text")); // NOI18N
611+ removeColumnLabel.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
612+ removeColumnLabel.setName("removeColumnLabel"); // NOI18N
613+ confirmRemoveColumnPanel.add(removeColumnLabel, java.awt.BorderLayout.NORTH);
614+
615+ removeColumnComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
616+ removeColumnComboBox.setName("removeColumnComboBox"); // NOI18N
617+ confirmRemoveColumnPanel.add(removeColumnComboBox, java.awt.BorderLayout.CENTER);
618+
599619 setComponent(mainPanel);
600620 setMenuBar(menuBar);
601621 setStatusBar(statusPanel);
@@ -715,6 +735,7 @@ public class TextKeyMatcherView extends FrameView implements ExitListener {
715735 dataViewTableModel.addLineDataList(collector);
716736 checkEnableSave();
717737 checkEnableNew();
738+ checkEnableRemoveColumn();
718739 statusMessageLabel.setText("done.");
719740 }
720741 }
@@ -780,6 +801,7 @@ public class TextKeyMatcherView extends FrameView implements ExitListener {
780801
781802 checkEnableSave();
782803 checkEnableNew();
804+ checkEnableRemoveColumn();
783805
784806 statusMessageLabel.setText("initialized.");
785807 }
@@ -823,6 +845,7 @@ public class TextKeyMatcherView extends FrameView implements ExitListener {
823845
824846 checkEnableSave();
825847 checkEnableNew();
848+ checkEnableRemoveColumn();
826849 }
827850
828851
@@ -851,17 +874,61 @@ public class TextKeyMatcherView extends FrameView implements ExitListener {
851874 }
852875 }
853876
877+ /**
878+ * カラムの削除アクション
879+ */
880+ @Action(enabledProperty = "enableRemoveColumn")
881+ public void onRemoveColumn() {
882+ int mx = dataViewTableModel.getNumOfLineDataLists();
883+ if (mx <= 1) {
884+ return;
885+ }
886+
887+ // カラム一覧を作成する.
888+ ArrayList<Object> items = new ArrayList<Object>();
889+ for (int idx = 0; idx < mx; idx++) {
890+ final LineDataList lineDataList = dataViewTableModel.getLineDataList(idx);
891+ Object item = new Object() {
892+ @Override
893+ public String toString() {
894+ return lineDataList.getTitle();
895+ }
896+ };
897+ items.add(item);
898+ }
899+
900+ DefaultComboBoxModel comboboxModel = new DefaultComboBoxModel(
901+ items.toArray(new Object[items.size()]));
902+
903+ removeColumnComboBox.setModel(comboboxModel);
904+
905+ JOptionPane optionPane = new JOptionPane();
906+
907+// .showConfirmDialog(
908+// getFrame(),
909+// confirmRemoveColumnPanel,
910+// "CONFIRM",
911+// JOptionPane.YES_NO_OPTION,
912+// JOptionPane.QUESTION_MESSAGE
913+// );
914+ }
854915
855916 private void checkEnableSave() {
856- boolean hasDataSource = dataViewTableModel.getDataListCount() > 0;
917+ boolean hasDataSource = dataViewTableModel.getNumOfLineDataLists() > 0;
857918 setEnableSave(hasDataSource);
858919 }
859920
860921 private void checkEnableNew() {
861- boolean hasDataSource = dataViewTableModel.getDataListCount() > 0;
922+ boolean hasDataSource = dataViewTableModel.getNumOfLineDataLists() > 0;
862923 setEnableNew(hasDataSource);
863924 }
864925
926+ private void checkEnableRemoveColumn() {
927+ // key/valueはペアであるため、最低1列は残す必要があるため、2以上の場合のみ削除可能.
928+ boolean hasDataSource = dataViewTableModel.getNumOfLineDataLists() > 1;
929+ setEnableRemoveColumn(hasDataSource);
930+ }
931+
865932 private boolean enableSave = false;
866933 public boolean isEnableSave() {
867934 return enableSave;
@@ -884,8 +951,20 @@ public class TextKeyMatcherView extends FrameView implements ExitListener {
884951 firePropertyChange("enableNew", old, isEnableNew());
885952 }
886953
954+ private boolean enableRemoveColumn = false;
955+ public boolean isEnableRemoveColumn() {
956+ return enableRemoveColumn;
957+ }
958+
959+ public void setEnableRemoveColumn(boolean b) {
960+ boolean old = isEnableRemoveColumn();
961+ this.enableRemoveColumn = b;
962+ firePropertyChange("enableRemoveColumn", old, isEnableRemoveColumn());
963+ }
964+
887965 // Variables declaration - do not modify//GEN-BEGIN:variables
888966 private javax.swing.JRadioButtonMenuItem allRadioButtonMenuItem;
967+ private javax.swing.JPanel confirmRemoveColumnPanel;
889968 private javax.swing.JMenu dataMenu;
890969 private javax.swing.JTable dataViewTable;
891970 private textkeymatcher.ui.model.DataViewTableModel dataViewTableModel;
@@ -910,6 +989,8 @@ public class TextKeyMatcherView extends FrameView implements ExitListener {
910989 private javax.swing.JRadioButtonMenuItem numberRadioButtonMenuItem;
911990 private javax.swing.JMenuItem openMenuItem;
912991 private javax.swing.JProgressBar progressBar;
992+ private javax.swing.JComboBox removeColumnComboBox;
993+ private javax.swing.JLabel removeColumnLabel;
913994 private javax.swing.JMenuItem removeMenuItem;
914995 private javax.swing.JMenuItem saveMenuItem;
915996 private javax.swing.JLabel statusAnimationLabel;
--- a/src/textkeymatcher/ui/model/DataViewTableModel.java
+++ b/src/textkeymatcher/ui/model/DataViewTableModel.java
@@ -140,10 +140,31 @@ public class DataViewTableModel extends KeyMatchedRowView implements TextKeyMatc
140140 }
141141
142142 /**
143+ * 指定したインデックスのデータソースを取得する.
144+ * @param index インデックス
145+ * @return データソース
146+ */
147+ public LineDataList getLineDataList(int index) {
148+ return rowMap.getLineDataList(index);
149+ }
150+
151+ /**
152+ * 指定したインデックスのデータソースを削除する.
153+ * @param index インデックス
154+ */
155+ public void removeLineDataList(int index) {
156+ rowMap.removeLineDataList(index);
157+ rowMap.remap();
158+
159+ renumbering(rowMap);
160+ setDirty(true);
161+ }
162+
163+ /**
143164 * 保持しているデータソースの数を返す
144165 * @return データソースの数
145166 */
146- public int getDataListCount() {
167+ public int getNumOfLineDataLists() {
147168 return rowMap.getNumOfLineDataLists();
148169 }
149170
--- a/src/textkeymatcher/ui/resources/TextKeyMatcherView.properties
+++ b/src/textkeymatcher/ui/resources/TextKeyMatcherView.properties
@@ -69,3 +69,6 @@ uniqueRadioButtonMenuItem.text=Unique
6969 ununiqueRadioButtonMenuItem.text=Ununique
7070 jRadioButtonMenuItem1.text=Unique (Strict)
7171 jRadioButtonMenuItem2.text=Ununique (Strict)
72+onRemoveColumn.Action.text=
73+onRemoveColumn.Action.shortDescription=
74+removeColumnLabel.text=Choose the Remove Column