Example usage for java.awt List size

List of usage examples for java.awt List size

Introduction

In this page you can find the example usage for java.awt List size.

Prototype

@Deprecated
public Dimension size() 

Source Link

Document

Returns the size of this component in the form of a Dimension object.

Usage

From source file:org.apache.tinkerpop.gremlin.driver.ser.GryoBaseMessageSerializerV1d0Test.java

@Test
public void shouldSerializeMapEntry() throws Exception {
    final Graph graph = TinkerGraph.open();
    final Vertex v1 = graph.addVertex();
    final Date d = new Date();

    final Map<Object, Object> map = new HashMap<>();
    map.put("x", 1);
    map.put(v1, 100);/*from   w w  w.  j  av  a2s .c  om*/
    map.put(d, "test");

    final ResponseMessage response = convertBinary(IteratorUtils.asList(map.entrySet()));
    assertCommon(response);

    final java.util.List<Map.Entry<Object, Object>> deserializedEntries = (java.util.List<Map.Entry<Object, Object>>) response
            .getResult().getData();
    assertEquals(3, deserializedEntries.size());
    deserializedEntries.forEach(e -> {
        if (e.getKey().equals("x"))
            assertEquals(1, e.getValue());
        else if (e.getKey().equals(v1))
            assertEquals(100, e.getValue());
        else if (e.getKey().equals(d))
            assertEquals("test", e.getValue());
        else
            fail("Map entries contains a key that is not part of what was serialized");
    });
}

From source file:org.yccheok.jstock.gui.StockJDialog.java

private void initBoardCheckBoxes() {
    final JStock m = JStock.instance();
    final StockInfoDatabase stockInfoDatabase = m.getStockInfoDatabase();

    boardCheckBoxes.add(jCheckBox1);/*  ww w.ja  v a 2s .  co m*/
    boardCheckBoxes.add(jCheckBox2);
    boardCheckBoxes.add(jCheckBox21);
    boardCheckBoxes.add(jCheckBox3);
    boardCheckBoxes.add(jCheckBox4);
    boardCheckBoxes.add(jCheckBox23);
    boardCheckBoxes.add(jCheckBox25);
    boardCheckBoxes.add(jCheckBox26);
    boardCheckBoxes.add(jCheckBox27);

    for (JCheckBox checkBox : boardCheckBoxes) {
        checkBox.setVisible(false);
    }

    java.util.List<Board> sortedBoards = stockInfoDatabase.getBoards();
    Collections.sort(sortedBoards);

    int count = 0;
    for (Board board : sortedBoards) {
        if (count >= boardCheckBoxes.size()) {
            log.error("You do not have enough check box components (" + boardCheckBoxes.size()
                    + ") to hold board (" + sortedBoards.size() + ")");
            break;
        }

        javax.swing.JCheckBox checkBox = boardCheckBoxes.get(count++);
        checkBox.setText(board.toString());
        checkBox.setVisible(true);
        checkBoxToBoard.put(checkBox, board);
    }
}

From source file:org.yccheok.jstock.gui.WizardSelectStockJPanel.java

private void initBoardCheckBoxes(StockInfoDatabase stockInfoDatabase) {
    boardCheckBoxes.add(jCheckBox1);/*www.  j a  va  2  s.  c om*/
    boardCheckBoxes.add(jCheckBox2);
    boardCheckBoxes.add(jCheckBox21);
    boardCheckBoxes.add(jCheckBox3);
    boardCheckBoxes.add(jCheckBox4);
    boardCheckBoxes.add(jCheckBox23);
    boardCheckBoxes.add(jCheckBox25);
    boardCheckBoxes.add(jCheckBox26);
    boardCheckBoxes.add(jCheckBox27);

    for (JCheckBox checkBox : boardCheckBoxes) {
        checkBox.setVisible(false);
    }

    java.util.List<Board> sortedBoards = stockInfoDatabase.getBoards();
    Collections.sort(sortedBoards);

    int count = 0;
    for (Board board : sortedBoards) {
        if (count >= boardCheckBoxes.size()) {
            log.error("You do not have enough check box components (" + boardCheckBoxes.size()
                    + ") to hold board (" + sortedBoards.size() + ")");
            break;
        }

        javax.swing.JCheckBox checkBox = boardCheckBoxes.get(count++);
        checkBox.setText(board.toString());
        checkBox.setVisible(true);
        checkBoxToBoard.put(checkBox, board);
    }
}

From source file:org.yccheok.jstock.gui.StockJDialog.java

private void initIndustryCheckBoxes() {
    final JStock m = JStock.instance();
    final StockInfoDatabase stockInfoDatabase = m.getStockInfoDatabase();

    industryCheckBoxes.add(jCheckBox5);/*from   w  ww. j  a va2 s  .  c om*/
    industryCheckBoxes.add(jCheckBox7);
    industryCheckBoxes.add(jCheckBox9);
    industryCheckBoxes.add(jCheckBox6);
    industryCheckBoxes.add(jCheckBox8);
    industryCheckBoxes.add(jCheckBox10);
    industryCheckBoxes.add(jCheckBox11);
    industryCheckBoxes.add(jCheckBox12);
    industryCheckBoxes.add(jCheckBox13);
    industryCheckBoxes.add(jCheckBox14);
    industryCheckBoxes.add(jCheckBox15);
    industryCheckBoxes.add(jCheckBox16);
    industryCheckBoxes.add(jCheckBox17);
    industryCheckBoxes.add(jCheckBox18);
    industryCheckBoxes.add(jCheckBox22);
    industryCheckBoxes.add(jCheckBox19);
    industryCheckBoxes.add(jCheckBox20);
    industryCheckBoxes.add(jCheckBox24);

    for (JCheckBox checkBox : industryCheckBoxes) {
        checkBox.setVisible(false);
    }

    java.util.List<Industry> sortedIndustries = stockInfoDatabase.getIndustries();
    Collections.sort(sortedIndustries);

    int count = 0;
    for (Industry industry : sortedIndustries) {
        if (count >= industryCheckBoxes.size()) {
            log.error("You do not have enough check box components (" + industryCheckBoxes.size()
                    + ") to hold industry (" + sortedIndustries.size() + ")");
            break;
        }

        javax.swing.JCheckBox checkBox = industryCheckBoxes.get(count++);
        checkBox.setText(industry.toString());
        checkBox.setVisible(true);
        checkBoxToIndustry.put(checkBox, industry);
    }
}

From source file:org.yccheok.jstock.gui.WizardSelectStockJPanel.java

private void initIndustryCheckBoxes(StockInfoDatabase stockInfoDatabase) {
    industryCheckBoxes.add(jCheckBox5);/*from   w  w w.jav  a 2  s.c o m*/
    industryCheckBoxes.add(jCheckBox7);
    industryCheckBoxes.add(jCheckBox9);
    industryCheckBoxes.add(jCheckBox6);
    industryCheckBoxes.add(jCheckBox8);
    industryCheckBoxes.add(jCheckBox10);
    industryCheckBoxes.add(jCheckBox11);
    industryCheckBoxes.add(jCheckBox12);
    industryCheckBoxes.add(jCheckBox13);
    industryCheckBoxes.add(jCheckBox14);
    industryCheckBoxes.add(jCheckBox15);
    industryCheckBoxes.add(jCheckBox16);
    industryCheckBoxes.add(jCheckBox17);
    industryCheckBoxes.add(jCheckBox18);
    industryCheckBoxes.add(jCheckBox22);
    industryCheckBoxes.add(jCheckBox19);
    industryCheckBoxes.add(jCheckBox20);
    industryCheckBoxes.add(jCheckBox24);

    for (JCheckBox checkBox : industryCheckBoxes) {
        checkBox.setVisible(false);
    }

    java.util.List<Industry> sortedIndustries = stockInfoDatabase.getIndustries();
    Collections.sort(sortedIndustries);

    int count = 0;
    for (Industry industry : sortedIndustries) {
        if (count >= industryCheckBoxes.size()) {
            log.error("You do not have enough check box components (" + industryCheckBoxes.size()
                    + ") to hold industry (" + sortedIndustries.size() + ")");
            break;
        }

        javax.swing.JCheckBox checkBox = industryCheckBoxes.get(count++);
        checkBox.setText(industry.toString());
        checkBox.setVisible(true);
        checkBoxToIndustry.put(checkBox, industry);
    }
}

From source file:com.kbot2.scriptable.methods.data.Bank.java

/**
 * Deposits item by itemID.//from   w w w.j av a2 s .  c  om
 *
 * @param itemID to deposit if it exists.
 * @param count  exact number, or Bank.MENU_ALL or Bank.MENU_ALL_BUT_ONE
 */
public void deposit(int itemID, int count) {
    java.util.List<Integer> dropPositions = new LinkedList<Integer>();
    Item[] inventoryArray = botEnv.inventory.getItems();
    for (int iterator1 = 0; iterator1 < inventoryArray.length; iterator1++) {
        if (inventoryArray[iterator1].isValid()) {
            if (inventoryArray[iterator1].getID() == itemID)
                dropPositions.add(iterator1);
        }
    }
    if (dropPositions.size() == 0)
        return;
    int[] ascending = new int[dropPositions.size()];
    int index = 0;
    for (int pos : dropPositions) {
        ascending[index] = pos;
        index++;
    }
    Arrays.sort(ascending);
    // Random drop position
    int randomIndex = random(0, ascending.length - 1);
    int pos = ascending[randomIndex];
    if (botEnv.methods.menu.isMenuOpen()) {
        botEnv.methods.atMenu("cancel");
    }
    Point p = botEnv.inventory.getInventoryItemLoc(pos);
    botEnv.methods.moveMouse(p);
    botEnv.methods.sleep(random(20, 100));
    if (count == MENU_ALL) {
        getMethods().atMenu("Deposit-All");
    } else if (count == MENU_ALL_BUT_ONE) {
        getMethods().atMenu("Deposit-All but one");
    } else {
        if (!getMethods().atMenu("Deposit-" + count)) {
            getMethods().atMenu("Deposit-X");
            for (int i = 0; i < 21; i++) {
                if (botEnv.interfaces.interfaceGroupExists(752)) {
                    getMethods().sendText("" + count, true);
                }
                getMethods().sleep(80, 130);
            }
        }
    }
    botEnv.methods.atMenu("drop");
    botEnv.methods.sleep(random(150, 300));
}

From source file:hudson.util.NoOverlapCategoryAxis.java

@Override
protected AxisState drawCategoryLabels(Graphics2D g2, Rectangle2D plotArea, Rectangle2D dataArea,
        RectangleEdge edge, AxisState state, PlotRenderingInfo plotState) {

    if (state == null) {
        throw new IllegalArgumentException("Null 'state' argument.");
    }//from www  . ja v a2  s . co m

    if (isTickLabelsVisible()) {
        java.util.List ticks = refreshTicks(g2, state, plotArea, edge);
        state.setTicks(ticks);

        // remember the last drawn label so that we can avoid drawing overlapping labels.
        Rectangle2D r = null;

        int categoryIndex = 0;
        Iterator iterator = ticks.iterator();
        while (iterator.hasNext()) {

            CategoryTick tick = (CategoryTick) iterator.next();
            g2.setFont(getTickLabelFont(tick.getCategory()));
            g2.setPaint(getTickLabelPaint(tick.getCategory()));

            CategoryLabelPosition position = this.getCategoryLabelPositions().getLabelPosition(edge);
            double x0 = 0.0;
            double x1 = 0.0;
            double y0 = 0.0;
            double y1 = 0.0;
            if (edge == RectangleEdge.TOP) {
                x0 = getCategoryStart(categoryIndex, ticks.size(), dataArea, edge);
                x1 = getCategoryEnd(categoryIndex, ticks.size(), dataArea, edge);
                y1 = state.getCursor() - this.getCategoryLabelPositionOffset();
                y0 = y1 - state.getMax();
            } else if (edge == RectangleEdge.BOTTOM) {
                x0 = getCategoryStart(categoryIndex, ticks.size(), dataArea, edge);
                x1 = getCategoryEnd(categoryIndex, ticks.size(), dataArea, edge);
                y0 = state.getCursor() + this.getCategoryLabelPositionOffset();
                y1 = y0 + state.getMax();
            } else if (edge == RectangleEdge.LEFT) {
                y0 = getCategoryStart(categoryIndex, ticks.size(), dataArea, edge);
                y1 = getCategoryEnd(categoryIndex, ticks.size(), dataArea, edge);
                x1 = state.getCursor() - this.getCategoryLabelPositionOffset();
                x0 = x1 - state.getMax();
            } else if (edge == RectangleEdge.RIGHT) {
                y0 = getCategoryStart(categoryIndex, ticks.size(), dataArea, edge);
                y1 = getCategoryEnd(categoryIndex, ticks.size(), dataArea, edge);
                x0 = state.getCursor() + this.getCategoryLabelPositionOffset();
                x1 = x0 - state.getMax();
            }
            Rectangle2D area = new Rectangle2D.Double(x0, y0, (x1 - x0), (y1 - y0));
            if (r == null || !r.intersects(area)) {
                Point2D anchorPoint = RectangleAnchor.coordinates(area, position.getCategoryAnchor());
                TextBlock block = tick.getLabel();
                block.draw(g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(),
                        position.getLabelAnchor(), (float) anchorPoint.getX(), (float) anchorPoint.getY(),
                        position.getAngle());
                Shape bounds = block.calculateBounds(g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(),
                        position.getLabelAnchor(), (float) anchorPoint.getX(), (float) anchorPoint.getY(),
                        position.getAngle());
                if (plotState != null && plotState.getOwner() != null) {
                    EntityCollection entities = plotState.getOwner().getEntityCollection();
                    if (entities != null) {
                        String tooltip = getCategoryLabelToolTip(tick.getCategory());
                        entities.add(new CategoryLabelEntity(tick.getCategory(), bounds, tooltip, null));
                    }
                }
                r = bounds.getBounds2D();
            }

            categoryIndex++;
        }

        if (edge.equals(RectangleEdge.TOP)) {
            double h = state.getMax();
            state.cursorUp(h);
        } else if (edge.equals(RectangleEdge.BOTTOM)) {
            double h = state.getMax();
            state.cursorDown(h);
        } else if (edge == RectangleEdge.LEFT) {
            double w = state.getMax();
            state.cursorLeft(w);
        } else if (edge == RectangleEdge.RIGHT) {
            double w = state.getMax();
            state.cursorRight(w);
        }
    }
    return state;
}

From source file:org.yccheok.jstock.gui.MainFrame.java

private void portfolioNavigation() {
    if (this.getSelectedComponent() != this.portfolioManagementJPanel) {
        // The page is not active. Make it active.
        MainFrame.this.jTabbedPane1.setSelectedIndex(3);
        return;//  w  ww. j  a  va 2 s  .c  om
    }

    final java.util.List<String> portfolioNames = org.yccheok.jstock.portfolio.Utils.getPortfolioNames();
    final int size = portfolioNames.size();
    if (size <= 1) {
        // Nothing to navigate.
        return;
    }
    final String currentPortfolioName = this.getJStockOptions().getPortfolioName();

    int index = 0;
    for (; index < size; index++) {
        if (portfolioNames.get(index).equals(currentPortfolioName)) {
            index++;
            if (index >= size)
                index = 0;
            break;
        }
    }
    this.selectActivePortfolio(portfolioNames.get(index));
}

From source file:org.yccheok.jstock.gui.MainFrame.java

private void watchlistNavigation() {
    if (this.getSelectedComponent() != this.jPanel8) {
        // The page is not active. Make it active.
        MainFrame.this.jTabbedPane1.setSelectedIndex(0);
        return;//from  ww w  .ja v a  2 s.co m
    }

    final java.util.List<String> watchlistNames = org.yccheok.jstock.watchlist.Utils.getWatchlistNames();
    final int size = watchlistNames.size();
    if (size <= 1) {
        // Nothing to navigate.
        return;
    }
    final String currentWatchlistName = this.getJStockOptions().getWatchlistName();

    int index = 0;

    for (; index < size; index++) {
        if (watchlistNames.get(index).equals(currentWatchlistName)) {
            index++;
            if (index >= size)
                index = 0;
            break;
        }
    }
    this.selectActiveWatchlist(watchlistNames.get(index));
}

From source file:org.yccheok.jstock.gui.JStock.java

private boolean openAsExcelFile(File file) {
    final java.util.List<Statements> statementsList = Statements.newInstanceFromExcelFile(file);
    boolean status = statementsList.size() > 0;
    for (Statements statements : statementsList) {
        status = status & this.openAsStatements(statements, file);
    }/*from w ww  .  j av  a  2 s  .c o m*/
    return status;
}