作業部屋の使い方を試しています。
(empty log message)
| @@ -254,6 +254,11 @@ | ||
| 254 | 254 | private void jBtnRowInsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnRowInsActionPerformed |
| 255 | 255 | int SelectedRow = jTable1.getSelectedRow(); |
| 256 | 256 | SearchData sdat = new SearchData(); |
| 257 | + sdat.setitem(""); | |
| 258 | + sdat.setHtmlid(""); | |
| 259 | + sdat.setHtmlclass(""); | |
| 260 | + sdat.setaround(""); | |
| 261 | + sdat.setregexp(""); | |
| 257 | 262 | |
| 258 | 263 | if(SelectedRow >= 0) { |
| 259 | 264 | this.serachDataList.add(SelectedRow, sdat); |
| @@ -28,7 +28,7 @@ | ||
| 28 | 28 | import javax.swing.text.html.HTML; |
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | - * | |
| 31 | + * HTMLタグの属性情報を保持する. | |
| 32 | 32 | * @author kgto |
| 33 | 33 | */ |
| 34 | 34 | public class AttributeData { |
| @@ -38,6 +38,11 @@ | ||
| 38 | 38 | size = 0; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | + /** | |
| 42 | + * 属性情報追加. | |
| 43 | + * @param tag | |
| 44 | + * @param attr | |
| 45 | + */ | |
| 41 | 46 | public void add(HTML.Tag tag, MutableAttributeSet attr) { |
| 42 | 47 | |
| 43 | 48 | int tagcount = tagcnt(tag); |
| @@ -59,6 +64,13 @@ | ||
| 59 | 64 | |
| 60 | 65 | } |
| 61 | 66 | |
| 67 | + /** | |
| 68 | + * 属性情報検索. | |
| 69 | + * @param tag | |
| 70 | + * @param attrname | |
| 71 | + * @param attrvalue | |
| 72 | + * @return | |
| 73 | + */ | |
| 62 | 74 | public boolean search(HTML.Tag tag, String attrname, String attrvalue) { |
| 63 | 75 | boolean ret = false; |
| 64 | 76 | for (Object AttrList1 : AttrList) { |
| @@ -146,6 +158,6 @@ | ||
| 146 | 158 | public String attrvalue; |
| 147 | 159 | } |
| 148 | 160 | public ArrayList AttrList; |
| 149 | - public int size; // AttrListのサイズ | |
| 161 | + public int size; // AttrListのサイズ | |
| 150 | 162 | |
| 151 | 163 | } |
| @@ -80,17 +80,43 @@ | ||
| 80 | 80 | serchpageData(skey); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - // 検索位置を数値変換 | |
| 84 | - String around = skey.getaround(); | |
| 85 | - byte bAround = 0; | |
| 86 | - if(around.length() > 0) { | |
| 87 | - bAround = Byte.parseByte(around); | |
| 88 | - } | |
| 83 | +// // 検索位置を数値変換 | |
| 84 | +// String around = skey.getaround(); | |
| 85 | +// byte bAround = 0; | |
| 86 | +// if(around.length() > 0) { | |
| 87 | +// bAround = Byte.parseByte(around); | |
| 88 | +// } | |
| 89 | +// | |
| 90 | +// if(bAround < sData.size()) { | |
| 91 | +// String str = (String)sData.get(bAround); | |
| 92 | +// String rtn = RegularExpression(str, regexp); | |
| 93 | +// return item + "\t" + rtn; | |
| 94 | +// } | |
| 89 | 95 | |
| 90 | - if(bAround < sData.size()) { | |
| 91 | - String str = (String)sData.get(bAround); | |
| 92 | - String rtn = RegularExpression(str, regexp); | |
| 93 | - return item + "\t" + rtn; | |
| 96 | + /* | |
| 97 | + around 出現位置指定 入力有り:指定された位置の情報のみ返す。 | |
| 98 | + 入力無し:取得した全ての情報を返す。 | |
| 99 | + */ | |
| 100 | + String wkaround = skey.getaround(); | |
| 101 | + if(wkaround.length() > 0) { | |
| 102 | + byte wbAround = 0; | |
| 103 | + wbAround = Byte.parseByte(wkaround); // 検索位置を数値変換 | |
| 104 | + if(wbAround < sData.size()) { | |
| 105 | + String str = (String)sData.get(wbAround); | |
| 106 | + String rtn = RegularExpression(str, regexp); | |
| 107 | + return item + "\t" + rtn; | |
| 108 | + } | |
| 109 | + } else { | |
| 110 | + StringBuilder strbuf = new StringBuilder(); | |
| 111 | + for (Object sData1 : sData) { | |
| 112 | + String str = (String)sData1; | |
| 113 | + String rtn = RegularExpression(str, regexp); | |
| 114 | + if(strbuf.length() > 0) { | |
| 115 | + strbuf.append("\t"); | |
| 116 | + } | |
| 117 | + strbuf.append(rtn); | |
| 118 | + } | |
| 119 | + return item + "\t" + strbuf; | |
| 94 | 120 | } |
| 95 | 121 | return null; |
| 96 | 122 | } |