Example #1
0
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {

    jPanel1 = new javax.swing.JPanel();
    jLabel3 = new javax.swing.JLabel();
    m_jName = new javax.swing.JTextField();
    jPanel3 = new javax.swing.JPanel();
    m_jImage = new uk.chromis.data.gui.JImageEditor();

    setMinimumSize(new java.awt.Dimension(91, 125));
    setLayout(new java.awt.BorderLayout());

    jPanel1.setPreferredSize(new java.awt.Dimension(150, 100));
    jPanel1.setLayout(null);

    jLabel3.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
    jLabel3.setText(AppLocal.getIntString("Label.Name")); // NOI18N
    jPanel1.add(jLabel3);
    jLabel3.setBounds(20, 20, 90, 25);

    m_jName.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
    jPanel1.add(m_jName);
    m_jName.setBounds(110, 20, 180, 25);

    add(jPanel1, java.awt.BorderLayout.NORTH);

    jPanel3.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 5, 0, 0));
    jPanel3.setLayout(new java.awt.BorderLayout());

    m_jImage.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
    jPanel3.add(m_jImage, java.awt.BorderLayout.CENTER);

    add(jPanel3, java.awt.BorderLayout.CENTER);
  } // </editor-fold>//GEN-END:initComponents
  private void jButtonTestActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButtonTestActionPerformed
    try {
      String driverlib = jtxtDbDriverLib.getText();
      String driver = jtxtDbDriver.getText();
      String url = jtxtDbURL.getText();
      String user = jtxtDbUser.getText();
      String password = new String(jtxtDbPassword.getPassword());

      ClassLoader cloader = new URLClassLoader(new URL[] {new File(driverlib).toURI().toURL()});
      DriverManager.registerDriver(
          new DriverWrapper((Driver) Class.forName(driver, true, cloader).newInstance()));

      Session session = new Session(url, user, password);
      Connection connection = session.getConnection();
      boolean isValid;
      isValid = (connection == null) ? false : connection.isValid(1000);

      if (isValid) {
        JOptionPane.showMessageDialog(
            this,
            AppLocal.getIntString("message.databasesuccess"),
            "Connection Test",
            JOptionPane.INFORMATION_MESSAGE);
      } else {
        JMessageDialog.showMessage(
            this, new MessageInf(MessageInf.SGN_WARNING, "Connection Error"));
      }
    } catch (InstantiationException
        | IllegalAccessException
        | MalformedURLException
        | ClassNotFoundException e) {
      JMessageDialog.showMessage(
          this,
          new MessageInf(
              MessageInf.SGN_WARNING, AppLocal.getIntString("message.databasedrivererror"), e));
    } catch (SQLException e) {
      JMessageDialog.showMessage(
          this,
          new MessageInf(
              MessageInf.SGN_WARNING, AppLocal.getIntString("message.databaseconnectionerror"), e));
    } catch (Exception e) {
      JMessageDialog.showMessage(
          this, new MessageInf(MessageInf.SGN_WARNING, "Unknown exception", e));
    }
  } // GEN-LAST:event_jButtonTestActionPerformed
Example #3
0
  // JG July 2014 - Thank you Ron Isaacson    public DevicePrinterPanel() {
  public DevicePrinterPanel(AppProperties props) {
    initComponents();

    m_sName = AppLocal.getIntString("Printer.Screen");

    m_ticketcurrent = null;

    m_jTicketContainer = new JTicketContainer();
    m_jScrollView.setViewportView(m_jTicketContainer);

    m_props = props;
  }
  /**
   * @param CommOutputPrinter
   * @param codes
   * @param trans
   * @throws TicketPrinterException
   */
  public DevicePrinterESCPOS(PrinterWritter CommOutputPrinter, Codes codes, UnicodeTranslator trans)
      throws TicketPrinterException {

    m_sName = AppLocal.getIntString("Printer.Serial");
    m_CommOutputPrinter = CommOutputPrinter;
    m_codes = codes;
    m_trans = trans;

    // Inicializamos la impresora
    m_CommOutputPrinter.init(ESCPOS.INIT);

    m_CommOutputPrinter.write(ESCPOS.SELECT_PRINTER); // A la impresora
    m_CommOutputPrinter.init(m_codes.getInitSequence());
    m_CommOutputPrinter.write(m_trans.getCodeTable());

    m_CommOutputPrinter.flush();
  }
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {

    jLabel6 = new javax.swing.JLabel();
    jcboDBDriver = new javax.swing.JComboBox();
    jLabel18 = new javax.swing.JLabel();
    jtxtDbDriverLib = new javax.swing.JTextField();
    jbtnDbDriverLib = new javax.swing.JButton();
    jLabel1 = new javax.swing.JLabel();
    jtxtDbDriver = new javax.swing.JTextField();
    jLabel2 = new javax.swing.JLabel();
    jtxtDbURL = new javax.swing.JTextField();
    jLabel3 = new javax.swing.JLabel();
    jtxtDbUser = new javax.swing.JTextField();
    jLabel4 = new javax.swing.JLabel();
    jtxtDbPassword = new javax.swing.JPasswordField();
    jButtonTest = new javax.swing.JButton();
    jSeparator1 = new javax.swing.JSeparator();
    jLabel5 = new javax.swing.JLabel();
    jButton1 = new javax.swing.JButton();

    setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
    setPreferredSize(new java.awt.Dimension(650, 500));

    jLabel6.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
    jLabel6.setText("Database");

    jcboDBDriver.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
    jcboDBDriver.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jcboDBDriverActionPerformed(evt);
          }
        });

    jLabel18.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
    jLabel18.setText(AppLocal.getIntString("label.dbdriverlib")); // NOI18N

    jtxtDbDriverLib.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
    jtxtDbDriverLib.setPreferredSize(new java.awt.Dimension(450, 25));

    jbtnDbDriverLib.setIcon(
        new javax.swing.ImageIcon(
            getClass().getResource("/uk/chromis/images/fileopen.png"))); // NOI18N
    java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("pos_messages"); // NOI18N
    jbtnDbDriverLib.setToolTipText(bundle.getString("tiptext.openfolder")); // NOI18N
    jbtnDbDriverLib.setMaximumSize(new java.awt.Dimension(64, 32));
    jbtnDbDriverLib.setMinimumSize(new java.awt.Dimension(64, 32));
    jbtnDbDriverLib.setPreferredSize(new java.awt.Dimension(64, 40));

    jLabel1.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
    jLabel1.setText(AppLocal.getIntString("Label.DbDriver")); // NOI18N

    jtxtDbDriver.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
    jtxtDbDriver.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jtxtDbDriverActionPerformed(evt);
          }
        });

    jLabel2.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
    jLabel2.setText(AppLocal.getIntString("Label.DbURL")); // NOI18N

    jtxtDbURL.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
    jtxtDbURL.setPreferredSize(new java.awt.Dimension(450, 25));

    jLabel3.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
    jLabel3.setText(AppLocal.getIntString("Label.DbUser")); // NOI18N

    jtxtDbUser.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N

    jLabel4.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
    jLabel4.setText(AppLocal.getIntString("Label.DbPassword")); // NOI18N

    jtxtDbPassword.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N

    jButtonTest.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
    jButtonTest.setIcon(
        new javax.swing.ImageIcon(
            getClass().getResource("/uk/chromis/images/database.png"))); // NOI18N
    jButtonTest.setText(bundle.getString("Button.Test")); // NOI18N
    jButtonTest.setActionCommand(bundle.getString("Button.Test")); // NOI18N
    jButtonTest.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButtonTestActionPerformed(evt);
          }
        });

    jLabel5.setFont(new java.awt.Font("Arial", 0, 13)); // NOI18N
    jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel5.setText(bundle.getString("message.DBDefault")); // NOI18N
    jLabel5.setToolTipText("");
    jLabel5.setVerticalAlignment(javax.swing.SwingConstants.TOP);

    jButton1.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
    jButton1.setText("Chromis Web site");
    jButton1.setMaximumSize(new java.awt.Dimension(150, 45));
    jButton1.setMinimumSize(new java.awt.Dimension(150, 45));
    jButton1.setPreferredSize(new java.awt.Dimension(150, 45));
    jButton1.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton1ActionPerformed(evt);
          }
        });

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(
                        jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                    .addContainerGap())
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addGap(10, 10, 10)
                                    .addComponent(
                                        jLabel6,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        80,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(10, 10, 10)
                                    .addComponent(
                                        jcboDBDriver,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        330,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addGap(10, 10, 10)
                                    .addComponent(
                                        jLabel18,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        80,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(10, 10, 10)
                                    .addComponent(
                                        jtxtDbDriverLib,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(10, 10, 10)
                                    .addComponent(
                                        jbtnDbDriverLib,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        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(
                                        jtxtDbDriver,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        310,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addContainerGap()
                                    .addComponent(
                                        jLabel2,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        80,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(10, 10, 10)
                                    .addComponent(
                                        jtxtDbURL,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addContainerGap()
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(
                                                jLabel3,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                80,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(
                                                jLabel4,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                80,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGap(10, 10, 10)
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(
                                                jtxtDbUser,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                180,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(
                                                jtxtDbPassword,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                180,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGap(20, 20, 20)
                                    .addComponent(
                                        jButtonTest,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        100,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addGap(10, 10, 10)
                                    .addComponent(
                                        jSeparator1,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        650,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGap(0, 0, Short.MAX_VALUE))
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addGap(255, 255, 255)
                    .addComponent(
                        jButton1,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        142,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addGap(10, 10, 10)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(
                                jcboDBDriver,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                30,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                jLabel6,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                30,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(
                                jbtnDbDriverLib,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addGap(10, 10, 10)
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(
                                                jLabel18,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                25,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(
                                                jtxtDbDriverLib,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(
                                jtxtDbDriver,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                25,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                jLabel1,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                25,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(5, 5, 5)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(
                                jtxtDbURL,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                jLabel2,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                25,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(5, 5, 5)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(
                                                jtxtDbUser,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                25,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(
                                                jLabel3,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                25,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGap(5, 5, 5)
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(
                                                jtxtDbPassword,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                25,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(
                                                jLabel4,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                25,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addGap(10, 10, 10)
                                    .addComponent(
                                        jButtonTest,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        40,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGap(27, 27, 27)
                    .addComponent(
                        jSeparator1,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        10,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(8, 8, 8)
                    .addComponent(
                        jLabel5,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        180,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(
                        jButton1,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(29, Short.MAX_VALUE)));
  } // </editor-fold>//GEN-END:initComponents
Example #6
0
 @Override
 public String getColumnName(int column) {
   return AppLocal.getIntString(m_acolumns[column].name);
   // return m_acolumns[column].name;
 }
Example #7
0
 /** @return */
 @Override
 public String getTitle() {
   return AppLocal.getIntString("Menu.StockImport");
 }
Example #8
0
 /** @return */
 @Override
 public String getTitle() {
   return AppLocal.getIntString("Menu.Roles");
 }