001: package net.matuschek.jobo;
002:
003: import java.util.Vector;
004:
005: import javax.swing.BoxLayout;
006: import javax.swing.JButton;
007: import javax.swing.JPanel;
008: import javax.swing.JScrollPane;
009: import javax.swing.JTable;
010:
011: import net.matuschek.spider.RegExpURLCheck;
012: import net.matuschek.swing.JHideFrame;
013: import net.matuschek.swing.OptionPanel;
014:
015: /*********************************************
016: Copyright (c) 2001 by Daniel Matuschek
017: *********************************************/
018:
019: /**
020: * Swing Configuration frame for the RegExpURLCheck rules
021: *
022: * @author Daniel Matuschek
023: * @version $Id $
024: */
025: public class URLCheckConfigFrame extends JHideFrame {
026:
027: private static final long serialVersionUID = 7588707167267231914L;
028:
029: public URLCheckConfigFrame(RegExpURLCheck check) {
030: super ("URLCheck configuration");
031: this .check = check;
032: initComponents();
033: }
034:
035: protected void initComponents() {
036: JPanel mainPanel = new JPanel();
037: mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
038: setContentPane(mainPanel);
039:
040: OptionPanel dialogPanel = new OptionPanel(2);
041:
042: JPanel buttonPanel = new JPanel();
043: buttonPanel.setLayout(new BoxLayout(buttonPanel,
044: BoxLayout.X_AXIS));
045:
046: mainPanel.add(dialogPanel);
047: mainPanel.add(buttonPanel);
048:
049: /**
050: Input fields
051: **/
052:
053: // table
054: Vector rules = check.getRules();
055: RegExpRuleTableModel tableModel = new RegExpRuleTableModel(
056: check.getRules());
057: JTable table = new JTable(tableModel);
058: JScrollPane scrollPane = new JScrollPane(table);
059: dialogPanel.add(scrollPane);
060:
061: /**
062: End of input fields
063: **/
064:
065: /**
066: Button panel
067: **/
068: JButton okButton = new JButton();
069: okButton.setText("OK");
070: okButton.addActionListener(new java.awt.event.ActionListener() {
071: public void actionPerformed(java.awt.event.ActionEvent evt) {
072: updateAndHide();
073: }
074: });
075: buttonPanel.add(okButton);
076:
077: JButton closeButton = new JButton();
078: closeButton.setText("Cancel");
079: closeButton
080: .addActionListener(new java.awt.event.ActionListener() {
081: public void actionPerformed(
082: java.awt.event.ActionEvent evt) {
083: exitForm();
084: }
085: });
086: buttonPanel.add(closeButton);
087:
088: /**
089: End of button panel
090: **/
091:
092: pack();
093: updateFormFromURLCheck();
094: }
095:
096: /**
097: update the RegExpURLCheck form dialog
098: **/
099: protected void updateAndHide() {
100: this .setVisible(false);
101: }
102:
103: /**
104: update the content of the form field from the current robot
105: settings
106: **/
107: protected void updateFormFromURLCheck() {
108: }
109:
110: /**
111: update the URLCheck settings from the current fields
112: @return true if everything is okay, false otherwise
113: **/
114: protected boolean updateURLCheckFromForm() {
115: return true;
116: }
117:
118: /**********************************************************************/
119: /**********************************************************************/
120: /**********************************************************************/
121:
122: /** the RegExpURLCheck to configure **/
123: RegExpURLCheck check = null;
124:
125: // input fields
126: //
127:
128: } // URLCheckConfigFrame
|