Search in sources :

Example 1 with SalesProduct

use of eu.ggnet.dwoss.redtape.ee.entity.SalesProduct in project dwoss by gg-net.

the class SalesProductUpdateCask method initComponents.

/**
 * 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.
 */
@SuppressWarnings("unchecked")
private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
void initComponents() {
    bindingGroup = new org.jdesktop.beansbinding.BindingGroup();
    salesProduct = new SalesProduct();
    jLabel6 = new javax.swing.JLabel();
    nameField = new javax.swing.JLabel();
    jLabel1 = new javax.swing.JLabel();
    jLabel2 = new javax.swing.JLabel();
    priceIncTaxField = new javax.swing.JTextField();
    jLabel3 = new javax.swing.JLabel();
    priceField = new javax.swing.JTextField();
    partNoField = new javax.swing.JLabel();
    setRequestFocusEnabled(false);
    jLabel6.setText("Name:");
    org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, salesProduct, org.jdesktop.beansbinding.ELProperty.create("${name}"), nameField, org.jdesktop.beansbinding.BeanProperty.create("text"), "nameField");
    bindingGroup.addBinding(binding);
    jLabel1.setText("PartNo.");
    jLabel2.setText("Preis (netto)");
    binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, salesProduct, org.jdesktop.beansbinding.ELProperty.create("${price}"), priceIncTaxField, org.jdesktop.beansbinding.BeanProperty.create("text"), "bruttoPrice");
    binding.setConverter(taxedConverter);
    bindingGroup.addBinding(binding);
    jLabel3.setText("Preis (brutto)");
    binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, salesProduct, org.jdesktop.beansbinding.ELProperty.create("${price}"), priceField, org.jdesktop.beansbinding.BeanProperty.create("text"), "nettoPrice");
    binding.setConverter(stringConverter);
    bindingGroup.addBinding(binding);
    partNoField.setText("<PartNo>");
    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().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(jLabel1).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(partNoField, javax.swing.GroupLayout.DEFAULT_SIZE, 152, Short.MAX_VALUE)).addGroup(layout.createSequentialGroup().addComponent(jLabel6).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addComponent(nameField, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))).addGap(20, 20, 20)).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 92, Short.MAX_VALUE).addComponent(priceField)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(priceIncTaxField).addContainerGap()).addGroup(layout.createSequentialGroup().addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE).addGap(20, 20, 20)))))));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jLabel6, javax.swing.GroupLayout.Alignment.TRAILING).addComponent(nameField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel1).addComponent(partNoField)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel2).addComponent(jLabel3)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(priceIncTaxField).addComponent(priceField)).addContainerGap()));
    bindingGroup.bind();
}
Also used : SalesProduct(eu.ggnet.dwoss.redtape.ee.entity.SalesProduct)

Example 2 with SalesProduct

use of eu.ggnet.dwoss.redtape.ee.entity.SalesProduct in project dwoss by gg-net.

the class SalesProductChooserCask method productTableMouseClicked.

// </editor-fold>//GEN-END:initComponents
private void productTableMouseClicked(java.awt.event.MouseEvent evt) {
    // GEN-FIRST:event_productTableMouseClicked
    String s = (String) productTable.getValueAt(productTable.getSelectedRow(), 0);
    for (SalesProduct p : products) {
        if (p.getPartNo().equals(s))
            product = p;
    }
    if (evt.getClickCount() > 1) {
        HtmlDialog dialog = new HtmlDialog(SwingUtilities.getWindowAncestor(this), Dialog.ModalityType.MODELESS);
        dialog.setText(product.toHtml());
        dialog.setVisible(true);
    }
}
Also used : HtmlDialog(eu.ggnet.dwoss.util.HtmlDialog) SalesProduct(eu.ggnet.dwoss.redtape.ee.entity.SalesProduct)

Example 3 with SalesProduct

use of eu.ggnet.dwoss.redtape.ee.entity.SalesProduct in project dwoss by gg-net.

the class SalesProductOperationIT method testUpdateSalesProdukt.

/**
 * Test of updatePrice method, of class SalesProductOperation.
 * <p>
 * @throws de.dw.util.UserInfoException
 */
// Fails under Linux, Enable with Arquilian
@Ignore
@Test
public void testUpdateSalesProdukt() throws UserInfoException {
    ProductSpec ps = receiptGenerator.makeProductSpec();
    SalesProduct createSalesProduct = redTapeWorker.createSalesProduct(ps.getPartNo());
    createSalesProduct.setPrice(1337.37);
    SalesProduct updateSalesProdukt = redTapeAgent.merge(createSalesProduct);
    assertTrue(updateSalesProdukt.getPrice() == 1337.37);
}
Also used : ProductSpec(eu.ggnet.dwoss.spec.ee.entity.ProductSpec) SalesProduct(eu.ggnet.dwoss.redtape.ee.entity.SalesProduct)

Example 4 with SalesProduct

use of eu.ggnet.dwoss.redtape.ee.entity.SalesProduct in project dwoss by gg-net.

the class SalesProductOperationIT method testCreateSalesProduct.

/**
 * Test of createSalesProduct method, of class SalesProductOperation.
 * <p>
 * @throws de.dw.util.UserInfoException
 */
// Fails under Linux, Enable with Arquilian
@Ignore
@Test
public void testCreateSalesProduct() throws UserInfoException {
    ProductSpec ps = receiptGenerator.makeProductSpec();
    redTapeWorker.createSalesProduct(ps.getPartNo());
    List<SalesProduct> salesProducts = redTapeAgent.findAll(SalesProduct.class);
    SalesProduct salesProduct = new SalesProduct(ps.getPartNo(), ps.getModel().getName(), 0., ps.getProductId(), SpecFormater.toSingleLine(ps));
    assertTrue(salesProducts.contains(salesProduct));
}
Also used : ProductSpec(eu.ggnet.dwoss.spec.ee.entity.ProductSpec) SalesProduct(eu.ggnet.dwoss.redtape.ee.entity.SalesProduct)

Example 5 with SalesProduct

use of eu.ggnet.dwoss.redtape.ee.entity.SalesProduct in project dwoss by gg-net.

the class SalesProductOperationIT method testRemoveSalesProdukt.

/**
 * Test of removeSalesProdukt method, of class SalesProductOperation.
 */
@Test
public void testRemoveSalesProdukt() {
    SalesProduct product1 = new SalesProduct("Part1", "Name1", 1D, 1, "Descritpt1");
    SalesProduct product2 = new SalesProduct("Part2", "Name2", 2D, 2, "Descritpt1");
    SalesProduct product3 = new SalesProduct("Part3", "Name3", 3D, 3, "Descritpt1");
    SalesProduct product4 = new SalesProduct("Part4", "Name4", 4D, 4, "Descritpt1");
    redTapeAgent.persist(product1);
    redTapeAgent.persist(product2);
    redTapeAgent.persist(product3);
    redTapeAgent.persist(product4);
    redTapeAgent.remove(product1);
    redTapeAgent.remove(product2);
    assertTrue(redTapeAgent.findAll(SalesProduct.class).size() == 2);
}
Also used : SalesProduct(eu.ggnet.dwoss.redtape.ee.entity.SalesProduct)

Aggregations

SalesProduct (eu.ggnet.dwoss.redtape.ee.entity.SalesProduct)11 SalesProductEao (eu.ggnet.dwoss.redtape.ee.eao.SalesProductEao)2 ProductSpec (eu.ggnet.dwoss.spec.ee.entity.ProductSpec)2 OkCancelDialog (eu.ggnet.dwoss.util.OkCancelDialog)2 HtmlDialog (eu.ggnet.dwoss.util.HtmlDialog)1 ArrayList (java.util.ArrayList)1 NoResultException (javax.persistence.NoResultException)1 Query (javax.persistence.Query)1 Test (org.junit.Test)1