com.vaadin.ui.Embedded.setWidth()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(12.3k)|赞(0)|评价(0)|浏览(180)

本文整理了Java中com.vaadin.ui.Embedded.setWidth()方法的一些代码示例,展示了Embedded.setWidth()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Embedded.setWidth()方法的具体详情如下:
包路径:com.vaadin.ui.Embedded
类名称:Embedded
方法名:setWidth

Embedded.setWidth介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

Embedded e = new Embedded(null, new ExternalResource(
        "http://www.youtube.com/v/meXvxkn1Y_8&hl=en_US&fs=1&"));
e.setMimeType("application/x-shockwave-flash");
e.setParameter("allowFullScreen", "true");
e.setWidth("320px");
e.setHeight("265px");
addComponent(e);

代码示例来源:origin: apache/ace

/**
 * Factory method to create an embeddable icon.
 * 
 * @param name
 *            the name of the icon to use (is also used as tooltip text);
 * @param res
 *            the resource denoting the actual icon.
 * @return an embeddable icon, never <code>null</code>.
 */
protected Embedded createIcon(String name, Resource res) {
  Embedded embedded = new Embedded(name, res);
  embedded.setType(Embedded.TYPE_IMAGE);
  embedded.setDescription(name);
  embedded.setHeight(ICON_HEIGHT + "px");
  embedded.setWidth(ICON_WIDTH + "px");
  return embedded;
}

代码示例来源:origin: org.activiti/activiti-explorer

protected void populateSubTasks(List<HistoricTaskInstance> subTasks) {
 for (final HistoricTaskInstance subTask : subTasks) {
  // icon
  Embedded icon = new Embedded(null, Images.TASK_22);
  icon.setWidth(22, UNITS_PIXELS);
  icon.setWidth(22, UNITS_PIXELS);
  subTaskGrid.addComponent(icon);
  
  // Link to subtask
  Button subTaskLink = new Button(subTask.getName());
  subTaskLink.addStyleName(Reindeer.BUTTON_LINK);
  subTaskLink.addListener(new ClickListener() {
   public void buttonClick(ClickEvent event) {
    ExplorerApp.get().getViewManager().showTaskPage(subTask.getId());
   }
  });
  subTaskGrid.addComponent(subTaskLink);
  subTaskGrid.setComponentAlignment(subTaskLink, Alignment.MIDDLE_LEFT);
 }
}

代码示例来源:origin: org.aperteworkflow/editor

private void showDefaultProcessLogo() {
  if (logoImage != null) {
    removeComponent(logoImage);
    logoImage = null;
  }
  // show the default logo
  logoImage = VaadinUtility.embedded(
      GenericEditorApplication.getCurrent(),
      ModelConstants.PROCESS_LOGO_DEFAULT_RESOURCE
  );
  logoImage.setWidth("32px");
  logoImage.setHeight("32px");
  addComponent(logoImage, 0, 1);
  // no point to reset the default logo
  logoResetButton.setEnabled(false);
}

代码示例来源:origin: org.aperteworkflow/editor

private void showProcessLogo(final byte[] content) {
  if (logoImage != null) {
    removeComponent(logoImage);
    logoImage = null;
  }
  StreamResource.StreamSource source = new StreamResource.StreamSource() {
    @Override
    public InputStream getStream() {
      return new ByteArrayInputStream(content);
    }
  };
  // generate random file name to bypass web browser image cache
  String randomFileName = "process-logo-" + System.nanoTime() + ".png";
  StreamResource resource = new StreamResource(source, randomFileName, GenericEditorApplication.getCurrent());
  // show the logo
  logoImage = new Embedded();
  logoImage.setType(Embedded.TYPE_IMAGE);
  logoImage.setSource(resource);
  logoImage.setWidth("32px");
  logoImage.setHeight("32px");
  addComponent(logoImage, 0, 1);
  // allow to reset the logo
  logoResetButton.setEnabled(true);
}

代码示例来源:origin: org.activiti/activiti-explorer

protected void addTaskEventPicture(final org.activiti.engine.task.Event taskEvent, GridLayout eventGrid) {
 final Picture userPicture = identityService.getUserPicture(taskEvent.getUserId());
 Embedded authorPicture = null;
 
 if (userPicture != null) {
  StreamResource imageresource = new StreamResource(new StreamSource() {
   private static final long serialVersionUID = 1L;
   public InputStream getStream() {
    return userPicture.getInputStream();
   }
  }, "event_" + taskEvent.getUserId() + "." + Constants.MIMETYPE_EXTENSION_MAPPING.get(userPicture.getMimeType()), ExplorerApp.get());
  authorPicture = new Embedded(null, imageresource);
 } else {
  authorPicture = new Embedded(null, Images.USER_50);
 }
 
 authorPicture.setType(Embedded.TYPE_IMAGE);
 authorPicture.setHeight("48px");
 authorPicture.setWidth("48px");
 authorPicture.addStyleName(ExplorerLayout.STYLE_TASK_EVENT_PICTURE);
 eventGrid.addComponent(authorPicture);
}

代码示例来源:origin: org.opennms.features.topology/api

@Override
  public void attach() {
    super.attach();
    
    int width = getUI().getPage().getBrowserWindowWidth();
    int height = getUI().getPage().getBrowserWindowHeight();
    
    /*Sets the browser and window sizes based on the main window*/
    int browserWidth = (int)(sizePercentage * width), browserHeight = (int)(sizePercentage * height);
    int windowWidth = browserWidth + widthCushion, windowHeight = browserHeight + heightCushion;
    setWidth(windowWidth, Unit.PIXELS);
    setHeight(windowHeight, Unit.PIXELS);
    setPositionX((width - windowWidth)/2);
    setPositionY((height - windowHeight)/2);
    
    /*Sets the size of the browser to fit within the sub-window*/
    infoBrowser.setType(Embedded.TYPE_BROWSER);
    infoBrowser.setWidth(browserWidth, Unit.PIXELS);
    infoBrowser.setHeight(browserHeight, Unit.PIXELS);
  }
}

代码示例来源:origin: org.activiti/activiti-explorer

icon = new Embedded(null, Images.TASK_22);
icon.setWidth(22, UNITS_PIXELS);
icon.setWidth(22, UNITS_PIXELS);
subTaskLayout.addComponent(icon);

代码示例来源:origin: OpenNMS/opennms

@Override
  public void attach() {
    super.attach();
    
    int width = getUI().getPage().getBrowserWindowWidth();
    int height = getUI().getPage().getBrowserWindowHeight();
    
    /*Sets the browser and window sizes based on the main window*/
    int browserWidth = (int)(sizePercentage * width), browserHeight = (int)(sizePercentage * height);
    int windowWidth = browserWidth + widthCushion, windowHeight = browserHeight + heightCushion;
    setWidth(windowWidth, Unit.PIXELS);
    setHeight(windowHeight, Unit.PIXELS);
    setPositionX((width - windowWidth)/2);
    setPositionY((height - windowHeight)/2);
    
    /*Sets the size of the browser to fit within the sub-window*/
    infoBrowser.setType(Embedded.TYPE_BROWSER);
    infoBrowser.setWidth(browserWidth, Unit.PIXELS);
    infoBrowser.setHeight(browserHeight, Unit.PIXELS);
  }
}

代码示例来源:origin: OpenNMS/opennms

@Override
  public void attach() {
    super.attach();
    
    int width = getUI().getPage().getBrowserWindowWidth();
    int height = getUI().getPage().getBrowserWindowHeight();
    
    /*Sets the browser and window size based on the main window*/
    int browserWidth = (int)(sizePercentage * width), browserHeight = (int)(sizePercentage * height);
    int windowWidth = browserWidth + widthCushion, windowHeight = browserHeight + heightCushion;
    setWidth("" + windowWidth + "px");
    setHeight("" + windowHeight + "px");
    setPositionX((width - windowWidth)/2);
    setPositionY((height - windowHeight)/2);
    
    /*Changes the size of the browser to fit within the sub-window*/
    rgBrowser.setType(Embedded.TYPE_BROWSER);
    rgBrowser.setWidth("" + browserWidth + "px");
    rgBrowser.setHeight("" + browserHeight + "px");
  }
}

代码示例来源:origin: org.opennms.features.topology/org.opennms.features.topology.netutils

@Override
  public void attach() {
    super.attach();
    
    int width = getUI().getPage().getBrowserWindowWidth();
    int height = getUI().getPage().getBrowserWindowHeight();
    
    /*Sets the browser and window size based on the main window*/
    int browserWidth = (int)(sizePercentage * width), browserHeight = (int)(sizePercentage * height);
    int windowWidth = browserWidth + widthCushion, windowHeight = browserHeight + heightCushion;
    setWidth("" + windowWidth + "px");
    setHeight("" + windowHeight + "px");
    setPositionX((width - windowWidth)/2);
    setPositionY((height - windowHeight)/2);
    
    /*Changes the size of the browser to fit within the sub-window*/
    rgBrowser.setType(Embedded.TYPE_BROWSER);
    rgBrowser.setWidth("" + browserWidth + "px");
    rgBrowser.setHeight("" + browserHeight + "px");
  }
}

代码示例来源:origin: org.opennms.features.topology/org.opennms.features.topology.api

@Override
  public void attach() {
    super.attach();
    
    int width = getUI().getPage().getBrowserWindowWidth();
    int height = getUI().getPage().getBrowserWindowHeight();
    
    /*Sets the browser and window sizes based on the main window*/
    int browserWidth = (int)(sizePercentage * width), browserHeight = (int)(sizePercentage * height);
    int windowWidth = browserWidth + widthCushion, windowHeight = browserHeight + heightCushion;
    setWidth(windowWidth, Unit.PIXELS);
    setHeight(windowHeight, Unit.PIXELS);
    setPositionX((width - windowWidth)/2);
    setPositionY((height - windowHeight)/2);
    
    /*Sets the size of the browser to fit within the sub-window*/
    infoBrowser.setType(Embedded.TYPE_BROWSER);
    infoBrowser.setWidth(browserWidth, Unit.PIXELS);
    infoBrowser.setHeight(browserHeight, Unit.PIXELS);
  }
}

代码示例来源:origin: org.opennms.features.topology/netutils

@Override
  public void attach() {
    super.attach();
    
    int width = getUI().getPage().getBrowserWindowWidth();
    int height = getUI().getPage().getBrowserWindowHeight();
    
    /*Sets the browser and window size based on the main window*/
    int browserWidth = (int)(sizePercentage * width), browserHeight = (int)(sizePercentage * height);
    int windowWidth = browserWidth + widthCushion, windowHeight = browserHeight + heightCushion;
    setWidth("" + windowWidth + "px");
    setHeight("" + windowHeight + "px");
    setPositionX((width - windowWidth)/2);
    setPositionY((height - windowHeight)/2);
    
    /*Changes the size of the browser to fit within the sub-window*/
    rgBrowser.setType(Embedded.TYPE_BROWSER);
    rgBrowser.setWidth("" + browserWidth + "px");
    rgBrowser.setHeight("" + browserHeight + "px");
  }
}

代码示例来源:origin: org.activiti/activiti-explorer

picture.setWidth("32px");

代码示例来源:origin: org.activiti/activiti-explorer

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(MouseEvents.ClickEvent event) {
     viewManager.showProfilePopup(userName);
    }
   });
   
   addComponent(image);
   setComponentAlignment(image, Alignment.MIDDLE_LEFT);
  } else {
   // TODO: what when no image is available?
  }
 }
}

代码示例来源:origin: org.activiti/activiti-explorer

protected void initPicture() {
 StreamResource imageresource = new StreamResource(new StreamSource() {
  private static final long serialVersionUID = 1L;
  public InputStream getStream() {
   return picture.getInputStream();
  }
 }, user.getId(), ExplorerApp.get());
 imageresource.setCacheTime(0);
 
 Embedded picture = new Embedded(null, imageresource);
 picture.setType(Embedded.TYPE_IMAGE);
 picture.setHeight(200, UNITS_PIXELS);
 picture.setWidth(200, UNITS_PIXELS);
 picture.addStyleName(ExplorerLayout.STYLE_PROFILE_PICTURE);
 
 imageLayout.addComponent(picture);
 imageLayout.setWidth(picture.getWidth() + 5, picture.getWidthUnits());
 
 // Change picture button
 if (isCurrentLoggedInUser) {
  Upload changePictureButton = initChangePictureButton();
  imageLayout.addComponent(changePictureButton);
  imageLayout.setComponentAlignment(changePictureButton, Alignment.MIDDLE_CENTER);
 }
}

代码示例来源:origin: org.activiti/activiti-explorer

Embedded browserPanel = new Embedded("", new ExternalResource(url));
browserPanel.setType(Embedded.TYPE_BROWSER);
browserPanel.setWidth(maxX + 350 + "px");
browserPanel.setHeight(maxY + 220 + "px");

代码示例来源:origin: org.activiti/activiti-explorer

Embedded browserPanel = new Embedded("", new ExternalResource(url));
browserPanel.setType(Embedded.TYPE_BROWSER);
browserPanel.setWidth(maxX + 350 + "px");
browserPanel.setHeight(maxY + 220 + "px");

代码示例来源:origin: nz.co.senanque/madura-workflow-vaadin

@PostConstruct
public void init() {
  
  final Window me = this;
  MessageSourceAccessor messageSourceAccessor= new MessageSourceAccessor(m_messageSource);
  Layout main = new VerticalLayout();
  setContent(main);
  main.setWidth("400px");
  Embedded embedded = new Embedded();
  embedded.setImmediate(false);
  embedded.setWidth("-1px");
  embedded.setHeight("-1px");
  embedded.setSource(new com.vaadin.server.ThemeResource("images/logo.jpg"));
  embedded.setType(1);
  embedded.setMimeType("image/gif");
  main.addComponent(embedded);
  main.addComponent(new Label(messageSourceAccessor.getMessage("about.text")));
  Label aboutInfoLabel = new Label(m_aboutInfo.toString(),ContentMode.HTML);
  main.addComponent(aboutInfoLabel);
  Button OK = new Button(messageSourceAccessor.getMessage("OK"));
  OK.setClickShortcut( KeyCode.ENTER ) ;
  OK.addStyleName( ValoTheme.BUTTON_PRIMARY ) ;
  main.addComponent(OK);
  OK.addClickListener(new ClickListener(){
    private static final long serialVersionUID = 1L;
    public void buttonClick(ClickEvent event) {
      me.close();
    }});
}

相关文章