本文整理汇总了Java中com.openbravo.pos.ticket.CategoryInfo类的典型用法代码示例。如果您正苦于以下问题:Java CategoryInfo类的具体用法?Java CategoryInfo怎么用?Java CategoryInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CategoryInfo类属于com.openbravo.pos.ticket包,在下文中一共展示了CategoryInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import com.openbravo.pos.ticket.CategoryInfo; //导入依赖的package包/类
/**
* This is the action called from the Struts framework.
* @param mapping The ActionMapping used to select this instance.
* @param form The optional ActionForm bean for this request.
* @param request The HTTP Request we are processing.
* @param response The HTTP Response we are processing.
* @throws java.lang.Exception
* @return
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
DynaActionForm inputFormPlace = (DynaActionForm) form;
RestaurantManager manager = new RestaurantManager();
List<CategoryInfo> categories = new ArrayList<CategoryInfo>();
categories = manager.findAllCategories();
List products = new ArrayList<ProductInfo>();
products = manager.findProductsByCategory(categories.get(0).getId());
List taxRates = new ArrayList<String>();
taxRates = manager.findAllTaxRatesByCategory(products);
List subcategories = new ArrayList<CategoryInfo>();
subcategories = manager.findAllSubcategories(categories.get(0).getId());
request.setAttribute("products", products);
request.setAttribute("rates", taxRates);
request.getSession().setAttribute("place", (String) inputFormPlace.get("place"));
request.setAttribute("placeName", manager.findPlaceNameById((String) inputFormPlace.get("place")));
request.setAttribute("categories", categories);
request.setAttribute("subcategories", subcategories);
request.getSession().setAttribute("floorId", (String) inputFormPlace.get("floorId"));
return mapping.findForward(SUCCESS);
}
示例2: findAllCategories
import com.openbravo.pos.ticket.CategoryInfo; //导入依赖的package包/类
public List<CategoryInfo> findAllCategories() {
Connection con = null;
PreparedStatement ps = null;
ResultSet rs = null;
List<CategoryInfo> vos = null;
String sqlStr = "select * from CATEGORIES where PARENTID IS NULL order by NAME";
try {
//get connection
con = getConnection();
//prepare statement
ps = con.prepareStatement(sqlStr);
//execute
rs = ps.executeQuery();
//transform to VO
vos = transformSet(rs);
} catch (Exception ex) {
ex.printStackTrace();
} finally {
try {
// close the resources
if (ps != null) {
ps.close();
}
if (con != null) {
con.close();
}
} catch (SQLException sqlee) {
sqlee.printStackTrace();
}
}
return vos;
}
示例3: findAllSubcategories
import com.openbravo.pos.ticket.CategoryInfo; //导入依赖的package包/类
public List<CategoryInfo> findAllSubcategories(String id) {
Connection con = null;
PreparedStatement ps = null;
ResultSet rs = null;
List<CategoryInfo> vos = null;
String sqlStr = "select * from CATEGORIES where PARENTID = ? order by NAME";
try {
//get connection
con = getConnection();
//prepare statement
ps = con.prepareStatement(sqlStr);
ps.setString(1, id);
//execute
rs = ps.executeQuery();
//transform to VO
vos = transformSet(rs);
} catch (Exception ex) {
ex.printStackTrace();
} finally {
try {
// close the resources
if (ps != null) {
ps.close();
}
if (con != null) {
con.close();
}
} catch (SQLException sqlee) {
sqlee.printStackTrace();
}
}
return vos;
}
示例4: findFirstCategory
import com.openbravo.pos.ticket.CategoryInfo; //导入依赖的package包/类
public String findFirstCategory() {
Connection con = null;
PreparedStatement ps = null;
ResultSet rs = null;
List<CategoryInfo> vos = null;
String sqlStr = "select * from CATEGORIES where PARENTID IS NULL order by NAME";
try {
//get connection
con = getConnection();
//prepare statement
ps = con.prepareStatement(sqlStr);
//execute
rs = ps.executeQuery();
//transform to VO
vos = transformSet(rs);
} catch (Exception ex) {
ex.printStackTrace();
} finally {
try {
// close the resources
if (ps != null) {
ps.close();
}
if (con != null) {
con.close();
}
} catch (SQLException sqlee) {
sqlee.printStackTrace();
}
}
return vos.get(0).getId();
}
示例5: map2VO
import com.openbravo.pos.ticket.CategoryInfo; //导入依赖的package包/类
@Override
protected CategoryInfo map2VO(ResultSet rs) throws SQLException {
CategoryInfo category = new CategoryInfo();
category.setId(rs.getString("id"));
category.setParentid(rs.getString("parentid"));
category.setName(rs.getString("name"));
return category;
}
示例6: loadCatalog
import com.openbravo.pos.ticket.CategoryInfo; //导入依赖的package包/类
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);
}
// Display catalog panel
showRootCategoriesPanel();
}
示例7: selectCategoryPanel
import com.openbravo.pos.ticket.CategoryInfo; //导入依赖的package包/类
private void selectCategoryPanel(String catid) {
try {
// Load categories panel if not exists
if (!m_categoriesset.contains(catid)) {
JCatalogTab jcurrTab = new JCatalogTab();
jcurrTab.applyComponentOrientation(getComponentOrientation());
m_jProducts.add(jcurrTab, catid);
m_categoriesset.add(catid);
// Add subcategories
java.util.List<CategoryInfo> categories = m_dlSales.getSubcategories(catid);
for (CategoryInfo cat : categories) {
jcurrTab.addButton(new ImageIcon(tnbbutton.getThumbNailText(cat.getImage(), cat.getName())), new SelectedCategory(cat));
}
// Add products
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));
}
}
// Show categories panel
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));
}
}
示例8: showRootCategoriesPanel
import com.openbravo.pos.ticket.CategoryInfo; //导入依赖的package包/类
private void showRootCategoriesPanel() {
selectIndicatorCategories();
// Show selected root category
CategoryInfo cat = (CategoryInfo) m_jListCategories.getSelectedValue();
if (cat != null) {
selectCategoryPanel(cat.getID());
}
showingcategory = null;
}
示例9: getListCellRendererComponent
import com.openbravo.pos.ticket.CategoryInfo; //导入依赖的package包/类
@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;
}
示例10: m_jListCategoriesValueChanged
import com.openbravo.pos.ticket.CategoryInfo; //导入依赖的package包/类
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());
}
}
}
示例11: syncCategory
import com.openbravo.pos.ticket.CategoryInfo; //导入依赖的package包/类
public void syncCategory(final CategoryInfo cat) throws BasicException {
Transaction t = new Transaction(s) {
public Object transact() throws BasicException {
// Sync the Category in a transaction
// Try to update
if (new PreparedSentence(s,
"UPDATE CATEGORIES SET NAME = ?, IMAGE = ? WHERE ID = ?",
SerializerWriteParams.INSTANCE
).exec(new DataParams() { public void writeValues() throws BasicException {
setString(1, cat.getName());
setBytes(2, ImageUtils.writeImage(cat.getImage()));
setString(3, cat.getID());
}}) == 0) {
// If not updated, try to insert
new PreparedSentence(s,
"INSERT INTO CATEGORIES(ID, NAME, IMAGE) VALUES (?, ?, ?)",
SerializerWriteParams.INSTANCE
).exec(new DataParams() { public void writeValues() throws BasicException {
setString(1, cat.getID());
setString(2, cat.getName());
setBytes(3, ImageUtils.writeImage(cat.getImage()));
}});
}
return null;
}
};
t.execute();
}
示例12: loadCatalog
import com.openbravo.pos.ticket.CategoryInfo; //导入依赖的package包/类
/**
*
* @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);
}
// Display catalog panel
showRootCategoriesPanel();
}
示例13: selectCategoryPanel
import com.openbravo.pos.ticket.CategoryInfo; //导入依赖的package包/类
private void selectCategoryPanel(String catid) {
try {
// Load categories panel if not exists
if (!m_categoriesset.contains(catid)) {
JCatalogTab jcurrTab = new JCatalogTab();
jcurrTab.applyComponentOrientation(getComponentOrientation());
m_jProducts.add(jcurrTab, catid);
m_categoriesset.add(catid);
// Add subcategories
java.util.List<CategoryInfo> categories = m_dlSales.getSubcategories(catid);
for (CategoryInfo cat : categories) {
// these the sub categories displayed in the main products Panel
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());
}
}
// Add products
java.util.List<ProductInfoExt> products = m_dlSales.getProductCatalog(catid);
for (ProductInfoExt prod : products) {
// These are the products selection panel
jcurrTab.addButton( new ImageIcon(tnbbutton.getThumbNailText(prod.getImage(), getProductLabel(prod))), new SelectedAction(prod),prod.getTextTip());
}
}
// Show categories panel
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));
}
}
示例14: showSubcategoryPanel
import com.openbravo.pos.ticket.CategoryInfo; //导入依赖的package包/类
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;
}
示例15: selectCategoryPanel
import com.openbravo.pos.ticket.CategoryInfo; //导入依赖的package包/类
private void selectCategoryPanel(String catid) {
try {
// Load categories panel if not exists
if (!m_categoriesset.contains(catid)) {
JCatalogTab jcurrTab = new JCatalogTab();
jcurrTab.applyComponentOrientation(getComponentOrientation());
m_jProducts.add(jcurrTab, catid);
m_categoriesset.add(catid);
// Add subcategories
java.util.List<CategoryInfo> categories = m_dlSales.getSubcategories(catid);
for (CategoryInfo cat : categories) {
// these the sub categories displayed in the main products Panel
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());
}
}
// Add products
java.util.List<ProductInfoExt> products = m_dlSales.getProductCatalog(catid);
for (ProductInfoExt prod : products) {
// These are the products selection panel
jcurrTab.addButton(new ImageIcon(tnbbutton.getThumbNailText(prod.getImage(), getProductLabel(prod))), new SelectedAction(prod),prod.getTextTip());
}
}
// Show categories panel
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));
}
}