/** Save. */ public void save() { Configuration.getInstance().setDmozPath(txtDmozPath.getText()); Configuration.getInstance().setSqlHost(txtSqlHost.getText()); Configuration.getInstance().setSqlUsername(txtSqlUsername.getText()); Configuration.getInstance().setSqlPassword(new String(txtSqlPassword.getPassword())); Configuration.getInstance().savePathProperties(); }
/** Instantiates a new dmoz tab view. */ public DmozTabView() { // PATH Dmoz file lblDmozPath = new JLabel("Dmoz File name : "); txtDmozPath = new JTextField(); txtDmozPath.setPreferredSize(new Dimension(200, 25)); txtDmozPath.setText(Configuration.getInstance().getIndexPath()); panelDmoz = new JPanel(); panelDmoz.setBorder(BorderFactory.createTitledBorder("Rdf File")); btnBrowserDmoz = new JButton("..."); btnBrowserDmoz.addActionListener(new BrowserFileClickController(this)); btnParseRdf = new JButton("Extarct to Mysql"); btnParseRdf.addActionListener(new ParseDmozClickController(this)); panelDmoz.add(lblDmozPath); panelDmoz.add(txtDmozPath); panelDmoz.add(btnBrowserDmoz); panelDmoz.add(btnParseRdf); // Sql Configuration JPanel panHost = new JPanel(); lblSqlHost = new JLabel("MySql Host & Database (//hostname/databasename) : "); txtSqlHost = new JTextField(); txtSqlHost.setPreferredSize(new Dimension(200, 25)); txtSqlHost.setText(Configuration.getInstance().getDataPath()); panHost.add(lblSqlHost); panHost.add(txtSqlHost); JPanel panId = new JPanel(); lblSqlUsername = new JLabel("Database User name : "); txtSqlUsername = new JTextField(); txtSqlUsername.setPreferredSize(new Dimension(100, 25)); txtSqlUsername.setText(Configuration.getInstance().getDataPath()); lblSqlPassword = new JLabel("Database Password : "******"Congiguration Mysql")); panelSql.add(splitSql); splitPath = new JSplitPane(JSplitPane.VERTICAL_SPLIT, panelDmoz, panelSql); // Init button cancel & save & Test btnTestConnection = new JButton("Test connection"); btnTestConnection.addActionListener(new TestSqlClickController(this)); btnSubmit = new JButton("Save"); btnSubmit.addActionListener(new SubmitDmozClickController(this)); btnCancel = new JButton("Cancel"); btnCancel.addActionListener(new CancelDmozClickController(this)); panelButton = new JPanel(); panelButton.add(btnTestConnection); panelButton.add(btnSubmit); panelButton.add(btnCancel); splitMain = new JSplitPane(JSplitPane.VERTICAL_SPLIT, splitPath, panelButton); this.add(splitMain); raz(); this.setVisible(true); }
/** Raz. */ public void raz() { txtDmozPath.setText(Configuration.getInstance().getDmozPath()); txtSqlHost.setText(Configuration.getInstance().getSqlHost()); txtSqlUsername.setText(Configuration.getInstance().getSqlUsername()); txtSqlPassword.setText(Configuration.getInstance().getSqlPassword()); }