Example usage for com.vaadin.ui GridLayout addStyleName

List of usage examples for com.vaadin.ui GridLayout addStyleName

Introduction

In this page you can find the example usage for com.vaadin.ui GridLayout addStyleName.

Prototype

@Override
    public void addStyleName(String style) 

Source Link

Usage

From source file:org.activiti.explorer.ui.reports.SavedReportDetailPanel.java

License:Apache License

protected void initHeader() {
    GridLayout details = new GridLayout(2, 2);
    details.setWidth(100, UNITS_PERCENTAGE);
    details.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
    details.setSpacing(true);//from w w  w  .  j  av  a  2  s  . c  o  m
    details.setMargin(false, false, true, false);
    details.setColumnExpandRatio(1, 1.0f);
    detailPanelLayout.addComponent(details);

    // Image
    Embedded image = new Embedded(null, Images.REPORT_50);
    details.addComponent(image, 0, 0, 0, 1);

    // Name
    Label nameLabel = new Label(SavedReportListItem.getReportDisplayName(historicProcessInstance));
    nameLabel.addStyleName(Reindeer.LABEL_H2);
    details.addComponent(nameLabel, 1, 0);

    // Properties
    HorizontalLayout propertiesLayout = new HorizontalLayout();
    propertiesLayout.setSpacing(true);
    details.addComponent(propertiesLayout);

    // Created Time
    String createLabel = i18nManager.getMessage(Messages.REPORTING_CREATE_TIME,
            new HumanTime(i18nManager).format(historicProcessInstance.getEndTime()));
    Label versionLabel = new Label(createLabel);
    versionLabel.addStyleName(ExplorerLayout.STYLE_PROCESS_HEADER_START_TIME);
    propertiesLayout.addComponent(versionLabel);
}

From source file:org.activiti.explorer.ui.task.HistoricTaskDetailPanel.java

License:Apache License

protected void initHeader() {
    GridLayout taskDetails = new GridLayout(5, 2);
    taskDetails.setWidth(100, UNITS_PERCENTAGE);
    taskDetails.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
    taskDetails.setSpacing(true);/* w  w w .  j a  v  a 2 s. c om*/
    taskDetails.setMargin(false, false, true, false);

    // Add image
    Embedded image = new Embedded(null, Images.TASK_50);
    taskDetails.addComponent(image, 0, 0, 0, 1);

    // Add task name
    Label nameLabel = new Label(historicTask.getName());
    nameLabel.addStyleName(Reindeer.LABEL_H2);
    taskDetails.addComponent(nameLabel, 1, 0, 4, 0);

    // Add due date
    PrettyTimeLabel dueDateLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.TASK_DUEDATE_SHORT),
            historicTask.getDueDate(), i18nManager.getMessage(Messages.TASK_DUEDATE_UNKNOWN), false);
    dueDateLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_DUEDATE);
    taskDetails.addComponent(dueDateLabel, 1, 1);

    // Add priority
    Integer lowMedHighPriority = convertPriority(historicTask.getPriority());
    Label priorityLabel = new Label();
    switch (lowMedHighPriority) {
    case 1:
        priorityLabel.setValue(i18nManager.getMessage(Messages.TASK_PRIORITY_LOW));
        priorityLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_PRIORITY_LOW);
        break;
    case 2:
        priorityLabel.setValue(i18nManager.getMessage(Messages.TASK_PRIORITY_MEDIUM));
        priorityLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_PRIORITY_MEDIUM);
        break;
    case 3:
    default:
        priorityLabel.setValue(i18nManager.getMessage(Messages.TASK_PRIORITY_HIGH));
        priorityLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_PRIORITY_HIGH);
    }
    taskDetails.addComponent(priorityLabel, 2, 1);

    // Add create date
    PrettyTimeLabel createLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.TASK_CREATED_SHORT),
            historicTask.getStartTime(), "", true);
    createLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_CREATE_TIME);
    taskDetails.addComponent(createLabel, 3, 1);

    // Add label to fill excess space
    Label spacer = new Label();
    spacer.setContentMode(Label.CONTENT_XHTML);
    spacer.setValue(" ");
    spacer.setSizeUndefined();
    taskDetails.addComponent(spacer);

    taskDetails.setColumnExpandRatio(1, 1.0f);
    taskDetails.setColumnExpandRatio(2, 1.0f);
    taskDetails.setColumnExpandRatio(3, 1.0f);
    taskDetails.setColumnExpandRatio(4, 1.0f);
    centralLayout.addComponent(taskDetails);
}

From source file:org.activiti.explorer.ui.task.TaskDetailPanel.java

License:Apache License

protected void initHeader() {
    GridLayout taskDetails = new GridLayout(2, 2);
    taskDetails.setWidth(100, UNITS_PERCENTAGE);
    taskDetails.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
    taskDetails.setSpacing(true);/*from  ww w. ja v  a2  s.co m*/
    taskDetails.setMargin(false, false, true, false);
    taskDetails.setColumnExpandRatio(1, 1.0f);
    centralLayout.addComponent(taskDetails);

    // Add image
    Embedded image = new Embedded(null, Images.TASK_50);
    taskDetails.addComponent(image, 0, 0, 0, 1);

    // Add task name
    Label nameLabel = new Label(task.getName());
    nameLabel.addStyleName(Reindeer.LABEL_H2);
    taskDetails.addComponent(nameLabel, 1, 0);
    taskDetails.setComponentAlignment(nameLabel, Alignment.MIDDLE_LEFT);

    // Properties
    HorizontalLayout propertiesLayout = new HorizontalLayout();
    propertiesLayout.setSpacing(true);
    taskDetails.addComponent(propertiesLayout);

    propertiesLayout.addComponent(new DueDateComponent(task, i18nManager, taskService));
    propertiesLayout.addComponent(new PriorityComponent(task, i18nManager, taskService));

    initCreateTime(propertiesLayout);
}

From source file:org.investovator.ui.utils.dashboard.dataplayback.BasicMainView.java

License:Open Source License

public void setupPanel() {
    //clear everything
    //        content.removeAllComponents();

    //add components only if components have not already been added
    if (content.getComponentCount() == 0) {

        //Main chart
        HorizontalLayout chartContainer = new HorizontalLayout();
        chartContainer.setWidth(95, Unit.PERCENTAGE);
        chartContainer.setMargin(true);/*from   w w w . j  a v  a  2  s .c  o m*/
        //            chartContainer.setHeight(30,Unit.PERCENTAGE);
        mainChart = buildMainChart();
        chartContainer.addComponent(mainChart);
        chartContainer.setComponentAlignment(mainChart, Alignment.MIDDLE_CENTER);
        chartContainer.setCaption(mainChart.getCaption());
        //            chartContainer.setCaption("Price");
        //            chartContainer.addStyleName("center-caption");

        content.addComponent(chartContainer);
        content.setExpandRatio(chartContainer, 1.3f);
        content.setComponentAlignment(chartContainer, Alignment.MIDDLE_CENTER);

        //Quantity chart
        HorizontalLayout quantityChartContainer = new HorizontalLayout();
        quantityChartContainer.setWidth(95, Unit.PERCENTAGE);
        //            quantityChartContainer.setMargin(true);
        quantityChartContainer.setMargin(new MarginInfo(true, true, false, true));
        //            quantityChartContainer.setHeight(30,Unit.PERCENTAGE);
        quantityChart = buildQuantityChart();
        quantityChartContainer.addComponent(quantityChart);
        quantityChartContainer.setComponentAlignment(quantityChart, Alignment.MIDDLE_CENTER);
        //            quantityChartContainer.setCaption("Quantity");
        //            quantityChartContainer.addStyleName("center-caption");

        content.addComponent(quantityChartContainer);
        content.setExpandRatio(quantityChartContainer, 1.0f);

        content.setComponentAlignment(quantityChartContainer, Alignment.MIDDLE_CENTER);

        //bottom row conatainer
        HorizontalLayout bottowRow = new HorizontalLayout();
        bottowRow.setWidth(100, Unit.PERCENTAGE);
        content.addComponent(bottowRow);
        content.setExpandRatio(bottowRow, 1.0f);

        //Stock price table
        GridLayout stockPriceTableContainer = new GridLayout(1, 2);
        //add a caption to the table
        //            Label tableCaption=new Label("Stock Price Table");
        //            stockPriceTableContainer.addComponent(tableCaption, 0, 0);
        //            stockPriceTableContainer.setComponentAlignment(tableCaption,Alignment.MIDDLE_RIGHT);
        stockPriceTable = setupStockPriceTable();
        stockPriceTableContainer.addComponent(stockPriceTable, 0, 1);
        stockPriceTableContainer.setMargin(new MarginInfo(false, true, true, true));
        stockPriceTableContainer.setCaption("Stock Price Table");
        stockPriceTableContainer.addStyleName("center-caption");

        stockPriceTableContainer.setComponentAlignment(stockPriceTable, Alignment.MIDDLE_CENTER);
        bottowRow.addComponent(stockPriceTableContainer);
        //            bottowRow.setExpandRatio(stockPriceTableContainer,1.0f);

        //buy-sell window
        GridLayout buySellWindowContainer = new GridLayout(1, 2);
        //            //add a caption to the table
        //            Label buySellWindowCaption=new Label("Buy/Sell Stocks");
        //            buySellWindowContainer.addComponent(buySellWindowCaption,0,0);
        //            buySellWindowContainer.setComponentAlignment(buySellWindowCaption,Alignment.MIDDLE_CENTER);
        Component buySellWindow = setupBuySellForm();
        buySellWindowContainer.addComponent(buySellWindow, 0, 1);
        buySellWindowContainer.setMargin(new MarginInfo(false, false, true, false));
        buySellWindowContainer.setCaption("Buy/Sell Stocks");
        buySellWindowContainer.addStyleName("center-caption");

        buySellWindowContainer.setComponentAlignment(buySellWindow, Alignment.MIDDLE_CENTER);
        bottowRow.addComponent(buySellWindowContainer);
        //            bottowRow.setExpandRatio(buySellWindowContainer,1.0f);

        //portfolio data
        //            VerticalLayout myPortfolioLayout=new VerticalLayout();
        //            myPortfolioLayout.setMargin(new MarginInfo(false,true,true,true));
        //            bottowRow.addComponent(myPortfolioLayout);
        //add a caption to the table
        //            Label portfolioCaption=new Label("My Portfolio");
        //            myPortfolioLayout.addComponent(portfolioCaption);
        //            myPortfolioLayout.setComponentAlignment(portfolioCaption,Alignment.MIDDLE_CENTER);

        HorizontalLayout portfolioContainer = new HorizontalLayout();
        portfolioContainer.setMargin(new MarginInfo(false, true, true, true));
        portfolioContainer.setCaption("My Portfolio");
        portfolioContainer.addStyleName("center-caption");
        bottowRow.addComponent(portfolioContainer);
        //            bottowRow.setExpandRatio(portfolioContainer,1.0f);

        //portfolio table
        portfolioTable = setupPortfolioTable();
        portfolioContainer.addComponent(portfolioTable);
        //            portfolioContainer.setExpandRatio(portfolioTable,1.0f);

        //profit chart
        //            HorizontalLayout profitContainer = new HorizontalLayout();
        //            bottowRow.addComponent(profitContainer);

        profitChart = setupProfitChart();
        profitChart.setCaption("Profit Chart");
        profitChart.addStyleName("center-caption");
        bottowRow.addComponent(profitChart);
        bottowRow.setExpandRatio(profitChart, 1.3f);

        //            Component accountInfo=setUpAccountInfoForm();
        //            accountInfo.setCaption("Profit Chart");
        //            accountInfo.addStyleName("center-caption");
        //
        //            bottowRow.addComponent(accountInfo);
        //            bottowRow.setExpandRatio(accountInfo,1.3f);

        this.setContent(content);
    }

}

From source file:org.lunifera.examples.kwiee.erp.module.core.presentation.web.vaadin.ui.KwieeUINavigator.java

License:Open Source License

@Override
public void init(VaadinRequest request) {

    // initialize push
    ////from  w w  w  . j  a v a 2 s .  co  m
    pusher = new ICEPush();
    pusher.extend(this);

    // prepare UI
    //
    GridLayout root = new GridLayout(8, 8);
    root.setStyleName(Reindeer.LAYOUT_BLUE);
    root.addStyleName("kwiee");
    root.setSizeFull();
    root.setMargin(new MarginInfo(false, true, true, true));
    root.setSpacing(false);
    setContent(root);

    root.setRowExpandRatio(0, 0.7f);
    root.setRowExpandRatio(1, 1.0f);
    root.setRowExpandRatio(2, 1.0f);
    root.setRowExpandRatio(3, 1.0f);
    root.setRowExpandRatio(4, 1.0f);
    root.setRowExpandRatio(5, 1.0f);
    root.setRowExpandRatio(6, 1.0f);
    root.setRowExpandRatio(7, 0.4f);

    // Create top frame
    topFrame = new HorizontalLayout();
    topFrame.addStyleName("k-topframe");
    topFrame.setMargin(true);
    topFrame.setSpacing(true);
    topFrame.setSizeFull();
    root.addComponent(topFrame, 1, 0, 7, 0);

    // Create top frame
    navFrame = new CssLayout();
    navFrame.addStyleName("k-navframe");
    navFrame.setSizeFull();
    root.addComponent(navFrame, 0, 1, 0, 6);

    // Create main frame
    mainFrame = new CssLayout();
    mainFrame.setSizeFull();
    root.addComponent(mainFrame, 1, 1, 7, 6);
    tabSheet = new TabSheet();
    tabSheet.setSizeFull();
    mainFrame.addComponent(tabSheet);

    // task table
    createTasksTable();

    // Create bottom frame
    bottomFrame = new CssLayout();
    bottomFrame.addStyleName("k-bottomframe");
    bottomFrame.setSizeFull();
    root.addComponent(bottomFrame, 0, 7, 7, 7);

    initialized = true;

    // attach the pending modules
    //
    synchronized (this) {
        for (IUIModule module : pendingModules) {
            attachModule(module);
        }
        pendingModules.clear();
    }

}