本文整理匯總了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;
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例6: getComponent
import com.vaadin.ui.Component; //導入依賴的package包/類
@Override
public Optional<Component> getComponent() {
return Optional.of(new AbstractComponent() {
@Override
public Object getData() {
return definition;
}
});
}
示例7: showViewContent
import com.vaadin.ui.Component; //導入依賴的package包/類
@Override
protected void showViewContent(Component content) {
container.removeAllComponents();
if (content != null) {
container.addComponent(content);
}
}
示例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;
}
示例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;
}
示例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()));
}
示例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();
}
示例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();
}
}
示例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;
}
示例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);
}
}
}
}
示例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");
}