本文整理汇总了Java中com.vaadin.ui.Window.addComponent方法的典型用法代码示例。如果您正苦于以下问题:Java Window.addComponent方法的具体用法?Java Window.addComponent怎么用?Java Window.addComponent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.ui.Window
的用法示例。
在下文中一共展示了Window.addComponent方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import com.vaadin.ui.Window; //导入方法依赖的package包/类
@Override
public Undoer execute(List<VertexRef> targets,
OperationContext operationContext) {
Window mainWindow = operationContext.getMainWindow();
CommandManager commandManager = m_commandManager;
Window window = new Window();
window.setModal(true);
for(Command command : commandManager.getHistoryList()) {
window.addComponent(new Label(command.toString()));
}
mainWindow.addWindow(window);
return null;
}
示例2: buttonClick
import com.vaadin.ui.Window; //导入方法依赖的package包/类
@Override
public void buttonClick(ClickEvent event) {
Button b = event.getButton();
if (b == btnJobQueueStatus) {
Window subWindow = new Window("Job Manager");
subWindow.setWidth("500px");
subWindow.center();
getApplication().getMainWindow().addWindow(subWindow);
Panel p = new Panel(new JobsStatusViewComponent(getApplication().getURL()));
p.getContent().setWidth("100%");
p.setWidth("100%");
subWindow.addComponent(p);
subWindow.setModal(true);
} else if (b == help) {
String HelpURL = getApplication().getURL().toExternalForm() + "doc";
getApplication().getMainWindow().open(new ExternalResource(HelpURL), "_blank");
} else if (b == restart) {
((ExpressZipWindow) getApplication().getMainWindow()).getApplication().close();
}
}
示例3: showGenericFormDialog
import com.vaadin.ui.Window; //导入方法依赖的package包/类
@Override
public <U> UIDialog showGenericFormDialog(BForm<U> form, U bean) {
Map<String, Object> extraObjects = new HashMap<String, Object>();
extraObjects.put(UIVaadinFormToolkit.EXTRA_OBJECT_APPLICATION, this);
VaadinBindingFormInstance formInstance = vaadinToolkit.buildForm(form, commonBindingToolkit, extraObjects, false);
Window window = new Window(form.getName());
window.setModal(true);
window.addComponent((ComponentContainer) formInstance.getImplementation());
formInstance.setValue(bean);
HorizontalLayout footer = new HorizontalLayout();
footer.setWidth(100, HorizontalLayout.UNITS_PERCENTAGE);
HorizontalLayout buttons = new HorizontalLayout();
buttons.setSpacing(true);
Button buttonOk = new Button("Ok");
buttons.addComponent(buttonOk);
Button buttonCancel = new Button("Cancel");
buttons.addComponent(buttonCancel);
footer.addComponent(buttons);
footer.setComponentAlignment(buttons, Alignment.MIDDLE_RIGHT);
window.addComponent(footer);
((VerticalLayout) window.getContent()).setComponentAlignment(footer, Alignment.BOTTOM_CENTER);
window.getContent().setSizeFull();
vaadinApplication.getMainWindow().addWindow(window);
return new UIDialogImpl(window, buttonOk, buttonCancel, formInstance);
}
示例4: showFormDialog
import com.vaadin.ui.Window; //导入方法依赖的package包/类
private <T> UIDialog showFormDialog(Class<T> modelClass, UIBean model, BindingFormCapability capability) {
AbstractFormBindingForm<T> form = formRegistryService.getDefaultForm(modelClass, AbstractFormBindingForm.class, capability);
Map<String, Object> extraObjects = new HashMap<String, Object>();
extraObjects.put(UIVaadinFormToolkit.EXTRA_OBJECT_APPLICATION, this);
VaadinBindingFormInstance formInstance = vaadinToolkit.buildForm(form.getAbstractBForm(), uiBeanBindingToolkit,
extraObjects, false);
Window window = new Window(form.getAbstractBForm().getName());
window.setModal(true);
window.addComponent((ComponentContainer) formInstance.getImplementation());
formInstance.setValue(model);
HorizontalLayout footer = new HorizontalLayout();
footer.setWidth(100, HorizontalLayout.UNITS_PERCENTAGE);
HorizontalLayout buttons = new HorizontalLayout();
buttons.setSpacing(true);
Button buttonOk = new Button("Ok");
buttons.addComponent(buttonOk);
Button buttonCancel = new Button("Cancel");
buttons.addComponent(buttonCancel);
footer.addComponent(buttons);
footer.setComponentAlignment(buttons, Alignment.MIDDLE_RIGHT);
window.addComponent(footer);
((VerticalLayout) window.getContent()).setComponentAlignment(footer, Alignment.BOTTOM_CENTER);
window.getContent().setSizeFull();
vaadinApplication.getMainWindow().addWindow(window);
return new UIDialogImpl(window, buttonOk, buttonCancel, formInstance);
}
示例5: init
import com.vaadin.ui.Window; //导入方法依赖的package包/类
@Override
public void init() {
Window main = new Window("Test window");
setMainWindow(main);
VaadinFormToolkit toolkit = new VaadinFormToolkit();
Form form = new SampleForm();
VaadinFormInstance formInstance = toolkit.buildForm(form);
main.addComponent(formInstance.getImplementation());
}
示例6: showAddProjectDialog
import com.vaadin.ui.Window; //导入方法依赖的package包/类
/**
* Zeige das Projekt-Hinzufuegen-Dialogfenster, bei dem ein Eingabefeld fuer
* den Namen des Projekts und ein Hinzfuege-Button vorhanden ist. Funktion
* bei geklicktem Button siehe Clicklistener in dieser Klasse. Das
* horizontale Layout zur Darstellung besitzt ein Formlayout und den Button,
* die nebeneinander dargestellt werden.
*
* @author Christian Scherer, Mirko Göpfrich
*/
@Override
public void showAddProjectDialog() {
addDialog = new Window("Projekt hinzufügen");
addDialog.setModal(true);
addDialog.setWidth(410, UNITS_PIXELS);
addDialog.setResizable(false);
addDialog.setDraggable(false);
VerticalLayout layout = new VerticalLayout();
layout.setSpacing(false);
FormLayout formLayout = new FormLayout();
formLayout.setMargin(true);
formLayout.setSpacing(true);
//TextFeld für Name dem Formular hinzufügen
tfName = new TextField("Name wählen:");
tfName.setRequired(true);
tfName.addValidator(new StringLengthValidator(
"Der Projektname muss zwischen 2 und 20 Zeichen lang sein.", 2,
20, false));
tfName.setRequiredError("Pflichtfeld");
tfName.setSizeFull();
formLayout.addComponent(tfName);
//TextArea für Beschreibung dem Formular hinzufügen
taDescription = new TextArea("Beschreibung wählen");
taDescription.setSizeFull();
formLayout.addComponent(taDescription);
//Formular dem Layout hinzufügen
layout.addComponent(formLayout);
//Hinzufüge-Button erstllen und dem Layout hinzufügen
dialogAddBtn = new Button("Hinzufügen", this);
layout.addComponent(dialogAddBtn);
//Layout dem Dialog-Fenster hinzufügen
addDialog.addComponent(layout);
//Dialog dem Hauptfenster hinzufügen
getWindow().addWindow(addDialog);
logger.debug("Hinzufuege-Dialog erzeugt");
}
示例7: showEditProjectDialog
import com.vaadin.ui.Window; //导入方法依赖的package包/类
/**Methode zur Implementierung des Dialogfensters für Projekt-Änderungen.
*
*/
@Override
public void showEditProjectDialog(Project project) {
editDialog = new Window("Projekt bearbeiten");
editDialog.setModal(true);
editDialog.setWidth(410, UNITS_PIXELS);
editDialog.setResizable(false);
editDialog.setDraggable(false);
VerticalLayout layout = new VerticalLayout();
layout.setSpacing(true);
FormLayout formLayout = new FormLayout();
formLayout.setMargin(true);
formLayout.setSpacing(true);
//TextFeld für Name dem Formular hinzufügen
tfName = new TextField("Name ändern:", project.getName());
tfName.setRequired(true);
tfName.addValidator(new StringLengthValidator(
"Der Projektname muss zwischen 2 und 20 Zeichen lang sein.", 2,
20, false));
tfName.setRequiredError("Pflichtfeld");
tfName.setSizeFull();
formLayout.addComponent(tfName);
//TextArea für Beschreibung dem Formular hinzufügen
taDescription = new TextArea("Beschreibung ändern:", project.getDescription());
taDescription.setSizeFull();
formLayout.addComponent(taDescription);
//Formular dem Layout hinzufügen
layout.addComponent(formLayout);
//Speichern-Button erstllen und dem Layout hinzufügen
//TODO: ist das korrekt? Gute Frage, I have no idea what u r doing
dialogEditBtn = new Button("Speichern");
layout.addComponent(dialogEditBtn);
dialogEditBtn.addListener(new Button.ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
if (tfName.isValid()) {
boolean succed = presenter.editProject(projects.get(indexEditBtn), (String) tfName.getValue(), (String) taDescription.getValue());
if (succed) {
getWindow().removeWindow(editDialog);
logger.debug("Projekt-bearbeiten Dialog geschlossen");
}
} else {
getWindow().showNotification(
"",
"Projektname ist ein Pflichtfeld. Bitte geben Sie einen Projektnamen an",
Notification.TYPE_ERROR_MESSAGE);
}
}
});
//Layout dem Dialog-Fenster hinzufügen
editDialog.addComponent(layout);
//Dialog dem Hauptfenster hinzufügen
getWindow().addWindow(editDialog);
logger.debug("Bearbeiten-Dialog erzeugt");
}
示例8: init
import com.vaadin.ui.Window; //导入方法依赖的package包/类
@Override
public void init() {
try {
Window main = new Window("Test window");
setMainWindow(main);
BFormToolkit<Component> toolkit = BFormService.getInstance().getFormToolkit(Component.class);
BForm<BusinessPartner> form = new SampleForm();
final BFormInstance<BusinessPartner, Component> formInstance = toolkit.buildForm(form);
main.addComponent(formInstance.getImplementation());
final BusinessPartner bean1 = new BusinessPartner();
bean1.setAbc("A");
bean1.setOrganization(SampleForm.ORG4);
bean1.setActive(true);
bean1.setCifCode("B55425451");
bean1.setClient(true);
bean1.setName("Sample Name");
bean1.setMail("[email protected]");
bean1.setCreated(new Date());
bean1.setCreatedBy("User 1");
bean1.setUpdated(new Date());
bean1.setUpdatedBy("User 2");
BusinessPartnerLocation loc = new BusinessPartnerLocation();
loc.setAddress1("Adress One of Bean One");
loc.setZipCode("78734");
bean1.getBusinessPartnerLocationSet().add(loc);
final BusinessPartner bean2 = new BusinessPartner();
bean2.setAbc("B");
bean2.setOrganization(null);
bean2.setActive(false);
bean2.setCifCode("OTRO");
bean2.setClient(false);
bean2.setName("Otro nombre");
bean2.setMail(null);
bean2.setCreated(new Date());
bean2.setCreatedBy("Administrator 2");
bean2.setUpdated(new Date());
bean2.setUpdatedBy("Administrator 1");
formInstance.setValue(bean1);
Button but1 = new Button("Change bean", new Button.ClickListener() {
private static final long serialVersionUID = 1L;
@Override
public void buttonClick(ClickEvent event) {
if (formInstance.getValue() == bean1) {
formInstance.setValue(bean2);
} else {
formInstance.setValue(bean1);
}
}
});
main.addComponent(but1);
but1 = new Button("Update Model", new Button.ClickListener() {
private static final long serialVersionUID = 1L;
@Override
public void buttonClick(ClickEvent event) {
formInstance.updateModel();
}
});
main.addComponent(but1);
} catch (Exception ex) {
throw new UndeclaredThrowableException(ex);
}
}
示例9: init
import com.vaadin.ui.Window; //导入方法依赖的package包/类
@Override
public void init() {
try {
Window main = new Window("Test window");
setMainWindow(main);
BFormToolkit<Component> toolkit = BFormService.getInstance().getFormToolkit(Component.class);
BForm<BusinessPartner> form = new SampleForm();
final BFormInstance<BusinessPartner, Component> formInstance = toolkit.buildForm(form);
main.addComponent(formInstance.getImplementation());
final BusinessPartner bean1 = new BusinessPartner();
bean1.setAbc("A");
bean1.setActive(true);
bean1.setCifCode("B55425451");
bean1.setClient(true);
bean1.setName("Sample Name");
bean1.setMail("[email protected]");
final BusinessPartner bean2 = new BusinessPartner();
bean2.setAbc("B");
bean2.setActive(false);
bean2.setCifCode("OTRO");
bean2.setClient(false);
bean2.setName("Otro nombre");
bean2.setMail(null);
formInstance.setValue(bean1);
Button but1 = new Button("Change bean", new Button.ClickListener() {
private static final long serialVersionUID = 1L;
@Override
public void buttonClick(ClickEvent event) {
if (formInstance.getValue() == bean1) {
formInstance.setValue(bean2);
} else {
formInstance.setValue(bean1);
}
}
});
main.addComponent(but1);
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
示例10: init
import com.vaadin.ui.Window; //导入方法依赖的package包/类
@Override
public void init() {
m_log.debug("initializing");
setTheme("opennms");
final MapWidgetComponent mapPanel = new MapWidgetComponent();
mapPanel.setNodeDao(m_nodeDao);
mapPanel.setAssetRecordDao(m_assetDao);
mapPanel.setAlarmDao(m_alarmDao);
mapPanel.setGeocoderService(m_geocoderService);
mapPanel.setTransactionOperation(m_transaction);
mapPanel.setSizeFull();
m_rootLayout = new AbsoluteLayout();
m_rootLayout.setSizeFull();
m_window = new Window("OpenNMS Node Maps");
m_window.setContent(m_rootLayout);
m_window.addParameterHandler(new ParameterHandler() {
@Override
public void handleParameters(final Map<String, String[]> parameters) {
if (parameters.containsKey("search")) {
mapPanel.setSearchString(parameters.get("search")[0].toString());
/*
int nodeId = parseInt(parameters.get("nodeId")[0], 0);
if (nodeId > 0) {
mapPanel.setSearchString("nodeId=" + nodeId);
}
*/
}
}
});
setMainWindow(m_window);
String mapLayerPosition = "top:0px; left:0px; right:0px; bottom:0px;";
if (m_headerHtml != null) {
final Panel header = new Panel("header");
header.setCaption(null);
header.setSizeUndefined();
header.addStyleName("onmsheader");
InputStream is = null;
try {
is = new ByteArrayInputStream(m_headerHtml.getBytes());
final CustomLayout layout = new CustomLayout(is);
header.setContent(layout);
m_rootLayout.addComponent(header, "top: 0px; left: 0px; right:0px;");
mapLayerPosition = "top:100px; left:0px; right:0px; bottom:0px;";
} catch (final IOException e) {
if (is != null) {
try {
is.close();
} catch (final IOException closeE) {
VConsole.log("failed to close HTML input stream");
VConsole.log(closeE);
}
}
VConsole.log("failed to get header layout data");
VConsole.log(e);
}
}
m_rootLayout.addComponent(mapPanel, mapLayerPosition);
final Refresher refresher = new Refresher();
refresher.setRefreshInterval(REFRESH_INTERVAL);
m_window.addComponent(refresher);
}
示例11: setupAddFilterWindow
import com.vaadin.ui.Window; //导入方法依赖的package包/类
private void setupAddFilterWindow(Window window) {
// General variables
// Layouts
GridLayout mainLayout = new GridLayout(1, 3);
HorizontalLayout axisLayout = new HorizontalLayout();
HorizontalLayout criteriaLayout = new HorizontalLayout();
HorizontalLayout buttonLayout = new HorizontalLayout();
hznCriteria = criteriaLayout;
// Buttons
ExpressZipButton btnAdd = new ExpressZipButton("Add", Style.ACTION);
btnAdd.setClickShortcut(KeyCode.ENTER);
btnAdd.addStyleName("primary");
ExpressZipButton btnCancel = new ExpressZipButton("Cancel", Style.ACTION);
// Fields
ComboBox cmbAxis = new ComboBox();
cmbAxis.setTextInputAllowed(false);
cmbAxis.setNullSelectionAllowed(false);
// Labels
Label lblAxis = new Label("Axis");
btnAdd.addListener(filterButtonListener);
btnCancel.addListener(filterButtonListener);
for (Filter.AxisFilters f : Filter.axisArray) {
cmbAxis.addItem(filter.getNameOfFilter(f));
}
cmbAxis.setImmediate(true);
cmbAxis.addListener(axisSelectedListener);
cmbAxis.setValue(filter.getNameOfFilter(Filter.axisArray[0]));
mainLayout.addComponent(axisLayout, 0, 0);
mainLayout.addComponent(criteriaLayout, 0, 1);
mainLayout.addComponent(buttonLayout, 0, 2);
mainLayout.setSpacing(true);
axisLayout.setSpacing(true);
axisLayout.addComponent(lblAxis);
axisLayout.addComponent(cmbAxis);
axisLayout.setExpandRatio(lblAxis, .2f);
axisLayout.setExpandRatio(cmbAxis, .8f);
axisLayout.setComponentAlignment(lblAxis, Alignment.MIDDLE_LEFT);
axisLayout.setComponentAlignment(cmbAxis, Alignment.MIDDLE_LEFT);
axisLayout.setSizeFull();
criteriaLayout.setSizeFull();
buttonLayout.setSpacing(true);
buttonLayout.addComponent(btnAdd);
buttonLayout.addComponent(btnCancel);
buttonLayout.setComponentAlignment(btnAdd, Alignment.BOTTOM_RIGHT);
buttonLayout.setComponentAlignment(btnCancel, Alignment.BOTTOM_RIGHT);
buttonLayout.setExpandRatio(btnAdd, 1f);
buttonLayout.setExpandRatio(btnCancel, 0f);
buttonLayout.setSizeFull();
mainLayout.setRowExpandRatio(0, 1f);
mainLayout.setRowExpandRatio(1, 1f);
mainLayout.setRowExpandRatio(2, 1f);
mainLayout.setSizeFull();
window.addComponent(mainLayout);
window.getContent().setSizeFull();
}
示例12: showHistoryList
import com.vaadin.ui.Window; //导入方法依赖的package包/类
protected void showHistoryList(List<Command> historyList) {
Window window = new Window();
window.setModal(true);
for(Command command : historyList) {
window.addComponent(new Label(command.toString()));
}
getMainWindow().addWindow(window);
}