// Wanda POS - Africa's Gift to the World // Copyright (c) 2014-2015 Wanda POS // www.erp-university-africa.com // // This file is part of Wanda POS // // Wanda POS is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Wanda POS is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with Wanda POS. If not, see <http://www.gnu.org/licenses/>. package com.openbravo.pos.config; import com.openbravo.data.user.DirtyManager; import com.openbravo.pos.forms.AppConfig; import com.openbravo.pos.forms.AppLocal; import java.awt.Component; /** * * @author Ing. Tatioti Mbogning Raoul */ public class JPanelConfigServer extends javax.swing.JPanel implements PanelConfig { private final DirtyManager dirty = new DirtyManager(); /** * Creates new form JPanelConfigServer */ public JPanelConfigServer() { initComponents(); jtxtServerHost.getDocument().addDocumentListener(dirty); jtxtServerPort.getDocument().addDocumentListener(dirty); } /** * * @return */ @Override public boolean hasChanged() { return dirty.isDirty(); } /** * * @return */ @Override public Component getConfigComponent() { return this; } /** * * @param config */ @Override public void loadProperties(AppConfig config) { jtxtServerHost.setText(config.getProperty("tomcat.host")); jtxtServerPort.setText(config.getProperty("tomcat.port")); dirty.setDirty(false); } /** * * @param config */ @Override public void saveProperties(AppConfig config) { config.setProperty("tomcat.host", jtxtServerHost.getText()); config.setProperty("tomcat.port", jtxtServerPort.getText()); dirty.setDirty(false); } private String comboValue(Object value) { return value == null ? "" : value.toString(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel18 = new javax.swing.JLabel(); jtxtServerHost = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); jtxtServerPort = new javax.swing.JTextField(); jPanel3 = new javax.swing.JPanel(); setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N setPreferredSize(new java.awt.Dimension(650, 500)); jLabel18.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N jLabel18.setText(AppLocal.getIntString("label.dbdriverlib")); // NOI18N jtxtServerHost.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N jtxtServerHost.setPreferredSize(new java.awt.Dimension(450, 25)); jtxtServerHost.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jtxtServerHostActionPerformed(evt); } }); jLabel1.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N jLabel1.setText(AppLocal.getIntString("Label.DbDriver")); // NOI18N jtxtServerPort.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N jtxtServerPort.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jtxtServerPortActionPerformed(evt); } }); java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("pos_messages"); // NOI18N jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), bundle.getString("label.tabledisplayoptions"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 1, 12), new java.awt.Color(102, 102, 102))); // NOI18N jPanel3.setLayout(null); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(10, 10, 10) .addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jtxtServerHost, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(10, 10, 10) .addComponent(jtxtServerPort, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(0, 420, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jtxtServerHost, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(5, 5, 5) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jtxtServerPort, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); }// </editor-fold>//GEN-END:initComponents private void jtxtServerPortActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtxtServerPortActionPerformed }//GEN-LAST:event_jtxtServerPortActionPerformed private void jtxtServerHostActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtxtServerHostActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jtxtServerHostActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel18; private javax.swing.JPanel jPanel3; private javax.swing.JTextField jtxtServerHost; private javax.swing.JTextField jtxtServerPort; // End of variables declaration//GEN-END:variables }