List of usage examples for java.awt List add
public void add(String item)
From source file:com.openbravo.pos.sales.JRetailPanelTakeAway.java
private void printTicketGeneric(String sresourcename, RetailTicketInfo ticket, Object ticketext) { java.util.List<TicketLineConstructor> allLines = null; java.util.List<TicketLineConstructor> startallLines = new ArrayList<TicketLineConstructor>(); int count = 0; com.openbravo.pos.printer.printer.ImageBillPrinter printer = new ImageBillPrinter(); if (sresourcename.equals("Printer.Bill")) { allLines = getAllLines(ticket, ticketext); } else if (sresourcename.equals("Printer.NonChargableBill")) { allLines = getNonChargeableLines(ticket, ticketext); }//from w w w. j a va 2s . com //try { //printer.print(allLines); // try { int divideLines = allLines.size() / 48; int remainder = allLines.size() % 48; System.out.println("divideLines---" + divideLines + "--" + remainder); int value = 48; int k = 0; if (divideLines > 0) { for (int i = 0; i < divideLines; i++) { for (int j = k; j < value; j++) { startallLines.add(new TicketLineConstructor(allLines.get(j).getLine())); System.out.println("allLines.get(j).getLine()--" + allLines.get(j).getLine()); } try { printer.print(startallLines); } catch (PrinterException ex) { Logger.getLogger(JRetailPanelTicket.class.getName()).log(Level.SEVERE, null, ex); } if (allLines.size() > 48) { try { Thread.sleep(5000); } catch (InterruptedException ex) { Logger.getLogger(JRetailPanelTicket.class.getName()).log(Level.SEVERE, null, ex); } int res = JOptionPane.showConfirmDialog(this, AppLocal.getIntString("message.wannaPrintcontinue"), AppLocal.getIntString("message.title"), JOptionPane.OK_OPTION, JOptionPane.QUESTION_MESSAGE); if (res == JOptionPane.OK_OPTION) { k = value; value = value + 48; startallLines = new ArrayList<TicketLineConstructor>(); System.out.println("startallLinest--" + startallLines.size()); startallLines.clear(); } else { break; } } } } System.out.println("value---" + value + k + "--" + remainder); if (remainder > 0) { startallLines = new ArrayList<TicketLineConstructor>(); System.out.println("startallLinest--" + startallLines.size()); startallLines.clear(); for (int m = k; m < k + remainder; m++) { startallLines.add(new TicketLineConstructor(allLines.get(m).getLine())); System.out.println("allLines.get(j).getLine()--" + allLines.get(m).getLine()); } try { printer.print(startallLines); } catch (PrinterException ex) { Logger.getLogger(JRetailPanelTicket.class.getName()).log(Level.SEVERE, null, ex); } } // try { // printer.print(allLines); // // } catch (PrinterException ex) { // Logger.getLogger(JRetailPanelTakeAway.class.getName()).log(Level.SEVERE, null, ex); // } }
From source file:com.openbravo.pos.sales.JRetailPanelTakeAway.java
public final synchronized void kotDisplay() throws BasicException { kotprintIssue = 0;/*from w ww . j av a 2 s. c o m*/ logger.info("kotaction value" + kotaction); int orderId = 0; if (m_oTicket.getOrderId() == 0) { if (m_oTicket.getLinesCount() != 0) { orderId = dlSales.getNextTicketOrderNumber(); m_oTicket.setOrderId(orderId); } } final int kotTicket; int kotTicketId = 0; kotTicketId = dlSales.getNextKotIndex(); if (kotTicketId == 0) { kotTicket = 1; } else { kotTicket = kotTicketId; // kotTicket = kotTicket+1; } RetailTicketInfo info = getActiveTicket(); java.util.List<kotPrintedInfo> kPrintedInfolist = null; final java.util.List<RetailTicketLineInfo> panelLines = info.getLines(); final java.util.List<RetailTicketLineInfo> panelNonKotLines = new ArrayList(); //Transaction t = new Transaction(m_App.getSession()) { // @Override // protected Object transact() throws BasicException { String sessionId = null; String tableId = null; System.out .println("m_App.getProperties().getProperty(" + m_App.getProperties().getProperty("machine.Floor")); // sessionId = dlReceipts.getTakeAwayFloorId(m_App.getProperties().getProperty("machine.Floor")); java.util.List<BeanInfo> takeawayInfo = dlReceipts.getTakeAwayInfoList(); tableId = takeawayInfo.get(0).getId(); m_oTicket.setPlaceid(tableId); sessionId = takeawayInfo.get(0).getName(); printerInfo = dlReceipts.getPrinterInfo(sessionId); for (int i = 0; i < panelLines.size(); i++) { if (panelLines.get(i).getIsKot() == 0) { String tbl_orderitemId = UUID.randomUUID().toString(); tbl_orderitemId = tbl_orderitemId.replaceAll("-", ""); panelLines.get(i).setTbl_orderId(tbl_orderitemId); panelLines.get(i).setKotid(kotTicket); panelLines.get(i).setKotdate(m_oTicket.getDate()); System.out.println("m_oTicket.getDate()" + m_oTicket.getDate()); panelLines.get(i).setKottable(m_oTicket.getPlaceId()); panelLines.get(i).setKotuser(m_oTicket.getUser().getId()); panelNonKotLines.add(panelLines.get(i)); // panelLines.get(i).setIsKot(1); } // if(panelLines.get(i).getPreparationStatus()!=3){ // panelLines.get(i).setPreparationStatus(4); // } } // Object[] values = new Object[] {m_oTicket.getPlaceId(), m_oTicket.getName(), m_oTicket,m_oTicket.getSplitSharedId(),m_oTicket.isPrinted(),m_oTicket.isListModified()}; // Datas[] datas = new Datas[] {Datas.STRING, Datas.STRING, Datas.SERIALIZABLE, Datas.STRING,Datas.BOOLEAN,Datas.BOOLEAN}; // new PreparedSentence(m_App.getSession() // , "UPDATE SHAREDTICKETS SET NAME = ?, CONTENT = ?, ISPRINTED = ?, ISMODIFIED = ? WHERE ID = ? AND SPLITID=? " // , new SerializerWriteBasicExt(datas, new int[] {1, 2, 4, 5, 0,3})).exec(values); // logger.info("updating shared tickets in kotaction successfully"); printRetailKotTicket("Printer.Kot", m_oTicket, panelNonKotLines, m_oTicketExt, printerInfo, kotTicket); // for(int i=0;i<panelLines.size();i++){ // if(panelLines.get(i).getPreparationStatus()!=3){ // paintKotTicketLine(i, panelLines.get(i)); // } // } // return null; // } // }; // try{ // t.execute(); // logger.info("kot transaction happened successfully"); // kotaction=0; // } catch (Exception e) { // logger.info("kot transaction failed"+e.getMessage()); // for(int i=0;i<panelNonKotLines.size();i++){ // panelNonKotLines.get(i).setIsKot(0); // panelNonKotLines.get(i).setPreparationStatus(0); // } // kotaction=1; // showMessage(this, "please re try the KOT action"); // } Runtime.getRuntime().gc(); System.out.println("current time after kot" + new Date()); }
From source file:op.allowance.PnlAllowance.java
private java.util.List<Component> addFilters() { java.util.List<Component> list = new ArrayList<Component>(); txtSearch = new JXSearchField(SYSTools.xx("misc.msg.residentsearch")); txtSearch.setFont(SYSConst.ARIAL14); txtSearch.setInstantSearchDelay(100000); txtSearch.addActionListener(new ActionListener() { @Override//from w ww . j a va2 s . com public void actionPerformed(ActionEvent e) { ArrayList<Resident> listSearchResidents = ResidentTools.getBy(txtSearch.getText().trim(), OPDE.getAppInfo().isAllowedTo(InternalClassACL.ARCHIVE, internalClassID)); if (listSearchResidents != null && !listSearchResidents.isEmpty()) { cmbResident.setModel(SYSTools.list2cmb(listSearchResidents)); lstResidents = new ArrayList<Resident>(); lstResidents.add((Resident) cmbResident.getSelectedItem()); reloadDisplay(); } else { OPDE.getDisplayManager().addSubMessage(new DisplayMessage("misc.msg.nodata")); } } }); list.add(txtSearch); cmbResident = new JComboBox(); cmbResident.setFont(SYSConst.ARIAL14); cmbResident.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { lstResidents = new ArrayList<Resident>(); lstResidents.add((Resident) e.getItem()); reloadDisplay(); } } }); list.add(cmbResident); final JideButton btnAllActiveResidents = GUITools.createHyperlinkButton( SYSTools.xx("admin.residents.cash.showallactiveresidents"), SYSConst.icon22residentActive, null); btnAllActiveResidents.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { lstResidents = ResidentTools.getAllActive(); reloadDisplay(); } }); list.add(btnAllActiveResidents); if (OPDE.getAppInfo().isAllowedTo(InternalClassACL.ARCHIVE, internalClassID)) { final JideButton btnAllInactiveResidents = GUITools.createHyperlinkButton( SYSTools.xx("admin.residents.cash.showallinactiveresidents"), SYSConst.icon22residentInactive, null); btnAllInactiveResidents.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { lstResidents = ResidentTools.getAllInactive(); reloadDisplay(); } }); list.add(btnAllInactiveResidents); final JideButton btnAllResidents = GUITools.createHyperlinkButton( SYSTools.xx("admin.residents.cash.showallresidents"), SYSConst.icon22residentBoth, null); btnAllResidents.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { lstResidents = ResidentTools.getAllInactive(); lstResidents.addAll(ResidentTools.getAllActive()); Collections.sort(lstResidents); reloadDisplay(); } }); list.add(btnAllResidents); } return list; }
From source file:op.allowance.PnlAllowance.java
private java.util.List<Component> addCommands() { java.util.List<Component> list = new ArrayList<Component>(); final JideButton btnNewTX = GUITools.createHyperlinkButton(SYSTools.xx("admin.residents.cash.enterTXs"), SYSConst.icon22add, null);//from w w w . j a va 2s .c om btnNewTX.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { // PnlTX pnlTX = new PnlTX(new Allowance(currentResident), new Closure() { // @Override // public void execute(Object o) { // // OPDE.debug(o); // if (o != null) { // // EntityManager em = OPDE.createEM(); // try { // em.getTransaction().begin(); // final Allowance myAllowance = em.merge((Allowance) o); // em.lock(em.merge(myAllowance.getResident()), LockModeType.OPTIMISTIC); // em.getTransaction().commit(); // // // } catch (OptimisticLockException ole) { // OPDE.warn(ole); // if (em.getTransaction().isActive()) { // em.getTransaction().rollback(); // } // if (ole.getMessage().indexOf("Class> entity.info.Resident") > -1) { // OPDE.getMainframe().emptyFrame(); // OPDE.getMainframe().afterLogin(); // } // OPDE.getDisplayManager().addSubMessage(DisplayManager.getLockMessage()); // } catch (Exception e) { // if (em.getTransaction().isActive()) { // em.getTransaction().rollback(); // } // OPDE.fatal(e); // } finally { // em.close(); // } // // } // } // }); MyJDialog myJDialog = new MyJDialog(true); myJDialog.setContentPane(getPnlTX(null, null)); myJDialog.pack(); myJDialog.setVisible(true); } }); list.add(btnNewTX); if (OPDE.getAppInfo().isAllowedTo(InternalClassACL.MANAGER, internalClassID)) { final JideButton btnPrintStat = GUITools.createHyperlinkButton( SYSTools.xx("admin.residents.cash.printstat"), SYSConst.icon22calc, null); btnPrintStat.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { SYSFilesTools.print(AllowanceTools.getOverallSumAsHTML(12), false); } }); list.add(btnPrintStat); } return list; }
From source file:op.care.bhp.PnlBHP.java
private java.util.List<Component> addKey() { java.util.List<Component> list = new ArrayList<Component>(); list.add(new JSeparator()); list.add(new JLabel(SYSTools.xx("misc.msg.key"))); list.add(new JLabel(SYSTools.xx("nursingrecords.bhp.keydescription3"), SYSConst.icon22stopSign, SwingConstants.LEADING)); list.add(new JLabel(SYSTools.xx("nursingrecords.bhp.keydescription1"), SYSConst.icon22ledYellowOn, SwingConstants.LEADING)); list.add(new JLabel(SYSTools.xx("nursingrecords.bhp.keydescription2"), SYSConst.icon22ledRedOn, SwingConstants.LEADING)); list.add(new JLabel(SYSTools.xx("nursingrecords.bhp.keydescription4"), SYSConst.icon22ledOrangeOn, SwingConstants.LEADING)); return list;/*from ww w .j a v a 2 s . c o m*/ }
From source file:op.care.bhp.PnlBHP.java
private java.util.List<Component> addFilter() { java.util.List<Component> list = new ArrayList<Component>(); jdcDatum = new JDateChooser(new Date()); jdcDatum.setFont(new Font("Arial", Font.PLAIN, 18)); jdcDatum.setMinSelectableDate(BHPTools.getMinDatum(resident)); jdcDatum.setBackground(Color.WHITE); jdcDatum.addPropertyChangeListener(new PropertyChangeListener() { @Override/* ww w . j av a 2s. c o m*/ public void propertyChange(PropertyChangeEvent evt) { if (initPhase) { return; } if (evt.getPropertyName().equals("date")) { reloadDisplay(); } } }); list.add(jdcDatum); JPanel buttonPanel = new JPanel(); buttonPanel.setBackground(Color.WHITE); buttonPanel.setLayout(new HorizontalLayout(5)); buttonPanel.setBorder(new EmptyBorder(0, 0, 0, 0)); JButton homeButton = new JButton( new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_start.png"))); homeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { jdcDatum.setDate(jdcDatum.getMinSelectableDate()); } }); homeButton.setPressedIcon( new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_start_pressed.png"))); homeButton.setBorder(null); homeButton.setBorderPainted(false); homeButton.setOpaque(false); homeButton.setContentAreaFilled(false); homeButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); JButton backButton = new JButton( new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_back.png"))); backButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { DateMidnight current = new DateMidnight(jdcDatum.getDate()); DateMidnight min = new DateMidnight(jdcDatum.getMinSelectableDate()); if (current.equals(min)) { return; } jdcDatum.setDate(SYSCalendar.addDate(jdcDatum.getDate(), -1)); } }); backButton .setPressedIcon(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_back_pressed.png"))); backButton.setBorder(null); backButton.setBorderPainted(false); backButton.setOpaque(false); backButton.setContentAreaFilled(false); backButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); JButton fwdButton = new JButton(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_play.png"))); fwdButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { DateMidnight current = new DateMidnight(jdcDatum.getDate()); if (current.equals(new DateMidnight())) { return; } jdcDatum.setDate(SYSCalendar.addDate(jdcDatum.getDate(), 1)); } }); fwdButton .setPressedIcon(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_play_pressed.png"))); fwdButton.setBorder(null); fwdButton.setBorderPainted(false); fwdButton.setOpaque(false); fwdButton.setContentAreaFilled(false); fwdButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); JButton endButton = new JButton(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_end.png"))); endButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { jdcDatum.setDate(new Date()); } }); endButton.setPressedIcon(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_end_pressed.png"))); endButton.setBorder(null); endButton.setBorderPainted(false); endButton.setOpaque(false); endButton.setContentAreaFilled(false); endButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); buttonPanel.add(homeButton); buttonPanel.add(backButton); buttonPanel.add(fwdButton); buttonPanel.add(endButton); list.add(buttonPanel); // panelFilter.setContentPane(labelPanel); return list; }
From source file:op.care.bhp.PnlBHP.java
private java.util.List<Component> addCommands() { java.util.List<Component> list = new ArrayList<Component>(); final JideButton printPrescription = GUITools.createHyperlinkButton("nursingrecords.dfn.print", SYSConst.icon22print2, new ActionListener() { @Override/* w w w. j a v a2s .com*/ public void actionPerformed(ActionEvent actionEvent) { String html = ""; synchronized (mapShift2BHP) { html += "<h1 id=\"fonth1\" >" + ResidentTools.getFullName(resident) + "</h1>"; html += SYSConst.html_h2(SYSTools.xx("nursingrecords.bhp") + ": " + SYSConst.html_bold(DateFormat.getDateInstance().format(jdcDatum.getDate()))); for (Byte shift : new Byte[] { BHPTools.SHIFT_ON_DEMAND, BHPTools.SHIFT_OUTCOMES, BHPTools.SHIFT_VERY_EARLY, BHPTools.SHIFT_EARLY, BHPTools.SHIFT_LATE, BHPTools.SHIFT_VERY_LATE }) { if (mapShift2BHP.containsKey(shift)) { html += BHPTools.getBHPsAsHTMLtable(mapShift2BHP.get(shift), true); } } } SYSFilesTools.print(html, true); } }); list.add(printPrescription); return list; }
From source file:op.care.med.structure.PnlMed.java
private java.util.List<TradeForm> getTradeForms() { java.util.List result = new ArrayList(); EntityManager em = OPDE.createEM();/*from w ww . j a va2 s . com*/ Query query = em.createQuery( "SELECT m FROM TradeForm m WHERE m.medProduct = :medProdukt ORDER BY m.dosageForm.preparation"); query.setParameter("medProdukt", product); java.util.List<TradeForm> listDAF = query.getResultList(); em.close(); for (TradeForm daf : listDAF) { DefaultMutableTreeNode nodeDAF = new DefaultMutableTreeNode(daf); SYSTools.addAllNodes(nodeDAF, getPackung(daf)); result.add(nodeDAF); } return result; }
From source file:op.care.med.structure.PnlMed.java
private java.util.List getPackung(TradeForm darreichung) { java.util.List result = new ArrayList(); for (MedPackage aPackage : darreichung.getPackages()) { result.add(new DefaultMutableTreeNode(aPackage)); }/* www . j ava2 s .co m*/ return result; }
From source file:op.care.med.structure.PnlMed.java
private java.util.List<Component> addFilters() { java.util.List<Component> list = new ArrayList<Component>(); tbIDs = GUITools.getNiceToggleButton("misc.msg.showIDs"); tbIDs.addItemListener(new ItemListener() { @Override/* www . java2 s .co m*/ public void itemStateChanged(ItemEvent e) { reload(); } }); tbIDs.setHorizontalAlignment(SwingConstants.LEFT); list.add(tbIDs); txtSuche = new JXSearchField("Suchen"); txtSuche.setFont(SYSConst.ARIAL14); txtSuche.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { txtSucheActionPerformed(actionEvent); } }); txtSuche.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent focusEvent) { SYSTools.markAllTxt(txtSuche); } }); list.add(txtSuche); lstPraep = new JList(new DefaultListModel()); lstPraep.setCellRenderer(MedProductsTools.getMedProdukteRenderer()); lstPraep.setFont(SYSConst.ARIAL14); lstPraep.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent listSelectionEvent) { lstPraepValueChanged(listSelectionEvent); } }); lstPraep.setFixedCellWidth(200); list.add(new JScrollPane(lstPraep)); return list; }