Examples of ItemLine


Examples of eu.flatworld.cstrader.data.ItemLine

    }//GEN-LAST:event_jpmWantedPopupMenuWillBecomeVisible

    private void jmiWantedEditPriceWatchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiWantedEditPriceWatchActionPerformed
        ItemsTableModel model = (ItemsTableModel) jtWanted.getModel();
        int row = jtWanted.getSelectedRow();
        ItemLine i = model.getItemAtRow(jtWanted.convertRowIndexToModel(row));
        ItemProperty ip = itemsProperties.get(i.getItem().getName());
        if (ip == null) {
            ip = new ItemProperty();
            ip.setName(i.getItem().getName());
        }
        PriceWatchDialog pwd = new PriceWatchDialog(JOptionPane.getFrameForComponent(this), ip);
        pwd.setVisible(true);
        if (pwd.getItemPorperties() != null) {
            itemsProperties.put(ip.getName(), ip);
View Full Code Here

Examples of eu.flatworld.cstrader.data.ItemLine

    }//GEN-LAST:event_jmiWantedEditPriceWatchActionPerformed

    private void jmicbWantedIgnoreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmicbWantedIgnoreActionPerformed
        ItemsTableModel model = (ItemsTableModel) jtWanted.getModel();
        int row = jtWanted.getSelectedRow();
        ItemLine i = model.getItemAtRow(jtWanted.convertRowIndexToModel(row));
        LocationProperty ln = locationsProperties.get(i.getLocation().getName());
        if (ln == null) {
            ln = new LocationProperty();
            ln.setName(i.getLocation().getName());
            ln.setIgnore(false);
            locationsProperties.put(ln.getName(), ln);
        }
        ln.setIgnore(jmicbWantedIgnore.isSelected());
        firePropertyChange(P_PRICELISTUPDATED, null, pricelist);
View Full Code Here

Examples of eu.flatworld.cstrader.data.ItemLine

    }//GEN-LAST:event_jmicbWantedIgnoreActionPerformed

    private void jmiForSaleEditPriceWatchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiForSaleEditPriceWatchActionPerformed
        ItemsTableModel model = (ItemsTableModel) jtForSale.getModel();
        int row = jtForSale.getSelectedRow();
        ItemLine i = model.getItemAtRow(jtForSale.convertRowIndexToModel(row));
        ItemProperty ip = itemsProperties.get(i.getItem().getName());
        if (ip == null) {
            ip = new ItemProperty();
            ip.setName(i.getItem().getName());
        }
        PriceWatchDialog pwd = new PriceWatchDialog(JOptionPane.getFrameForComponent(this), ip);
        pwd.setVisible(true);
        if (pwd.getItemPorperties() != null) {
            itemsProperties.put(ip.getName(), ip);
View Full Code Here

Examples of eu.flatworld.cstrader.data.ItemLine

    }//GEN-LAST:event_jmiForSaleEditPriceWatchActionPerformed

    private void jmicbForSaleIgnoreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmicbForSaleIgnoreActionPerformed
        ItemsTableModel model = (ItemsTableModel) jtForSale.getModel();
        int row = jtForSale.getSelectedRow();
        ItemLine i = model.getItemAtRow(jtForSale.convertRowIndexToModel(row));
        LocationProperty ln = locationsProperties.get(i.getLocation().getName());
        if (ln == null) {
            ln = new LocationProperty();
            ln.setName(i.getLocation().getName());
            ln.setIgnore(false);
            locationsProperties.put(ln.getName(), ln);
        }
        ln.setIgnore(jmicbForSaleIgnore.isSelected());
        firePropertyChange(P_PRICELISTUPDATED, null, pricelist);
View Full Code Here

Examples of eu.flatworld.cstrader.data.ItemLine

        return data.size();
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        ItemLine i = data.get(rowIndex);
        switch (columnIndex) {
            case 0:
                return i.getItem().getName();
            case 1:
                return i.getItem().getWeight();
            case 2:
                return i.getQuantity();
            case 3:
                return i.getPrice();
            case 4:
                return i.getLocation().getName();
        }
        return null;
    }
View Full Code Here

Examples of eu.flatworld.cstrader.data.ItemLine

        return forSale;
    }

    @Override
    public void setValueAt(Object value, int rowIndex, int columnIndex) {
        ItemLine i = data.get(rowIndex);
        switch (columnIndex) {
            case 2:
                i.setQuantity((Long) value);
            default:
                return;
        }
    }
View Full Code Here

Examples of eu.flatworld.cstrader.data.ItemLine

        Matcher m = Pattern.compile(pattern).matcher(text);

        while (m.find()) {
            // groups: 1-itemid, 2-item name, 3-quantity, 4-weight or null
            // 5-price 6,7,8-sys,sec,grid 9-place name
            ItemLine itemLine = new ItemLine();
            itemLine.setItem(new Item());
            itemLine.getItem().setName(m.group(2).replace('*', ' ').trim());
            itemLine.setQuantity(Long.parseLong(m.group(3)));
            if (m.group(4) == null) {
                itemLine.setForSale(false);
                itemLine.getItem().setWeight(PricelistsTools.loadWeight(itemLine.getItem().getName()));
            } else {
                itemLine.setForSale(true);
                long w = Long.parseLong(m.group(4));
                weightCache.put(itemLine.getItem().getName(), new Long(w));
                itemLine.getItem().setWeight(w);
            }
            itemLine.setPrice(Long.parseLong(m.group(5)));
            Location l = new Location();
            l.setName(m.group(9).trim());
            Long grd = Long.parseLong(m.group(8));
            if (grd == 190) {
                l.setPlanet(true);
            } else {
                l.setPlanet(false);
            }
            l.setGrid(grd);
            Long sector = Long.parseLong(m.group(7));
            l.setSector(sector);
            // get system id (6) and cross check
            l.setSystem(galaxy);
            // NEW: stash coords in file.
            LocationProperty lp = locationsProperties.get(itemLine.getItem().getName());
            if (lp == null) {
                lp = new LocationProperty();
            }
            lp.setLocation(galaxy, sector, grd);
            locationsProperties.put(itemLine.getItem().getName(), lp);

            itemLine.setLocation(l);
            if (itemLine.isForSale()) {
                pl.getForSale().add(itemLine);
            } else {
                pl.getWanted().add(itemLine);
            }
        }
View Full Code Here

Examples of eu.flatworld.cstrader.data.ItemLine

            if (forSale) {
                try {
                    int begin = 0;
                    int end = 0;
                    ItemLine itemLine = new ItemLine();
                    itemLine.setItem(new Item());
                    itemLine.setForSale(true);
                    begin = 0;
                    end = row.indexOf("X ", begin);
                    if (Character.isDigit(row.charAt(end + 2))) {
                        //the X of the price
                        itemLine.getItem().setName(row.substring(begin, end).replace('*', ' ').trim());
                    } else {
                        //next X
                        end = row.indexOf("X ", end + 1);
                        itemLine.getItem().setName(row.substring(begin, end).replace('*', ' ').trim());
                    }


                    begin = end + 2;
                    end = row.indexOf(" (", begin);
                    String qty = row.substring(begin, end).trim();
                    itemLine.setQuantity(Long.parseLong(qty));

                    begin = end + 2;
                    end = row.indexOf("Isaton");
                    String weight = row.substring(begin, end).trim();
                    long w = Long.parseLong(weight);
                    weightCache.put(itemLine.getItem().getName(), new Long(w));
                    itemLine.getItem().setWeight(w);

                    begin = row.indexOf("for $") + 5;
                    end = row.indexOf(" ", begin);
                    itemLine.setPrice(Long.parseLong(row.substring(begin, end).trim()));

                    Location l = new Location();
                    begin = end + 1;
                    l.setName(row.substring(begin).trim());
                    if (planet) {
                        l.setPlanet(true);
                        l.setSystem(galaxy);
                    }
                    if (starbase) {
                        l.setPlanet(false);
                        l.setSystem(galaxy);
                    }
                    // JUST a sec, lets check the coord cache.
                    LocationProperty lp = locationsProperties.get(itemLine.getItem().getName());
                    if (lp != null) {
                        l.setSector(lp.getSector());
                        l.setGrid(lp.getGrid());
                    }
                    itemLine.setLocation(l);
                    pl.getForSale().add(itemLine);
                } catch (Exception ex) {
                    throw new Exception("Impossible to import the pricelist. Offending line: " + row, ex);
                }
            }
            if (wanted) {
                try {
                    int begin = 0;
                    int end = 0;
                    ItemLine itemLine = new ItemLine();
                    itemLine.setItem(new Item());
                    itemLine.setForSale(false);
                    begin = 0;
                    end = row.indexOf("X ", begin);
                    if (Character.isDigit(row.charAt(end + 2))) {
                        //the X of the price
                        itemLine.getItem().setName(row.substring(begin, end).replace('*', ' ').trim());
                    } else {
                        //next X
                        end = row.indexOf("X ", end + 1);
                        itemLine.getItem().setName(row.substring(begin, end).replace('*', ' ').trim());
                    }

                    begin = end + 2;
                    end = row.indexOf(" ", begin);
                    String qty = row.substring(begin, end).trim();
                    itemLine.setQuantity(Long.parseLong(qty));

                    begin = row.indexOf("at $") + 4;
                    end = row.indexOf(" ", begin);
                    itemLine.setPrice(Long.parseLong(row.substring(begin, end).trim()));

                    itemLine.getItem().setWeight(PricelistsTools.loadWeight(itemLine.getItem().getName()));

                    Location l = new Location();
                    if (planet) {
                        begin = row.indexOf("CE") + 2;
                        l.setName(row.substring(begin).trim());
                        l.setPlanet(true);
                        l.setSystem(galaxy);
                    }
                    if (starbase) {
                        begin = end + 1;
                        l.setName(row.substring(begin).trim());
                        l.setPlanet(false);
                        l.setSystem(galaxy);
                    }
                    // JUST a sec, lets check the coord cache.
                    LocationProperty lp = locationsProperties.get(itemLine.getItem().getName());
                    if (lp != null) {
                        l.setSector(lp.getSector());
                        l.setGrid(lp.getGrid());
                    }
                    itemLine.setLocation(l);
                    pl.getWanted().add(itemLine);
                } catch (Exception ex) {
                    throw new Exception("Impossible to import the pricelist. Offending line: " + row, ex);
                }
            }
View Full Code Here

Examples of eu.flatworld.cstrader.data.ItemLine

        Matcher m = Pattern.compile(pattern).matcher(text);

        while (m.find()) {
            // groups: 1-itemid, 2-item name, 3-quantity, 4-weight or null
            // 5-price 6,7,8-sys,sec,grid 9-place name
            ItemLine itemLine = new ItemLine();
            itemLine.setItem(new Item());
            itemLine.getItem().setName(m.group(2).replace('*', ' ').trim());
            itemLine.setQuantity(Long.parseLong(m.group(3)));
            if (m.group(4) == null) {
                itemLine.setForSale(false);
                itemLine.getItem().setWeight(PricelistsTools.loadWeight(itemLine.getItem().getName()));
            } else {
                itemLine.setForSale(true);
                long w = Long.parseLong(m.group(4));
                weightCache.put(itemLine.getItem().getName(), new Long(w));
                itemLine.getItem().setWeight(w);
            }
            itemLine.setPrice(Long.parseLong(m.group(5)));
            Location l = new Location();
            l.setName(m.group(9).trim());
            Long grd = Long.parseLong(m.group(8));
            if (grd == 190) {
                l.setPlanet(true);
            } else {
                l.setPlanet(false);
            }
            l.setGrid(grd);
            Long sector = Long.parseLong(m.group(7));
            l.setSector(sector);
            // get system id (6) and cross check
            Integer sysid = Integer.parseInt(m.group(6));
            System system = System.findSystemById(sysid);
            l.setSystem(system);

            // NEW: stash coords in file.
            LocationProperty lp = locationsProperties.get(itemLine.getItem().getName());
            if (lp == null) {
                lp = new LocationProperty();
            }
            lp.setLocation(system, sector, grd);
            locationsProperties.put(itemLine.getItem().getName(), lp);

            itemLine.setLocation(l);
            if (itemLine.isForSale()) {
                newpls[system.ordinal()].getForSale().add(itemLine);
            } else {
                newpls[system.ordinal()].getWanted().add(itemLine);
            }
        }
View Full Code Here

Examples of eu.flatworld.cstrader.data.ItemLine

            if (forSale) {
                try {
                    int begin = 0;
                    int end = 0;
                    ItemLine itemLine = new ItemLine();
                    itemLine.setItem(new Item());
                    itemLine.setForSale(true);
                    begin = 0;
                    end = row.indexOf("X ", begin);
                    if (Character.isDigit(row.charAt(end + 2))) {
                        //the X of the price
                        itemLine.getItem().setName(row.substring(begin, end).replace('*', ' ').trim());
                    } else {
                        //next X
                        end = row.indexOf("X ", end + 1);
                        itemLine.getItem().setName(row.substring(begin, end).replace('*', ' ').trim());
                    }


                    begin = end + 2;
                    end = row.indexOf(" (", begin);
                    String qty = row.substring(begin, end).trim();
                    itemLine.setQuantity(Long.parseLong(qty));

                    begin = end + 2;
                    end = row.indexOf("Isaton");
                    String weight = row.substring(begin, end).trim();
                    long w = Long.parseLong(weight);
                    weightCache.put(itemLine.getItem().getName(), new Long(w));
                    itemLine.getItem().setWeight(w);

                    begin = row.indexOf("for $") + 5;
                    end = row.indexOf(" ", begin);
                    itemLine.setPrice(Long.parseLong(row.substring(begin, end).trim()));

                    Location l = new Location();
                    begin = end + 1;
                    l.setName(row.substring(begin).replace('*', ' ').trim());
                    if (planet) {
                        l.setPlanet(true);
                        l.setSystem(cursys);
                    }
                    if (starbase) {
                        l.setPlanet(false);
                        l.setSystem(cursys);
                    }
                    // JUST a sec, lets check the coord cache.
                    LocationProperty lp = locationsProperties.get(itemLine.getItem().getName());
                    if (lp != null) {
                        l.setSector(lp.getSector());
                        l.setGrid(lp.getGrid());
                    }
                    itemLine.setLocation(l);
                    curpl.getForSale().add(itemLine);
                } catch (Exception ex) {
                    throw new Exception("Impossible to import the pricelist. Offending line: " + row, ex);
                }
            }
            if (wanted) {
                try {
                    int begin = 0;
                    int end = 0;
                    ItemLine itemLine = new ItemLine();
                    itemLine.setItem(new Item());
                    itemLine.setForSale(false);
                    begin = 0;
                    end = row.indexOf("X ", begin);
                    if (Character.isDigit(row.charAt(end + 2))) {
                        //the X of the price
                        itemLine.getItem().setName(row.substring(begin, end).replace('*', ' ').trim());
                    } else {
                        //next X
                        end = row.indexOf("X ", end + 1);
                        itemLine.getItem().setName(row.substring(begin, end).replace('*', ' ').trim());
                    }

                    begin = end + 2;
                    end = row.indexOf(" ", begin);
                    String qty = row.substring(begin, end).trim();
                    itemLine.setQuantity(Long.parseLong(qty));

                    begin = row.indexOf("at $") + 4;
                    end = row.indexOf(" ", begin);
                    itemLine.setPrice(Long.parseLong(row.substring(begin, end).trim()));

                    itemLine.getItem().setWeight(PricelistsTools.loadWeight(itemLine.getItem().getName()));

                    Location l = new Location();
                    if (planet) {
                        begin = row.indexOf("CE") + 2;
                        l.setName(row.substring(begin).trim());
                        l.setPlanet(true);
                        l.setSystem(cursys);
                    }
                    if (starbase) {
                        begin = end + 1;
                        l.setName(row.substring(begin).trim());
                        l.setPlanet(false);
                        l.setSystem(cursys);
                    }
                    // JUST a sec, lets check the coord cache.
                    LocationProperty lp = locationsProperties.get(itemLine.getItem().getName());
                    if (lp != null) {
                        l.setSector(lp.getSector());
                        l.setGrid(lp.getGrid());
                    }
                    itemLine.setLocation(l);
                    curpl.getWanted().add(itemLine);
                } catch (Exception ex) {
                    throw new Exception("Impossible to import the pricelist. Offending line: " + row, ex);
                }
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.