當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。