use of com.vaadin.ui.TabSheet in project opennms by OpenNMS.
the class SnmpCollectionAdminApplication method init.
/* (non-Javadoc)
* @see com.vaadin.ui.UI#init(com.vaadin.server.VaadinRequest)
*/
@Override
public void init(VaadinRequest request) {
if (dataCollectionDao == null)
throw new RuntimeException("dataCollectionDao cannot be null.");
TabSheet tabs = new TabSheet();
tabs.addStyleName("light");
tabs.setSizeFull();
tabs.addTab(new SnmpCollectionPanel(dataCollectionDao, new SimpleLogger()));
tabs.addTab(new DataCollectionGroupAdminPanel(dataCollectionDao));
setContent(tabs);
}
use of com.vaadin.ui.TabSheet in project opennms by OpenNMS.
the class DataCollectionGroupPanel method selectedTabChange.
/* (non-Javadoc)
* @see com.vaadin.ui.TabSheet.SelectedTabChangeListener#selectedTabChange(com.vaadin.ui.TabSheet.SelectedTabChangeEvent)
*/
@Override
public void selectedTabChange(SelectedTabChangeEvent event) {
TabSheet tabsheet = event.getTabSheet();
Tab tab = tabsheet.getTab(tabsheet.getSelectedTab());
if (tab != null) {
Notification.show("Selected tab: " + tab.getCaption());
}
}
use of com.vaadin.ui.TabSheet in project v-leaflet by mstahv.
the class JtsPointFieldTest method getTestComponent.
// private Polygon polygon;
@Override
public Component getTestComponent() {
content.setMargin(true);
display.setContentMode(ContentMode.PREFORMATTED);
display.setCaption("Pojo state:");
display.setValue(pojo.toString());
HorizontalLayout horizontalLayout = new HorizontalLayout();
horizontalLayout.setSizeFull();
VerticalLayout editorform = new VerticalLayout();
editorform.setSizeFull();
editorform.setSpacing(true);
editorform.setCaption("Edit JTS pojo:");
TabSheet jtsFields = new TabSheet(point);
jtsFields.setCaption("JTS fiels:");
jtsFields.setSizeFull();
editorform.addComponents(new HorizontalLayout(name, date), jtsFields);
editorform.setExpandRatio(jtsFields, 1);
final Binder<JtsPojo> beanBinder = new Binder<>(JtsPojo.class);
beanBinder.readBean(pojo);
beanBinder.bindInstanceFields(this);
HorizontalLayout buttonLayout = new HorizontalLayout();
buttonLayout.addComponent(new Button("Save", (ClickListener) event -> {
try {
beanBinder.writeBean(pojo);
display.setValue(pojo.toString());
} catch (ValidationException e) {
System.err.println("Validation errors:" + Arrays.toString(e.getBeanValidationErrors().toArray()));
}
}));
CheckBox roCheckBox = new CheckBox("Read only", false);
roCheckBox.addValueChangeListener(event -> beanBinder.setReadOnly(event.getValue()));
buttonLayout.addComponent(roCheckBox);
buttonLayout.addComponent(new Button("Assign new empty bean", (ClickListener) event -> {
pojo = new JtsPojo();
beanBinder.readBean(pojo);
display.setValue(pojo.toString());
}));
buttonLayout.addComponent(new Button("Assign bean with preset data", (ClickListener) event -> {
pojo = new JtsPojo();
pojo.setPoint(JTSUtil.toPoint(new org.vaadin.addon.leaflet.shared.Point(61, 22)));
beanBinder.readBean(pojo);
display.setValue(pojo.toString());
}));
editorform.addComponent(buttonLayout);
horizontalLayout.addComponents(editorform, display);
horizontalLayout.setExpandRatio(editorform, 1);
horizontalLayout.setExpandRatio(display, 1);
return horizontalLayout;
}
use of com.vaadin.ui.TabSheet in project VaadinUtils by rlsutton1.
the class BaseCrudView method selectFirstFieldAndShowTab.
protected void selectFirstFieldAndShowTab() {
for (Field<?> field : fieldGroup.getFields()) {
Component childField = field;
for (int i = 0; i < 10; i++) {
Component parentField = childField.getParent();
if (parentField instanceof TabSheet) {
((TabSheet) parentField).setSelectedTab(childField);
break;
}
if (parentField == null) {
// out of luck, didn't find a parent tab
break;
}
childField = parentField;
}
field.focus();
break;
}
}
use of com.vaadin.ui.TabSheet in project VaadinUtils by rlsutton1.
the class JasperReportScheduleLayout method buildEditor.
@Override
@SuppressWarnings("deprecation")
public TabSheet buildEditor(ValidatingFieldGroup<ReportEmailScheduleEntity> validatingFieldGroup) {
TabSheet tabsheet = new TabSheet();
tabsheet.setSizeFull();
VerticalLayout main = new VerticalLayout();
main.setSpacing(true);
main.setMargin(true);
main.setSizeFull();
tabsheet.addTab(main, "Email");
main.addComponent(emailTargetLayout);
FormHelper<ReportEmailScheduleEntity> helper = new FormHelper<ReportEmailScheduleEntity>(main, fieldGroup);
reportTitle = helper.bindTextField("Report", ReportEmailScheduleEntity_.reportTitle);
reportTitle.setReadOnly(true);
sender = helper.bindEntityField("From", ReportEmailScheduleEntity_.sender, ReportEmailSender.class, ReportEmailSender_.username);
sender.setReadOnly(true);
outputFormat = helper.bindEnumField("Output format", ReportEmailScheduleEntity_.outputFormat.getName(), OutputFormat.class);
outputFormat.removeItem(OutputFormat.HTML);
helper.bindTextField("Subject", ReportEmailScheduleEntity_.subject);
CKEditorEmailField message = helper.bindEditorField("Message", ReportEmailScheduleEntity_.message, false);
helper.bindTextField("Report Log", ReportEmailScheduleEntity_.reportLog.getName()).setReadOnly(true);
main.setExpandRatio(message, 1);
TopVerticalLayout scheduleWrapper = new TopVerticalLayout();
scheduleWrapper.setSizeFull();
tabsheet.addTab(scheduleWrapper, "Schedule");
FormLayout scheduleForm = new FormLayout();
scheduleForm.setSizeFull();
scheduleForm.setMargin(true);
scheduleWrapper.addComponent(scheduleForm);
buildScheduleTab(validatingFieldGroup, scheduleForm, helper);
VerticalLayout paramWrapper = new VerticalLayout();
paramWrapper.setSizeFull();
tabsheet.addTab(paramWrapper, "Parameters");
paramForm = new VerticalLayout();
paramForm.setSizeFull();
paramForm.setMargin(true);
paramWrapper.addComponent(paramForm);
return tabsheet;
}
Aggregations