当前位置: 首页>>代码示例>>Java>>正文


Java Image.addClickListener方法代码示例

本文整理汇总了Java中com.vaadin.ui.Image.addClickListener方法的典型用法代码示例。如果您正苦于以下问题:Java Image.addClickListener方法的具体用法?Java Image.addClickListener怎么用?Java Image.addClickListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.vaadin.ui.Image的用法示例。


在下文中一共展示了Image.addClickListener方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addWoundAtPosition

import com.vaadin.ui.Image; //导入方法依赖的package包/类
public void addWoundAtPosition(WoundPosition woundPosition) {
	if (!markedWounds.containsKey(woundPosition)) {
		
		Image image = getImage(WOUND_INDICATOR);
		
		if (woundManager.getWoundAtWoundPosition(woundPosition).getEndDate() != null) {
			image = getImage(WOUND_HEALED_INDICATOR);
		}
		
		image.addClickListener(woundClickListener);
		image.setDescription(woundPosition.getDescription());
		image.setAlternateText(woundPosition.getDescription());

		// Removing half the size of the indicator to put the click position in the middle of the indicator
		float correctedXPos = (float) scaleFactor*(woundPosition.getXPosition() - (image.getWidth() / 2));
		float correctedYPos = (float) scaleFactor*(woundPosition.getYPosition() - (image.getHeight() / 2));

		ComponentPosition imagePosition = new ComponentPosition();
		imagePosition.setLeft((float)correctedXPos, Unit.PIXELS);
		imagePosition.setTop((float)correctedYPos, Unit.PIXELS);
		image.setData(woundPosition);

		markedWounds.put(woundPosition, image);
		addComponent(image);
		setPosition(image, imagePosition);
	}
}
 
开发者ID:fau-amos-2014-team-2,项目名称:root,代码行数:28,代码来源:WoundSelector.java

示例2: createEmailIcon

import com.vaadin.ui.Image; //导入方法依赖的package包/类
private Image createEmailIcon(EmailContact emailContact)
{
	final String basepath = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath();
	final FileResource resource = new FileResource(new File(basepath + "/images/email.png"));

	Image image = new Image(null, resource);
	image.setDescription("Click to send an email");
	image.setVisible(false);

	image.addClickListener(new MouseEventLogged.ClickListener()
	{
		private static final long serialVersionUID = 1L;

		@Override
		public void clicked(final com.vaadin.event.MouseEvents.ClickEvent event)
		{
			showMailForm(emailContact);

		}
	});

	return image;
}
 
开发者ID:bsutton,项目名称:scoutmaster,代码行数:24,代码来源:SchoolView.java

示例3: addImage

import com.vaadin.ui.Image; //导入方法依赖的package包/类
public void addImage(DSImage image) {
        image.setIndex(images.size());
        images.add(image);
        Image loadedImage = new Image();
        loadedImage.setSource(image.getResource());

        if (loadedImage.getWidth() > imageMaxWidth) {
            loadedImage.setWidth(imageMaxWidth, Unit.PIXELS);
        }
        if (loadedImage.getHeight() > imageMaxHeight) {
            loadedImage.setHeight(imageMaxHeight, Unit.PIXELS);
        }

        loadedImage.setData(image.getIndex());
        loadedImage.addClickListener(event -> {
            if (isSelectable()) {
                DSImage clicked = images.get((int) loadedImage.getData());
//                Notification.show(selectedImage.toString(), Type.HUMANIZED_MESSAGE);
                setValue(clicked);
            }
        });
        loadedImages.add(loadedImage);

        if (visibleImages.size() < maxAllowed || maxAllowed < 0) {
            addVisibleImage(image.getIndex(), loadedImage);
        }
    }
 
开发者ID:viydaag,项目名称:dungeonstory-java,代码行数:28,代码来源:ImageSelector.java

示例4: createDetailsIcons

import com.vaadin.ui.Image; //导入方法依赖的package包/类
public static Image createDetailsIcons(Grid grid, Customer customer) {
    final Image imageDown = new Image("", new ThemeResource("../demotheme/img/caret-down.png"));
    final Image imageUp = new Image("", new ThemeResource("../demotheme/img/caret-up.png"));
    imageDown.setCaption(null);
    imageDown.setHeight(32, Sizeable.Unit.PIXELS);
    imageDown.setWidth(32, Sizeable.Unit.PIXELS);
    imageUp.setCaption(null);
    imageUp.setHeight(32, Sizeable.Unit.PIXELS);
    imageDown.setWidth(32, Sizeable.Unit.PIXELS);

    imageDown.addShortcutListener(new ShortcutListener("enter", ShortcutAction.KeyCode.ENTER, null) {
        @Override
        public void handleAction(Object sender, Object target) {
            if (sender == imageDown || sender == imageUp) {
                Notification.show("Shortcut captured");
                grid.setDetailsVisible(customer, !grid.isDetailsVisible(customer));
            }
        }
    });
    imageDown.addClickListener(event -> grid.setDetailsVisible(customer, true));
    imageUp.addClickListener(event -> grid.setDetailsVisible(customer, false));

    if (grid.isDetailsVisible(customer)) {
        return imageUp;
    } else {
        return imageDown;
    }
}
 
开发者ID:datenhahn,项目名称:componentrenderer,代码行数:29,代码来源:ViewComponents.java

示例5: WoundSelector

import com.vaadin.ui.Image; //导入方法依赖的package包/类
public WoundSelector(WoundManager woundManager, Sex sex, float scaleFactor) {
	this.woundManager = woundManager;
	this.scaleFactor = scaleFactor;

	Image backgroundImage;
	
	this.sex = (sex != null) ? sex : Sex.NEUTER;
	if (sex == Sex.FEMALE)
		backgroundImage = getImage(BODY_IMAGE_FEMALE);
	else if (sex == Sex.MALE)
		backgroundImage = getImage(BODY_IMAGE_MALE);
	else 
		backgroundImage = getImage(BODY_IMAGE);

	backgroundImage.addClickListener(this);

	selectionIndicator = getImage(SELECTION_INDICATOR);
	selectionIndicator.setVisible(false);

	selectedWoundIndicator = getImage(WOUND_SELECTION_INDICATOR);
	selectedWoundIndicator.setVisible(false);
	
	selctedWoundHealedIndicator = getImage(WOUND_HEALED_INDICATOR);
	selctedWoundHealedIndicator.setVisible(false); 

	addComponents(backgroundImage, 
			selectionIndicator, selectedWoundIndicator, selctedWoundHealedIndicator);

	setWidth(backgroundImage.getWidth(), Unit.PIXELS);
	setHeight(backgroundImage.getHeight(), Unit.PIXELS);
}
 
开发者ID:fau-amos-2014-team-2,项目名称:root,代码行数:32,代码来源:WoundSelector.java

示例6: addImage

import com.vaadin.ui.Image; //导入方法依赖的package包/类
private void addImage(final File imageFile) {
    FileResource imageResource = new FileResource(imageFile);

    // Frame list
    Image image = new Image(null, imageResource);
    image.setWidth("104px");
    final CssLayout wrapper = new CssLayout();
    wrapper.addComponent(image);
    image.addClickListener(new ClickListener() {

        @Override
        public void click(ClickEvent event) {
            framesLayout.removeComponent(wrapper);
            preview.removeImage(imageFiles.indexOf(imageFile));
            imageFiles.remove(imageFile);
            downloadButton.setEnabled(!imageFiles.isEmpty());
        }
    });
    framesLayout.addComponent(wrapper);

    // Add to preview animation
    preview.addImage(imageResource);

    // Add to our internal list
    imageFiles.add(imageFile);
    if (imageFiles.size() > 1) {
        webcamAndGif.replaceComponent(gifImage, preview);
        downloadButton.setEnabled(true);
    }
}
 
开发者ID:tehapo,项目名称:webcam,代码行数:31,代码来源:GifBoothUI.java

示例7: init

import com.vaadin.ui.Image; //导入方法依赖的package包/类
/**
 * Initialise la vue
 */
@PostConstruct
public void init() {
	/* Style */
	setMargin(true);
	setSpacing(true);
	setSizeFull();
	
	/* Titre */
	HorizontalLayout hlLangue = new HorizontalLayout();
	hlLangue.setWidth(100, Unit.PERCENTAGE);
	hlLangue.setSpacing(true);
	
	/*Le titre*/
	labelTitle.addStyleName(StyleConstants.VIEW_TITLE);
	hlLangue.addComponent(labelTitle);
	hlLangue.setExpandRatio(labelTitle, 1);
	hlLangue.setComponentAlignment(labelTitle, Alignment.MIDDLE_LEFT);
	
	if (cacheController.getLangueEnServiceWithoutDefault().size()>0){
		Langue langueDef = cacheController.getLangueDefault();
		Image flagDef = new Image(null, new ThemeResource("images/flags/"+langueDef.getCodLangue()+".png"));
		flagDef.addClickListener(e->updateLangue(langueDef));
		flagDef.addStyleName(StyleConstants.CLICKABLE);
		hlLangue.addComponent(flagDef);
		hlLangue.setComponentAlignment(flagDef, Alignment.MIDDLE_CENTER);
		cacheController.getLangueEnServiceWithoutDefault().forEach(langue->{
			Image flag = new Image(null, new ThemeResource("images/flags/"+langue.getCodLangue()+".png"));
			flag.addClickListener(e->updateLangue(langue));
			flag.addStyleName(StyleConstants.CLICKABLE);
			hlLangue.addComponent(flag);
			hlLangue.setComponentAlignment(flag, Alignment.MIDDLE_CENTER);
			
		});
	}

	addComponent(hlLangue);
	
	/*Panel scrollable de contenu*/
	Panel panelContent = new Panel();
	panelContent.setSizeFull();
	panelContent.addStyleName(ValoTheme.PANEL_BORDERLESS);
	addComponent(panelContent);
	setExpandRatio(panelContent, 1);
	
	VerticalLayout vlContent = new VerticalLayout();
	vlContent.setSpacing(true);
	panelContent.setContent(vlContent);
	
	
	restResult.setContentMode(ContentMode.HTML);
	restResult.addStyleName(StyleConstants.LABEL_MORE_BOLD);
	restResult.addStyleName(ValoTheme.LABEL_COLORED);
	restResult.setValue("");
	vlContent.addComponent(restResult);
	
	/* Texte */		
	labelAccueil.setValue("");
	labelAccueil.setContentMode(ContentMode.HTML);		
	vlContent.addComponent(labelAccueil);
	
	connexionLayout.addStyleName(StyleConstants.MAX_WIDTH_500);
	connexionLayout.addCasListener(()->userController.connectCAS());
	connexionLayout.addStudentListener((user,pwd)->userController.connectCandidatInterne(user, pwd));
	connexionLayout.addForgotPasswordListener(()->{UI.getCurrent().addWindow(new CandidatIdOublieWindow(ConstanteUtils.FORGOT_MODE_ID_OUBLIE));});
	connexionLayout.addForgotCodeActivationListener(()->{UI.getCurrent().addWindow(new CandidatIdOublieWindow(ConstanteUtils.FORGOT_MODE_CODE_ACTIVATION));});
	vlContent.addComponent(connexionLayout);
}
 
开发者ID:EsupPortail,项目名称:esup-ecandidat,代码行数:71,代码来源:CandidatCompteMinimaView.java


注:本文中的com.vaadin.ui.Image.addClickListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。