Example usage for com.vaadin.ui Image getData

List of usage examples for com.vaadin.ui Image getData

Introduction

In this page you can find the example usage for com.vaadin.ui Image getData.

Prototype

public Object getData() 

Source Link

Document

Gets the application specific data.

Usage

From source file:org.inakirj.imagerulette.screens.DicePlayView.java

License:Open Source License

/**
 * Loop thread.//ww w .  j av a2s.com
 */
private void onPickABallClick() {
    int value = randomizer.nextInt(lotteryList.size());
    Image img = (Image) lotteryList.get(value);
    img.setWidth(78, Unit.PIXELS);
    img.setHeight(81, Unit.PIXELS);
    img.addStyleName("random-image");
    imageLayout.replaceComponent(randomImgToBeReplaced, img);
    randomImgToBeReplaced = img;
    String imgUrlToIncrease = (String) img.getData();
    Integer currentValue = statsImageIdOcurrencesMap.get(imgUrlToIncrease);
    currentValue++;
    statsImageIdOcurrencesMap.put(imgUrlToIncrease, new Integer(currentValue));
    calculateStats();
}

From source file:org.inakirj.imagerulette.screens.DiceURLSetupView.java

License:Open Source License

/**
 * Generate lottery list./*ww  w.j a v a2  s  . c  om*/
 *
 * @return the list
 */
private List<Object> generateLotteryList() {
    List<Object> randomList = new ArrayList<>();
    Iterator<Component> iterator = imagesLayout.iterator();
    while (iterator.hasNext()) {
        HorizontalLayout hl = (HorizontalLayout) iterator.next();
        Image imageSelected = (Image) hl.getComponent(0);
        Image img = new Image("", imageSelected.getSource());
        img.setData(imageSelected.getData());
        Slider slider = (Slider) hl.getComponent(1);
        int rep = slider.getValue().intValue();
        while (rep > 0) {
            randomList.add(img);
            rep--;
        }
    }
    return randomList;
}