List of usage examples for com.vaadin.ui Image getData
public Object getData()
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; }