Examples of Barcode


Examples of br.com.objectos.way.barcode.Barcode

    return new CodigoDeBarras(codigoBarras);
  }

  public List<MustacheBarra> getBarras() {
    int[] digits = seqNum.toArray();
    Barcode barcode = Barcode
        .encode(digits)
        .asInterleavedTwoFive();

    List<Bar> bars = barcode.getBars();

    List<MustacheBarra> barras;
    barras = transform(bars, new ToMustacheBar());

    return ImmutableList.copyOf(barras);
View Full Code Here

Examples of ca.odell.glazedlists.impl.adt.Barcode

    /**
     * Rebuild the entire collapsed elements barcode.
     */
    private void rebuildCollapsedElements() {
        collapsedElements = new Barcode();
        collapsedElements.addBlack(0, separatorSource.size());
        int groupCount = separatorSource.insertedSeparators.colourSize(SEPARATOR);
        for(int i = 0; i < groupCount; i++) {
            updateGroup(i, groupCount, false);
        }
View Full Code Here

Examples of ca.odell.glazedlists.impl.adt.Barcode

        /**
         * Statically build the separators data structures.
         */
        private void rebuildSeparators() {
            // clear the initial state of these separators
            insertedSeparators = new Barcode();
            separators = new SimpleTree<GroupSeparator>();

            // prepare the separator list
            insertedSeparators.add(0, SOURCE_ELEMENT, source.size());
            for(BarcodeIterator i = grouper.getBarcode().iterator(); i.hasNextColour(Grouper.UNIQUE); ) {
View Full Code Here

Examples of ca.odell.glazedlists.impl.adt.Barcode

        if(listChanges.isReordering()) {
            int[] sourceReorderMap = listChanges.getReorderMap();
            int[] filterReorderMap = new int[flagList.blackSize()];

            // adjust the flaglist & construct a reorder map to propagate
            Barcode previousFlagList = flagList;
            flagList = new Barcode();
            for(int i = 0; i < sourceReorderMap.length; i++) {
                Object flag = previousFlagList.get(sourceReorderMap[i]);
                flagList.add(i, flag, 1);
                if(flag != Barcode.WHITE) filterReorderMap[flagList.getBlackIndex(i)] = previousFlagList.getBlackIndex(sourceReorderMap[i]);
            }

            // fire the reorder
            updates.reorder(filterReorderMap);
View Full Code Here

Examples of ca.odell.glazedlists.impl.adt.Barcode

        if(this.comparator == comparator) return;
        this.comparator = comparator;

        // Populate the barcode by examining adjacent entries within the
        // source SortedList to check if they belong to the same group.
        barcode = new Barcode();
        for (int i = 0, n = sortedList.size(); i < n; i++) {
            barcode.add(i, groupTogether(i, i-1) ? DUPLICATE : UNIQUE, 1);
        }
    }
View Full Code Here

Examples of ca.odell.glazedlists.impl.adt.Barcode

        // c) Deleted events may be forwarded with a resultant DELETE or UPDATE
        // event, depending on whether the deleted value was the last member of
        // its group.

        // a Barcode to track values that must be revisited to determine if they are UNIQUE or DUPLICATE
        final Barcode toDoList = new Barcode();
        toDoList.addWhite(0, barcode.size());

        // first pass -> update the barcode and accumulate the type of values removed (UNIQUE or DUPLICATE or UNIQUE_WITH_DUPLICATE)
        final LinkedList removedValues = new LinkedList();
        while (listChanges.next()) {
            final int changeIndex = listChanges.getIndex();
            final int changeType = listChanges.getType();

            if (changeType == ListEvent.INSERT) {
                // assume the inserted element is unique until we determine otherwise
                barcode.add(changeIndex, UNIQUE, 1);
                // indicate we must revisit this index later to determine its uniqueness
                toDoList.add(changeIndex, TODO, 1);

            } else if (changeType == ListEvent.UPDATE) {
                // case: AACCC -> AABCC
                // if the updated index is a UNIQUE index, we MAY have just created a
                // new group (by modifying an element in place). Consequently, we must
                // mark the NEXT element as UNIQUE and revisit it later to determine
                // if it really is
                if (barcode.get(changeIndex) == UNIQUE) {
                    if (changeIndex+1 < barcode.size() && barcode.get(changeIndex+1) == DUPLICATE) {
                        barcode.set(changeIndex, UNIQUE, 2);
                        toDoList.set(changeIndex, TODO, 1);
                    }
                }

            } else if (changeType == ListEvent.DELETE) {
                Object deleted = barcode.get(changeIndex);
                barcode.remove(changeIndex, 1);
                toDoList.remove(changeIndex, 1);

                if (deleted == UNIQUE) {
                    // if the deleted UNIQUE value has a DUPLICATE, promote the DUPLICATE to be the new UNIQUE
                    if (changeIndex < barcode.size() && barcode.get(changeIndex) == DUPLICATE) {
                        // case: AABB -> AAB
                        barcode.set(changeIndex, UNIQUE, 1);
                        deleted = UNIQUE_WITH_DUPLICATE;
                    }
                }

                removedValues.addLast(deleted);
            }
        }

        TryJoinResult<E> tryJoinResult = new TryJoinResult<E>();

        // second pass, handle toDoList, update groupLists, and fire events
        listChanges.reset();
        while(listChanges.next()) {
            final int changeIndex = listChanges.getIndex();
            final int changeType = listChanges.getType();
            E newValue = listChanges.getNewValue();
            E oldValue = listChanges.getOldValue();

            // inserts can result in UPDATE or INSERT events
            if(changeType == ListEvent.INSERT) {

                // if no group already exists to join, create a new group
                tryJoinExistingGroup(changeIndex, toDoList, tryJoinResult);
                if(tryJoinResult.group == NO_GROUP) {
                    client.groupChanged(changeIndex, tryJoinResult.groupIndex, ListEvent.INSERT, true, changeType, (E)ListEvent.UNKNOWN_VALUE, tryJoinResult.newFirstInGroup);
                } else {
                    client.groupChanged(changeIndex, tryJoinResult.groupIndex, ListEvent.UPDATE, true, changeType, tryJoinResult.oldFirstInGroup, tryJoinResult.newFirstInGroup);
                }

            // updates can result in INSERT, UPDATE and DELETE events
            } else if(changeType == ListEvent.UPDATE) {

                // get the location of the group before the update occurred
                int oldGroup = 0;
                if(toDoList.get(changeIndex) == TODO) oldGroup = RIGHT_GROUP;
                else if(barcode.get(changeIndex) == DUPLICATE) oldGroup = LEFT_GROUP;
                else if(barcode.get(changeIndex) == UNIQUE) oldGroup = NO_GROUP;

                // get the new group location
                tryJoinExistingGroup(changeIndex, toDoList, tryJoinResult);
View Full Code Here

Examples of ca.odell.glazedlists.impl.adt.Barcode

        // for speed, we add all source elements together, rather than individually
        this.observedElements = new ArrayList<E>(source);

        // we initialize the single EventListener registry, as we optimistically
        // assume we'll be using a single listener for all observed elements
        this.singleEventListenerRegistry = new Barcode();
        this.singleEventListenerRegistry.addWhite(0, source.size());

        // add listeners to all source list elements
        for (int i = 0, n = size(); i < n; i++) {
            // connect a listener to the element
View Full Code Here

Examples of ca.odell.glazedlists.impl.adt.Barcode

            int[] sourceReorderMap = listChanges.getReorderMap();
            int[] selectReorderMap = new int[barcode.colourSize(SELECTED)];
            int[] deselectReorderMap = new int[barcode.colourSize(DESELECTED)];

            // adjust the flaglist & construct a reorder map to propagate
            Barcode previousBarcode = barcode;
            barcode = new Barcode();
            for(int c = 0; c < sourceReorderMap.length; c++) {
                Object flag = previousBarcode.get(sourceReorderMap[c]);
                boolean wasSelected = (flag != DESELECTED);
                barcode.add(c, flag, 1);
                if(wasSelected) {
                    int previousIndex = previousBarcode.getColourIndex(sourceReorderMap[c], SELECTED);
                    int currentIndex = barcode.getColourIndex(c, SELECTED);
                    selectReorderMap[currentIndex] = previousIndex;
                } else {
                    int previousIndex = previousBarcode.getColourIndex(sourceReorderMap[c], DESELECTED);
                    int currentIndex = barcode.getColourIndex(c, DESELECTED);
                    deselectReorderMap[currentIndex] = previousIndex;
                }
            }
View Full Code Here

Examples of ca.odell.glazedlists.impl.adt.Barcode

    public void listChanged(ListEvent listChanges) {
        // if the table is no longer available, we don't want to do anything as
        // it will result in a "Widget is disposed" exception
        if (table.isDisposed()) return;

        Barcode deletes = new Barcode();
        deletes.addWhite(0, source.size());
        int firstChange = source.size();
        // Disable redraws so that the table is updated in bulk
        table.setRedraw(false);

        // Apply changes to the list
        while (listChanges.next()) {
            int changeIndex = listChanges.getIndex();
            int adjustedIndex = deletes.getIndex(changeIndex, Barcode.WHITE);
            int changeType = listChanges.getType();

            // Insert a new element in the Table and the Barcode
            if (changeType == ListEvent.INSERT) {
                deletes.addWhite(adjustedIndex, 1);
                tableHandler.addRow(adjustedIndex, source.get(changeIndex));
                firstChange = Math.min(changeIndex, firstChange);

                // Update the element in the Table
            } else if (changeType == ListEvent.UPDATE) {
                tableHandler.updateRow(adjustedIndex, source.get(changeIndex));

                // Just mark the element as deleted in the Barcode
            } else if (changeType == ListEvent.DELETE) {
                deletes.setBlack(adjustedIndex, 1);
                firstChange = Math.min(changeIndex, firstChange);
            }
        }

        // Process the deletes as a single Table change
        if (deletes.blackSize() > 0) {
            int[] deletedIndices = new int[deletes.blackSize()];
            for (BarcodeIterator i = deletes.iterator(); i.hasNextBlack();) {
                i.nextBlack();
                deletedIndices[i.getBlackIndex()] = i.getIndex();
            }
            tableHandler.removeAll(deletedIndices);
        }
View Full Code Here

Examples of it.stefanobertini.zebra.cpcl.labelmode.Barcode

public class BarcodeTest {

    @Test
    public void test1() {

  Barcode command = new Barcode(BarcodeType.Code128, BarcodeRatio.RATIO_2D0_TO_1__1, 1, 50, new Position(150, 10), "HORIZ.");

  CommandOutputBuilder output = new CommandOutputBuilder();
  output.printLn("BARCODE 128 1 1 50 150 10 HORIZ.");

  assertCommand(output, command);
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.