List of usage examples for com.vaadin.ui Button addListener
@Override
public Registration addListener(Component.Listener listener)
From source file:org.escidoc.browser.ui.view.WikiPageView.java
License:Open Source License
private Button downloadShowVersion(final Version version) { Button edit = new Button(); edit.setStyleName(BaseTheme.BUTTON_LINK); edit.setDescription(ViewConstants.PROPERTY_DOWNLOAD); edit.setIcon(new ThemeResource("images/wpzoom/eye.png")); edit.addListener(new Button.ClickListener() { @Override/*ww w . j a va 2 s .c o m*/ public void buttonClick(ClickEvent event) { try { controller.getMetadata(ViewConstants.WIKIPAGEMD); router.getMainWindow().open(new ExternalResource(buildUri(version.getXLinkHref()), "_blank")); } catch (EscidocClientException e) { controller.getRouter().getMainWindow().showNotification( "No content to download! Could it be that this Wiki is empty!?", Notification.TYPE_HUMANIZED_MESSAGE); } } }); return edit; }
From source file:org.fossa.vaadin.auth.ui.FossaLoginScreen.java
License:Open Source License
public FossaLoginScreen(FossaApplication app, FossaAuthorizer authorizer, String error) { super(app);/* w ww .j a va2 s . c om*/ setStyleName("login"); this.authorizer = authorizer; setCaption("Bitte melden Sie sich an!"); setWidth("500px"); center(); CustomLayout layout = new CustomLayout("./login/loginScreen"); setContent(layout); Label errorlabel = new Label(error); formLoginScreen = new Form(); formLoginScreen.addField(username, username); username.focus(); formLoginScreen.addField(password, password); formLoginScreen.getField(username).setRequired(true); formLoginScreen.getField(password).setRequired(true); layout.addComponent(formLoginScreen, "form"); layout.addComponent(errorlabel, "errorlabel"); Button login = new Button("Anmelden"); layout.addComponent(login, "login"); login.addListener((Button.ClickListener) this); login.setClickShortcut(KeyCode.ENTER); }
From source file:org.iespuigcastellar.attendancemanager.screenlayouts.NoModalWindowTeacherMainLayout.java
License:Open Source License
private void initLayout() { datePopupDateField = new PopupDateField(""); datePopupDateField.setDescription(app.locale.getString("TEACHERMAINLAYOUT_DATEFIELD_DESCRIPTION")); datePopupDateField.setValue(new java.util.Date()); datePopupDateField.setResolution(PopupDateField.RESOLUTION_DAY); datePopupDateField.setImmediate(true); datePopupDateField.addListener(ValueChangeEvent.class, this, "changedDate"); classblockComboBox = new ComboBox(); classblockComboBox.setInputPrompt(app.locale.getString("TEACHERMAINLAYOUT_CLASSBLOCK_INPUTPROMPT")); classblockComboBox.setDescription(app.locale.getString("TEACHERMAINLAYOUT_CLASSBLOCK_DESCRIPTION")); classblockComboBox.setFilteringMode(Filtering.FILTERINGMODE_CONTAINS); classblockComboBox.setImmediate(true); classblockComboBox.addContainerProperty("name", String.class, ""); classblockComboBox.setItemCaptionPropertyId("name"); classblockComboBox.addListener(ValueChangeEvent.class, this, "changedClassblock"); Button logoutButton = new Button(app.locale.getString("TEACHERMAINLAYOUT_LOGOUTBUTTON_CAPTION")); logoutButton.addListener(new Button.ClickListener() { @Override/*from w w w .j a va 2 s .c o m*/ public void buttonClick(ClickEvent event) { Logger.log("User " + app.user.getLogin() + " closes session"); app.storage.close(); getApplication().close(); } }); GridLayout optionsGridLayout = new GridLayout(2, 1); HorizontalLayout haLayout = new HorizontalLayout(); haLayout.setSpacing(true); //haLayout.setWidth("100%"); // Fix layout errors, but bad display haLayout.addComponent(new PasswordChangeLayout()); haLayout.addComponent(datePopupDateField); haLayout.addComponent(classblockComboBox); optionsGridLayout.addComponent(haLayout); optionsGridLayout.addComponent(logoutButton); optionsGridLayout.setComponentAlignment(logoutButton, Alignment.TOP_RIGHT); optionsGridLayout.setWidth("100%"); addComponent(optionsGridLayout); table.setSizeFull(); table.setImmediate(true); table.setColumnReorderingAllowed(true); table.setColumnCollapsingAllowed(true); table.addContainerProperty("Name", String.class, null); table.addContainerProperty("Surname 1", String.class, null); table.addContainerProperty("Surname 2", String.class, null); table.addContainerProperty("Miss", CheckBox.class, null); table.addContainerProperty("Excused", CheckBox.class, null); table.addContainerProperty("Delay", CheckBox.class, null); table.addContainerProperty("Expulsion", CheckBox.class, null); table.setColumnExpandRatio("Name", 1); table.setColumnExpandRatio("Surname 1", 1); table.setColumnExpandRatio("Surname 2", 1); table.setColumnHeaders(new String[] { app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_NAME"), app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_SURNAME1"), app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_SURNAME2"), app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_MISS"), app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_EXCUSED"), app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_DELAY"), app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_EXPULSION") }); addComponent(table); setExpandRatio(table, 1); setSizeFull(); }
From source file:org.iespuigcastellar.attendancemanager.screenlayouts.TeacherMainLayout.java
License:Open Source License
private void initLayout() { passwordChangeWindow = new PasswordChangeWindow(); passwordChangeWindow.setCaption(app.locale.getString("TEACHERMAINLAYOUT_CHANGEMYPASSWORD_BUTTON")); datePopupDateField = new PopupDateField(""); datePopupDateField.setDescription(app.locale.getString("TEACHERMAINLAYOUT_DATEFIELD_DESCRIPTION")); datePopupDateField.setValue(new java.util.Date()); datePopupDateField.setResolution(PopupDateField.RESOLUTION_DAY); datePopupDateField.setImmediate(true); datePopupDateField.addListener(ValueChangeEvent.class, this, "changedDate"); classblockComboBox = new ComboBox(); classblockComboBox.setInputPrompt(app.locale.getString("TEACHERMAINLAYOUT_CLASSBLOCK_INPUTPROMPT")); classblockComboBox.setDescription(app.locale.getString("TEACHERMAINLAYOUT_CLASSBLOCK_DESCRIPTION")); classblockComboBox.setFilteringMode(Filtering.FILTERINGMODE_CONTAINS); classblockComboBox.setImmediate(true); classblockComboBox.addContainerProperty("name", String.class, ""); classblockComboBox.setItemCaptionPropertyId("name"); classblockComboBox.addListener(ValueChangeEvent.class, this, "changedClassblock"); Button logoutButton = new Button(app.locale.getString("TEACHERMAINLAYOUT_LOGOUTBUTTON_CAPTION")); logoutButton.addListener(new Button.ClickListener() { @Override//from ww w . j a va 2 s . co m public void buttonClick(ClickEvent event) { Logger.log("User " + app.user.getLogin() + " closes session"); app.storage.close(); getApplication().close(); } }); Button changePasswordButton = new Button(app.locale.getString("TEACHERMAINLAYOUT_CHANGEMYPASSWORD_BUTTON")); changePasswordButton.setIcon(new ThemeResource("../runo/icons/16/user.png")); changePasswordButton.setStyleName(Button.STYLE_LINK); changePasswordButton.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { // Open window if not open already if (passwordChangeWindow.getParent() != null) { // Window already open } else { // open window getWindow().addWindow(passwordChangeWindow); } } }); GridLayout optionsGridLayout = new GridLayout(2, 1); HorizontalLayout haLayout = new HorizontalLayout(); haLayout.setSpacing(true); haLayout.addComponent(changePasswordButton); haLayout.setComponentAlignment(changePasswordButton, Alignment.MIDDLE_LEFT); haLayout.addComponent(datePopupDateField); haLayout.addComponent(classblockComboBox); optionsGridLayout.addComponent(haLayout); optionsGridLayout.addComponent(logoutButton); optionsGridLayout.setComponentAlignment(logoutButton, Alignment.TOP_RIGHT); optionsGridLayout.setWidth("100%"); addComponent(optionsGridLayout); table.setSizeFull(); table.setImmediate(true); table.setColumnReorderingAllowed(true); table.setColumnCollapsingAllowed(true); table.addContainerProperty("Name", String.class, null); table.addContainerProperty("Surname 1", String.class, null); table.addContainerProperty("Surname 2", String.class, null); table.addContainerProperty("Miss", CheckBox.class, null); table.addContainerProperty("Excused", CheckBox.class, null); table.addContainerProperty("Delay", CheckBox.class, null); table.addContainerProperty("Expulsion", CheckBox.class, null); table.setColumnExpandRatio("Name", 1); table.setColumnExpandRatio("Surname 1", 1); table.setColumnExpandRatio("Surname 2", 1); table.setColumnHeaders(new String[] { app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_NAME"), app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_SURNAME1"), app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_SURNAME2"), app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_MISS"), app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_EXCUSED"), app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_DELAY"), app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_EXPULSION") }); addComponent(table); setExpandRatio(table, 1); setSizeFull(); }
From source file:org.metawidget.example.vaadin.addressbook.CommunicationDialog.java
License:BSD License
public CommunicationDialog(final ContactDialog contactDialog, final Communication communication) { setCaption("Communication"); setWidth("350px"); setHeight("175px"); setResizable(false);//from w w w .jav a 2 s . com // Metawidget final VaadinMetawidget metawidget = new VaadinMetawidget(); metawidget.setWidth("100%"); metawidget.setConfig("org/metawidget/example/vaadin/addressbook/metawidget.xml"); metawidget.setToInspect(communication); // Buttons final Button saveButton = new Button("Save"); saveButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { try { metawidget.getWidgetProcessor(SimpleBindingProcessor.class).save(metawidget); contactDialog.addCommunication(communication); getParent().removeWindow(CommunicationDialog.this); } catch (Exception e) { showNotification("Save Error", e.getLocalizedMessage(), Notification.TYPE_ERROR_MESSAGE); return; } } }); final Button cancelButton = new Button("Cancel"); cancelButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { getParent().removeWindow(CommunicationDialog.this); } }); Facet facetButtons = new Facet(); facetButtons.setData("buttons"); facetButtons.setWidth("100%"); HorizontalLayout layout = new HorizontalLayout(); layout.setMargin(false); layout.setSpacing(true); layout.addComponent(saveButton); layout.addComponent(cancelButton); facetButtons.addComponent(layout); ((com.vaadin.ui.VerticalLayout) facetButtons.getContent()).setComponentAlignment(layout, Alignment.MIDDLE_CENTER); metawidget.addComponent(facetButtons); addComponent(metawidget); ((VerticalLayout) getContent()).setMargin(true, true, false, true); }
From source file:org.metawidget.example.vaadin.addressbook.ContactDialog.java
License:BSD License
public ContactDialog(AddressBook addressBook, final Contact contact) { mAddressBook = addressBook;/*from w w w .ja va 2s.c o m*/ setHeight("600px"); setWidth("800px"); ((Layout) getContent()).setMargin(false); CustomLayout body = new CustomLayout("contact"); addComponent(body); // Bundle ResourceBundle bundle = ResourceBundle .getBundle("org.metawidget.example.shared.addressbook.resource.Resources"); // Title StringBuilder builder = new StringBuilder(contact.getFullname()); if (builder.length() > 0) { builder.append(" - "); } // Personal/business icon if (contact instanceof PersonalContact) { builder.append(bundle.getString("personalContact")); body.addComponent(new Embedded(null, new ThemeResource("../addressbook/img/personal.gif")), "icon"); } else { builder.append(bundle.getString("businessContact")); body.addComponent(new Embedded(null, new ThemeResource("../addressbook/img/business.gif")), "icon"); } setCaption(builder.toString()); // Metawidget mContactMetawidget = new VaadinMetawidget(); mContactMetawidget.setWidth("100%"); mContactMetawidget.setConfig("org/metawidget/example/vaadin/addressbook/metawidget.xml"); mContactMetawidget.setReadOnly(contact.getId() != 0); mContactMetawidget.setToInspect(contact); // Communications override final TableDataSource<Communication> tableDataSource = new TableDataSource<Communication>( Communication.class, contact.getCommunications(), "type", "value"); mCommunicationsTable = new Table(); mCommunicationsTable.setWidth("100%"); mCommunicationsTable.setHeight("170px"); final Button deleteButton = new Button("Delete"); deleteButton.setEnabled(false); deleteButton.addListener(new ClickListener() { @SuppressWarnings("unchecked") public void buttonClick(ClickEvent event) { Communication communication = tableDataSource.getDataRow(mCommunicationsTable.getValue()); contact.removeCommunication(communication); ((TableDataSource<Communication>) mCommunicationsTable.getContainerDataSource()) .importCollection(contact.getCommunications()); } }); Button addNewButton = new Button("Add"); addNewButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { mCommunicationsTable.setValue(null); deleteButton.setEnabled(false); CommunicationDialog communicationDialog = new CommunicationDialog(ContactDialog.this, new Communication()); communicationDialog.setModal(true); getParent().addWindow(communicationDialog); } }); mCommunicationsTable.setSelectable(false); mCommunicationsTable.addListener(new ItemClickListener() { public void itemClick(ItemClickEvent event) { if (!mCommunicationsTable.isSelectable()) { return; } if (!event.isDoubleClick()) { deleteButton.setEnabled(true); return; } deleteButton.setEnabled(false); Communication communication = tableDataSource.getDataRow(event.getItemId()); CommunicationDialog communicationDialog = new CommunicationDialog(ContactDialog.this, communication); communicationDialog.setModal(true); getParent().addWindow(communicationDialog); } }); mCommunicationsButtons = new com.vaadin.ui.HorizontalLayout(); mCommunicationsButtons.setVisible(!mContactMetawidget.isReadOnly()); mCommunicationsButtons.setMargin(false); mCommunicationsButtons.setSpacing(true); mCommunicationsButtons.addComponent(addNewButton); mCommunicationsButtons.addComponent(deleteButton); VerticalLayout wrapper = new VerticalLayout(); wrapper.setData("communications"); wrapper.addComponent(mCommunicationsTable); wrapper.addComponent(mCommunicationsButtons); wrapper.setComponentAlignment(mCommunicationsButtons, Alignment.MIDDLE_CENTER); mContactMetawidget.addComponent(wrapper); mCommunicationsTable.setContainerDataSource(tableDataSource); body.addComponent(mContactMetawidget, "pagebody"); // Embedded buttons Facet facetButtons = new Facet(); facetButtons.setData("buttons"); facetButtons.setWidth("100%"); mContactMetawidget.addComponent(facetButtons); mButtonsMetawidget = new VaadinMetawidget(); mButtonsMetawidget.setWidth(null); mButtonsMetawidget.setConfig("org/metawidget/example/vaadin/addressbook/metawidget.xml"); mButtonsMetawidget.setLayout(new HorizontalLayout()); mButtonsMetawidget.setToInspect(this); facetButtons.addComponent(mButtonsMetawidget); ((com.vaadin.ui.VerticalLayout) facetButtons.getContent()).setComponentAlignment(mButtonsMetawidget, Alignment.MIDDLE_CENTER); }
From source file:org.metawidget.vaadin.ui.widgetprocessor.binding.reflection.ReflectionBindingProcessor.java
License:LGPL
public Component processWidget(final Component component, String elementName, Map<String, String> attributes, VaadinMetawidget metawidget) {/*from www. j a v a 2s . c o m*/ // Only bind to non-read-only Actions if (!ACTION.equals(elementName)) { return component; } if (component instanceof Stub) { return component; } if (!(component instanceof Button)) { throw WidgetProcessorException .newException("ReflectionBindingProcessor only supports binding actions to Buttons"); } if (WidgetBuilderUtils.isReadOnly(attributes)) { return component; } if (metawidget == null) { return component; } Object toInspect = metawidget.getToInspect(); if (toInspect == null) { return component; } Button button = (Button) component; // Traverse to the last Object... String[] names = PathUtils.parsePath(metawidget.getPath()).getNamesAsArray(); for (String name : names) { toInspect = ClassUtils.getProperty(toInspect, name); if (toInspect == null) { return component; } } // ...and wire it up final Object fireActionOn = toInspect; final Class<?> fireActionOnClass = fireActionOn.getClass(); final String actionName = attributes.get(NAME); button.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { try { Method method = fireActionOnClass.getMethod(actionName, (Class[]) null); method.invoke(fireActionOn, (Object[]) null); } catch (Exception e) { throw WidgetProcessorException.newException(e); } } }); return component; }
From source file:org.milleni.dunning.ui.customer.CustomerListDetailPanel.java
License:Apache License
protected void addDunningProcessMaster(List<DunningProcessMaster> dngPrcsMasterList) { if (dunningProcessHeader != null) { mainPanel.removeComponent(dunningProcessHeader); }/*from w w w .j a v a 2 s .com*/ dunningProcessHeader = new Label(i18nManager.getMessage(Constants.CUSTOMER_DUNNING_PROCESSES)); dunningProcessHeader.addStyleName(ExplorerLayout.STYLE_H3); dunningProcessHeader.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK); dunningProcessHeader.addStyleName(ExplorerLayout.STYLE_NO_LINE); addDetailComponent(dunningProcessHeader); if (dunningProcessLayout != null) { mainPanel.removeComponent(dunningProcessLayout); } dunningProcessLayout = new HorizontalLayout(); dunningProcessLayout.setSpacing(true); dunningProcessLayout.setWidth(100, UNITS_PERCENTAGE); addDetailComponent(dunningProcessLayout); // dunningProcessLayout.addComponent(tasksHeader); duningProcessTable = new Table(); duningProcessTable.addStyleName(ExplorerLayout.STYLE_PROCESS_INSTANCE_TASK_LIST); duningProcessTable.setWidth(100, UNITS_PERCENTAGE); duningProcessTable.setHeight(250, UNITS_PIXELS); duningProcessTable.setEditable(false); duningProcessTable.setImmediate(true); duningProcessTable.setSelectable(true); duningProcessTable.setNullSelectionAllowed(false); duningProcessTable.setSortDisabled(true); // duningProcessTable.setSizeFull(); if (dngPrcsMasterList.size() > 0) { duningProcessTable.addContainerProperty("bpmProcessId", Button.class, null, i18nManager.getMessage(Constants.DUNNING_BPM_RPOCESS_ID), null, Table.ALIGN_LEFT); duningProcessTable.addContainerProperty("startDate", Date.class, null, i18nManager.getMessage(Constants.DUNNING_START_DATE), null, Table.ALIGN_LEFT); duningProcessTable.addContainerProperty("status", String.class, null, i18nManager.getMessage(Constants.CUSTOMER_STATUS), null, Table.ALIGN_LEFT); duningProcessTable.addContainerProperty("nextStep", String.class, null, i18nManager.getMessage(Constants.DUNNING_NEXT_STEP), null, Table.ALIGN_LEFT); duningProcessTable.addContainerProperty("nextStepDate", Date.class, null, i18nManager.getMessage(Constants.DUNNING_NEXT_STEP_DATE), null, Table.ALIGN_LEFT); duningProcessTable.addContainerProperty("currentDebit", String.class, null, i18nManager.getMessage(Constants.DUNNING_CURRENT_DEBIT), null, Table.ALIGN_LEFT); dunningProcessLayout.addComponent(duningProcessTable); for (DunningProcessMaster dnngPMaster : dngPrcsMasterList) { Item item = duningProcessTable.addItem(dnngPMaster); Button detailsField = new Button(dnngPMaster.getBpmProcessId()); detailsField.setData(dnngPMaster.getBpmProcessId()); detailsField.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { String processId = (String) event.getButton().getData(); ExplorerApp.get().getViewManager().showPopupWindow(new ProcessDetailPopupWindow(processId)); } }); item.getItemProperty("bpmProcessId").setValue(detailsField); // item.getItemProperty("bpmProcessId").setValue(dnngPMaster.getBpmProcessId()); item.getItemProperty("startDate").setValue(dnngPMaster.getCreateDate()); String masterStatusDesc = ""; if (StringUtils.hasLength(dnngPMaster.getStatusDesc())) masterStatusDesc = "(" + dnngPMaster.getStatusDesc() + ")"; item.getItemProperty("status").setValue(dnngPMaster.getStatus().getStatusText() + masterStatusDesc); item.getItemProperty("currentDebit").setValue( String.valueOf(dnngPMaster.getCurrentDebit() != null ? dnngPMaster.getCurrentDebit() : "")); item.getItemProperty("nextStepDate").setValue(dnngPMaster.getNextStepExecutionDate()); if (dnngPMaster.getNextStepId() != null) item.getItemProperty("nextStep").setValue(dnngPMaster.getNextStepId().getStepText()); duningProcessTable.addContainerProperty("nextStep", String.class, null, i18nManager.getMessage(Constants.DUNNING_NEXT_STEP), null, Table.ALIGN_LEFT); duningProcessTable.addContainerProperty("nextStepDate", Date.class, null, i18nManager.getMessage(Constants.DUNNING_NEXT_STEP_DATE), null, Table.ALIGN_LEFT); } duningProcessTable.setPageLength(duningProcessTable.size()); duningProcessTable.addListener(new Property.ValueChangeListener() { private static final long serialVersionUID = 1L; public void valueChange(ValueChangeEvent event) { DunningProcessMaster item = (DunningProcessMaster) event.getProperty().getValue(); if (item != null) { if (dunningProcessLayout != null && processStepTable != null) dunningProcessLayout.removeComponent(processStepTable); List<DunningProcessDetail> dunningProcessDetails = dunningProcessDetailRepository .findDunningProcessDetails(item.getProcessId()); processStepTable = new DunningStepTableComponent(dunningProcessDetails); dunningProcessLayout.addComponent(processStepTable); } } }); processStepTable = new DunningStepTableComponent( dngPrcsMasterList.get(0).getDunningProcessDetailCollection()); dunningProcessLayout.addComponent(processStepTable); } else { // No tasks noTasksLabel = new Label(i18nManager.getMessage(Messages.PROCESS_INSTANCE_NO_TASKS)); dunningProcessLayout.addComponent(noTasksLabel); } }
From source file:org.milleni.dunning.ui.customer.CustomerTableListItem.java
License:Apache License
public CustomerTableListItem(Customer customer) { addItemProperty("id", new ObjectProperty<Long>(customer.getCustomerId(), Long.class)); addItemProperty("name", new ObjectProperty<String>(customer.getCustomerName(), String.class)); addItemProperty("customerGroup", new ObjectProperty<String>( customer.getCustomerGroup() != null ? customer.getCustomerGroup().getGroupName() : "", String.class)); addItemProperty("customerType", new ObjectProperty<String>( customer.getCustomerType() != null ? customer.getCustomerType().getTypeName() : "", String.class)); addItemProperty("status", new ObjectProperty<String>(customer.getStatus(), String.class)); Button detailsField = new Button("Fatura"); detailsField.setData(customer.getCustomerId()); detailsField.addListener(new Button.ClickListener() { @Override/*from w w w . j av a2 s. co m*/ public void buttonClick(ClickEvent event) { Long customerId = (Long) event.getButton().getData(); ExplorerApp.get().getViewManager().showPopupWindow(new InvoiceDetailPopupWindow(customerId)); } }); addItemProperty("invoicePopup", new ObjectProperty<Button>(detailsField, Button.class)); }
From source file:org.milleni.dunning.ui.customer.form.CustomerDetailPopupWindow.java
License:Apache License
protected void initUi() { VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true);/*from w w w.j av a 2 s . c o m*/ addComponent(layout); // Description Button updateInvoiceInfo = new Button(i18nManager.getMessage(Messages.INVOICE_UPDATE)); updateInvoiceInfo.addStyleName(Reindeer.BUTTON_SMALL); updateInvoiceInfo.addListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { try { boolean customerHasUnpaidBill = invoicePaymentRuleService .customerHasUnpaidBillInLimit(customerId, true); if (!customerHasUnpaidBill) { processSignalService.signalCustomerProcessIfPaymentReceived(customerId); notificationManager.showErrorNotification(Messages.INVOICE_PAYMENT_UPDATE_INFO, i18nManager.getMessage(Messages.INVOICE_PAYMENT_UPDATE_INFO_DESC)); viewManager.showInboxPage(); } else { initialize(customerId); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); layout.addComponent(updateInvoiceInfo); Customer bean = DaoHelper.getInstance().getCustomerService().findOne(customerId); if (bean == null) return; final Table custTable = new Table(); custTable.setWidth(100, com.vaadin.terminal.Sizeable.UNITS_PERCENTAGE); custTable.setHeight(60, com.vaadin.terminal.Sizeable.UNITS_PIXELS); custTable.setEditable(false); custTable.setImmediate(true); custTable.setSelectable(true); custTable.setSortDisabled(false); custTable.addContainerProperty("id", String.class, null, "Mteri No", null, Table.ALIGN_LEFT); custTable.addContainerProperty("musteriAdi", String.class, null, "Mteri Ad", null, Table.ALIGN_LEFT); custTable.addContainerProperty("musteriBorc", String.class, null, "Toplam Bor", null, Table.ALIGN_LEFT); custTable.addContainerProperty("hizmetTuru", String.class, null, "Mteri Tipi", null, Table.ALIGN_LEFT); custTable.addContainerProperty("durum", String.class, null, "Durum", null, Table.ALIGN_LEFT); custTable.addItem(new Object[] { bean.getCustomerId(), bean.getCustomerName(), bean.getCurrentDebit(), bean.getCustomerType().getTypeName(), bean.getStatus() }, bean.getCustomerId()); layout.addComponent(custTable); totalDebitSot = new Label(i18nManager.getMessage(Constants.DUNNING_INVOICE_UNPAID_TOTAL_SOT) + ":" + invoicePaymentRuleService.getCustomerUnpaidTotalInvoiceAmountBeforeSot(customerId)); totalDebitSot.addStyleName(ExplorerLayout.STYLE_H3); totalDebitSot.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK); totalDebitSot.addStyleName(ExplorerLayout.STYLE_NO_LINE); layout.addComponent(totalDebitSot); layout.addComponent(invoiceTable); dunningProcessHeader = new Label(i18nManager.getMessage(Constants.CUSTOMER_DUNNING_PROCESSES)); dunningProcessHeader.addStyleName(ExplorerLayout.STYLE_H3); dunningProcessHeader.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK); dunningProcessHeader.addStyleName(ExplorerLayout.STYLE_NO_LINE); layout.addComponent(dunningProcessHeader); layout.addComponent(dunningProcessLayout); }