Here are the examples of the java api com.vaadin.ui.CssLayout.setStyleName() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
6 Examples
19
Source : TRAbstractEntityComboBox.java
with Apache License 2.0
from ijazfx
with Apache License 2.0
from ijazfx
public TRAbstractEnreplacedyComboBox<T> build() {
if (!isBuilt) {
addButton = new MButton(FontAwesome.PLUS, event -> {
try {
onAddButtonClick(initializeEnreplacedy(enreplacedyClreplaced.newInstance()));
} catch (Exception e) {
L.warn(e.getMessage(), e);
}
}).withStyleName(ValoTheme.BUTTON_ICON_ONLY);
editButton = new MButton(FontAwesome.PENCIL, event -> {
try {
T item = (T) comboBox.getValue();
if (item != null) {
preEdit(item);
openEditorForm(item);
}
} catch (Exception e) {
L.warn(e.getMessage(), e);
}
}).withStyleName(ValoTheme.BUTTON_ICON_ONLY);
editButton.setEnabled(false);
deleteButton = new MButton(FontAwesome.TRASH, event -> {
if (shouldShowDeleteConfirmation()) {
ConfirmDialog.show(UI.getCurrent(), "Are you sure to remove selected record?", e -> {
if (e.isConfirmed()) {
try {
T item = (T) comboBox.getValue();
if (item != null) {
if (onDeleteEnreplacedy(item)) {
beanItemContainer.removeItem(item);
if (delegate != null) {
delegate.onDelete(item);
}
}
}
} catch (Exception ex) {
L.warn(e.getMessage(), ex);
}
}
});
} else {
T item = (T) comboBox.getValue();
if (item != null) {
if (onDeleteEnreplacedy(item)) {
beanItemContainer.removeItem(item);
if (delegate != null) {
delegate.onDelete(item);
}
}
}
}
}).withStyleName(ValoTheme.BUTTON_ICON_ONLY);
deleteButton.setEnabled(false);
comboBox = new ComboBox();
beanItemContainer = new BeanItemContainer<>(enreplacedyClreplaced);
comboBox.setContainerDataSource(beanItemContainer);
comboBox.sereplacedemCaptionPropertyId(comboBoxVisibleProperty());
comboBox.setInputPrompt(comboBoxInputPrompt());
comboBox.addValueChangeListener(enreplacedy -> {
if (delegate != null) {
delegate.onItemSelect((T) comboBox.getValue());
}
if (comboBox.getValue() != null) {
editButton.setEnabled(true);
deleteButton.setEnabled(true);
}
});
layout = new CssLayout(addButton, comboBox, editButton, deleteButton);
layout.setStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
addComponent(layout);
postBuild();
isBuilt = true;
refresh();
}
return this;
}
19
Source : GxEmailTemplateListPanel.java
with Apache License 2.0
from ijazfx
with Apache License 2.0
from ijazfx
@Override
protected void addButtonsToSecondaryToolbar(AbstractOrderedLayout toolbar) {
MButton activeButton = new MButton("Active");
MButton inactiveButton = new MButton("Inactive");
activeButton.addClickListener(event -> {
activeButton.setEnabled(false);
inactiveButton.setEnabled(true);
fetchMode = ACTIVE;
refresh();
});
inactiveButton.addClickListener(event -> {
activeButton.setEnabled(true);
inactiveButton.setEnabled(false);
fetchMode = INACTIVE;
refresh();
});
activeButton.setEnabled(false);
inactiveButton.setEnabled(true);
CssLayout activeInactiveLayout = new CssLayout(activeButton, inactiveButton);
activeInactiveLayout.setStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
activeInactiveLayout.setCaption("Template Status");
toolbar.addComponent(activeInactiveLayout);
toolbar.setExpandRatio(activeInactiveLayout, 1);
}
18
Source : MetroStyleDashboardPanel.java
with Apache License 2.0
from ijazfx
with Apache License 2.0
from ijazfx
@Override
protected void postInitialize() {
rootLayout = new CssLayout();
rootLayout.setStyleName("metro-layout");
List<TRMenuItem> menuItems = dashboardSetup.menuItems();
generateTiles(rootLayout, menuItems);
addComponent(rootLayout);
}
18
Source : GxMeetingClient.java
with Apache License 2.0
from ijazfx
with Apache License 2.0
from ijazfx
private Component getToolbar() {
CssLayout toolbar = new CssLayout();
toolbar.setStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
joinButton = new MButton("Join").withStyleName(ValoTheme.BUTTON_PRIMARY).withListener(e -> {
if (meeting == null || !meeting.isStarted()) {
GxNotification.tray("Notification", "Meeting is not yet started or has ended already.").show(Page.getCurrent());
return;
}
meeting.join(user);
join(user);
joinButton.setEnabled(false);
leaveButton.setEnabled(true);
});
leaveButton = new MButton("Leave").withStyleName(ValoTheme.BUTTON_DANGER).withListener(e -> {
meeting.leave(user);
leave(user);
leaveButton.setEnabled(false);
joinButton.setEnabled(true);
});
cameraButton = new MButton().withIcon(FontAwesome.VIDEO_CAMERA).withStyleName(ValoTheme.BUTTON_ICON_ONLY);
screenButton = new MButton().withIcon(FontAwesome.DESKTOP).withStyleName(ValoTheme.BUTTON_ICON_ONLY);
cameraButton.addClickListener(e -> {
String statement = String.format("startCamera()");
com.vaadin.ui.JavaScript.getCurrent().execute(statement);
});
screenButton.addClickListener(e -> {
String statement = String.format("startScreen()");
com.vaadin.ui.JavaScript.getCurrent().execute(statement);
});
toolbar.addComponents(joinButton, leaveButton, cameraButton, screenButton);
return toolbar;
}
12
Source : GxMeetingHost.java
with Apache License 2.0
from ijazfx
with Apache License 2.0
from ijazfx
private Component getToolbar() {
CssLayout toolbar = new CssLayout();
toolbar.setStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
startButton = new MButton("Start").withStyleName(ValoTheme.BUTTON_PRIMARY).withListener(e -> {
meeting.start(user);
meetingContainer.removeAllItems();
meetingContainer.addBean(user);
for (GxMeetingUser u : meeting.getInvitees()) {
if (!u.getUserId().equals(user.getUserId()))
meetingContainer.addBean(u);
}
roomPanel.refresh();
startButton.setEnabled(false);
endButton.setEnabled(true);
});
endButton = new MButton("End").withStyleName(ValoTheme.BUTTON_DANGER).withListener(e -> {
meeting.end(user);
meetingContainer.removeAllItems();
roomPanel.refresh();
endButton.setEnabled(false);
startButton.setEnabled(true);
});
cameraButton = new MButton().withIcon(FontAwesome.VIDEO_CAMERA).withStyleName(ValoTheme.BUTTON_ICON_ONLY);
screenButton = new MButton().withIcon(FontAwesome.DESKTOP).withStyleName(ValoTheme.BUTTON_ICON_ONLY);
muteAllButton = new MButton().withIcon(FontAwesome.MICROPHONE).withStyleName(ValoTheme.BUTTON_ICON_ONLY);
cameraButton.addClickListener(e -> {
String statement = String.format("startCamera()");
com.vaadin.ui.JavaScript.getCurrent().execute(statement);
});
screenButton.addClickListener(e -> {
String statement = String.format("startScreen()");
com.vaadin.ui.JavaScript.getCurrent().execute(statement);
});
muteAllButton.addClickListener(e -> {
if (!allMuted) {
com.vaadin.ui.JavaScript.getCurrent().execute("muteAllAttendees()");
allMuted = true;
muteAllButton.setIcon(FontAwesome.MICROPHONE_SLASH);
} else {
com.vaadin.ui.JavaScript.getCurrent().execute("unmuteAllAttendees()");
allMuted = false;
muteAllButton.setIcon(FontAwesome.MICROPHONE);
}
});
toolbar.addComponents(startButton, endButton, cameraButton, screenButton, muteAllButton);
return toolbar;
}
2
Source : MTimeField.java
with Apache License 2.0
from ijazfx
with Apache License 2.0
from ijazfx
@Override
protected Component initContent() {
CssLayout layout = new CssLayout();
layout.setCaption(getCaption());
layout.setStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
hourComboBox = new ComboBox() {
public String gereplacedemCaption(Object itemId) {
return String.format("%02d", itemId);
}
};
hourComboBox.setWidth("60px");
hourComboBox.setInputPrompt("hh");
hourComboBox.setStyleName(ValoTheme.COMBOBOX_SMALL);
hourComboBox.setStyleName(ValoTheme.COMBOBOX_ALIGN_CENTER);
hourComboBox.addValueChangeListener(event -> {
if (getValue() != null) {
Calendar gcal = GregorianCalendar.getInstance();
gcal.setTime(getValue());
Integer hour = (Integer) hourComboBox.getValue();
if (hour == null) {
gcal.set(Calendar.HOUR_OF_DAY, 0);
} else {
gcal.set(Calendar.HOUR_OF_DAY, hour);
}
setValue(new Timestamp(gcal.getTime().getTime()));
}
});
minuteComboBox = new ComboBox() {
public String gereplacedemCaption(Object itemId) {
return String.format("%02d", itemId);
}
};
minuteComboBox.setWidth("60px");
minuteComboBox.setInputPrompt("mm");
minuteComboBox.setStyleName(ValoTheme.COMBOBOX_SMALL);
minuteComboBox.setStyleName(ValoTheme.COMBOBOX_ALIGN_CENTER);
minuteComboBox.addValueChangeListener(event -> {
if (getValue() != null) {
Calendar gcal = GregorianCalendar.getInstance();
gcal.setTime(getValue());
Integer hour = (Integer) minuteComboBox.getValue();
if (hour == null) {
gcal.set(Calendar.MINUTE, 0);
} else {
gcal.set(Calendar.MINUTE, hour);
}
setValue(new Timestamp(gcal.getTime().getTime()));
}
});
secondComboBox = new ComboBox() {
public String gereplacedemCaption(Object itemId) {
return String.format("%02d", itemId);
}
};
secondComboBox.setWidth("60px");
secondComboBox.setInputPrompt("ss");
secondComboBox.setStyleName(ValoTheme.COMBOBOX_SMALL);
secondComboBox.setStyleName(ValoTheme.COMBOBOX_ALIGN_CENTER);
secondComboBox.addValueChangeListener(event -> {
if (getValue() != null) {
Calendar gcal = GregorianCalendar.getInstance();
gcal.setTime(getValue());
Integer hour = (Integer) secondComboBox.getValue();
if (hour == null) {
gcal.set(Calendar.SECOND, 0);
} else {
gcal.set(Calendar.SECOND, hour);
}
setValue(new Timestamp(gcal.getTime().getTime()));
}
});
for (int i = 0; i < 24; i++) {
hourComboBox.addItem(i);
}
for (int i = 0; i < 60; i += minuteStepSize) {
minuteComboBox.addItem(i);
}
for (int i = 0; i < 60; i += secondStepSize) {
secondComboBox.addItem(i);
}
layout.addComponent(hourComboBox);
if (resolution == Resolution.MINUTE || resolution == Resolution.SECOND) {
MLabel label = new MLabel(TIME_SEPARATOR).withWidthUndefined().withContentMode(ContentMode.HTML).withStyleName(ValoTheme.LABEL_BOLD);
layout.addComponents(label, minuteComboBox);
}
if (resolution == Resolution.SECOND) {
MLabel label = new MLabel(TIME_SEPARATOR).withWidthUndefined().withContentMode(ContentMode.HTML).withStyleName(ValoTheme.LABEL_BOLD);
layout.addComponents(label, secondComboBox);
}
addValueChangeListener(event -> {
if (getValue() == null) {
hourComboBox.setValue(null);
minuteComboBox.setValue(null);
secondComboBox.setValue(null);
} else {
Calendar gcal = GregorianCalendar.getInstance();
gcal.setTime(getValue());
hourComboBox.setValue(gcal.get(Calendar.HOUR_OF_DAY));
int minute = gcal.get(Calendar.MINUTE);
minute = (minute / minuteStepSize) * minuteStepSize;
minuteComboBox.setValue(minute);
int second = gcal.get(Calendar.SECOND);
second = (second / secondStepSize) * secondStepSize;
secondComboBox.setValue(second);
}
});
fireValueChange(true);
return layout;
}