Search in sources :

Example 56 with Component

use of com.vaadin.ui.Component in project cuba by cuba-platform.

the class WebTableFieldFactory method createField.

@SuppressWarnings("unchecked")
@Override
public com.vaadin.v7.ui.Field<?> createField(com.vaadin.v7.data.Container container, Object itemId, Object propertyId, Component uiContext) {
    String fieldPropertyId = String.valueOf(propertyId);
    Table.Column columnConf = webTable.getColumnsInternal().get(propertyId);
    TableDataContainer tableDataContainer = (TableDataContainer) container;
    Entity entity = (Entity) tableDataContainer.getInternalItem(itemId);
    InstanceContainer instanceContainer = webTable.getInstanceContainer((E) entity);
    com.haulmont.cuba.gui.components.Component columnComponent = createField(new ContainerValueSource(instanceContainer, fieldPropertyId), fieldPropertyId, columnConf.getXmlDescriptor());
    if (columnComponent instanceof Field) {
        Field cubaField = (Field) columnComponent;
        Map<Table.Column, String> requiredColumns = webTable.getRequiredColumnsInternal();
        if (requiredColumns != null && requiredColumns.containsKey(columnConf)) {
            cubaField.setRequired(true);
            cubaField.setRequiredMessage(requiredColumns.get(columnConf));
        }
    }
    if (!(columnComponent instanceof CheckBox)) {
        // todo get rid of concrete CheckBox class !
        columnComponent.setWidthFull();
    }
    if (columnComponent instanceof BelongToFrame) {
        BelongToFrame belongToFrame = (BelongToFrame) columnComponent;
        if (belongToFrame.getFrame() == null) {
            belongToFrame.setFrame(webTable.getFrame());
        }
    }
    applyPermissions(columnComponent);
    columnComponent.setParent(webTable);
    Component componentImpl = getComponentImplementation(columnComponent);
    if (componentImpl instanceof com.vaadin.v7.ui.Field) {
        return (com.vaadin.v7.ui.Field<?>) componentImpl;
    }
    return new EditableColumnFieldWrapper(componentImpl, columnComponent);
}
Also used : Entity(com.haulmont.cuba.core.entity.Entity) Table(com.haulmont.cuba.gui.components.Table) WebAbstractTable(com.haulmont.cuba.web.gui.components.WebAbstractTable) BelongToFrame(com.haulmont.cuba.gui.components.Component.BelongToFrame) InstanceContainer(com.haulmont.cuba.gui.model.InstanceContainer) ContainerValueSource(com.haulmont.cuba.gui.components.data.value.ContainerValueSource) Field(com.haulmont.cuba.gui.components.Field) CheckBox(com.haulmont.cuba.gui.components.CheckBox) Component(com.vaadin.ui.Component)

Example 57 with Component

use of com.vaadin.ui.Component in project charts by vaadin.

the class PieChart method getChart.

@Override
protected Component getChart() {
    Component ret = createChart();
    ret.setWidth("100%");
    ret.setHeight("450px");
    return ret;
}
Also used : Component(com.vaadin.ui.Component)

Example 58 with Component

use of com.vaadin.ui.Component in project charts by vaadin.

the class LibraryData method setup.

@Override
protected void setup() {
    searchField.addValueChangeListener(e -> {
        try {
            result = Helmet.search(searchField.getValue());
            updateChart();
            updateSearchNavi();
        } catch (IOException exc) {
            // TODO Auto-generated catch block
            exc.printStackTrace();
        }
    });
    searchField.setValue("orwell");
    HorizontalLayout searchNavi = new HorizontalLayout();
    searchNavi.addComponent(searchField);
    searchNavi.addComponent(prevButton);
    searchNavi.addComponent(pageLabel);
    searchNavi.addComponent(nextButton);
    updateSearchNavi();
    searchNavi.setWidth("100%");
    content = this;
    Component map = getChart();
    content.setSizeFull();
    content.addComponent(searchNavi);
    content.addComponent(map);
    content.setExpandRatio(map, 1);
}
Also used : IOException(java.io.IOException) Component(com.vaadin.ui.Component) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 59 with Component

use of com.vaadin.ui.Component in project charts by vaadin.

the class SimpleChartWithDataProviderSeries method getChart.

@Override
protected Component getChart() {
    HorizontalLayout lo = new HorizontalLayout();
    Component table = createGrid();
    DataProviderSeries<Browser> ds = createChartDS();
    Component chart = createChart(ds);
    table.setSizeFull();
    chart.setSizeFull();
    lo.setWidth("100%");
    lo.setHeight("450px");
    lo.addComponents(table);
    lo.addComponent(chart);
    return lo;
}
Also used : Component(com.vaadin.ui.Component) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 60 with Component

use of com.vaadin.ui.Component in project charts by vaadin.

the class ContainerWithLotsOfData method getChart.

@Override
protected Component getChart() {
    HorizontalLayout lo = new HorizontalLayout();
    ContainerDataSeries container = createContainer();
    Component table = createTable(container.getVaadinContainer());
    Component chart = createChart(container);
    lo.addComponents(table);
    lo.addComponent(chart);
    table.setSizeFull();
    chart.setSizeFull();
    lo.setSizeFull();
    lo.setExpandRatio(table, 1);
    lo.setExpandRatio(chart, 5);
    return lo;
}
Also used : Component(com.vaadin.ui.Component) ContainerDataSeries(com.vaadin.v7.addon.charts.model.ContainerDataSeries) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Aggregations

Component (com.vaadin.ui.Component)146 LayoutBoundTransferable (com.haulmont.cuba.web.widgets.addons.dragdroplayouts.events.LayoutBoundTransferable)23 VerticalDropLocation (com.vaadin.shared.ui.dd.VerticalDropLocation)13 ComponentContainer (com.vaadin.ui.ComponentContainer)12 SingleComponentContainer (com.vaadin.ui.SingleComponentContainer)12 WebAbstractComponent (com.haulmont.cuba.web.gui.components.WebAbstractComponent)11 HorizontalLayout (com.vaadin.ui.HorizontalLayout)11 VerticalLayout (com.vaadin.ui.VerticalLayout)11 Button (com.vaadin.ui.Button)9 Window (com.haulmont.cuba.gui.components.Window)8 Label (com.vaadin.ui.Label)8 Test (org.junit.Test)8 WebWindow (com.haulmont.cuba.web.gui.WebWindow)7 AbstractOrderedLayout (com.vaadin.ui.AbstractOrderedLayout)6 CssLayout (com.vaadin.ui.CssLayout)6 List (java.util.List)6 com.haulmont.cuba.gui.components (com.haulmont.cuba.gui.components)5 CubaUI (com.haulmont.cuba.web.widgets.CubaUI)5 DDAbsoluteLayout (com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDAbsoluteLayout)5 Item (com.vaadin.data.Item)5