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


Java Resource类代码示例

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


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

示例1: initPicture

import com.vaadin.terminal.Resource; //导入依赖的package包/类
protected void initPicture(IdentityService identityService, boolean renderPicture, final String userName) {
  if(renderPicture) {
    Picture picture = identityService.getUserPicture(userName);
    if(picture != null) {
      Resource imageResource = new StreamResource(new InputStreamStreamSource(picture.getInputStream()), 
        userName + picture.getMimeType(), ExplorerApp.get());
      
      Embedded image = new Embedded(null, imageResource);
      image.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
      image.setType(Embedded.TYPE_IMAGE);
      image.setHeight(30, Embedded.UNITS_PIXELS);
      image.setWidth(30, Embedded.UNITS_PIXELS);
      image.addListener(new MouseEvents.ClickListener() {
        private static final long serialVersionUID = 7341560240277898495L;
        public void click(com.vaadin.event.MouseEvents.ClickEvent event) {
          viewManager.showProfilePopup(userName);
        }
      });
      
      addComponent(image);
      setComponentAlignment(image, Alignment.MIDDLE_LEFT);
    } else {
     // TODO: what when no image is available?
    }
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:27,代码来源:UserProfileLink.java

示例2: addModule

import com.vaadin.terminal.Resource; //导入依赖的package包/类
@Override
public void addModule(String id, String name, IViewContainer viewComponent, boolean closeable, Resource icon, LOCATION location) {
	if (tabSheetModule.getComponentCount() == 0) 
		tabSheetModule.hideTabs(false);

	// add module to the list
	modules.put(id, viewComponent);
	
	// create new tab for the current module
	Tab tab = tabSheetModule.addTab((Component) viewComponent, name, icon);
	
	// set closable flag
	tab.setClosable(closeable);
			
	tabSheetModule.setSelectedTab((Component) viewComponent);
			
}
 
开发者ID:thingtrack,项目名称:konekti,代码行数:18,代码来源:WorkbenchPanel.java

示例3: extractDatasetInfo

import com.vaadin.terminal.Resource; //导入依赖的package包/类
private void extractDatasetInfo(URI graph, org.openrdf.model.Resource catalogUri, Value rawGraph, RepositoryConnection connection) throws RepositoryException, DatatypeConfigurationException {
  RepositoryResult<Statement> statements = connection.getStatements(null, ODSVoc.DCAT_CAT_PROP_DATASET, null, false, graph);
  Collection<Statement> statementList = Iterations.asList(statements);
  for (Statement s : statementList) {
    Value rawDatasetUrl = s.getObject();
    String rawDatasetId = getRawDatasetId(rawDatasetUrl);
    URI catalogRecordUri = valueFactory.createURI(catalogUri.toString() + "record/" + rawDatasetId);
    URI harmonizedDatasetUri = valueFactory.createURI(catalogUri.toString() + "dataset/" + rawDatasetId);
    connection.add(valueFactory.createStatement(catalogUri, ODSVoc.DCAT_CAT_PROP_RECORD, catalogRecordUri), graph);
    connection.add(valueFactory.createStatement(catalogRecordUri, ODSVoc.FOAF_PRIMARYTOPIC, harmonizedDatasetUri), graph);
    connection.add(valueFactory.createStatement(catalogRecordUri, ODSVoc.RDFTYPE, ODSVoc.DCAT_CATALOGRECORD), graph);
    connection.add(valueFactory.createStatement(catalogRecordUri, ODSVoc.ODS_RAW_DATASET, rawDatasetUrl), graph);
    connection.add(valueFactory.createStatement(catalogRecordUri, ODSVoc.DCT_MODIFIED, valueFactory.createLiteral(getXMLNow())), graph);
    connection.add(valueFactory.createStatement(harmonizedDatasetUri, ODSVoc.RDFTYPE, ODSVoc.DCAT_DATASET), graph);
    connection.add(valueFactory.createStatement(catalogUri, ODSVoc.DCAT_CAT_PROP_DATASET, harmonizedDatasetUri), graph);

  }
  statements.close();
}
 
开发者ID:nvdk,项目名称:ods-lodms-plugins,代码行数:20,代码来源:ODSDCatGenerator.java

示例4: load

import com.vaadin.terminal.Resource; //导入依赖的package包/类
@Override
public void load(Repository repository, URI graph, LoadContext context) throws LoadException {
    try {
        PPTApi api = new PPTApi(config.getApiConfig().getServer(), config.getApiConfig().getAuthentication());
        RepositoryConnection repCon = repository.getConnection();
        try {
            org.openrdf.model.Resource targetGraph = null;
            if (StringUtils.hasText(config.getGraph())) {
                targetGraph = (org.openrdf.model.Resource) new URIImpl(config.getGraph());
            }
            api.importRdf(config.getApiConfig().getProjectId(), repCon, graph, targetGraph);
            api.createSnapshot(config.getApiConfig().getProjectId());
        } finally {
            repCon.close();
        }
    } catch (Exception ex) {
        throw new LoadException(ex);
    }
}
 
开发者ID:lodms,项目名称:lodms-plugins,代码行数:20,代码来源:ThesaurusImportLoader.java

示例5: addMenuButton

import com.vaadin.terminal.Resource; //导入依赖的package包/类
protected Button addMenuButton(String type, String label, Resource icon, boolean active, float width) {
  Button button = new Button(label);
  button.addStyleName(type);
  button.addStyleName(ExplorerLayout.STYLE_MAIN_MENU_BUTTON);
  button.addStyleName(Reindeer.BUTTON_LINK);
  button.setHeight(54, UNITS_PIXELS);
  button.setIcon(icon);
  button.setWidth(width, UNITS_PIXELS);
  
  addComponent(button);
  setComponentAlignment(button, Alignment.TOP_CENTER);
  
  return button;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:15,代码来源:MainMenuBar.java

示例6: determineTableIcon

import com.vaadin.terminal.Resource; //导入依赖的package包/类
protected Embedded determineTableIcon(String tableName) {
  Resource image = null;
  if (tableName.startsWith("ACT_HI")) {
    image = Images.DATABASE_HISTORY;
  } else if (tableName.startsWith("ACT_RU")) {
    image = Images.DATABASE_RUNTIME;
  } else if (tableName.startsWith("ACT_RE")) {
    image = Images.DATABASE_REPOSITORY;
  } else if (tableName.startsWith("ACT_ID")) {
    image = Images.DATABASE_IDENTITY;
  } else {
    image = Images.DATABASE_22;
  }
  return new Embedded(null, image);
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:16,代码来源:DatabasePage.java

示例7: createIconResource

import com.vaadin.terminal.Resource; //导入依赖的package包/类
private Resource createIconResource(IUnoVaadinApplication application, Notification notification) {
	Map<URL, ApplicationResource> mapApplicationResource = mapResourceXURL.get(application);
	if (mapApplicationResource == null) {
		mapApplicationResource = new HashMap<URL, ApplicationResource>();
		mapResourceXURL.put(application, mapApplicationResource);
	}
	URL iconURL = notification.getIcon32x32URL();
	ApplicationResource resource = mapApplicationResource.get(iconURL);
	if (resource == null) {
		resource = new URLResource(iconURL, application.getMainWindow().getApplication());
		mapApplicationResource.put(iconURL, resource);
	}
	return resource;
}
 
开发者ID:frincon,项目名称:openeos,代码行数:15,代码来源:VaadinNotificationManager.java

示例8: setIcon

import com.vaadin.terminal.Resource; //导入依赖的package包/类
public void setIcon(Resource icon, int width, int height, int xOffset, int yOffset) {
	icon_w = width;
	icon_h = height;
	icon_ox = xOffset;
	icon_oy = yOffset;
	setIcon(icon); // also calls requestRepaint()		
}
 
开发者ID:lizardtechblog,项目名称:ExpressZip,代码行数:8,代码来源:Marker.java

示例9: createDataSource

import com.vaadin.terminal.Resource; //导入依赖的package包/类
private HierarchicalContainer createDataSource(Organization organization) {
	HierarchicalContainer container = new HierarchicalContainer();
	
	// A property that holds the caption is needed for ITEM_CAPTION_MODE_PROPERTY
       container.addContainerProperty("description", String.class, "");
       container.addContainerProperty("icon", Resource.class, null);
	
	// create the root node
	container.addItem(organization);
	container.getItem(organization).getItemProperty("description").setValue(organization.getName());
	container.getItem(organization).getItemProperty("icon").setValue(new ThemeResource("../konekti/images/icons/organization-module/building.png"));
	
	for (Location location : organization.getLocations()) {
		container.addItem(location);
		container.getItem(location).getItemProperty("description").setValue(location.getName());
		container.getItem(location).getItemProperty("icon").setValue(new ThemeResource("../konekti/images/icons/organization-module/marker.png"));
		container.setParent(location, organization);
		
		for (Area area : location.getAreas()) {
			container.addItem(area);
			container.getItem(area).getItemProperty("description").setValue(area.getName());
			container.getItem(area).getItemProperty("icon").setValue(new ThemeResource("../konekti/images/icons/organization-module/sitemap-application-blue.png"));
			container.setParent(area, location);
			container.setChildrenAllowed(area, false);
		}
	}
	
	return container;
	
}
 
开发者ID:thingtrack,项目名称:konekti,代码行数:31,代码来源:OrganizationView.java

示例10: addMenuItem

import com.vaadin.terminal.Resource; //导入依赖的package包/类
@Override
public MenuItem addMenuItem(String caption, String hint, Resource icon, MenuItem menuItem, Command command) {
	MenuItem itm = menuItem.addItem(caption, icon, command);
	itm.setDescription(hint);
	
	return itm;
	
}
 
开发者ID:thingtrack,项目名称:konekti,代码行数:9,代码来源:MenuLayout.java

示例11: addModule

import com.vaadin.terminal.Resource; //导入依赖的package包/类
@Override
public void addModule(String id, String name, IViewContainer viewComponent, boolean closeable, Resource icon, LOCATION location) {
	if (location == LOCATION.TOP)
		getTopPanelWorkbench().addModule(id, name, viewComponent, closeable, icon, location);
	else if (location == LOCATION.LEFT)
		getLeftPanelWorkbench().addModule(id, name, viewComponent, closeable, icon, location);
	else if(location == LOCATION.CENTER)
		getCentralPanelWorkbench().addModule(id, name, viewComponent, closeable, icon, location);
	else if(location == LOCATION.RIGHT)
		getRightPanelWorkbench().addModule(id, name, viewComponent, closeable, icon, location);
	else if(location == LOCATION.BOTTON)
		getBottonPanelWorkbench().addModule(id, name, viewComponent, closeable, icon, location);
	
	modules.put(id, location);
}
 
开发者ID:thingtrack,项目名称:konekti,代码行数:16,代码来源:WorkbenchLayout.java

示例12: transform

import com.vaadin.terminal.Resource; //导入依赖的package包/类
/**
 * Transforms the cached RDF data in the repository.
 *
 * @param repository The repository where the RDF data is cached that should be transformed
 * @param graph      The graph that contains the RDF data which was extracted
 * @param context    The context containing meta information about this transformation process
 * @throws at.punkt.lodms.spi.transform.TransformException
 *          If the transformation fails, this exception has to be thrown
 */
@Override
public void transform(Repository repository, URI graph, TransformContext context) throws TransformException {
    try {
        WKDLawHandler wkdLawHandler = new WKDLawHandler(repository);
        org.openrdf.model.Resource documentResource = wkdLawHandler.getDocumentResource(graph);
        String suggestionURI = documentResource + "?Suggestions";
        context.getCustomData().put("wkdspotlighttagger.documenturi",suggestionURI);
        QueryResult<BindingSet> result = wkdLawHandler.getTextValues(graph);
        RepositoryConnection connection = repository.getConnection();
        try {
            connection.clear(graph);
            connection.add(ValueFactoryImpl.getInstance().createURI(suggestionURI),rdfType, pebblesSuggestion,graph);
            while (result.hasNext()) {
                BindingSet bSet = result.next();
                Value text = bSet.getValue("value");
                URI fragment = (URI) bSet.getValue("fragment");
                if (!text.stringValue().isEmpty()) {
                    String nif = getTagsForText(fragment,text.stringValue());
                    connection.add(new ByteArrayInputStream(nif.getBytes("ISO-8859-1")),fragment.stringValue(), RDFFormat.RDFXML,graph);
                }
            }
        }
        finally {
            result.close();
            connection.close();
        }
    }
    catch (Exception e) {
        throw new TransformException(e.getMessage(),e);
    }
}
 
开发者ID:lodms,项目名称:lodms-plugins,代码行数:41,代码来源:WkdSpotlightNifTagger.java

示例13: transform

import com.vaadin.terminal.Resource; //导入依赖的package包/类
/**
 * Transforms the cached RDF data in the repository.
 *
 * @param repository The repository where the RDF data is cached that should be transformed
 * @param graph      The graph that contains the RDF data which was extracted
 * @param context    The context containing meta information about this transformation process
 * @throws at.punkt.lodms.spi.transform.TransformException
 *          If the transformation fails, this exception has to be thrown
 */
@Override
public void transform(Repository repository, URI graph, TransformContext context) throws TransformException {
    try {
        WKDLawHandler wkdLawHandler = new WKDLawHandler(repository);
        org.openrdf.model.Resource documentResource = wkdLawHandler.getDocumentResource(graph);
        String suggestionURI = documentResource + "?Suggestions";
        context.getCustomData().put("wkdspotlighttagger.documenturi",suggestionURI);
        List<SpotlightAnnotation> annotationList = getAnnotations(repository, graph, context);
        RepositoryConnection connection = repository.getConnection();
        connection.clear(graph);
        connection.commit();
        URI suggestionGraph = valueFactory.createURI(suggestionURI);
        connection.add(suggestionGraph,rdfType, pebblesSuggestion,graph);
        try {
            for (SpotlightAnnotation annotation : annotationList) {
                URI fragmentURI = annotation.getFragmentURI();
                for (SpotlightResource resource : annotation.getResources()) {
                    URI relatedConcept = valueFactory.createURI(resource.getURI());
                    connection.add(documentResource,skosRelated,relatedConcept,graph);
                    connection.add(fragmentURI,skosRelated,relatedConcept,graph);
                }
            }
            connection.commit();
        }
        finally {
            connection.close();
        }
    }
    catch (Exception e) {
        throw new TransformException(e.getMessage(),e);
    }
}
 
开发者ID:lodms,项目名称:lodms-plugins,代码行数:42,代码来源:WkdSpotlightTagger.java

示例14: ThemeImageColumnGenerator

import com.vaadin.terminal.Resource; //导入依赖的package包/类
public ThemeImageColumnGenerator(Resource image) {
  this.image = image;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:4,代码来源:ThemeImageColumnGenerator.java

示例15: getImage

import com.vaadin.terminal.Resource; //导入依赖的package包/类
public Resource getImage(Attachment attachment) {
  return Images.IMAP;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:4,代码来源:EmailAttachmentRenderer.java


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