カルネージハートエクサのチームデータ編集ツール JAVAベース
テキストファイル出力機能を追加
| @@ -609,4 +609,34 @@ | ||
| 609 | 609 | retstr += (data_name == null) ? "" : data_name.getName(); |
| 610 | 610 | return retstr; |
| 611 | 611 | } |
| 612 | + | |
| 613 | + /** | |
| 614 | + * ファイル出力用テキスト作成 | |
| 615 | + * | |
| 616 | + * @param dname 出力に付加するデータ名(nullの時は読み込み元ファイル名) | |
| 617 | + * @return 作成した文字列 | |
| 618 | + */ | |
| 619 | + public String make_text(String dname) { | |
| 620 | + String retstr; | |
| 621 | + int i; | |
| 622 | + retstr = (dname != null) ? dname : data_name.getName(); | |
| 623 | + retstr += '\t'; | |
| 624 | + retstr += team_name; | |
| 625 | + retstr += '\t'; | |
| 626 | + retstr += '(' + owner_name + ')'; | |
| 627 | + for (i = 0; i < 3; i++) { | |
| 628 | + retstr += '\t'; | |
| 629 | + if (oke[i] != null) { | |
| 630 | + retstr += oke[i].get_name(); | |
| 631 | + retstr += '\t'; | |
| 632 | + retstr += '[' + oke[i].get_bodyname() + ']'; | |
| 633 | + retstr += '\t'; | |
| 634 | + retstr += member_pos(i); | |
| 635 | + } else { | |
| 636 | + retstr += '\t'; | |
| 637 | + retstr += '\t'; | |
| 638 | + } | |
| 639 | + } | |
| 640 | + return retstr; | |
| 641 | + } | |
| 612 | 642 | } |
| @@ -7,6 +7,12 @@ | ||
| 7 | 7 | |
| 8 | 8 | import java.awt.Frame; |
| 9 | 9 | import java.io.File; |
| 10 | +import java.io.FileOutputStream; | |
| 11 | +import java.io.IOException; | |
| 12 | +import java.io.OutputStreamWriter; | |
| 13 | +import java.io.PrintWriter; | |
| 14 | +import java.util.logging.Level; | |
| 15 | +import java.util.logging.Logger; | |
| 10 | 16 | import javax.swing.DefaultListModel; |
| 11 | 17 | import javax.swing.JFileChooser; |
| 12 | 18 | import javax.swing.JFrame; |
| @@ -104,9 +110,10 @@ | ||
| 104 | 110 | pos8 = new javax.swing.JLabel(); |
| 105 | 111 | loadCHE = new javax.swing.JButton(); |
| 106 | 112 | clearCHE = new javax.swing.JButton(); |
| 107 | - exitGUI = new javax.swing.JButton(); | |
| 108 | 113 | teamIcon = new javax.swing.JLabel(); |
| 114 | + textOutTeam = new javax.swing.JButton(); | |
| 109 | 115 | removeCHE = new javax.swing.JButton(); |
| 116 | + exitGUI = new javax.swing.JButton(); | |
| 110 | 117 | |
| 111 | 118 | teamList.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N |
| 112 | 119 | teamList.setModel(teamdata); |
| @@ -222,14 +229,6 @@ | ||
| 222 | 229 | } |
| 223 | 230 | }); |
| 224 | 231 | |
| 225 | - exitGUI.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 226 | - exitGUI.setText(bundle.getString("exitAPP")); // NOI18N | |
| 227 | - exitGUI.addActionListener(new java.awt.event.ActionListener() { | |
| 228 | - public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 229 | - exitGUIActionPerformed(evt); | |
| 230 | - } | |
| 231 | - }); | |
| 232 | - | |
| 233 | 232 | teamIcon.setBackground(java.awt.Color.white); |
| 234 | 233 | teamIcon.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); |
| 235 | 234 | teamIcon.setMaximumSize(new java.awt.Dimension(34, 34)); |
| @@ -236,6 +235,14 @@ | ||
| 236 | 235 | teamIcon.setMinimumSize(new java.awt.Dimension(34, 34)); |
| 237 | 236 | teamIcon.setPreferredSize(new java.awt.Dimension(34, 34)); |
| 238 | 237 | |
| 238 | + textOutTeam.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 239 | + textOutTeam.setText(bundle.getString("textOut")); // NOI18N | |
| 240 | + textOutTeam.addActionListener(new java.awt.event.ActionListener() { | |
| 241 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 242 | + textOutTeamActionPerformed(evt); | |
| 243 | + } | |
| 244 | + }); | |
| 245 | + | |
| 239 | 246 | removeCHE.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N |
| 240 | 247 | removeCHE.setText(bundle.getString("removeCHE")); // NOI18N |
| 241 | 248 | removeCHE.addActionListener(new java.awt.event.ActionListener() { |
| @@ -244,6 +251,14 @@ | ||
| 244 | 251 | } |
| 245 | 252 | }); |
| 246 | 253 | |
| 254 | + exitGUI.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 255 | + exitGUI.setText(bundle.getString("exitAPP")); // NOI18N | |
| 256 | + exitGUI.addActionListener(new java.awt.event.ActionListener() { | |
| 257 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 258 | + exitGUIActionPerformed(evt); | |
| 259 | + } | |
| 260 | + }); | |
| 261 | + | |
| 247 | 262 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); |
| 248 | 263 | this.setLayout(layout); |
| 249 | 264 | layout.setHorizontalGroup( |
| @@ -251,25 +266,24 @@ | ||
| 251 | 266 | .addGroup(layout.createSequentialGroup() |
| 252 | 267 | .addContainerGap() |
| 253 | 268 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
| 269 | + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 416, Short.MAX_VALUE) | |
| 254 | 270 | .addGroup(layout.createSequentialGroup() |
| 255 | - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 416, Short.MAX_VALUE) | |
| 256 | - .addContainerGap()) | |
| 257 | - .addGroup(layout.createSequentialGroup() | |
| 258 | 271 | .addComponent(loadCHE) |
| 259 | 272 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
| 260 | 273 | .addComponent(removeCHE) |
| 261 | - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 146, Short.MAX_VALUE) | |
| 274 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
| 275 | + .addComponent(textOutTeam) | |
| 276 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | |
| 262 | 277 | .addComponent(clearCHE) |
| 263 | - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 264 | - .addComponent(exitGUI) | |
| 265 | - .addGap(70, 70, 70)) | |
| 278 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | |
| 279 | + .addComponent(exitGUI)) | |
| 266 | 280 | .addGroup(layout.createSequentialGroup() |
| 267 | 281 | .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 357, Short.MAX_VALUE) |
| 268 | 282 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
| 269 | 283 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
| 270 | 284 | .addComponent(teamIcon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) |
| 271 | - .addComponent(positionPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) | |
| 272 | - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) | |
| 285 | + .addComponent(positionPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))) | |
| 286 | + .addContainerGap()) | |
| 273 | 287 | ); |
| 274 | 288 | layout.setVerticalGroup( |
| 275 | 289 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
| @@ -285,9 +299,11 @@ | ||
| 285 | 299 | .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)) |
| 286 | 300 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
| 287 | 301 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
| 288 | - .addComponent(clearCHE, javax.swing.GroupLayout.Alignment.TRAILING) | |
| 289 | - .addComponent(exitGUI, javax.swing.GroupLayout.Alignment.TRAILING) | |
| 290 | 302 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) |
| 303 | + .addComponent(clearCHE) | |
| 304 | + .addComponent(exitGUI) | |
| 305 | + .addComponent(textOutTeam)) | |
| 306 | + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |
| 291 | 307 | .addComponent(loadCHE) |
| 292 | 308 | .addComponent(removeCHE))) |
| 293 | 309 | .addContainerGap()) |
| @@ -389,6 +405,52 @@ | ||
| 389 | 405 | } |
| 390 | 406 | }//GEN-LAST:event_removeCHEActionPerformed |
| 391 | 407 | |
| 408 | + private void textOutTeamActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textOutTeamActionPerformed | |
| 409 | + int i; | |
| 410 | + JFileChooser fdlg = new JFileChooser(Main.cheTextDataDir); | |
| 411 | + String filterTitle | |
| 412 | + = java.util.ResourceBundle.getBundle("chexaformation/resource"). | |
| 413 | + getString("filterTitleText"); | |
| 414 | + FileNameExtensionFilter ffilter | |
| 415 | + = new FileNameExtensionFilter(filterTitle, "txt"); | |
| 416 | + fdlg.setFileFilter(ffilter); | |
| 417 | + if (fdlg.showSaveDialog(getRootPane().getParent()) | |
| 418 | + == JFileChooser.APPROVE_OPTION) { | |
| 419 | + File ifile = fdlg.getSelectedFile(); | |
| 420 | + if (ifile.exists() == true) { | |
| 421 | + String wktitle; | |
| 422 | + String wkmesg; | |
| 423 | + wktitle = java.util.ResourceBundle.getBundle( | |
| 424 | + "chexaformation/resource"). | |
| 425 | + getString("titleSaveText"); | |
| 426 | + wkmesg = java.util.ResourceBundle.getBundle( | |
| 427 | + "chexaformation/resource"). | |
| 428 | + getString("confirmExistText"); | |
| 429 | + if (Main.confirm_box((Frame) (getRootPane().getParent()), | |
| 430 | + wktitle, wkmesg, "") == false) { | |
| 431 | + return; | |
| 432 | + } | |
| 433 | + } | |
| 434 | + try { | |
| 435 | + PrintWriter w = new PrintWriter( | |
| 436 | + new OutputStreamWriter( | |
| 437 | + new FileOutputStream(ifile.getAbsolutePath()), | |
| 438 | + "UTF-8")); | |
| 439 | + Main.cheTextDataDir = ifile.getParent(); | |
| 440 | + for (i = 0; i < teamdata.size(); i++) { | |
| 441 | + cheTeamData team = (cheTeamData) teamdata.get(i); | |
| 442 | + if (team != null) { | |
| 443 | + w.println(team.make_text(null)); | |
| 444 | + } | |
| 445 | + } | |
| 446 | + w.close(); | |
| 447 | + } catch (IOException ex) { | |
| 448 | + Logger.getLogger(MatchDataPanel.class.getName()). | |
| 449 | + log(Level.SEVERE, null, ex); | |
| 450 | + } | |
| 451 | + } | |
| 452 | + }//GEN-LAST:event_textOutTeamActionPerformed | |
| 453 | + | |
| 392 | 454 | // Variables declaration - do not modify//GEN-BEGIN:variables |
| 393 | 455 | private javax.swing.JButton clearCHE; |
| 394 | 456 | private javax.swing.JButton exitGUI; |
| @@ -409,5 +471,6 @@ | ||
| 409 | 471 | private javax.swing.JButton removeCHE; |
| 410 | 472 | private javax.swing.JLabel teamIcon; |
| 411 | 473 | private javax.swing.JList teamList; |
| 474 | + private javax.swing.JButton textOutTeam; | |
| 412 | 475 | // End of variables declaration//GEN-END:variables |
| 413 | 476 | } |
| @@ -7,6 +7,12 @@ | ||
| 7 | 7 | |
| 8 | 8 | import java.awt.Dialog; |
| 9 | 9 | import java.io.File; |
| 10 | +import java.io.FileOutputStream; | |
| 11 | +import java.io.IOException; | |
| 12 | +import java.io.OutputStreamWriter; | |
| 13 | +import java.io.PrintWriter; | |
| 14 | +import java.util.logging.Level; | |
| 15 | +import java.util.logging.Logger; | |
| 10 | 16 | import javax.swing.DefaultListModel; |
| 11 | 17 | import javax.swing.JDialog; |
| 12 | 18 | import javax.swing.JFileChooser; |
| @@ -190,6 +196,7 @@ | ||
| 190 | 196 | addTeam = new javax.swing.JButton(); |
| 191 | 197 | delTeam = new javax.swing.JButton(); |
| 192 | 198 | saveMatch = new javax.swing.JButton(); |
| 199 | + outTextTeam = new javax.swing.JButton(); | |
| 193 | 200 | closeButton = new javax.swing.JButton(); |
| 194 | 201 | |
| 195 | 202 | titleMatch.setFont(new java.awt.Font("Monospaced", 0, 15)); // NOI18N |
| @@ -231,6 +238,14 @@ | ||
| 231 | 238 | } |
| 232 | 239 | }); |
| 233 | 240 | |
| 241 | + outTextTeam.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 242 | + outTextTeam.setText(bundle.getString("textOut")); // NOI18N | |
| 243 | + outTextTeam.addActionListener(new java.awt.event.ActionListener() { | |
| 244 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 245 | + outTextTeamActionPerformed(evt); | |
| 246 | + } | |
| 247 | + }); | |
| 248 | + | |
| 234 | 249 | closeButton.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N |
| 235 | 250 | closeButton.setText(bundle.getString("closeWindow")); // NOI18N |
| 236 | 251 | closeButton.addActionListener(new java.awt.event.ActionListener() { |
| @@ -253,7 +268,9 @@ | ||
| 253 | 268 | .addComponent(delTeam) |
| 254 | 269 | .addGap(18, 18, 18) |
| 255 | 270 | .addComponent(saveMatch) |
| 256 | - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 149, Short.MAX_VALUE) | |
| 271 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 93, Short.MAX_VALUE) | |
| 272 | + .addComponent(outTextTeam) | |
| 273 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 257 | 274 | .addComponent(closeButton)) |
| 258 | 275 | .addGroup(layout.createSequentialGroup() |
| 259 | 276 | .addComponent(titleMatch) |
| @@ -275,8 +292,9 @@ | ||
| 275 | 292 | .addComponent(addTeam) |
| 276 | 293 | .addComponent(delTeam) |
| 277 | 294 | .addComponent(saveMatch) |
| 278 | - .addComponent(closeButton)) | |
| 279 | - .addContainerGap(14, Short.MAX_VALUE)) | |
| 295 | + .addComponent(closeButton) | |
| 296 | + .addComponent(outTextTeam)) | |
| 297 | + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) | |
| 280 | 298 | ); |
| 281 | 299 | }// </editor-fold>//GEN-END:initComponents |
| 282 | 300 |
| @@ -356,6 +374,55 @@ | ||
| 356 | 374 | JDialog dlg = (JDialog) (getRootPane().getParent()); |
| 357 | 375 | dlg.dispose(); |
| 358 | 376 | }//GEN-LAST:event_closeButtonActionPerformed |
| 377 | + | |
| 378 | + private void outTextTeamActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_outTextTeamActionPerformed | |
| 379 | + int i; | |
| 380 | + JFileChooser fdlg = new JFileChooser(Main.cheTextDataDir); | |
| 381 | + String filterTitle | |
| 382 | + = java.util.ResourceBundle.getBundle("chexaformation/resource"). | |
| 383 | + getString("filterTitleText"); | |
| 384 | + FileNameExtensionFilter ffilter | |
| 385 | + = new FileNameExtensionFilter(filterTitle, "txt"); | |
| 386 | + fdlg.setFileFilter(ffilter); | |
| 387 | + if (fdlg.showSaveDialog(getRootPane().getParent()) | |
| 388 | + == JFileChooser.APPROVE_OPTION) { | |
| 389 | + File ifile = fdlg.getSelectedFile(); | |
| 390 | + if (ifile.exists() == true) { | |
| 391 | + String wktitle; | |
| 392 | + String wkmesg; | |
| 393 | + wktitle = java.util.ResourceBundle.getBundle( | |
| 394 | + "chexaformation/resource"). | |
| 395 | + getString("titleSaveText"); | |
| 396 | + wkmesg = java.util.ResourceBundle.getBundle( | |
| 397 | + "chexaformation/resource"). | |
| 398 | + getString("confirmExistText"); | |
| 399 | + if (Main.confirm_box((Dialog) (getRootPane().getParent()), | |
| 400 | + wktitle, wkmesg, "") == false) { | |
| 401 | + return; | |
| 402 | + } | |
| 403 | + } | |
| 404 | + try { | |
| 405 | + PrintWriter w = new PrintWriter( | |
| 406 | + new OutputStreamWriter( | |
| 407 | + new FileOutputStream(ifile.getAbsolutePath()), | |
| 408 | + "UTF-8")); | |
| 409 | + Main.cheTextDataDir = ifile.getParent(); | |
| 410 | + normalize_teamlist(); | |
| 411 | + for (i = 0; i < matchdata.get_team_max(); i++) { | |
| 412 | + cheTeamData team = matchdata.get_team(i); | |
| 413 | + if (team != null) { | |
| 414 | + File wkfile = new File(matchdata.get_fname()); | |
| 415 | + w.println(team.make_text(wkfile.getName())); | |
| 416 | + } | |
| 417 | + } | |
| 418 | + w.close(); | |
| 419 | + } catch (IOException ex) { | |
| 420 | + Logger.getLogger(MatchDataPanel.class.getName()). | |
| 421 | + log(Level.SEVERE, null, ex); | |
| 422 | + } | |
| 423 | + } | |
| 424 | + }//GEN-LAST:event_outTextTeamActionPerformed | |
| 425 | + | |
| 359 | 426 | // Variables declaration - do not modify//GEN-BEGIN:variables |
| 360 | 427 | private javax.swing.JButton addTeam; |
| 361 | 428 | private javax.swing.JButton closeButton; |
| @@ -362,6 +429,7 @@ | ||
| 362 | 429 | private javax.swing.JButton delTeam; |
| 363 | 430 | private javax.swing.JScrollPane jScrollPane1; |
| 364 | 431 | private javax.swing.JTextField matchName; |
| 432 | + private javax.swing.JButton outTextTeam; | |
| 365 | 433 | private javax.swing.JButton saveMatch; |
| 366 | 434 | private javax.swing.JList teamList; |
| 367 | 435 | private javax.swing.JLabel titleMatch; |
| @@ -12,9 +12,10 @@ | ||
| 12 | 12 | */ |
| 13 | 13 | public class Main { |
| 14 | 14 | |
| 15 | - static public final String app_version = "Version 1.1"; | |
| 15 | + static public final String app_version = "Version 1.2"; | |
| 16 | 16 | static public String cheDataDir = null; |
| 17 | 17 | static public String cheMatchDataDir = null; |
| 18 | + static public String cheTextDataDir = null; | |
| 18 | 19 | |
| 19 | 20 | /** |
| 20 | 21 | * メッセージボックス表示 |
| @@ -188,6 +188,15 @@ | ||
| 188 | 188 | return okeno; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | + /** | |
| 192 | + * ボディ名称を取得 | |
| 193 | + * | |
| 194 | + * @return ボディ名 | |
| 195 | + */ | |
| 196 | + public String get_bodyname() { | |
| 197 | + return bodylist.get(realData[0x270]); | |
| 198 | + } | |
| 199 | + | |
| 191 | 200 | @Override |
| 192 | 201 | public String toString() { |
| 193 | 202 | String retstr = get_name(); |
| @@ -197,7 +206,7 @@ | ||
| 197 | 206 | } |
| 198 | 207 | retstr += "("; |
| 199 | 208 | try { |
| 200 | - retstr += bodylist.get(realData[0x270]); | |
| 209 | + retstr += get_bodyname(); | |
| 201 | 210 | } catch (IndexOutOfBoundsException e) { |
| 202 | 211 | retstr += "?"; |
| 203 | 212 | } |