• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java UploadEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.richfaces.event.UploadEvent的典型用法代码示例。如果您正苦于以下问题:Java UploadEvent类的具体用法?Java UploadEvent怎么用?Java UploadEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UploadEvent类属于org.richfaces.event包,在下文中一共展示了UploadEvent类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: uploadListener

import org.richfaces.event.UploadEvent; //导入依赖的package包/类
public void uploadListener(UploadEvent event) {
    UploadItem item = event.getUploadItem();
    if (item.isTempFile()) {
    } else {
        try {
            String fname = item.getFileName();
            int i = fname.lastIndexOf('/');
            if (i == -1) {
                i = fname.lastIndexOf('\\');
            }
            if (i != -1) {
                fname = fname.substring(i);
            }

            FileOutputStream fout = new FileOutputStream(getFwPath() + fname);
            fout.write(item.getData());
            fout.close();
        } catch (Exception e) {
            // TODO: handle exception
        }

    }
}
 
开发者ID:navisidhu,项目名称:libreacs,代码行数:24,代码来源:SoftwaresBean.java


示例2: actionHandleFileUpload

import org.richfaces.event.UploadEvent; //导入依赖的package包/类
/**
* Action
* @param event
* @throws IOException 
*/
public void actionHandleFileUpload(UploadEvent event) throws IOException {  
	QuestionVO editQuestion = getEditQuestion();
	
	if(editQuestion==null){
		return;
	}
	
	if(editQuestion.getImageVOs().size()>=QuestionnaireJSFBean.MAX_IMAGES_PER_QUESTION){
		addMessage(FacesMessage.SEVERITY_ERROR, "Não é possível carregar mais de "+QuestionnaireJSFBean.MAX_IMAGES_PER_QUESTION+" imagens por questão!", "");
		return;
	}
	

	List<UploadItem> files = event.getUploadItems();
	
	for (UploadItem uploadItem : files) {
		if(isImage(uploadItem)){
			attachQuestionImage(editQuestion, uploadItem);
		}
}  	
	
  addMessage(FacesMessage.SEVERITY_INFO, "Imagens carregadas com sucesso!", "");
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:29,代码来源:QuestionnaireJSFBean.java


示例3: onUploadRendition

import org.richfaces.event.UploadEvent; //导入依赖的package包/类
/**
 * Event handler for uploading a new {@link Rendition} to the
 * {@link MediaItem}
 *
 * @param event Event that invoked the handler
 * @throws IOException If the file could not be uploaded
 */
public void onUploadRendition(UploadEvent event) throws IOException {
    UploadItem item = event.getUploadItem();
    LOG.log(Level.FINE, "Uploading {0}", item.getFileName());

    MediaItemRendition mediaItemRendition;
    try {
        mediaItemRendition = catalogueFacade.create(item.getFile(),
                getSelectedMediaItem(),
                getUploadRendition(),
                item.getFileName(),
                item.getContentType(),
                true);
        LOG.log(Level.FINE, "New media item rendition created: {0}", mediaItemRendition.getId());
    } catch (IOException ex) {
        LOG.log(Level.SEVERE, "Could not create media item rendition. {0}", ex.getMessage());
        LOG.log(Level.FINEST, "", ex);
    }
}
 
开发者ID:getconverge,项目名称:converge-1.x,代码行数:26,代码来源:MediaItemDetails.java


示例4: onUploadReplaceRendition

import org.richfaces.event.UploadEvent; //导入依赖的package包/类
/**
 * Event handler for uploading a replacement for an existing
 * {@link Rendition}.
 *
 * @param event Event that invoked the handler
 * @throws IOException If the file could not be uploaded
 */
public void onUploadReplaceRendition(UploadEvent event) throws IOException {
    UploadItem item = event.getUploadItem();
    LOG.log(Level.FINE, "Uploading {0}", item.getFileName());

    MediaItemRendition mediaItemRendition;
    try {
        mediaItemRendition = catalogueFacade.update(item.getFile(),
                item.getFileName(),
                item.getContentType(),
                getSelectedRendition(),
                true);
        LOG.log(Level.FINE, "Media item rendition #{0} was updated.", mediaItemRendition.getId());
    } catch (IOException ex) {
        LOG.log(Level.SEVERE, "Could not create media item rendition. {0}", ex.getMessage());
    }
}
 
开发者ID:getconverge,项目名称:converge-1.x,代码行数:24,代码来源:MediaItemDetails.java


示例5: uploadListener

import org.richfaces.event.UploadEvent; //导入依赖的package包/类
public void uploadListener(UploadEvent event) {
    UploadItem item = event.getUploadItem();

    System.out.println("item : '" + item);
    System.out.println("File : '" + item.getFileName() + "' was uploaded");
    System.out.println("Content-type : '" + item.getContentType());
    System.out.println("Data : '" + item.getData());
    System.out.println("IsTemporary : '" + item.isTempFile());
    //        System.out.println("Length : '" + item.getData().length);
    System.out.println("javaFile : '" + item.getFile());

    String fname = item.getFileName();
    int i = fname.lastIndexOf('/');
    if (i == -1) {
        i = fname.lastIndexOf('\\');
    }
    if (i != -1) {
        fname = fname.substring(i);
    }
    fname = getFwPath() + fname;
    if (item.isTempFile()) {
        try {
            File tmpfile = item.getFile();
            if (!tmpfile.renameTo(new File(fname))) {
                setErrorMessage("Failed to rename file '" + tmpfile.getCanonicalPath() + "' to '" + fname + "'");
            }
        } catch (Exception ex) {
            setErrorMessage(ex.getMessage());
        }
    } else {
        try {
            FileOutputStream fout = new FileOutputStream(fname);
            fout.write(item.getData());
            fout.close();
        } catch (Exception e) {
            setErrorMessage(e.getMessage());
        }

    }
}
 
开发者ID:navisidhu,项目名称:libreacs,代码行数:41,代码来源:SoftwareJsfBean.java


示例6: actionLogoImgUpload

import org.richfaces.event.UploadEvent; //导入依赖的package包/类
/**
* Processa upload de imagem contendo novo logotipo da empresa
* @param event
*/
public void actionLogoImgUpload(UploadEvent event) {  
	List<UploadItem> files = event.getUploadItems();
	for (UploadItem uploadItem : files) {
	//transforma qualquer arquivo que vier (img, zip, gzip, pdf, word) numa colecao de imagens para processamento
	atualizaLogotipoEmpresa(uploadItem);
}
FacesContext context = FacesContext.getCurrentInstance();					
context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Imagens carregadas com sucesso!", "Imagens carregadas com sucesso!"));
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:14,代码来源:ConfiguracoesJSFBean.java


示例7: enviarArquivo

import org.richfaces.event.UploadEvent; //导入依赖的package包/类
/**
   * Este m�todo � respons�vel pelo upload de arquivos, perceba que este
   * metodo esta ligado a um fileUploadListener, ou seja, a um listener de aplica�ao,
   * por isso nao foi necessario passar um atributo do tipo File, pois o proprio
   * atributo fileUploadListener encarrega-se de receber um objeto do tipo File. 
   * 
   * chama o metodo incluiComUpload() de modelagemFuzzyService.
   * 
   * @author felipe.arruda
   * @param evento
   * 
   */
  public void enviarArquivo(UploadEvent evento) {

  	
  	UploadItem item = evento.getUploadItem();
  	
      try {        	
      	dataCriacao = new Date();
      	modelagemFuzzyCorrente.setDataCriacao(DataUtil.dateToCalendar(dataCriacao));
      	modelagemFuzzyCorrente.setNomeArquivo(item.getFileName());
      	modelagemFuzzyCorrente.setAutor(sessaoUsuarioCorrente.getUsuarioLogado().getNome());
      	modelagemFuzzyCorrente.setFinalidadeModelagem(comboModelagemFuzzy.getObjetoSelecionado());
      	modelagemFuzzyService.incluiComUpload(modelagemFuzzyCorrente, item);			
      	
	File file = new File();
       file.setLength(item.getData().length);
       file.setName(item.getFileName());
       file.setData(item.getData());
       files.add(file);
       
       uploadsAvailable--;
	listaDeModelagemFuzzys = null;
	messenger = true;
      	
} catch (AplicacaoException e) {
	
	valorDaMensagem=e.getMessage();
	messenger = false;
}

  }
 
开发者ID:dayse,项目名称:gesplan,代码行数:43,代码来源:ModelagemFuzzyActions.java


示例8: carregaModelo

import org.richfaces.event.UploadEvent; //导入依赖的package包/类
/*** Métodos da classe ***/

public void carregaModelo(UploadEvent event) throws Exception {
	UploadItem item = event.getUploadItem();
	relatorio.setTamanhoArquivo(item.getData().length);
	relatorio.setArquivo(item.getFileName());
	relatorio.setDados(item.getData());
}
 
开发者ID:herculeshssj,项目名称:imobiliariaweb,代码行数:9,代码来源:RelatorioController.java


示例9: carregaFoto

import org.richfaces.event.UploadEvent; //导入依赖的package包/类
public void carregaFoto(UploadEvent event) throws Exception {
	UploadItem item = event.getUploadItem();
	foto = new Foto();
	foto.setTamanho(item.getData().length);
	foto.setArquivo(item.getFileName());
	foto.setDados(item.getData());
	ImageIcon temp = new ImageIcon(item.getData());
	foto.setLargura(temp.getIconWidth());
	foto.setAltura(temp.getIconHeight());
	listaFoto.add(foto);
	contaArquivos--;
}
 
开发者ID:herculeshssj,项目名称:imobiliariaweb,代码行数:13,代码来源:ImovelController.java


示例10: richFileUpload

import org.richfaces.event.UploadEvent; //导入依赖的package包/类
public void richFileUpload(UploadEvent event) {
	System.out.println("");
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:4,代码来源:UploadJSFBean.java


示例11: actionHandleFileUpload

import org.richfaces.event.UploadEvent; //导入依赖的package包/类
/**
* Action
* @param event
*/
public void actionHandleFileUpload(UploadEvent event) {  
	List<UploadItem> files = event.getUploadItems();
	processUploadFiles(files);
  addMessage(FacesMessage.SEVERITY_INFO, "Imagens carregadas com sucesso!", "");
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:10,代码来源:EventProcJSFBean.java


示例12: handleUploadRelatorio

import org.richfaces.event.UploadEvent; //导入依赖的package包/类
/**
* Processa upload do arquivo jasper inserindo-o no relatório selecionado
* @param event
*/
public void handleUploadRelatorio(UploadEvent event) {  
	
	List<UploadItem> files = event.getUploadItems();
	
	for (UploadItem uploadItem : files) {
	
		byte[] data = getData(uploadItem);//espera um jasper. Já filtrado no componentes rich:fileupload.
	
	JRFileVO jrFileVO = getJrUpload();
	jrFileVO.setJasperReport(data);
	
	String datePart = LABEL_DTFORMAT.format(new Date());

	RelatorioVO relatorioVO = getSelectedRelatorio();
	relatorioVO.getJrFileVOs().add(jrFileVO);
}
	
FacesContext context = FacesContext.getCurrentInstance();					
context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Arquivos carregados com sucesso!", "Arquivos carregados com sucesso!"));
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:25,代码来源:ConfiguracoesJSFBean.java


示例13: onUploadMediaItem

import org.richfaces.event.UploadEvent; //导入依赖的package包/类
/**
 * Event handler for uploading a new {@link MediaItem}.
 *
 * @param event Event that invoked the handler
 * @throws IOException If the file upload could not complete
 */
public void onUploadMediaItem(UploadEvent event) throws IOException {
    UploadItem item = event.getUploadItem();

    try {
        // Find the original rendition (assume this is what is being uploaded)
        Rendition rendition = getSelectedCatalogue().getOriginalRendition();

        // Create MediaItem placeholder
        MediaItem mediaItem = new MediaItem();
        mediaItem.setTitle(FilenameUtils.getBaseName(item.getFileName()));
        mediaItem.setStatus(MediaItemStatus.SELF_UPLOAD);
        mediaItem.setOwner(getUser());
        mediaItem.setByLine(getUser().getFullName());
        mediaItem.setStatus(MediaItemStatus.SELF_UPLOAD);
        mediaItem.setCatalogue(getSelectedCatalogue());
        mediaItem = catalogueFacade.create(mediaItem);

        // Store MediaItemRendition in Database
        MediaItemRendition mediaItemRendition = catalogueFacade.create(
                item.getFile(),
                mediaItem,
                rendition,
                item.getFileName(),
                item.getContentType(),
                true);

        LOG.log(Level.FINE, "New media item rendition created: {0}",
                mediaItemRendition.getId());

        this.uploadedMediaItem = mediaItem.getId();
        setSelectedMediaItemId(this.uploadedMediaItem);
    } catch (IOException ex) {
        JsfUtils.createMessage("frmPage",
                FacesMessage.SEVERITY_FATAL,
                Bundle.i18n.name(),
                "Generic_AN_ERROR_OCCURRED_X",
                new Object[]{ex.getMessage()});
        LOG.log(Level.SEVERE, "Could not create media item rendition. {0}",
                ex.getMessage());
    }
}
 
开发者ID:getconverge,项目名称:converge-1.x,代码行数:48,代码来源:NewsItem.java


示例14: onUploadConcepts

import org.richfaces.event.UploadEvent; //导入依赖的package包/类
/**
 * Event handler for uploading and importing concepts.
 *
 * @param event Event that invoked the handler
 */
public void onUploadConcepts(UploadEvent event) throws IOException {
    UploadItem item = event.getUploadItem();
    this.uploadedConcepts.add(item);
}
 
开发者ID:getconverge,项目名称:converge-1.x,代码行数:10,代码来源:Concepts.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ClusterStatusProtos类代码示例发布时间:2022-05-23
下一篇:
Java TimelineEvents类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap