Java Code Examples for com.vaadin.ui.Panel

The following are top voted examples for showing how to use com.vaadin.ui.Panel. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: spring-boot-plugins-example   File: VaadinUI.java   Source Code and License 6 votes vote down vote up
@Override
protected void init(VaadinRequest request) {
	final VerticalLayout root = new VerticalLayout();
	root.setSizeFull();
	root.setMargin(true);
	root.setSpacing(true);
	setContent(root);
	MHorizontalLayout horizontalLayout = new MHorizontalLayout();
	for (MenuEntry menuEntry : menuEntries) {
		horizontalLayout.addComponent(new MButton(menuEntry.getName(), event -> {
			navigator.navigateTo(menuEntry.getNavigationTarget());
		}));
	}
	root.addComponent(horizontalLayout);
	springViewDisplay = new Panel();
	springViewDisplay.setSizeFull();
	root.addComponent(springViewDisplay);
	root.setExpandRatio(springViewDisplay, 1.0f);

}
 
Example 2
Project: spring-boot-vaadin-rabbitmq-pipeline-demo   File: NavigatorUI.java   Source Code and License 6 votes vote down vote up
@Override
protected void init(VaadinRequest request) {
    final VerticalLayout rootLayout = new VerticalLayout();
    rootLayout.setSizeFull();
    setContent(rootLayout);

    final CssLayout navigationBar = new CssLayout();
    navigationBar.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
    navigationBar.addComponent(createNavigationButton("Demo View (Default)",
            Constants.VIEW_DEFAULT));
    navigationBar.addComponent(createNavigationButton("Stream View",
            Constants.VIEW_STREAM));
    rootLayout.addComponent(navigationBar);

    springViewDisplay = new Panel();
    springViewDisplay.setSizeFull();
    
    rootLayout.addComponent(springViewDisplay);
    rootLayout.setExpandRatio(springViewDisplay, 1.0f);

}
 
Example 3
Project: osc-core   File: BaseDeploymentSpecWindow.java   Source Code and License 6 votes vote down vote up
@SuppressWarnings("serial")
protected Panel getOptionTable() {
    this.optionTable = new Table();
    this.optionTable.setPageLength(3);
    this.optionTable.setSizeFull();
    this.optionTable.setImmediate(true);
    this.optionTable.addGeneratedColumn("Enabled", new CheckBoxGenerator());
    this.optionTable.addContainerProperty("Name", String.class, null);
    this.optionTable.addItemClickListener(new ItemClickListener() {
        @Override
        public void itemClick(ItemClickEvent event) {
            optionTableClicked(event);
        }
    });

    this.optionPanel = new Panel();
    this.optionPanel.addStyleName(StyleConstants.FORM_PANEL);
    this.optionPanel.setWidth(100, Sizeable.Unit.PERCENTAGE);
    this.optionPanel.setContent(this.optionTable);

    return this.optionPanel;

}
 
Example 4
Project: osc-core   File: ManageLayout.java   Source Code and License 6 votes vote down vote up
public ManageLayout(BackupServiceApi backupService, RestoreServiceApi restoreService,
        ServerApi server, ValidationApi validator) {
    super();
    this.backupService = backupService;
    this.validator = validator;

    VerticalLayout backupContainer = new VerticalLayout();
    VerticalLayout restoreContainer = new VerticalLayout();

    DbRestorer restorer = new DbRestorer(restoreService, server, validator);
    restorer.setSizeFull();

    // Component to Backup Database
    Panel bkpPanel = new Panel();
    bkpPanel.setContent(createBackup());

    backupContainer.addComponent(ViewUtil.createSubHeader("Backup Database", null));
    backupContainer.addComponent(bkpPanel);

    restoreContainer.addComponent(ViewUtil.createSubHeader("Restore Database", null));
    restoreContainer.addComponent(restorer);

    addComponent(backupContainer);
    addComponent(restoreContainer);
}
 
Example 5
Project: osc-core   File: BaseDAWindow.java   Source Code and License 6 votes vote down vote up
protected Panel getAttributesPanel() {

        this.sharedKey = new PasswordField();
        this.sharedKey.setRequiredError("shared secret key cannot be empty");
        this.sharedKey.setRequired(true);
        // best show/hide this conditionally based on Manager type.
        this.sharedKey.setValue("dummy1234");

        this.attributes = new Table();
        this.attributes.setPageLength(0);
        this.attributes.setSelectable(true);
        this.attributes.setSizeFull();
        this.attributes.setImmediate(true);

        this.attributes.addContainerProperty("Attribute Name", String.class, null);
        this.attributes.addContainerProperty("Value", PasswordField.class, null);
        this.attributes.addItem(new Object[] { "Shared Secret key", this.sharedKey }, new Integer(1));
        // creating panel to store attributes table
        this.attributePanel = new Panel("Common Appliance Configuration Attributes:");
        this.attributePanel.addStyleName("form_Panel");
        this.attributePanel.setWidth(100, Sizeable.Unit.PERCENTAGE);
        this.attributePanel.setContent(this.attributes);

        return this.attributePanel;
    }
 
Example 6
Project: garantia   File: LoginUI.java   Source Code and License 6 votes vote down vote up
@Override
protected void init(VaadinRequest request) {
	log.info("Levanto la pagina UI");
	
	final VerticalLayout root = new VerticalLayout();
       root.setSizeFull();
       root.setMargin(true);
       root.setSpacing(true);
       setContent(root);
	
       final Panel viewContainer = new Panel();
       viewContainer.setSizeFull();
       root.addComponent(viewContainer);
       root.setExpandRatio(viewContainer, 1.0f);
       
       Navigator navigator = new Navigator(this, viewContainer);
       //Navigator navigator = new Navigator(this, this);
       navigator.addProvider(viewProvider);
       
       log.info("Termina de levantar la pagina UI");

}
 
Example 7
Project: HomeWire-Server   File: FlowViewPanel.java   Source Code and License 6 votes vote down vote up
public FlowViewPanel(FlowDTO flowDTO,
                     ConditionWidgetRepository conditionWidgetRepository,
                     ActionWidgetRepository actionWidgetRepository) {
  this.flowDTO = flowDTO;
  this.innerPanel = new Panel(flowDTO.getName());
  this.conditionWidgetRepository = conditionWidgetRepository;
  this.actionWidgetRepository = actionWidgetRepository;

  StackPanel stackPanel = StackPanel.extend(innerPanel);
  stackPanel.setToggleIconsEnabled(false);
  stackPanel.close();

  innerPanel.setContent(getPanelGrid());

  setCompositionRoot(innerPanel);
}
 
Example 8
Project: HomeWire-Server   File: ConditionPanel.java   Source Code and License 6 votes vote down vote up
public ConditionPanel(ConditionDTO conditionDTO,
                      ConditionWidgetRepository conditionWidgetRepository,
                      Consumer<ConditionDTO> changeListener) {
  this.conditionWidgetRepository = conditionWidgetRepository;
  this.conditionDTO = conditionDTO;

  this.mainPanel = new Panel("Condition");
  this.mainTypeComboBox = new ComboBox("Type");

  this.currentConditionWidget = conditionWidgetRepository
      .getFactory(TypeViewDTO.ConditionTypes.ofConditionDto(conditionDTO))
      .createWidget(conditionDTO);
  currentConditionWidget.setChangeListener(changeListener);

  this.changeListener = changeListener;

  setupPanel();

  setCompositionRoot(mainPanel);
  setSizeUndefined();
}
 
Example 9
Project: HomeWire-Server   File: ActionPanel.java   Source Code and License 6 votes vote down vote up
public ActionPanel(ActionDTO actionDTO,
                   ActionWidgetRepository actionWidgetRepository,
                   Consumer<ActionDTO> changeListener) {
  this.actionWidgetRepository = actionWidgetRepository;
  this.actionDTO = actionDTO;

  this.mainPanel = new Panel("Action");
  this.mainTypeComboBox = new ComboBox("Type");

  this.currentActionWidget = actionWidgetRepository
      .getFactory(TypeViewDTO.ActionTypes.ofActionDto(actionDTO))
      .createWidget(actionDTO);
  currentActionWidget.setChangeListener(changeListener);

  this.changeListener = changeListener;

  setupPanel();

  setCompositionRoot(mainPanel);
  setSizeUndefined();
}
 
Example 10
Project: HomeWire-Server   File: StatisticView.java   Source Code and License 6 votes vote down vote up
private Component createSensorList() {
  VerticalLayout listLayout = new VerticalLayout();
  //listLayout.setWidth(25, Unit.PERCENTAGE);

  deviceSetupService.getSensorDtosGroupedByType().forEach((groupName, sensorDTOS) -> {
    VerticalLayout sensorList = new VerticalLayout();

    sensorDTOS.forEach(sensorDTO -> {
      CheckBox c = new CheckBox(sensorDTO.getName());

      c.addValueChangeListener(event -> {
        updateChart(sensorDTO.getType() + sensorDTO.getDevId(),
            (Boolean) event.getProperty().getValue());
      });

      sensorList.addComponent(c);
    });

    Panel typePanel = new Panel(groupName.substring(0, 1).toUpperCase() + groupName.substring(1));
    typePanel.setContent(sensorList);
    listLayout.addComponent(typePanel);
  });

  return listLayout;
}
 
Example 11
Project: vaadin-vertx-samples   File: MovieDetailsWindow.java   Source Code and License 6 votes vote down vote up
private MovieDetailsWindow(final Movie movie, final Date startTime,
        final Date endTime) {
    addStyleName("moviedetailswindow");
    Responsive.makeResponsive(this);

    setCaption(movie.getTitle());
    center();
    setCloseShortcut(KeyCode.ESCAPE, null);
    setResizable(false);
    setClosable(false);
    setHeight(90.0f, Unit.PERCENTAGE);

    VerticalLayout content = new VerticalLayout();
    content.setSizeFull();
    setContent(content);

    Panel detailsWrapper = new Panel(buildMovieDetails(movie, startTime,
            endTime));
    detailsWrapper.setSizeFull();
    detailsWrapper.addStyleName(ValoTheme.PANEL_BORDERLESS);
    detailsWrapper.addStyleName("scroll-divider");
    content.addComponent(detailsWrapper);
    content.setExpandRatio(detailsWrapper, 1f);

    content.addComponent(buildFooter());
}
 
Example 12
Project: dungeonstory-java   File: ImageSelector.java   Source Code and License 6 votes vote down vote up
public ImageSelector() {
    images = new LinkedList<DSImage>();
    visibleImages = new HashMap<Integer, Image>();
    loadedImages = new LinkedList<Image>();

    mainPanel = new Panel();
    imageLayout = new HorizontalLayout();
    layout = new HorizontalLayout();

    imageMaxWidth = 110;
    imageMaxHeight = 110;

    leftButton = new Button("<", e -> scrollLeft());
    rightButton = new Button(">", e -> scrollRight());
    leftButton.setEnabled(false);
    rightButton.setEnabled(false);
}
 
Example 13
Project: dungeonstory-java   File: MultiColumnFormLayout.java   Source Code and License 6 votes vote down vote up
public MultiColumnFormLayout(int columns, String caption) {
    if (columns < 1) {
        throw new IllegalArgumentException("column number must be greater than 1");
    }
    hLayout = new HorizontalLayout();
    hLayout.setWidth(100, Unit.PERCENTAGE);
    for (int i = 0; i < columns; i++) {
        FormLayout form = new FormLayout();
        hLayout.addComponent(form, i);
    }
    
    if (caption != null) {
        hLayout.setMargin(new MarginInfo(false, true));
        Panel panel = new Panel(caption, hLayout);
        setCompositionRoot(panel);
    } else {
        setCompositionRoot(hLayout);
    }
    
}
 
Example 14
Project: SecureBPMN   File: DetailPanel.java   Source Code and License 6 votes vote down vote up
public DetailPanel() {
  setSizeFull();
  addStyleName(ExplorerLayout.STYLE_DETAIL_PANEL);
  setMargin(true);
  
  CssLayout cssLayout = new CssLayout(); // Needed for rounded corners
  cssLayout.addStyleName(ExplorerLayout.STYLE_DETAIL_PANEL);
  cssLayout.setSizeFull();
  super.addComponent(cssLayout);
  
  mainPanel = new Panel();
  mainPanel.addStyleName(Reindeer.PANEL_LIGHT);
  mainPanel.setSizeFull();
  cssLayout.addComponent(mainPanel);
  
  // Use default layout
  VerticalLayout verticalLayout = new VerticalLayout();
  verticalLayout.setWidth(100, UNITS_PERCENTAGE);
  verticalLayout.setMargin(true);
  mainPanel.setContent(verticalLayout);
}
 
Example 15
Project: demo-spring-vaadin   File: MyVaadinUI.java   Source Code and License 6 votes vote down vote up
private void initLayout() {
	final VerticalLayout root = new VerticalLayout();
	root.setSizeFull();
	root.setMargin(true);
	root.setSpacing(true);
	setContent(root);

	final CssLayout navigationBar = new CssLayout();
	navigationBar.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);

	navigationBar.addComponent(createNavigationButton("Default View",
               DefaultView.VIEW_NAME));		
       navigationBar.addComponent(createNavigationButton("MongoDB View",
               MongoDBUIView.VIEW_NAME));
       navigationBar.addComponent(createNavigationButton("Combobox Example View",
               CityComboboxView.VIEW_NAME));
       
	root.addComponent(navigationBar);

	springViewDisplay = new Panel();
       springViewDisplay.setSizeFull();
       root.addComponent(springViewDisplay);
       root.setExpandRatio(springViewDisplay, 1.0f);

}
 
Example 16
Project: cherry-web   File: SimplePageLayout.java   Source Code and License 6 votes vote down vote up
public SimplePageLayout(CaoNode res) {
		this.res = res;
		
		p = new Panel();
		un = new Panel();
		
		h = new HorizontalLayout();
		v = new VerticalLayout();
		p.setContent(v);
//		setSizeFull();
		h.setWidth("100%");
		p.addStyleName("v-scrollable");
        p.setHeight("100%");
		un.addStyleName("v-scrollable");
        un.setHeight("100%");
        un.setWidth("250px");
        addComponent(p);
        addComponent(un);
        setExpandRatio(p, 1);
	}
 
Example 17
Project: SecureBPMN   File: ProfilePanel.java   Source Code and License 6 votes vote down vote up
protected void initInformationPanel() {
  Panel infoPanel = new Panel();
  infoPanel.addStyleName(Reindeer.PANEL_LIGHT);
  infoPanel.setSizeFull();
  
  profilePanelLayout.addComponent(infoPanel);
  profilePanelLayout.setExpandRatio(infoPanel, 1.0f); // info panel should take all the remaining width available
  
  // All the information sections are put under each other in a vertical layout
  this.infoPanelLayout = new VerticalLayout();
  infoPanel.setContent(infoPanelLayout);
  
  initAboutSection();
  initContactSection();
  
}
 
Example 18
Project: minimal-j   File: VaadinDialog.java   Source Code and License 6 votes vote down vote up
private static VaadinComponentWithWidth findComponentWithWidth(Component c) {
	if (c instanceof VaadinComponentWithWidth) {
		return (VaadinComponentWithWidth) c;
	} else if (c instanceof Panel) {
		Panel panel = (Panel) c;
		return findComponentWithWidth(panel.getContent());
	} else if (c instanceof ComponentContainer) {
		ComponentContainer container = (ComponentContainer) c;
		Iterator<Component> componentIterator = container.getComponentIterator();
		while (componentIterator.hasNext()) {
			VaadinComponentWithWidth componentWithWidth = findComponentWithWidth(componentIterator.next());
			if (componentWithWidth != null) {
				return componentWithWidth;
			}
		}
	}
	return null;
}
 
Example 19
Project: holon-vaadin7   File: AbstractDialog.java   Source Code and License 5 votes vote down vote up
/**
 * Constructor
 */
public AbstractDialog() {
	super();

	// defaults
	setModal(true);
	setResizable(false);
	setDraggable(false);
	setClosable(false);

	// style name
	addStyleName("h-dialog");

	// build
	content = new Panel();
	content.setWidth("100%");
	content.addStyleName(ValoTheme.PANEL_BORDERLESS);
	content.addStyleName("h-dialog-content");

	actions = new HorizontalLayout();
	actions.setWidth("100%");
	actions.setSpacing(true);
	actions.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
	actions.addStyleName("h-dialog-actions");

	root = new VerticalLayout();
	root.addComponent(content);
	root.addComponent(actions);

	setContent(root);
}
 
Example 20
Project: osc-core   File: MaintenanceView.java   Source Code and License 5 votes vote down vote up
private VerticalLayout createTab(String caption, String title, FormLayout content, String guid) {
    VerticalLayout tabSheet = new VerticalLayout();
    tabSheet.setCaption(caption);
    tabSheet.setStyleName(StyleConstants.TAB_SHEET);
    Panel panel = new Panel();
    // creating subHeader inside panel
    panel.setContent(content);
    panel.setSizeFull();
    tabSheet.addComponent(ViewUtil.createSubHeader(title, guid));
    tabSheet.addComponent(panel);
    return tabSheet;
}
 
Example 21
Project: osc-core   File: ArchiveLayout.java   Source Code and License 5 votes vote down vote up
public ArchiveLayout(ArchiveServiceApi archiveService, GetJobsArchiveServiceApi getJobsArchiveService,
        UpdateJobsArchiveServiceApi updateJobsArchiveService) {
    super();

    VerticalLayout downloadContainer = new VerticalLayout();
    VerticalLayout archiveContainer = new VerticalLayout();

    // Component to Archive Jobs
    JobsArchiverPanel archiveConfigurator = new JobsArchiverPanel(this, archiveService,
            getJobsArchiveService, updateJobsArchiveService);
    archiveConfigurator.setSizeFull();

    archiveContainer.addComponent(ViewUtil.createSubHeader("Archive Jobs/Alerts", null));
    archiveContainer.addComponent(archiveConfigurator);

    downloadContainer.addComponent(ViewUtil.createSubHeader("Download Archive", null));
    // Component to download archive

    this.archiveTable = new Table();
    this.archiveTable.setSizeFull();
    this.archiveTable.setPageLength(5);
    this.archiveTable.setImmediate(true);
    this.archiveTable.addContainerProperty("Name", String.class, null);
    this.archiveTable.addContainerProperty("Date", Date.class, null);
    this.archiveTable.addContainerProperty("Size", Long.class, null);
    this.archiveTable.addContainerProperty("Download", Link.class, null);
    this.archiveTable.addContainerProperty("Delete", Button.class, null);
    buildArchivesTable();

    Panel archiveTablePanel = new Panel();
    archiveTablePanel.setContent(this.archiveTable);

    addComponent(archiveContainer);
    addComponent(archiveTablePanel);
}
 
Example 22
Project: osc-core   File: InternalCertReplacementUploader.java   Source Code and License 5 votes vote down vote up
@Override
protected void layout(Panel panel) {
    Label warningLabel = new Label(getString(KEYPAIR_UPLOAD_WARN_RESTART));

    this.verLayout.addComponent(warningLabel);

    super.layout(panel);
}
 
Example 23
Project: osc-core   File: SslConfigurationLayout.java   Source Code and License 5 votes vote down vote up
public SslConfigurationLayout(DeleteSslCertificateServiceApi deleteSslCertificate,
        ListSslCertificatesServiceApi listSslCertificateService,
        X509TrustManagerApi trustManager, BundleContext ctx) {
    super();

    this.deleteSslCertificateService = deleteSslCertificate;
    this.listSslCertificateService = listSslCertificateService;

    SslCertificateUploader certificateUploader = new SslCertificateUploader(trustManager);
    VerticalLayout sslUploadContainer = makeSslUploadContainer(certificateUploader, getString(CERTIFICATE_UPLOAD_TITLE));
    InternalCertReplacementUploader internalCertReplacementUploader = new InternalCertReplacementUploader(trustManager);
    VerticalLayout sslReplaceInternalContainer = makeSslUploadContainer(internalCertReplacementUploader, getString(KEYPAIR_UPLOAD_TITLE));

    VerticalLayout sslListContainer = new VerticalLayout();
    sslListContainer.addComponent(createHeaderForSslList());

    this.sslConfigTable = new Table();
    this.sslConfigTable.setSizeFull();
    this.sslConfigTable.setImmediate(true);
    this.sslConfigTable.addContainerProperty("Alias", String.class, null);
    this.sslConfigTable.addContainerProperty("SHA1 fingerprint", String.class, null);
    this.sslConfigTable.addContainerProperty("Issuer", String.class, null);
    this.sslConfigTable.addContainerProperty("Valid from", Date.class, null);
    this.sslConfigTable.addContainerProperty("Valid until", Date.class, null);
    this.sslConfigTable.addContainerProperty("Algorithm type", String.class, null);
    this.sslConfigTable.addContainerProperty("Delete", Button.class, null);
    this.sslConfigTable.setColumnWidth("Issuer", 200);
    buildSslConfigurationTable();

    Panel sslConfigTablePanel = new Panel();
    sslConfigTablePanel.setContent(this.sslConfigTable);
    sslListContainer.addComponent(sslConfigTablePanel);

    addComponent(sslReplaceInternalContainer);
    addComponent(sslUploadContainer);
    addComponent(sslListContainer);

    this.registration = ctx.registerService(TruststoreChangedListener.class, this, null);
}
 
Example 24
Project: osc-core   File: SslCertificateUploader.java   Source Code and License 5 votes vote down vote up
public SslCertificateUploader(X509TrustManagerApi x509TrustManager) {
    this.x509TrustManager = x509TrustManager;

    Panel panel = new Panel();
    layout(panel);
    setCompositionRoot(panel);
}
 
Example 25
Project: osc-core   File: SslCertificateUploader.java   Source Code and License 5 votes vote down vote up
protected void layout(Panel panel) {
    createUpload();
    this.verLayout.setSpacing(true);

    panel.setWidth("100%");
    panel.setContent(this.verLayout);

    this.verLayout.addComponent(this.upload);
    this.verLayout.addStyleName(StyleConstants.COMPONENT_SPACING);
}
 
Example 26
Project: osc-core   File: PluginView.java   Source Code and License 5 votes vote down vote up
private VerticalLayout createComponent(String caption, String title, FormLayout content, String guid) {
    VerticalLayout tabSheet = new VerticalLayout();
    Panel panel = new Panel();
    // creating subHeader inside panel
    panel.setContent(content);
    panel.setSizeFull();
    tabSheet.addComponent(ViewUtil.createSubHeader(title, guid));
    tabSheet.addComponent(panel);
    return tabSheet;
}
 
Example 27
Project: osc-core   File: BaseVCWindow.java   Source Code and License 5 votes vote down vote up
protected Panel providerPanel() {
    this.providerPanel = new Panel();
    this.providerPanel.setImmediate(true);
    this.providerPanel.setCaption(OPENSTACK_CAPTION);

    this.providerIP = new TextField("IP");
    this.providerIP.setImmediate(true);
    this.adminDomainId = new TextField("Admin Domain Id");
    this.adminDomainId.setImmediate(true);
    this.adminProjectName = new TextField("Admin Project Name");
    this.adminProjectName.setImmediate(true);
    this.providerUser = new TextField("User Name");
    this.providerUser.setImmediate(true);
    this.providerPW = new PasswordField("Password");
    this.providerPW.setImmediate(true);

    // adding not null constraint
    this.adminDomainId.setRequired(true);
    this.adminDomainId.setRequiredError(this.providerPanel.getCaption() + " Admin Domain Id cannot be empty");
    this.adminProjectName.setRequired(true);
    this.adminProjectName.setRequiredError(this.providerPanel.getCaption() + " Admin Project Name cannot be empty");
    this.providerIP.setRequired(true);
    this.providerIP.setRequiredError(this.providerPanel.getCaption() + " IP cannot be empty");
    this.providerUser.setRequired(true);
    this.providerUser.setRequiredError(this.providerPanel.getCaption() + " User Name cannot be empty");
    this.providerPW.setRequired(true);
    this.providerPW.setRequiredError(this.providerPanel.getCaption() + " Password cannot be empty");

    FormLayout providerFormPanel = new FormLayout();
    providerFormPanel.addComponent(this.providerIP);
    providerFormPanel.addComponent(this.adminDomainId);
    providerFormPanel.addComponent(this.adminProjectName);
    providerFormPanel.addComponent(this.providerUser);
    providerFormPanel.addComponent(this.providerPW);
    this.providerPanel.setContent(providerFormPanel);

    return this.providerPanel;
}
 
Example 28
Project: osc-core   File: BaseDAWindow.java   Source Code and License 5 votes vote down vote up
/**
 * @return AZ Panel
 */
@SuppressWarnings("serial")
protected Panel getVirtualSystemPanel() {
    try {

        this.vsTable = new Table();
        this.vsTable.setPageLength(5);
        this.vsTable.setImmediate(true);
        this.vsTable.addGeneratedColumn("Enabled", new CheckBoxGenerator());
        this.vsTable.addItemClickListener(new ItemClickListener() {
            @Override
            public void itemClick(ItemClickEvent event) {
                vsTableClicked((Long) event.getItemId());
            }
        });

        // populating VS table
        populateVirtualSystem();

        Panel vsPanel = new Panel("Virtualization System:");
        vsPanel.addStyleName("form_Panel");
        vsPanel.setWidth(100, Sizeable.Unit.PERCENTAGE);
        vsPanel.setContent(this.vsTable);

        return vsPanel;

    } catch (Exception e) {

        log.error("Error while creating DA's VS panel", e);
    }

    return null;
}
 
Example 29
Project: md-stepper   File: VerticalStepper.java   Source Code and License 5 votes vote down vote up
private RowLayout(Step step) {
  this.step = step;

  label = getLabelProvider().getStepLabel(step);

  divider = new CssLayout();
  divider.addStyleName(STYLE_DIVIDER);
  divider.setHeight(100, Unit.PERCENTAGE);

  contentContainer = new Panel();
  contentContainer.addStyleName(STYLE_CONTENT_CONTAINER);
  contentContainer.addStyleName(ValoTheme.PANEL_BORDERLESS);
  contentContainer.setSizeFull();

  buttonBar = new HorizontalLayout();
  buttonBar.addStyleName(STYLE_BUTTON_BAR);
  buttonBar.setMargin(false);
  buttonBar.setSpacing(true);
  buttonBar.setWidth(100, Unit.PERCENTAGE);
  buttonBar.setMargin(new MarginInfo(false, false, !isLastStep(step), false));

  rootLayout = new GridLayout(2, 3);
  rootLayout.setSizeFull();
  rootLayout.setMargin(false);
  rootLayout.setSpacing(false);
  rootLayout.setColumnExpandRatio(1, 1);
  rootLayout.setRowExpandRatio(1, 1);
  rootLayout.addComponent(label, 0, 0, 1, 0);
  rootLayout.addComponent(divider, 0, 1, 0, 2);
  rootLayout.addComponent(contentContainer, 1, 1, 1, 1);
  rootLayout.addComponent(buttonBar, 1, 2, 1, 2);

  setCompositionRoot(rootLayout);
  addStyleName(STYLE_COMPONENT);
  setWidth(100, Unit.PERCENTAGE);
  setActive(false);
}
 
Example 30
Project: Persephone   File: PersephoneUI.java   Source Code and License 5 votes vote down vote up
@Override
protected void init(VaadinRequest request) {

	// Root layout
       final VerticalLayout root = new VerticalLayout();
       root.setSizeFull();

       root.setSpacing(false);
       root.setMargin(false);

       setContent(root);

       // Main panel
       springViewDisplay = new Panel();
       springViewDisplay.setSizeFull();

       root.addComponent(springViewDisplay);
       root.setExpandRatio(springViewDisplay, 1);

       // Footer
       Layout footer = getFooter();
       root.addComponent(footer);
       root.setExpandRatio(footer, 0);

       // Error handler
	UI.getCurrent().setErrorHandler(new UIErrorHandler());

	// Disable session expired notification, the page will be reloaded on any action
	VaadinService.getCurrent().setSystemMessagesProvider(
			systemMessagesInfo -> {
				CustomizedSystemMessages msgs = new CustomizedSystemMessages();
				msgs.setSessionExpiredNotificationEnabled(false);
				return msgs;
			});
}
 
Example 31
Project: holon-vaadin   File: AbstractDialog.java   Source Code and License 5 votes vote down vote up
/**
 * Constructor
 */
public AbstractDialog() {
	super();

	// defaults
	setModal(true);
	setResizable(false);
	setDraggable(false);
	setClosable(false);

	// style name
	addStyleName("h-dialog");

	// build
	content = new Panel();
	content.setWidth("100%");
	content.addStyleName(ValoTheme.PANEL_BORDERLESS);
	content.addStyleName("h-dialog-content");

	actions = new HorizontalLayout();
	actions.setWidth("100%");
	actions.setSpacing(true);
	actions.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
	actions.addStyleName("h-dialog-actions");

	root = new VerticalLayout();
	root.addComponent(content);
	root.addComponent(actions);

	setContent(root);
}
 
Example 32
Project: incubator-tamaya-sandbox   File: ApplicationLayout.java   Source Code and License 5 votes vote down vote up
private void initLayouts() {
    navBar = new NavBar(this);
    // Use panel as main content container to allow it's content to scroll
    content = new Panel();
    content.setSizeFull();
    content.addStyleName(UIConstants.PANEL_BORDERLESS);

    addComponents(navBar, content);
    setExpandRatio(content, 1);
}
 
Example 33
Project: vaadin-medium-editor   File: WindowEditorView.java   Source Code and License 5 votes vote down vote up
@Override
public Component getAddonComponent() {
    Window w = new Window("Medium Editor in window");
    w.setWidth(500, Unit.PIXELS);
    w.setHeight(400, Unit.PIXELS);
    
    
    Panel p = new Panel();
    p.addStyleName(ValoTheme.PANEL_WELL);
    p.setSizeFull();

    MediumEditor editor = new MediumEditor();
    editor.setSizeFull();
    editor.setFocusOutlineEnabled(false);
    editor.setJsLoggingEnabled(true);
    editor.setContent(Lorem.getHtmlParagraphs(3, 5));
    editor.configure(
            editor.options()
            .toolbar()
            .buttons(Buttons.BOLD, Buttons.ITALIC, 
                    Buttons.JUSTIFY_CENTER, 
                    Buttons.ANCHOR)
            .done()
            .autoLink(true)
            .imageDragging(false)
            .done()
            );
    editors.add(editor);
    p.setContent(editor);
    w.setContent(p);

    Button b = new Button("Open Window");
    b.addClickListener(e -> {
        w.setPosition(e.getClientX(), e.getClientY());
        UI.getCurrent().addWindow(w);
    });


    return b; 
}
 
Example 34
Project: vaadin-medium-editor   File: AddonDemoUI.java   Source Code and License 5 votes vote down vote up
private Component buildPreview() {
    previewLabel = new Label();
    previewLabel.setSizeFull();

    Panel panel = new Panel(previewLabel);
    panel.setCaption("Preview");
    panel.setSizeFull();
    panel.addStyleName(ValoTheme.PANEL_BORDERLESS);
    panel.addStyleName("addon-code");
    return panel;
}
 
Example 35
Project: vaadin-medium-editor   File: AddonDemoUI.java   Source Code and License 5 votes vote down vote up
private Component buildCode() {
    codeLabel = new Label();
    codeLabel.setContentMode(ContentMode.HTML);

    Panel codePanel = new Panel(codeLabel);
    codePanel.setSizeFull();
    codePanel.addStyleName(ValoTheme.PANEL_BORDERLESS);
    codePanel.addStyleName("addon-code");
    return codePanel;
}
 
Example 36
Project: vaadin-medium-editor   File: AddonDemoUI.java   Source Code and License 5 votes vote down vote up
private Component buildMenu() {
    Panel menuPanel = new Panel();
    menuPanel.setSizeFull();
    menuPanel.addStyleName(ValoTheme.PANEL_BORDERLESS);
    menuPanel.addStyleName("addon-menu");

    VerticalLayout vl = new VerticalLayout();
    vl.setWidth(100, Unit.PERCENTAGE);

    for (EditorStructure editorStructure : EditorStructure.values()) {
        List<MenuItem> children = new ArrayList<>();
        for (MenuItem i : menuItems) {
            if (i.getType() == editorStructure) {
                children.add(i);
            }
        }

        Label section = new Label();
        section.addStyleName(ValoTheme.LABEL_SUCCESS);
        section.setSizeFull();
        section.setValue(editorStructure.toString());
        vl.addComponent(section);

        for (MenuItem menuItem : children) {
            Button b = new Button(menuItem.getLabel());
            b.setSizeFull();
            b.addClickListener(e -> {
                getUI().getNavigator().navigateTo(menuItem.getViewName());
                vl.forEach(c -> c.removeStyleName(ValoTheme.BUTTON_PRIMARY));
                b.addStyleName(ValoTheme.BUTTON_PRIMARY);
            });
            vl.addComponent(b);
        }
    }
    menuPanel.setContent(vl);
    return menuPanel;
}
 
Example 37
Project: kumoreg   File: ReportWindow.java   Source Code and License 5 votes vote down vote up
private Panel buildReportPanel(String report) {
    lblReport.setContentMode(ContentMode.HTML);
    lblReport.setValue(report);
    reportPanel.setContent(lblReport);
    reportPanel.setWidth("100%");
    reportPanel.setHeight("600");
    lblReport.setHeightUndefined();
    lblReport.setWidthUndefined();
    return reportPanel;
}
 
Example 38
Project: dungeonstory-java   File: ClassFeatureList.java   Source Code and License 5 votes vote down vote up
public ClassFeatureList(Character character) {
    
    // class features
    FHorizontalLayout classFeatureLayout = new FHorizontalLayout().withFullWidth();
    Panel classFeaturePanel = new Panel("Dons de classe", classFeatureLayout);
    
    Tree<ClassFeature> classfeatureTree = new Tree<ClassFeature>();
    classfeatureTree.setItems(ClassUtil.getAllRootCharacterClassFeatures(character), ClassFeature::getChildren);
    classFeatureLayout.addComponent(classfeatureTree);
    
    DSLabel classFeatureDescription = new DSLabel();
    classFeatureLayout.addComponent(classFeatureDescription);
    classfeatureTree.addItemClickListener(event -> {
        if (event.getItem() != null) {
            classFeatureDescription.setValue(event.getItem().getDescription());
        } else {
            classFeatureDescription.setValue("");
        }
    });
    addComponent(classFeaturePanel);

    // feats
    if (!character.getFeats().isEmpty()) {
        FHorizontalLayout featLayout = new FHorizontalLayout().withFullWidth();
        Panel featPanel = new Panel("Dons", featLayout);
        Tree<Feat> featTree = new Tree<Feat>();
        featTree.setItems(character.getFeats());
        featLayout.addComponent(featTree);

        DSLabel featDescription = new DSLabel();
        featLayout.addComponent(featDescription);
        featTree.addItemClickListener(event -> {
            if (event.getItem() != null) {
                featDescription.setValue(event.getItem().getDescription());
            } else {
                featDescription.setValue("");
            }
        });
        addComponent(featPanel);
    }

}
 
Example 39
Project: dungeonstory-java   File: SummaryStep.java   Source Code and License 5 votes vote down vote up
private void showCharacterInfo() {

        Messages messages = Messages.getInstance();
        Character character = wizard.getCharacter();

        if (character.getId() == null) {
            FormLayout infoLayout = new FFormLayout().withMargin(true);
            Panel infoPanel = new Panel(messages.getMessage("summaryStep.info.label"), infoLayout);
            layout.addComponent(infoPanel);

            File imageFile = new File(DSConstant.getImageDir() + character.getImage());
            FileResource resource = new FileResource(imageFile);
            Image image = new Image("Image", resource);
            DSLabel nameLabel = new DSLabel(messages.getMessage("summaryStep.name.label"), character.getName());
            DSLabel genderLabel = new DSLabel(messages.getMessage("summaryStep.sex.label"), character.getGender().toString());
            DSLabel ageLabel = new DSLabel(messages.getMessage("summaryStep.age.label"), String.valueOf(character.getAge()));
            DSLabel weightLabel = new DSLabel(messages.getMessage("summaryStep.weight.label"), character.getWeight() + " lbs");
            DSLabel heightLabel = new DSLabel(messages.getMessage("summaryStep.height.label"), character.getHeight());
            DSLabel alignmentLabel = new DSLabel(messages.getMessage("summaryStep.alignment.label"),
                    character.getAlignment().toString());
            DSLabel regionLabel = new DSLabel(messages.getMessage("summaryStep.region.label"), character.getRegion().toString());
            DSLabel backgroundLabel = new DSLabel(messages.getMessage("summaryStep.background.label"),
                    character.getBackground().getBackground().toString());
            DSLabel goldLabel = new DSLabel(messages.getMessage("summaryStep.startingGold.label"), character.getGold());
            infoLayout.addComponents(image, nameLabel, genderLabel, ageLabel, weightLabel, heightLabel, alignmentLabel,
                    regionLabel, backgroundLabel, goldLabel);
        }
    }
 
Example 40
Project: dungeonstory-java   File: ProficiencyList.java   Source Code and License 5 votes vote down vote up
public ProficiencyList(Character character) {
    
    setSpacing(true);

    CollectionToStringListConverter<Set<?>> setConverter = new CollectionToStringListConverter<Set<?>>();

    Label proficiencyBonus = new Label("Bonus de maitrise : " + String.valueOf(character.getLevel().getProficiencyBonus()));

    String armorProficiencies = setConverter.convertToPresentation(character.getArmorProficiencies(), new ValueContext());
    HtmlLabel armorLabel = new HtmlLabel(StringUtils.defaultIfEmpty(armorProficiencies, "Aucune"));
    Panel armorProficiencyPanel = new Panel("Armures", armorLabel);

    String savingThrowProficiencies = setConverter.convertToPresentation(character.getSavingThrowProficiencies(), new ValueContext());
    HtmlLabel savingThrowLabel = new HtmlLabel(StringUtils.defaultIfEmpty(savingThrowProficiencies, "Aucune"));
    Panel savingThrowProficiencyPanel = new Panel("Jets de sauvegarde", savingThrowLabel);

    String toolProficiencies = setConverter.convertToPresentation(character.getToolProficiencies(), new ValueContext());
    HtmlLabel toolLabel = new HtmlLabel(StringUtils.defaultIfEmpty(toolProficiencies, "Aucune"));
    Panel toolProficiencyPanel = new Panel("Outils", toolLabel);

    String skillProficiencies = setConverter.convertToPresentation(character.getSkillProficiencies(), new ValueContext());
    HtmlLabel skillLabel = new HtmlLabel(StringUtils.defaultIfEmpty(skillProficiencies, "Aucune"));
    Panel skillProficiencyPanel = new Panel("Comp├ętences", skillLabel);

    setConverter.setNbColumns(2);
    String weaponProficiencies = setConverter.convertToPresentation(character.getWeaponProficiencies(), new ValueContext());
    HtmlLabel weaponLabel = new HtmlLabel(StringUtils.defaultIfEmpty(weaponProficiencies, "Aucune"));
    Panel weaponProficiencyPanel = new Panel("Armes", weaponLabel);

    addComponents(proficiencyBonus, armorProficiencyPanel, weaponProficiencyPanel, skillProficiencyPanel, savingThrowProficiencyPanel,
            toolProficiencyPanel);

}