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.size() == 0) {
// no hay productos por tanto lo anado a la de vacios y muestro el panel principal.
m_productsset.put(id, null);
if (showingcategory == null) {
showRootCategoriesPanel();
} else {
showSubcategoryPanel(showingcategory);
}
} else {
// Load product panel
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));
}
selectIndicatorPanel(new ImageIcon(tnbbutton.getThumbNail(product.getImage())), product.getName());
CardLayout cl = (CardLayout)(m_jProducts.getLayout());
cl.show(m_jProducts, "PRODUCT." + id);
}
} catch (BasicException eb) {
eb.printStackTrace();
m_productsset.put(id, null);
if (showingcategory == null) {
showRootCategoriesPanel();
} else {
showSubcategoryPanel(showingcategory);
}
}
}
} else {
// already exists
selectIndicatorPanel(new ImageIcon(tnbbutton.getThumbNail(product.getImage())), product.getName());
CardLayout cl = (CardLayout)(m_jProducts.getLayout());
cl.show(m_jProducts, "PRODUCT." + id);
}
}