List of usage examples for com.vaadin.ui Window close
public void close()
From source file:com.peergreen.webconsole.scope.home.extensions.PeergreenNewsFeedFrame.java
License:Open Source License
/** * News popup//from w ww . j a v a 2s .com * * @param feedMessage * @return */ private Window getNewsDescription(FeedMessage feedMessage) { FormLayout fields = new FormLayout(); fields.setWidth("35em"); fields.setSpacing(true); fields.setMargin(true); Label label = new Label("<a href=\"" + feedMessage.getLink() + "\">" + feedMessage.getLink().substring(0, 50) + "..." + "</a>"); label.setContentMode(ContentMode.HTML); label.setSizeUndefined(); label.setCaption("URL"); fields.addComponent(label); String description = feedMessage.getDescription(); if (description.length() > 1000) { description = description.substring(0, 999) + "..."; } Label desc = new Label(description); desc.setContentMode(ContentMode.HTML); desc.setCaption("Description"); fields.addComponent(desc); Button ok = new Button("Close"); ok.addStyleName("wide"); ok.addStyleName("default"); final Window w = new DefaultWindow(feedMessage.getTitle(), fields, ok); w.center(); ok.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { w.close(); } }); return w; }
From source file:com.pms.component.ganttchart.DemoUI.java
License:Apache License
private void openStepEditor(AbstractStep step) { final Window win = new Window("Step Editor"); win.setResizable(false);/*w w w.j a v a2 s .co m*/ win.center(); final Collection<Component> hidden = new ArrayList<Component>(); BeanItem<AbstractStep> item = new BeanItem<AbstractStep>(step); final FieldGroup group = new FieldGroup(item); group.setBuffered(true); TextField captionField = new TextField("Caption"); captionField.setNullRepresentation(""); group.bind(captionField, "caption"); TextField descriptionField = new TextField("Description"); descriptionField.setNullRepresentation(""); group.bind(descriptionField, "description"); descriptionField.setVisible(false); hidden.add(descriptionField); NativeSelect captionMode = new NativeSelect("Caption Mode"); captionMode.addItem(Step.CaptionMode.TEXT); captionMode.addItem(Step.CaptionMode.HTML); group.bind(captionMode, "captionMode"); captionMode.setVisible(false); hidden.add(captionMode); final NativeSelect parentStepSelect = new NativeSelect("Parent Step"); parentStepSelect.setEnabled(false); if (!gantt.getSteps().contains(step)) { // new step parentStepSelect.setEnabled(true); for (Step parentStepCanditate : gantt.getSteps()) { parentStepSelect.addItem(parentStepCanditate); parentStepSelect.setItemCaption(parentStepCanditate, parentStepCanditate.getCaption()); if (step instanceof SubStep) { if (parentStepCanditate.getSubSteps().contains(step)) { parentStepSelect.setValue(parentStepCanditate); parentStepSelect.setEnabled(false); break; } } } } parentStepSelect.setVisible(false); hidden.add(parentStepSelect); TextField bgField = new TextField("Background color"); bgField.setNullRepresentation(""); group.bind(bgField, "backgroundColor"); bgField.setVisible(false); hidden.add(bgField); DateField startDate = new DateField("Start date"); startDate.setLocale(gantt.getLocale()); startDate.setTimeZone(gantt.getTimeZone()); startDate.setResolution(Resolution.SECOND); startDate.setConverter(new DateToLongConverter()); group.bind(startDate, "startDate"); DateField endDate = new DateField("End date"); endDate.setLocale(gantt.getLocale()); endDate.setTimeZone(gantt.getTimeZone()); endDate.setResolution(Resolution.SECOND); endDate.setConverter(new DateToLongConverter()); group.bind(endDate, "endDate"); CheckBox showMore = new CheckBox("Show all settings"); showMore.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { for (Component c : hidden) { c.setVisible((Boolean) event.getProperty().getValue()); } win.center(); } }); VerticalLayout content = new VerticalLayout(); content.setMargin(true); content.setSpacing(true); win.setContent(content); content.addComponent(captionField); content.addComponent(captionMode); content.addComponent(descriptionField); content.addComponent(parentStepSelect); content.addComponent(bgField); content.addComponent(startDate); content.addComponent(endDate); content.addComponent(showMore); HorizontalLayout buttons = new HorizontalLayout(); content.addComponent(buttons); Button ok = new Button("Ok", new ClickListener() { @Override public void buttonClick(ClickEvent event) { try { group.commit(); AbstractStep step = ((BeanItem<AbstractStep>) group.getItemDataSource()).getBean(); gantt.markStepDirty(step); if (parentStepSelect.isEnabled() && parentStepSelect.getValue() != null) { SubStep subStep = addSubStep(parentStepSelect, step); step = subStep; } if (step instanceof Step && !gantt.getSteps().contains(step)) { gantt.addStep((Step) step); } if (ganttListener != null && step instanceof Step) { ganttListener.stepModified((Step) step); } win.close(); } catch (CommitException e) { Notification.show("Commit failed", e.getMessage(), Type.ERROR_MESSAGE); e.printStackTrace(); } } private SubStep addSubStep(final NativeSelect parentStepSelect, AbstractStep dataSource) { SubStep subStep = new SubStep(); subStep.setCaption(dataSource.getCaption()); subStep.setCaptionMode(dataSource.getCaptionMode()); subStep.setStartDate(dataSource.getStartDate()); subStep.setEndDate(dataSource.getEndDate()); subStep.setBackgroundColor(dataSource.getBackgroundColor()); subStep.setDescription(dataSource.getDescription()); subStep.setStyleName(dataSource.getStyleName()); ((Step) parentStepSelect.getValue()).addSubStep(subStep); return subStep; } }); Button cancel = new Button("Cancel", new ClickListener() { @Override public void buttonClick(ClickEvent event) { group.discard(); win.close(); } }); Button delete = new Button("Delete", new ClickListener() { @Override public void buttonClick(ClickEvent event) { AbstractStep step = ((BeanItem<AbstractStep>) group.getItemDataSource()).getBean(); if (step instanceof SubStep) { SubStep substep = (SubStep) step; substep.getOwner().removeSubStep(substep); } else { gantt.removeStep((Step) step); if (ganttListener != null) { ganttListener.stepDeleted((Step) step); } } win.close(); } }); buttons.addComponent(ok); buttons.addComponent(cancel); buttons.addComponent(delete); win.setClosable(true); DashboardUI.getCurrent().getUI().addWindow(win); }
From source file:com.pms.component.ganttchart.scheduletask.TaskGanntChart.java
License:Apache License
private void openStepEditor(AbstractStep step) { final Window win = new Window("More Info"); win.setResizable(false);/*from w ww. j ava 2 s . com*/ win.center(); VerticalLayout content = new VerticalLayout(); content.setMargin(true); content.setSpacing(true); win.setContent(content); String taskName = step.getCaption(); UserStoryDAO userStoryDAO = (UserStoryDAO) DashboardUI.context.getBean("UserStory"); UserStory userStory = userStoryDAO.getCurrentWorkingUserStory(project); TaskDAO taskDAO = (TaskDAO) DashboardUI.context.getBean("Task"); Task task1 = taskDAO.getTaskFromUserStroyNameAndTaskName(userStory.getName(), taskName); TextField userStoryNameField = new TextField("Task Name"); userStoryNameField.setValue(task1.getName()); TextField userStoryPriority = new TextField("Priority"); userStoryPriority.setValue(String.valueOf(task1.getPriority())); TextField userStoryState = new TextField("State"); userStoryState.setValue(task1.getState()); TextField projectName = new TextField("Project Name"); projectName.setValue(project.getName()); TextField userStoryName = new TextField("UserStoryName Name"); userStoryName.setValue(userStory.getName()); content.addComponent(userStoryNameField); content.addComponent(userStoryPriority); content.addComponent(userStoryState); content.addComponent(projectName); content.addComponent(userStoryName); Button ok = new Button("Ok", new ClickListener() { @Override public void buttonClick(ClickEvent event) { win.close(); } }); content.addComponent(ok); win.setClosable(true); DashboardUI.getCurrent().getUI().addWindow(win); }
From source file:com.pms.component.ganttchart.scheduletask.UserStoryGanntChart.java
License:Apache License
private void openStepEditor(AbstractStep step) { final Window win = new Window("More Info"); win.setResizable(false);/* ww w . ja v a2s . c o m*/ win.center(); VerticalLayout content = new VerticalLayout(); content.setMargin(true); content.setSpacing(true); win.setContent(content); String userStoryName = step.getCaption(); UserStoryDAO userStoryDAO = (UserStoryDAO) DashboardUI.context.getBean("UserStory"); UserStory userStory = userStoryDAO.getUserStoryFormProjectNameAndUserStoryName(project.getName(), userStoryName); TextField userStoryNameField = new TextField("User Story Name"); userStoryNameField.setValue(userStory.getName()); TextField userStoryPriority = new TextField("Priority"); userStoryPriority.setValue(String.valueOf(userStory.getPriority())); TextField userStoryState = new TextField("State"); userStoryState.setValue(userStory.getState()); TextField projectName = new TextField("Project Name"); projectName.setValue(project.getName()); content.addComponent(userStoryNameField); content.addComponent(userStoryPriority); content.addComponent(userStoryState); content.addComponent(projectName); Button ok = new Button("Ok", new ClickListener() { @Override public void buttonClick(ClickEvent event) { win.close(); } }); content.addComponent(ok); win.setClosable(true); DashboardUI.getCurrent().getUI().addWindow(win); }
From source file:com.save.client.promodeals.PDDataGridProperties.java
Window delete(Object itemId, int promoId) { Window sub = new Window("REMOVE PROMO DEAL"); sub.setWidth("250px"); sub.setModal(true);/*ww w. j av a 2s . c o m*/ sub.center(); VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); v.setMargin(true); Button delBtn = new Button("CONFIRM DELETE?", (Button.ClickEvent event) -> { boolean result = pds.delete(promoId, "removed"); getContainerDataSource().removeItem(itemId); sub.close(); }); delBtn.setWidth("100%"); delBtn.addStyleName(ValoTheme.BUTTON_PRIMARY); delBtn.addStyleName(ValoTheme.BUTTON_SMALL); v.addComponent(delBtn); sub.setContent(v); return sub; }
From source file:com.save.client.RemoveAccountWindow.java
void getConfirmationWindow(final String str) { final Window sub = new Window("Conifrm?"); sub.setWidth("180px"); sub.setHeight("150px"); sub.center();/*from www . jav a 2 s . co m*/ sub.setResizable(false); UI.getCurrent().addWindow(sub); VerticalLayout vlayout = new VerticalLayout(); vlayout.setMargin(true); vlayout.setSpacing(true); vlayout.addComponent(new Label("Client is a Distributor!")); Button removeBtn = new Button("REMOVE"); removeBtn.setWidth("100%"); removeBtn.addClickListener((Button.ClickEvent event) -> { boolean result = clientService.removeAccount(getClientId(), str); if (result) { sub.close(); close(); } }); vlayout.addComponent(removeBtn); sub.setContent(vlayout); sub.addCloseListener((CloseEvent e) -> { close(); }); }
From source file:com.save.employee.maintenance.MRDataGridProperties.java
Window deletConfirmationWindow(int mrId, Object itemId) { Window sub = new Window(); sub.setCaption("CONFIRM DELETE"); sub.setWidth("250px"); sub.setModal(true);/*from w w w .j av a2 s . c o m*/ VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); v.setMargin(true); Button deleteBtn = new Button("DELETE?"); deleteBtn.setWidth("100%"); deleteBtn.addStyleName(ValoTheme.BUTTON_PRIMARY); deleteBtn.addClickListener((Button.ClickEvent event) -> { boolean result = mrs.removeMaintenanceReimbursement(mrId); if (result) { getContainerDataSource().removeItem(itemId); sub.close(); } }); v.addComponent(deleteBtn); sub.setContent(v); sub.getContent().setHeightUndefined(); return sub; }
From source file:com.save.employee.request.RequestFormWindow.java
Window deleteRequestForm() { Window sub = new Window("DELETE REQUEST"); sub.setWidth("280px"); sub.setModal(true);/*w w w . ja v a 2 s .c o m*/ sub.center(); VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); v.setMargin(true); Button delete = new Button(); delete.setCaption("CONFIRM DELETE REQUEST?"); delete.setWidth("100%"); delete.addStyleName(ValoTheme.BUTTON_PRIMARY); delete.addStyleName(ValoTheme.BUTTON_SMALL); delete.addClickListener((Button.ClickEvent event) -> { boolean result = rls.deleteRequestById(getRequestId()); if (result) { sub.close(); close(); } }); v.addComponent(delete); sub.setContent(v); sub.getContent().setHeightUndefined(); return sub; }
From source file:com.save.employee.request.RLDataGridProperties.java
Window deletConfirmationWindow(int rlId, Object itemId) { Window sub = new Window(); sub.setCaption("CONFIRM DELETE"); sub.setWidth("250px"); sub.setModal(true);/* www .j av a2 s. c om*/ VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); v.setMargin(true); Button deleteBtn = new Button("DELETE?"); deleteBtn.setWidth("100%"); deleteBtn.addStyleName(ValoTheme.BUTTON_PRIMARY); deleteBtn.addClickListener((Button.ClickEvent event) -> { boolean result = rls.deleteRequestById(rlId); if (result) { getContainerDataSource().removeItem(itemId); sub.close(); } }); v.addComponent(deleteBtn); sub.setContent(v); sub.getContent().setHeightUndefined(); return sub; }
From source file:com.save.reports.maintenance.MaintenanceReportUI.java
private Window filterReport() { Window sub = new Window("FILTER REPORT"); sub.setWidth("400px"); sub.setModal(true);// w ww . j a v a 2 s . c om sub.center(); FormLayout f = new FormLayout(); f.setWidth("100%"); f.setMargin(true); f.setSpacing(true); CheckBox areaCheckBox = new CheckBox("Filter by Area"); f.addComponent(areaCheckBox); CheckBox employeeCheckBox = new CheckBox("Filter by Employee"); f.addComponent(employeeCheckBox); CheckBox amountCheckBox = new CheckBox("Filter by Amount"); f.addComponent(amountCheckBox); CheckBox dateCheckBox = new CheckBox("Filter by Date"); f.addComponent(dateCheckBox); ComboBox areaComboBox = CommonComboBox.areas(); ComboBox employeeComboBox = CommonComboBox.getAllClients(); areaComboBox.setEnabled(false); f.addComponent(areaComboBox); areaCheckBox.addValueChangeListener((Property.ValueChangeEvent event) -> { areaComboBox.setEnabled((boolean) event.getProperty().getValue()); employeeComboBox.setEnabled(!(boolean) event.getProperty().getValue()); employeeCheckBox.setValue(!(boolean) event.getProperty().getValue()); isAreaSelect = (boolean) event.getProperty().getValue(); isEmployeeSelect = !(boolean) event.getProperty().getValue(); }); employeeComboBox.setEnabled(false); f.addComponent(employeeComboBox); employeeCheckBox.addValueChangeListener((Property.ValueChangeEvent e) -> { employeeComboBox.setEnabled((boolean) e.getProperty().getValue()); areaComboBox.setEnabled(!(boolean) e.getProperty().getValue()); areaCheckBox.setValue(!(boolean) e.getProperty().getValue()); isAreaSelect = !(boolean) e.getProperty().getValue(); isEmployeeSelect = (boolean) e.getProperty().getValue(); }); TextField amountField = new CommonTextField("Amount: "); amountField.addStyleName("align-right"); amountField.setEnabled(false); f.addComponent(amountField); amountCheckBox.addValueChangeListener((Property.ValueChangeEvent e) -> { amountField.setEnabled((boolean) e.getProperty().getValue()); isAmountSelect = (boolean) e.getProperty().getValue(); }); HorizontalLayout h = new HorizontalLayout(); h.setCaption("Date: "); h.setWidth("100%"); h.setSpacing(true); DateField from = new DateField(); from.setWidth("100%"); from.setEnabled(false); h.addComponent(from); DateField to = new DateField(); to.setWidth("100%"); to.setEnabled(false); h.addComponent(to); dateCheckBox.addValueChangeListener((Property.ValueChangeEvent e) -> { from.setEnabled((boolean) e.getProperty().getValue()); to.setEnabled((boolean) e.getProperty().getValue()); isDateSelect = (boolean) e.getProperty().getValue(); }); f.addComponent(h); Button generate = new CommonButton("Generate Report"); generate.addClickListener((Button.ClickEvent e) -> { if (!isEmployeeSelect && !isAmountSelect && !isDateSelect) { mrDataGrid.setContainerDataSource(new MaintenanceDataContainer()); mrDataGrid.setFrozenColumnCount(2); } if (isAreaSelect && !isAmountSelect && !isDateSelect) { if (areaComboBox.getValue() == null) { Notification.show("Select an Area!", Notification.Type.ERROR_MESSAGE); return; } mrDataGrid.setContainerDataSource( new MaintenanceDataContainer(areaComboBox.getItemCaption(areaComboBox.getValue()))); mrDataGrid.setFrozenColumnCount(2); } if (isEmployeeSelect && !isAmountSelect && !isDateSelect) { if (employeeComboBox.getValue() == null) { Notification.show("Select a Client!", Notification.Type.ERROR_MESSAGE); return; } mrDataGrid.setContainerDataSource(new MaintenanceDataContainer((int) employeeComboBox.getValue())); mrDataGrid.setFrozenColumnCount(2); } if (!isEmployeeSelect && isAmountSelect && !isDateSelect) { if (amountField.getValue() == null || amountField.getValue().trim().isEmpty()) { Notification.show("Enter Amount!", Notification.Type.ERROR_MESSAGE); return; } else { if (!CommonUtilities.checkInputIfDouble(amountField.getValue().trim())) { Notification.show("Enter numeric format for Amount!", Notification.Type.ERROR_MESSAGE); return; } } mrDataGrid.setContainerDataSource(new MaintenanceDataContainer( CommonUtilities.convertStringToDouble(amountField.getValue().trim()))); mrDataGrid.setFrozenColumnCount(2); } if (!isEmployeeSelect && !isAmountSelect && isDateSelect) { if (from.getValue() == null) { Notification.show("Select first Date!", Notification.Type.ERROR_MESSAGE); return; } if (to.getValue() == null) { Notification.show("Select 2nd Date!", Notification.Type.ERROR_MESSAGE); return; } mrDataGrid.setContainerDataSource(new MaintenanceDataContainer(from.getValue(), to.getValue())); mrDataGrid.setFrozenColumnCount(2); } if (isAreaSelect && isAmountSelect && !isDateSelect) { if (areaComboBox.getValue() == null) { Notification.show("Select an Area!", Notification.Type.ERROR_MESSAGE); return; } if (amountField.getValue() == null || amountField.getValue().trim().isEmpty()) { Notification.show("Enter Amount!", Notification.Type.ERROR_MESSAGE); return; } else { if (!CommonUtilities.checkInputIfDouble(amountField.getValue().trim())) { Notification.show("Enter numeric format for Amount!", Notification.Type.ERROR_MESSAGE); return; } } mrDataGrid.setContainerDataSource( new MaintenanceDataContainer(areaComboBox.getItemCaption(areaComboBox.getValue()), CommonUtilities.convertStringToDouble(amountField.getValue().trim()))); mrDataGrid.setFrozenColumnCount(2); } if (isEmployeeSelect && isAmountSelect && !isDateSelect) { if (employeeComboBox.getValue() == null) { Notification.show("Select a Client!", Notification.Type.ERROR_MESSAGE); return; } if (amountField.getValue() == null || amountField.getValue().trim().isEmpty()) { Notification.show("Enter Amount!", Notification.Type.ERROR_MESSAGE); return; } else { if (!CommonUtilities.checkInputIfDouble(amountField.getValue().trim())) { Notification.show("Enter numeric format for Amount!", Notification.Type.ERROR_MESSAGE); return; } } mrDataGrid.setContainerDataSource(new MaintenanceDataContainer((int) employeeComboBox.getValue(), CommonUtilities.convertStringToDouble(amountField.getValue().trim()))); mrDataGrid.setFrozenColumnCount(2); } if (isAreaSelect && !isAmountSelect && isDateSelect) { if (areaComboBox.getValue() == null) { Notification.show("Select an Area!", Notification.Type.ERROR_MESSAGE); return; } if (from.getValue() == null) { Notification.show("Select first Date!", Notification.Type.ERROR_MESSAGE); return; } if (to.getValue() == null) { Notification.show("Select 2nd Date!", Notification.Type.ERROR_MESSAGE); return; } mrDataGrid.setContainerDataSource(new MaintenanceDataContainer( areaComboBox.getItemCaption(areaComboBox.getValue()), from.getValue(), to.getValue())); mrDataGrid.setFrozenColumnCount(2); } if (isEmployeeSelect && !isAmountSelect && isDateSelect) { if (employeeComboBox.getValue() == null) { Notification.show("Select a Client!", Notification.Type.ERROR_MESSAGE); return; } if (from.getValue() == null) { Notification.show("Select first Date!", Notification.Type.ERROR_MESSAGE); return; } if (to.getValue() == null) { Notification.show("Select 2nd Date!", Notification.Type.ERROR_MESSAGE); return; } mrDataGrid.setContainerDataSource(new MaintenanceDataContainer((int) employeeComboBox.getValue(), from.getValue(), to.getValue())); mrDataGrid.setFrozenColumnCount(2); } if (!isEmployeeSelect && isAmountSelect && isDateSelect) { if (amountField.getValue() == null || amountField.getValue().trim().isEmpty()) { Notification.show("Enter Amount!", Notification.Type.ERROR_MESSAGE); return; } else { if (!CommonUtilities.checkInputIfDouble(amountField.getValue().trim())) { Notification.show("Enter numeric format for Amount!", Notification.Type.ERROR_MESSAGE); return; } } if (from.getValue() == null) { Notification.show("Select first Date!", Notification.Type.ERROR_MESSAGE); return; } if (to.getValue() == null) { Notification.show("Select 2nd Date!", Notification.Type.ERROR_MESSAGE); return; } mrDataGrid.setContainerDataSource(new MaintenanceDataContainer( CommonUtilities.convertStringToDouble(amountField.getValue().trim()), from.getValue(), to.getValue())); mrDataGrid.setFrozenColumnCount(2); } if (isAreaSelect && isAmountSelect && isDateSelect) { if (areaComboBox.getValue() == null) { Notification.show("Select an Area!", Notification.Type.ERROR_MESSAGE); return; } if (amountField.getValue() == null || amountField.getValue().trim().isEmpty()) { Notification.show("Enter Amount!", Notification.Type.ERROR_MESSAGE); return; } else { if (!CommonUtilities.checkInputIfDouble(amountField.getValue().trim())) { Notification.show("Enter numeric format for Amount!", Notification.Type.ERROR_MESSAGE); return; } } if (from.getValue() == null) { Notification.show("Select first Date!", Notification.Type.ERROR_MESSAGE); return; } if (to.getValue() == null) { Notification.show("Select 2nd Date!", Notification.Type.ERROR_MESSAGE); return; } mrDataGrid.setContainerDataSource( new MaintenanceDataContainer(employeeComboBox.getItemCaption(employeeComboBox.getValue()), CommonUtilities.convertStringToDouble(amountField.getValue().trim()), from.getValue(), to.getValue())); mrDataGrid.setFrozenColumnCount(2); } if (isEmployeeSelect && isAmountSelect && isDateSelect) { if (employeeComboBox.getValue() == null) { Notification.show("Select a Client!", Notification.Type.ERROR_MESSAGE); return; } if (amountField.getValue() == null || amountField.getValue().trim().isEmpty()) { Notification.show("Enter Amount!", Notification.Type.ERROR_MESSAGE); return; } else { if (!CommonUtilities.checkInputIfDouble(amountField.getValue().trim())) { Notification.show("Enter numeric format for Amount!", Notification.Type.ERROR_MESSAGE); return; } } if (from.getValue() == null) { Notification.show("Select first Date!", Notification.Type.ERROR_MESSAGE); return; } if (to.getValue() == null) { Notification.show("Select 2nd Date!", Notification.Type.ERROR_MESSAGE); return; } mrDataGrid.setContainerDataSource(new MaintenanceDataContainer((int) employeeComboBox.getValue(), CommonUtilities.convertStringToDouble(amountField.getValue().trim()), from.getValue(), to.getValue())); mrDataGrid.setFrozenColumnCount(2); } sub.close(); }); f.addComponent(generate); sub.setContent(f); sub.getContent().setHeightUndefined(); return sub; }