5.0 Source Code
Committing 5.0 Source Code
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
// uniCenta oPOS - Touch Friendly Point Of Sale
|
||||
// Copyright (c) 2009-2018 uniCenta & previous Openbravo POS works
|
||||
// https://unicenta.com
|
||||
//
|
||||
// This file is part of uniCenta oPOS
|
||||
//
|
||||
// uniCenta oPOS 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.
|
||||
//
|
||||
// uniCenta oPOS 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 uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package com.unicenta.pos.catalog;
|
||||
|
||||
import com.unicenta.basic.BasicException;
|
||||
import java.awt.Component;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author adrianromero
|
||||
*/
|
||||
public interface CatalogSelector {
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws BasicException
|
||||
*/
|
||||
public void loadCatalog() throws BasicException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public void showCatalogPanel(String id);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param value
|
||||
*/
|
||||
public void setComponentEnabled(boolean value);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Component getComponent();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param l
|
||||
*/
|
||||
public void addActionListener(ActionListener l);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param l
|
||||
*/
|
||||
public void removeActionListener(ActionListener l);
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
// uniCenta oPOS - Touch Friendly Point Of Sale
|
||||
// Copyright (c) 2009-2018 uniCenta & previous Openbravo POS works
|
||||
// https://unicenta.com
|
||||
//
|
||||
// This file is part of uniCenta oPOS
|
||||
//
|
||||
// uniCenta oPOS 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.
|
||||
//
|
||||
// uniCenta oPOS 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 uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package com.unicenta.pos.catalog;
|
||||
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.data.loader.DataRead;
|
||||
import com.unicenta.data.loader.SerializerRead;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JG uniCenta Dec 17
|
||||
* Used in Categories to display all this Categories Products
|
||||
*/
|
||||
|
||||
public class CategoryStock {
|
||||
|
||||
String productId;
|
||||
String productName;
|
||||
String productCode;
|
||||
String categoryId;
|
||||
|
||||
/**
|
||||
* Main method to return all customer's transactions
|
||||
*/
|
||||
public CategoryStock() {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param productId
|
||||
* @param productName
|
||||
* @param cId
|
||||
*/
|
||||
public CategoryStock(String productId, String productName, String productCode, String pId) {
|
||||
this.productId = productId;
|
||||
this.productName = productName;
|
||||
this.productCode = productCode;
|
||||
this.categoryId = pId;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return product string
|
||||
*/
|
||||
public String getProductId() {
|
||||
return productId;
|
||||
}
|
||||
public void setProductId(String productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return product name string
|
||||
*/
|
||||
public String getProductName() {
|
||||
return productName;
|
||||
}
|
||||
public void setProductName(String productName) {
|
||||
this.productName = productName;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return product barcode string
|
||||
*/
|
||||
public String getProductCode() {
|
||||
return productCode;
|
||||
}
|
||||
public void setProductCode(String productCode) {
|
||||
this.productCode = productCode;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return category name string
|
||||
*/
|
||||
public String getCategoryId() {
|
||||
return categoryId;
|
||||
}
|
||||
public void setCategoryId(String categoryId) {
|
||||
this.categoryId = categoryId;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return products for this category
|
||||
*/
|
||||
public static SerializerRead getSerializerRead() {
|
||||
return new SerializerRead() {
|
||||
@Override
|
||||
public Object readValues(DataRead dr) throws BasicException {
|
||||
String productId = dr.getString(1);
|
||||
String productName = dr.getString(2);
|
||||
String productCode = dr.getString(3);
|
||||
String categoryId = dr.getString(4);
|
||||
return new CategoryStock(productId, productName, productCode, categoryId);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,229 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,0,-66,0,0,2,25"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="m_jCategories">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="0"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[275, 600]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[265, 0]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="Before"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignCardLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="m_jRootCategories">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="11" style="0"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[200, 100]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[275, 130]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignCardLayout" value="org.netbeans.modules.form.compat2.layouts.DesignCardLayout$CardConstraintsDescription">
|
||||
<CardConstraints cardName="rootcategories"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JScrollPane" name="m_jscrollcat">
|
||||
<Properties>
|
||||
<Property name="horizontalScrollBarPolicy" type="int" value="31"/>
|
||||
<Property name="verticalScrollBarPolicy" type="int" value="22"/>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="0"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[265, 130]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="Center"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JList" name="m_jListCategories">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="0"/>
|
||||
</Property>
|
||||
<Property name="selectionMode" type="int" value="0"/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="valueChanged" listener="javax.swing.event.ListSelectionListener" parameters="javax.swing.event.ListSelectionEvent" handler="m_jListCategoriesValueChanged"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel2">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="After"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanel3">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
|
||||
<EmptyBorder bottom="0" left="5" right="5" top="0"/>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="North"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridLayout">
|
||||
<Property name="columns" type="int" value="1"/>
|
||||
<Property name="rows" type="int" value="0"/>
|
||||
<Property name="verticalGap" type="int" value="5"/>
|
||||
</Layout>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="m_jSubCategories">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignCardLayout" value="org.netbeans.modules.form.compat2.layouts.DesignCardLayout$CardConstraintsDescription">
|
||||
<CardConstraints cardName="subcategories"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanel4">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="West"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="m_lblIndicator">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="jLabel1"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="North"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel1">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="After"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanel5">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
|
||||
<EmptyBorder bottom="0" left="5" right="5" top="0"/>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="North"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridLayout">
|
||||
<Property name="columns" type="int" value="1"/>
|
||||
<Property name="rows" type="int" value="0"/>
|
||||
<Property name="verticalGap" type="int" value="5"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JButton" name="m_btnBack1">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/com/unicenta/images/2uparrow.png"/>
|
||||
</Property>
|
||||
<Property name="focusPainted" type="boolean" value="false"/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
|
||||
<Insets value="[8, 14, 8, 14]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[60, 45]"/>
|
||||
</Property>
|
||||
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="m_btnBack1ActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="m_jProducts">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="0"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="Center"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignCardLayout"/>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,622 @@
|
||||
// uniCenta oPOS - Touch Friendly Point Of Sale
|
||||
// Copyright (c) 2009-2018 uniCenta & previous Openbravo POS works
|
||||
// https://unicenta.com
|
||||
//
|
||||
// This file is part of uniCenta oPOS
|
||||
//
|
||||
// uniCenta oPOS 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.
|
||||
//
|
||||
// uniCenta oPOS 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 uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package com.unicenta.pos.catalog;
|
||||
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.data.gui.JMessageDialog;
|
||||
import com.unicenta.data.gui.MessageInf;
|
||||
import com.unicenta.pos.forms.AppLocal;
|
||||
import com.unicenta.pos.forms.DataLogicSales;
|
||||
import com.unicenta.pos.sales.TaxesLogic;
|
||||
import com.unicenta.pos.ticket.CategoryInfo;
|
||||
import com.unicenta.pos.ticket.ProductInfoExt;
|
||||
import com.unicenta.pos.ticket.TaxInfo;
|
||||
import com.unicenta.pos.util.ThumbNailBuilder;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.CardLayout;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.*;
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.EventListenerList;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author adrianromero
|
||||
*/
|
||||
public class JCatalog extends JPanel implements ListSelectionListener, CatalogSelector {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected EventListenerList listeners = new EventListenerList();
|
||||
private DataLogicSales m_dlSales;
|
||||
private TaxesLogic taxeslogic;
|
||||
|
||||
private boolean pricevisible;
|
||||
private boolean taxesincluded;
|
||||
|
||||
// Set of Products panels
|
||||
private final Map<String, ProductInfoExt> m_productsset = new HashMap<>();
|
||||
|
||||
// Set of Categoriespanels
|
||||
private final Set<String> m_categoriesset = new HashSet<>();
|
||||
|
||||
private ThumbNailBuilder tnbbutton;
|
||||
private ThumbNailBuilder tnbcat;
|
||||
private ThumbNailBuilder tnbsubcat;
|
||||
|
||||
private CategoryInfo showingcategory = null;
|
||||
|
||||
/** Creates new form JCatalog
|
||||
* @param dlSales */
|
||||
public JCatalog(DataLogicSales dlSales) {
|
||||
this(dlSales, false, false, 90, 60);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param dlSales
|
||||
* @param pricevisible
|
||||
* @param taxesincluded
|
||||
* @param width
|
||||
* @param height
|
||||
*/
|
||||
public JCatalog(DataLogicSales dlSales, boolean pricevisible,
|
||||
boolean taxesincluded, int width, int height) {
|
||||
|
||||
m_dlSales = dlSales;
|
||||
this.pricevisible = pricevisible;
|
||||
this.taxesincluded = taxesincluded;
|
||||
|
||||
initComponents();
|
||||
|
||||
m_jListCategories.addListSelectionListener(this);
|
||||
|
||||
m_jscrollcat.getVerticalScrollBar().setPreferredSize(new Dimension(35, 35));
|
||||
|
||||
tnbcat = new ThumbNailBuilder(48, 48, "com/unicenta/images/category.png");
|
||||
tnbsubcat = new ThumbNailBuilder(width, height, "com/unicenta/images/subcategory.png");
|
||||
tnbbutton = new ThumbNailBuilder(width, height, "com/unicenta/images/null.png");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Component getComponent() {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
@Override
|
||||
public void showCatalogPanel(String id) {
|
||||
|
||||
if (id == null) {
|
||||
showRootCategoriesPanel();
|
||||
} else {
|
||||
showProductPanel(id);
|
||||
}
|
||||
}
|
||||
|
||||
public Component getCatComponent() {
|
||||
return m_jCategories;
|
||||
}
|
||||
|
||||
public Component getProductComponent() {
|
||||
return m_jProducts;
|
||||
}
|
||||
|
||||
public boolean setControls(String position) {
|
||||
if (position.equals("south")) {
|
||||
m_jRootCategories.add(jPanel2, BorderLayout.SOUTH);
|
||||
m_jSubCategories.add(jPanel1, BorderLayout.SOUTH);
|
||||
((GridLayout) jPanel3.getLayout()).setRows(1);
|
||||
((GridLayout) jPanel5.getLayout()).setRows(1);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws BasicException
|
||||
*/
|
||||
@Override
|
||||
public void loadCatalog() throws BasicException {
|
||||
|
||||
// delete all categories panel
|
||||
m_jProducts.removeAll();
|
||||
|
||||
m_productsset.clear();
|
||||
m_categoriesset.clear();
|
||||
|
||||
showingcategory = null;
|
||||
|
||||
// Load the taxes logic
|
||||
taxeslogic = new TaxesLogic(m_dlSales.getTaxList().list());
|
||||
|
||||
// Load all categories.
|
||||
java.util.List<CategoryInfo> categories = m_dlSales.getRootCategories();
|
||||
|
||||
// Select the first category
|
||||
m_jListCategories.setCellRenderer(new SmallCategoryRenderer());
|
||||
m_jListCategories.setModel(new CategoriesListModel(categories)); // aCatList
|
||||
|
||||
if (m_jListCategories.getModel().getSize() == 0) {
|
||||
m_jscrollcat.setVisible(false);
|
||||
jPanel2.setVisible(false);
|
||||
} else {
|
||||
m_jscrollcat.setVisible(true);
|
||||
jPanel2.setVisible(true);
|
||||
m_jListCategories.setSelectedIndex(0);
|
||||
}
|
||||
|
||||
showRootCategoriesPanel();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param value
|
||||
*/
|
||||
@Override
|
||||
public void setComponentEnabled(boolean value) {
|
||||
|
||||
m_jListCategories.setEnabled(value);
|
||||
m_jscrollcat.setEnabled(value);
|
||||
m_lblIndicator.setEnabled(value);
|
||||
m_btnBack1.setEnabled(value);
|
||||
m_jProducts.setEnabled(value);
|
||||
|
||||
synchronized (m_jProducts.getTreeLock()) {
|
||||
int compCount = m_jProducts.getComponentCount();
|
||||
for (int i = 0 ; i < compCount ; i++) {
|
||||
m_jProducts.getComponent(i).setEnabled(value);
|
||||
}
|
||||
}
|
||||
|
||||
this.setEnabled(value);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param l
|
||||
*/
|
||||
@Override
|
||||
public void addActionListener(ActionListener l) {
|
||||
listeners.add(ActionListener.class, l);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param l
|
||||
*/
|
||||
@Override
|
||||
public void removeActionListener(ActionListener l) {
|
||||
listeners.remove(ActionListener.class, l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent evt) {
|
||||
|
||||
if (!evt.getValueIsAdjusting()) {
|
||||
int i = m_jListCategories.getSelectedIndex();
|
||||
if (i >= 0) {
|
||||
// Lo hago visible...
|
||||
Rectangle oRect = m_jListCategories.getCellBounds(i, i);
|
||||
m_jListCategories.scrollRectToVisible(oRect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param prod
|
||||
*/
|
||||
protected void fireSelectedProduct(ProductInfoExt prod) {
|
||||
EventListener[] l = listeners.getListeners(ActionListener.class);
|
||||
ActionEvent e = null;
|
||||
for (EventListener l1 : l) {
|
||||
if (e == null) {
|
||||
e = new ActionEvent(prod, ActionEvent.ACTION_PERFORMED, prod.getID());
|
||||
}
|
||||
((ActionListener) l1).actionPerformed(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void selectCategoryPanel(String catid) {
|
||||
try {
|
||||
if (!m_categoriesset.contains(catid)) {
|
||||
|
||||
JCatalogTab jcurrTab = new JCatalogTab();
|
||||
jcurrTab.applyComponentOrientation(getComponentOrientation());
|
||||
m_jProducts.add(jcurrTab, catid);
|
||||
m_categoriesset.add(catid);
|
||||
|
||||
java.util.List<CategoryInfo> categories = m_dlSales.getSubcategories(catid);
|
||||
for (CategoryInfo cat : categories) {
|
||||
|
||||
if (cat.getCatShowName()) {
|
||||
jcurrTab.addButton(new ImageIcon(tnbsubcat.getThumbNailText
|
||||
(cat.getImage(), cat.getName())),
|
||||
new SelectedCategory(cat),cat.getTextTip());
|
||||
}else{
|
||||
jcurrTab.addButton(new ImageIcon(
|
||||
tnbsubcat.getThumbNailText(cat.getImage(), "")),
|
||||
new SelectedCategory(cat),cat.getTextTip());
|
||||
}
|
||||
}
|
||||
|
||||
java.util.List<ProductInfoExt> prods = m_dlSales.getProductConstant();
|
||||
for (ProductInfoExt prod : prods) {
|
||||
jcurrTab.addButton(
|
||||
new ImageIcon(tnbbutton.getThumbNailText(prod.getImage(),
|
||||
getProductLabel(prod))),
|
||||
new SelectedAction(prod),
|
||||
prod.getTextTip());
|
||||
}
|
||||
|
||||
java.util.List<ProductInfoExt> products = m_dlSales.getProductCatalog(catid);
|
||||
|
||||
for (ProductInfoExt prod : products) {
|
||||
jcurrTab.addButton(
|
||||
new ImageIcon(tnbbutton.getThumbNailText(prod.getImage(),
|
||||
getProductLabel(prod))),
|
||||
new SelectedAction(prod),prod.getTextTip());
|
||||
}
|
||||
}
|
||||
|
||||
CardLayout cl = (CardLayout)(m_jProducts.getLayout());
|
||||
cl.show(m_jProducts, catid);
|
||||
} catch (BasicException e) {
|
||||
JMessageDialog.showMessage(this, new MessageInf(MessageInf.SGN_WARNING,
|
||||
AppLocal.getIntString("message.notactive"), e));
|
||||
}
|
||||
}
|
||||
|
||||
private String getProductLabel(ProductInfoExt product) {
|
||||
|
||||
if (pricevisible) {
|
||||
if (taxesincluded) {
|
||||
TaxInfo tax = taxeslogic.getTaxInfo(product.getTaxCategoryID());
|
||||
if(!"".equals(product.getDisplay())){
|
||||
return "<html><center>" + product.getDisplay() + "<br>" + product.printPriceSellTax(tax);
|
||||
} else {
|
||||
return "<html><center>" + product.getName() + "<br>" + product.printPriceSellTax(tax);
|
||||
}
|
||||
} else {
|
||||
if(!"".equals(product.getDisplay())){
|
||||
return "<html><center>" + product.getDisplay() + "<br>" + product.printPriceSell();
|
||||
} else {
|
||||
return "<html><center>" + product.getName() + "<br>" + product.printPriceSell();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
if (!"".equals(product.getDisplay())) {
|
||||
return product.getDisplay();
|
||||
} else {
|
||||
return product.getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void selectIndicatorPanel(Icon icon, String label, String texttip) {
|
||||
|
||||
m_lblIndicator.setText(label);
|
||||
m_lblIndicator.setIcon(icon);
|
||||
|
||||
// Show subcategories panel
|
||||
CardLayout cl = (CardLayout)(m_jCategories.getLayout());
|
||||
cl.show(m_jCategories, "subcategories");
|
||||
}
|
||||
|
||||
private void selectIndicatorCategories() {
|
||||
// Show root categories panel
|
||||
CardLayout cl = (CardLayout)(m_jCategories.getLayout());
|
||||
cl.show(m_jCategories, "rootcategories");
|
||||
}
|
||||
|
||||
private void showRootCategoriesPanel() {
|
||||
|
||||
selectIndicatorCategories();
|
||||
// Show selected root category
|
||||
CategoryInfo cat = (CategoryInfo) m_jListCategories.getSelectedValue();
|
||||
|
||||
if (cat != null) {
|
||||
selectCategoryPanel(cat.getID());
|
||||
}
|
||||
showingcategory = null;
|
||||
}
|
||||
|
||||
private void showSubcategoryPanel(CategoryInfo category) {
|
||||
// Modified JDL 13.04.13
|
||||
// this is the new panel that displays when a sub catergory is selected mouse does not work here
|
||||
selectIndicatorPanel(new ImageIcon(tnbsubcat.getThumbNail(
|
||||
category.getImage())),category.getName(), category.getTextTip());
|
||||
selectCategoryPanel(category.getID());
|
||||
showingcategory = category;
|
||||
}
|
||||
|
||||
private void showProductPanel(String id) {
|
||||
|
||||
ProductInfoExt product = m_productsset.get(id);
|
||||
|
||||
if (product == null) {
|
||||
if (m_productsset.containsKey(id)) {
|
||||
// It is an empty panel
|
||||
if (showingcategory == null) {
|
||||
showRootCategoriesPanel();
|
||||
} else {
|
||||
showSubcategoryPanel(showingcategory);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
// Create products panel
|
||||
java.util.List<ProductInfoExt> products = m_dlSales.getProductComments(id);
|
||||
|
||||
if (products.isEmpty()) {
|
||||
m_productsset.put(id, null);
|
||||
|
||||
if (showingcategory == null) {
|
||||
showRootCategoriesPanel();
|
||||
} else {
|
||||
showSubcategoryPanel(showingcategory);
|
||||
}
|
||||
} else {
|
||||
|
||||
product = m_dlSales.getProductInfo(id);
|
||||
m_productsset.put(id, product);
|
||||
|
||||
JCatalogTab jcurrTab = new JCatalogTab();
|
||||
jcurrTab.applyComponentOrientation(getComponentOrientation());
|
||||
m_jProducts.add(jcurrTab, "PRODUCT." + id);
|
||||
|
||||
// Add products
|
||||
for (ProductInfoExt prod : products) {
|
||||
jcurrTab.addButton(new ImageIcon(tnbbutton.getThumbNailText(prod.getImage(),
|
||||
getProductLabel(prod))), new SelectedAction(prod),prod.getTextTip());
|
||||
}
|
||||
selectIndicatorPanel(new ImageIcon(tnbbutton.getThumbNail(product.getImage())),
|
||||
product.getDisplay(), product.getTextTip());
|
||||
|
||||
CardLayout cl = (CardLayout)(m_jProducts.getLayout());
|
||||
cl.show(m_jProducts, "PRODUCT." + id);
|
||||
}
|
||||
} catch (BasicException eb) {
|
||||
m_productsset.put(id, null);
|
||||
if (showingcategory == null) {
|
||||
showRootCategoriesPanel();
|
||||
} else {
|
||||
showSubcategoryPanel(showingcategory);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
selectIndicatorPanel(new ImageIcon(tnbbutton.getThumbNail(
|
||||
product.getImage())), product.getName(), product.getTextTip());
|
||||
|
||||
CardLayout cl = (CardLayout)(m_jProducts.getLayout());
|
||||
cl.show(m_jProducts, "PRODUCT." + id);
|
||||
}
|
||||
}
|
||||
|
||||
private class SelectedAction implements ActionListener {
|
||||
private final ProductInfoExt prod;
|
||||
public SelectedAction(ProductInfoExt prod) {
|
||||
this.prod = prod;
|
||||
}
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
fireSelectedProduct(prod);
|
||||
}
|
||||
}
|
||||
|
||||
private class SelectedCategory implements ActionListener {
|
||||
private final CategoryInfo category;
|
||||
public SelectedCategory(CategoryInfo category) {
|
||||
this.category = category;
|
||||
}
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
showSubcategoryPanel(category);
|
||||
}
|
||||
}
|
||||
|
||||
private class CategoriesListModel extends AbstractListModel {
|
||||
private final java.util.List m_aCategories;
|
||||
public CategoriesListModel(java.util.List aCategories) {
|
||||
m_aCategories = aCategories;
|
||||
}
|
||||
@Override
|
||||
public int getSize() {
|
||||
return m_aCategories.size();
|
||||
}
|
||||
@Override
|
||||
public Object getElementAt(int i) {
|
||||
return m_aCategories.get(i);
|
||||
}
|
||||
}
|
||||
|
||||
private class SmallCategoryRenderer extends DefaultListCellRenderer {
|
||||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value,
|
||||
int index, boolean isSelected, boolean cellHasFocus) {
|
||||
|
||||
super.getListCellRendererComponent(list, null, index, isSelected, cellHasFocus);
|
||||
CategoryInfo cat = (CategoryInfo) value;
|
||||
setText(cat.getName());
|
||||
setIcon(new ImageIcon(tnbcat.getThumbNail(cat.getImage())));
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
/** 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() {
|
||||
|
||||
m_jCategories = new javax.swing.JPanel();
|
||||
m_jRootCategories = new javax.swing.JPanel();
|
||||
m_jscrollcat = new javax.swing.JScrollPane();
|
||||
m_jListCategories = new javax.swing.JList();
|
||||
jPanel2 = new javax.swing.JPanel();
|
||||
jPanel3 = new javax.swing.JPanel();
|
||||
m_jSubCategories = new javax.swing.JPanel();
|
||||
jPanel4 = new javax.swing.JPanel();
|
||||
m_lblIndicator = new javax.swing.JLabel();
|
||||
jPanel1 = new javax.swing.JPanel();
|
||||
jPanel5 = new javax.swing.JPanel();
|
||||
m_btnBack1 = new javax.swing.JButton();
|
||||
m_jProducts = new javax.swing.JPanel();
|
||||
|
||||
setLayout(new java.awt.BorderLayout());
|
||||
|
||||
m_jCategories.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
m_jCategories.setMaximumSize(new java.awt.Dimension(275, 600));
|
||||
m_jCategories.setPreferredSize(new java.awt.Dimension(265, 0));
|
||||
m_jCategories.setLayout(new java.awt.CardLayout());
|
||||
|
||||
m_jRootCategories.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
|
||||
m_jRootCategories.setMinimumSize(new java.awt.Dimension(200, 100));
|
||||
m_jRootCategories.setPreferredSize(new java.awt.Dimension(275, 130));
|
||||
m_jRootCategories.setLayout(new java.awt.BorderLayout());
|
||||
|
||||
m_jscrollcat.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||
m_jscrollcat.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
|
||||
m_jscrollcat.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
m_jscrollcat.setPreferredSize(new java.awt.Dimension(265, 130));
|
||||
|
||||
m_jListCategories.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
m_jListCategories.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
|
||||
m_jListCategories.setFocusable(false);
|
||||
m_jListCategories.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
|
||||
public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
|
||||
m_jListCategoriesValueChanged(evt);
|
||||
}
|
||||
});
|
||||
m_jscrollcat.setViewportView(m_jListCategories);
|
||||
|
||||
m_jRootCategories.add(m_jscrollcat, java.awt.BorderLayout.CENTER);
|
||||
|
||||
jPanel2.setLayout(new java.awt.BorderLayout());
|
||||
|
||||
jPanel3.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 5, 0, 5));
|
||||
jPanel3.setLayout(new java.awt.GridLayout(0, 1, 0, 5));
|
||||
jPanel2.add(jPanel3, java.awt.BorderLayout.NORTH);
|
||||
|
||||
m_jRootCategories.add(jPanel2, java.awt.BorderLayout.LINE_END);
|
||||
|
||||
m_jCategories.add(m_jRootCategories, "rootcategories");
|
||||
|
||||
m_jSubCategories.setLayout(new java.awt.BorderLayout());
|
||||
|
||||
jPanel4.setLayout(new java.awt.BorderLayout());
|
||||
|
||||
m_lblIndicator.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
m_lblIndicator.setText("jLabel1");
|
||||
jPanel4.add(m_lblIndicator, java.awt.BorderLayout.NORTH);
|
||||
|
||||
m_jSubCategories.add(jPanel4, java.awt.BorderLayout.WEST);
|
||||
|
||||
jPanel1.setLayout(new java.awt.BorderLayout());
|
||||
|
||||
jPanel5.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 5, 0, 5));
|
||||
jPanel5.setLayout(new java.awt.GridLayout(0, 1, 0, 5));
|
||||
|
||||
m_btnBack1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/2uparrow.png"))); // NOI18N
|
||||
m_btnBack1.setFocusPainted(false);
|
||||
m_btnBack1.setFocusable(false);
|
||||
m_btnBack1.setMargin(new java.awt.Insets(8, 14, 8, 14));
|
||||
m_btnBack1.setPreferredSize(new java.awt.Dimension(60, 45));
|
||||
m_btnBack1.setRequestFocusEnabled(false);
|
||||
m_btnBack1.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
m_btnBack1ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jPanel5.add(m_btnBack1);
|
||||
|
||||
jPanel1.add(jPanel5, java.awt.BorderLayout.NORTH);
|
||||
|
||||
m_jSubCategories.add(jPanel1, java.awt.BorderLayout.LINE_END);
|
||||
|
||||
m_jCategories.add(m_jSubCategories, "subcategories");
|
||||
|
||||
add(m_jCategories, java.awt.BorderLayout.LINE_START);
|
||||
|
||||
m_jProducts.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
m_jProducts.setLayout(new java.awt.CardLayout());
|
||||
add(m_jProducts, java.awt.BorderLayout.CENTER);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void m_jListCategoriesValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_m_jListCategoriesValueChanged
|
||||
|
||||
if (!evt.getValueIsAdjusting()) {
|
||||
CategoryInfo cat = (CategoryInfo) m_jListCategories.getSelectedValue();
|
||||
if (cat != null) {
|
||||
selectCategoryPanel(cat.getID());
|
||||
}
|
||||
}
|
||||
|
||||
}//GEN-LAST:event_m_jListCategoriesValueChanged
|
||||
|
||||
private void m_btnBack1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_btnBack1ActionPerformed
|
||||
|
||||
showRootCategoriesPanel();
|
||||
|
||||
}//GEN-LAST:event_m_btnBack1ActionPerformed
|
||||
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JPanel jPanel2;
|
||||
private javax.swing.JPanel jPanel3;
|
||||
private javax.swing.JPanel jPanel4;
|
||||
private javax.swing.JPanel jPanel5;
|
||||
private javax.swing.JButton m_btnBack1;
|
||||
private javax.swing.JPanel m_jCategories;
|
||||
private javax.swing.JList m_jListCategories;
|
||||
private javax.swing.JPanel m_jProducts;
|
||||
private javax.swing.JPanel m_jRootCategories;
|
||||
private javax.swing.JPanel m_jSubCategories;
|
||||
private javax.swing.JScrollPane m_jscrollcat;
|
||||
private javax.swing.JLabel m_lblIndicator;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="0"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,1,0,0,1,102"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
</Form>
|
||||
@@ -0,0 +1,98 @@
|
||||
// uniCenta oPOS - Touch Friendly Point Of Sale
|
||||
// Copyright (c) 2009-2018 uniCenta & previous Openbravo POS works
|
||||
// https://unicenta.com
|
||||
//
|
||||
// This file is part of uniCenta oPOS
|
||||
//
|
||||
// uniCenta oPOS 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.
|
||||
//
|
||||
// uniCenta oPOS 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 uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package com.unicenta.pos.catalog;
|
||||
|
||||
import com.unicenta.beans.JFlowPanel;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionListener;
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author adrianromero
|
||||
*/
|
||||
public class JCatalogTab extends javax.swing.JPanel {
|
||||
|
||||
private JFlowPanel flowpanel;
|
||||
|
||||
/** Creates new form JCategoryProducts */
|
||||
public JCatalogTab() {
|
||||
initComponents();
|
||||
|
||||
flowpanel = new JFlowPanel();
|
||||
JScrollPane scroll = new JScrollPane(flowpanel);
|
||||
scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||
scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
|
||||
scroll.getVerticalScrollBar().setPreferredSize(new Dimension(35, 35));
|
||||
|
||||
add(scroll, BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnabled(boolean value) {
|
||||
flowpanel.setEnabled(value);
|
||||
super.setEnabled(value);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ico
|
||||
* @param al
|
||||
* @param textTip
|
||||
*/
|
||||
public void addButton(Icon ico, ActionListener al, String textTip) {
|
||||
JButton btn = new JButton();
|
||||
btn.applyComponentOrientation(getComponentOrientation());
|
||||
btn.setIcon(ico);
|
||||
btn.setFocusPainted(false);
|
||||
btn.setFocusable(false);
|
||||
|
||||
if (textTip != null){
|
||||
btn.setToolTipText(textTip);
|
||||
}
|
||||
|
||||
btn.setRequestFocusEnabled(false);
|
||||
btn.setHorizontalTextPosition(SwingConstants.CENTER);
|
||||
btn.setVerticalTextPosition(SwingConstants.BOTTOM);
|
||||
btn.setMargin(new Insets(2, 2, 2, 2));
|
||||
btn.addActionListener(al);
|
||||
|
||||
flowpanel.add(btn);
|
||||
}
|
||||
|
||||
/** 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() {
|
||||
|
||||
setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
setLayout(new java.awt.BorderLayout());
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="0"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/>
|
||||
</AuxValues>
|
||||
<LayoutCode>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="1">
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="ComponentRef">
|
||||
<ComponentRef name="."/>
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<StatementProvider type="CodeMethod">
|
||||
<CodeMethod name="setLayout" class="java.awt.Container" parameterTypes="java.awt.LayoutManager"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="2">
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="CodeConstructor">
|
||||
<CodeConstructor class="org.jdesktop.swingx.VerticalLayout" parameterTypes=""/>
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
</LayoutCode>
|
||||
</Form>
|
||||
@@ -0,0 +1,95 @@
|
||||
// uniCenta oPOS - Touch Friendly Point Of Sale
|
||||
// Copyright (c) 2009-2018 uniCenta & previous Openbravo POS works
|
||||
// https://unicenta.com
|
||||
//
|
||||
// This file is part of uniCenta oPOS
|
||||
//
|
||||
// uniCenta oPOS 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.
|
||||
//
|
||||
// uniCenta oPOS 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 uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package com.unicenta.pos.catalog;
|
||||
|
||||
import com.unicenta.beans.JFlowPanel;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Image;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionListener;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.SwingConstants;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author adrianromero
|
||||
*/
|
||||
public class JProductsSelector extends javax.swing.JPanel {
|
||||
|
||||
private final JFlowPanel flowpanel;
|
||||
|
||||
/** Creates new form JProductsSelector */
|
||||
public JProductsSelector() {
|
||||
initComponents();
|
||||
|
||||
flowpanel = new JFlowPanel();
|
||||
|
||||
add(flowpanel, BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param img
|
||||
* @param display
|
||||
* @param al
|
||||
* @param textTip
|
||||
*/
|
||||
public void addProduct(Image img, String display, ActionListener al,String textTip) {
|
||||
JButton btn = new JButton();
|
||||
btn.applyComponentOrientation(getComponentOrientation());
|
||||
btn.setText(display);
|
||||
btn.setFocusPainted(false);
|
||||
|
||||
if (textTip != null){
|
||||
btn.setToolTipText(textTip);
|
||||
}
|
||||
|
||||
btn.setFocusable(false);
|
||||
btn.setRequestFocusEnabled(false);
|
||||
btn.setHorizontalTextPosition(SwingConstants.CENTER);
|
||||
btn.setVerticalTextPosition(SwingConstants.TOP);
|
||||
btn.setMargin(new Insets(0, 0, 0, 0));
|
||||
btn.setMaximumSize(new Dimension(80, 70));
|
||||
// btn.setPreferredSize(new Dimension(20, 20));
|
||||
btn.setMinimumSize(new Dimension(40, 30));
|
||||
btn.addActionListener(al);
|
||||
|
||||
flowpanel.add(btn);
|
||||
}
|
||||
|
||||
/** 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() {
|
||||
|
||||
setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
setLayout(new org.jdesktop.swingx.VerticalLayout());
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user