/** * Creates new form JLinesTicket * * @param ticketline */ public JTicketLines(String ticketline) { initComponents(); ColumnTicket[] acolumns = new ColumnTicket[0]; if (ticketline != null) { try { if (m_sp == null) { SAXParserFactory spf = SAXParserFactory.newInstance(); m_sp = spf.newSAXParser(); } ColumnsHandler columnshandler = new ColumnsHandler(); m_sp.parse(new InputSource(new StringReader(ticketline)), columnshandler); acolumns = columnshandler.getColumns(); } catch (ParserConfigurationException ePC) { logger.log(Level.WARNING, LocalRes.getIntString("exception.parserconfig"), ePC); } catch (SAXException eSAX) { logger.log(Level.WARNING, LocalRes.getIntString("exception.xmlfile"), eSAX); } catch (IOException eIO) { logger.log(Level.WARNING, LocalRes.getIntString("exception.iofile"), eIO); } } m_jTableModel = new TicketTableModel(acolumns); m_jTicketTable.setModel(m_jTableModel); // m_jTicketTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); TableColumnModel jColumns = m_jTicketTable.getColumnModel(); for (int i = 0; i < acolumns.length; i++) { jColumns.getColumn(i).setPreferredWidth(acolumns[i].width); jColumns.getColumn(i).setResizable(false); } m_jScrollTableTicket.getVerticalScrollBar().setPreferredSize(new Dimension(35, 35)); m_jTicketTable.getTableHeader().setReorderingAllowed(false); m_jTicketTable.setDefaultRenderer(Object.class, new TicketCellRenderer(acolumns)); // m_jTicketTable.setDefaultRenderer(Object.class, new TicketCellRendererSent(acolumns)); m_jTicketTable.setRowHeight(40); m_jTicketTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // reseteo la tabla... m_jTableModel.clear(); }
/** @return */ public String getMessageMsg() { StringBuilder sb = new StringBuilder(); int iSignalWord = getSignalWord(); if (iSignalWord == SGN_DANGER) { sb.append(LocalRes.getIntString("sgn.danger")); } else if (iSignalWord == SGN_WARNING) { sb.append(LocalRes.getIntString("sgn.warning")); } else if (iSignalWord == SGN_CAUTION) { sb.append(LocalRes.getIntString("sgn.caution")); } else if (iSignalWord == SGN_NOTICE) { // sb.append(LocalRes.getIntString("sgn.notice")); } else if (iSignalWord == SGN_IMPORTANT) { sb.append(LocalRes.getIntString("sgn.important")); } else if (iSignalWord == SGN_SUCCESS) { sb.append(LocalRes.getIntString("sgn.success")); } else { sb.append(LocalRes.getIntString("sgn.unknown")); } sb.append(m_sHazard); sb.append(m_sConsequences); sb.append(m_sAvoiding); return sb.toString(); }