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


Java Component类代码示例

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


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

示例1: createRaisedButtonVariables

import com.vaadin.ui.Component; //导入依赖的package包/类
private Component createRaisedButtonVariables(boolean lightTheme) {
    String theme = lightTheme ? RAISED_BUTTONS_LIGHT_THEME : RAISED_BUTTONS_DARK_THEME;
    String prefix = "$" + (lightTheme ? Styles.Buttons.Raised.LIGHT : Styles.Buttons.Raised.DARK);

    MDDataTableLayout dt = new MDDataTableLayout();
    dt.setHeaders("Name", "Information");
    dt.addItem(prefix + "-font-color", createVariableLayout(FONT_COLOR, TYPE_COLOR, theme));
    dt.addItem(prefix + "-bg-color", createVariableLayout(BACKGROUND_COLOR, TYPE_COLOR, theme));
    dt.addItem(prefix + "-focus-bg-color", createVariableLayout(FOCUSED_BACKGROUND_COLOR, TYPE_COLOR, theme));
    dt.addItem(prefix + "-ripple-color", createVariableLayout(RIPPLE_COLOR, TYPE_COLOR, theme));
    dt.addItem(prefix + "-disabled-font-color", createVariableLayout(DISABLED_FONT_COLOR, TYPE_COLOR, theme));
    dt.addItem(prefix + "-disabled-bg-color", createVariableLayout(DISABLED_BACKGROUND_COLOR, TYPE_COLOR, theme));
    dt.setColumnWidth(0, 40, Unit.PERCENTAGE);
    dt.setColumnWidth(1, 60, Unit.PERCENTAGE);
    dt.addStyleName(Margins.Bottom.LARGE);
    return dt;
}
 
开发者ID:vaadin,项目名称:material-theme-fw8,代码行数:18,代码来源:ButtonsView.java

示例2: addItem

import com.vaadin.ui.Component; //导入依赖的package包/类
public void addItem(Object... values) {
    FlexLayout item = new FlexLayout();
    item.setPrimaryStyleName("md-datatable-row");
    item.addStyleName(Spacings.Right.LARGE);
    item.addStyleName(Paddings.Vertical.TABLE);
    for (Object value : values) {
        if (value instanceof String) {
            Label lbl = new Label((String) value);
            lbl.setContentMode(ContentMode.HTML);
            lbl.setPrimaryStyleName(Typography.Dark.Table.Row.PRIMARY);
            item.addComponent(lbl);
        } else if (value instanceof Component) {
            item.addComponent((Component) value);
        }
    }
    items.addComponent(item);
}
 
开发者ID:vaadin,项目名称:material-theme-fw8,代码行数:18,代码来源:MDDataTableLayout.java

示例3: getTestComponent

import com.vaadin.ui.Component; //导入依赖的package包/类
@Override
public Component getTestComponent() {
    NativeSelectGroup<String> field = new NativeSelectGroup<>();

    field.setCaption("Caption");
    field.setDescription("Description");
    field.getField().setItems("1", "2", "3");

    Button action1 = new Button("Change Mode to Danger");
    action1.setId("action1");
    action1.addClickListener(event -> {
        field.setMode(BootstrapMode.DANGER);
    });

    Button action2 = new Button("Remove Mode");
    action2.setId("action2");
    action2.addClickListener(event -> {
        field.removeMode();
    });

    MyCustomLayout layout = new MyCustomLayout(FormGroupHtml.BASIC, action1, action2);
    layout.addComponent(field, "field");

    return layout;
}
 
开发者ID:knoobie,项目名称:bootstrap-formgroup,代码行数:26,代码来源:NativeSelectGroupUI.java

示例4: getPolicy

import com.vaadin.ui.Component; //导入依赖的package包/类
protected Component getPolicy() {
    try {
        this.policy = new ComboBox("Select Policy");
        this.policy.setTextInputAllowed(false);
        this.policy.setNullSelectionAllowed(false);
        this.policy.setImmediate(true);
        this.policy.setRequired(true);
        this.policy.setRequiredError("Policy cannot be empty");
        populatePolicy();

    } catch (Exception e) {
        ViewUtil.iscNotification(e.getMessage(), Notification.Type.ERROR_MESSAGE);
        log.error("Error populating Policy List combobox", e);
    }

    return this.policy;
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:18,代码来源:BaseSecurityGroupInterfaceWindow.java

示例5: HttpSourceStatsWindow

import com.vaadin.ui.Component; //导入依赖的package包/类
public HttpSourceStatsWindow(String sourceUrl) {
    setModal(true);
    center();
    setCaption(String.format("%s crawling statistics", sourceUrl));
    setWidth(50, Unit.PERCENTAGE);
    setHeight(50, Unit.PERCENTAGE);
    List<DateHistogramValue> urls = ElasticSearch.getUrlOperations().calculateStats(sourceUrl);
    List<DateHistogramValue> documents = ElasticSearch.getDocumentOperations().calculateStats(sourceUrl);
    Component layout = getChart(sourceUrl, urls, documents);
    layout.setWidth(100, Unit.PERCENTAGE);
    setContent(layout);
}
 
开发者ID:tokenmill,项目名称:crawling-framework,代码行数:13,代码来源:HttpSourceStatsWindow.java

示例6: getComponent

import com.vaadin.ui.Component; //导入依赖的package包/类
@Override
public Optional<Component> getComponent() {
	return Optional.of(new AbstractComponent() {
		@Override
		public Object getData() {
			return definition;
		}
	});
}
 
开发者ID:peterl1084,项目名称:bean-grid,代码行数:10,代码来源:AbstractSummarizer.java

示例7: showViewContent

import com.vaadin.ui.Component; //导入依赖的package包/类
@Override
protected void showViewContent(Component content) {
	container.removeAllComponents();
	if (content != null) {
		container.addComponent(content);
	}
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:8,代码来源:ContainerViewDisplay.java

示例8: getTestComponent

import com.vaadin.ui.Component; //导入依赖的package包/类
@Override
public Component getTestComponent() {
	TextField tf = new TextField();
	new NumeralFieldFormatter(tf);
	tf.addValueChangeListener(l -> Notification.show("Value: " + l.getValue()));
	return tf;
}
 
开发者ID:johannesh2,项目名称:textfieldformatter,代码行数:8,代码来源:DefaultNumeralFieldFormatterUsageUI.java

示例9: initContent

import com.vaadin.ui.Component; //导入依赖的package包/类
@Override
protected Component initContent() {
	final Field<?> content = getInternalField();
	if (getWidth() > -1) {
		content.setWidth(100, Unit.PERCENTAGE);
	}
	if (getHeight() > -1) {
		content.setHeight(100, Unit.PERCENTAGE);
	}
	return content;
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:12,代码来源:AbstractCustomField.java

示例10: streamOfComponents

import com.vaadin.ui.Component; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public Stream<PropertyBinding<?, Component>> streamOfComponents() {
	return propertySet.stream().filter(p -> !_propertyConfiguration(p).isHidden())
			.filter(p -> _propertyConfiguration(p).getInput().isPresent())
			.map(p -> PropertyBinding.create(p, _propertyConfiguration(p).getInput().get().getComponent()));
}
 
开发者ID:holon-platform,项目名称:holon-vaadin,代码行数:8,代码来源:DefaultPropertyInputGroup.java

示例11: addAlignAndExpand

import com.vaadin.ui.Component; //导入依赖的package包/类
@Override
public com.holonplatform.vaadin.components.builders.OrderedLayoutConfigurator.BaseOrderedLayoutConfigurator addAlignAndExpand(
		Component component, Alignment alignment, float expandRatio) {
	getInstance().addComponent(component);
	getInstance().setComponentAlignment(component, alignment);
	getInstance().setExpandRatio(component, expandRatio);
	return builder();
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:9,代码来源:DefaultOrderedLayoutConfigurator.java

示例12: _valueContext

import com.vaadin.ui.Component; //导入依赖的package包/类
/**
 * Build the {@link ValueContext} to be used with the converter.
 * @return the {@link ValueContext}
 */
private ValueContext _valueContext() {
	final Component component = getComponent();
	if (component != null) {
		return new ValueContext(component);
	} else {
		return new ValueContext();
	}
}
 
开发者ID:holon-platform,项目名称:holon-vaadin,代码行数:13,代码来源:InputConverterAdapter.java

示例13: initContent

import com.vaadin.ui.Component; //导入依赖的package包/类
/**
 * @see com.vaadin.ui.CustomField#initContent()
 */
@Override
protected Component initContent() {
	if (value==null || value.equals(ConstanteUtils.TYP_BOOLEAN_NO)){
		field.setValue(false);
	}else{
		field.setValue(true);
	}		
	return field;
}
 
开发者ID:EsupPortail,项目名称:esup-ecandidat,代码行数:13,代码来源:RequiredStringCheckBox.java

示例14: setButtonsEnabled

import com.vaadin.ui.Component; //导入依赖的package包/类
/**
 * @param enabled
 *            either enable or disable all the buttons in the gived Layout
 * @param layout
 *            Layout these buttons belongs to
 * @param ignoreList
 *            Buttons who does not need this state change i.e. Add button
 */
public static void setButtonsEnabled(boolean enabled, HorizontalLayout layout, List<String> ignoreList) {
    if (layout != null) {
        Iterator<Component> iterate = layout.iterator();
        while (iterate.hasNext()) {
            Component c = iterate.next();
            if (c instanceof Button && !ignoreList.contains(c.getId())) {
                c.setEnabled(enabled);
            }
        }
    }
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:20,代码来源:ViewUtil.java

示例15: OSCViewProvider

import com.vaadin.ui.Component; //导入依赖的package包/类
public OSCViewProvider(String name, Class<T> type, ComponentServiceObjects<T> factory) {
    this.name = Objects.requireNonNull(name, "The view must have a name");
    Objects.requireNonNull(type, "The view must have a type");
    if (!Component.class.isAssignableFrom(type)) {
        throw new IllegalArgumentException("The type must be a Vaadin Component");
    }
    this.type = type;

    this.factory = Objects.requireNonNull(factory, "The view must have a factory");
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:11,代码来源:OSCViewProvider.java


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