/** * Returns the component state of the priority field. * * @param alertType the alert type lookup. May be <tt>null</tt> * @return the priority field, populated with the alert type */ private ComponentState getPriority(Lookup alertType) { String displayName = DescriptorHelper.getDisplayName("lookup.customerAlertType", "priority"); if (alertType != null) { priority.setText(AlertHelper.getPriorityName(alertType)); } return new ComponentState(priority, null, null, displayName); }
/** Verifies that an {@link CustomerEditor} is created for <em>party.customer*</em> */ @Test public void testCreateCustomerEditor() { String[] shortNames = DescriptorHelper.getShortNames("party.customer*"); for (String shortName : shortNames) { checkCreate(shortName, CustomerEditor.class); } }
/** * Constructs an {@code AlertsViewer} to display alerts for a single alert type. * * @param alert the alerts * @param context the context * @param help the help context */ public AlertsViewer(Alert alert, Context context, HelpContext help) { this(Arrays.asList(alert), context, help); if (alert.getAlert() != null) { setTitle(DescriptorHelper.getDisplayName(alert.getAlert())); } else { setTitle(alert.getAlertType().getName()); } }
/** * Verifies that an {@link ProductEditor} is created for each <em>product.*</em> archetype except * <em>product.template</em> which uses {@link ProductTemplateEditor}. */ @Test public void testCreateProductEditor() { for (String shortName : DescriptorHelper.getShortNames("product.*")) { if (ProductArchetypes.TEMPLATE.equals(shortName)) { checkCreate(shortName, ProductTemplateEditor.class); } else { checkCreate(shortName, ProductEditor.class); } } }
/** Default constructor. */ public DeliveryItemLayoutStrategy() { NodeDescriptor node = DescriptorHelper.getNode( SupplierArchetypes.DELIVERY_ITEM, SUPPLIER_INVOICE_LINE_ID, ServiceHelper.getArchetypeService()); ArchetypeNodes nodes = new ArchetypeNodes().excludeIfEmpty("order"); if (node != null && node.isReadOnly()) { nodes.excludeIfEmpty(SUPPLIER_INVOICE_LINE_ID); } setArchetypeNodes(nodes); }
/** * Validates the object. * * @param validator the validator * @return {@code true} if the object and its descendants are valid otherwise {@code false} */ @Override protected boolean doValidation(Validator validator) { boolean result = super.doValidation(validator); if (result) { FinancialAct balance = (FinancialAct) getParent(); if (balance != null) { currentBalance = IMObjectHelper.reload(balance); // make sure we have the latest instance if (currentBalance == null) { ErrorDialog.show( Messages.format("imobject.noexist", DescriptorHelper.getDisplayName(balance))); result = false; } else if (TillBalanceStatus.CLEARED.equals(currentBalance.getStatus())) { ErrorDialog.show(Messages.get("till.adjustment.error.clearedBalance")); result = false; } } } return result; }
/** * Verifies that an {@link EntityRelationshipEditor} is returned for all * <em>entityRelationship.*</em> short names, with the exception of: * * <ul> * <li><em>entityRelationship.patientOwner</em> - returns an {@link * PatientOwnerRelationshipEditor} * <li><em>entityRelationship.documentTemplatePrinter</em> - returns an {@link * DocumentTemplatePrinterEditor} * <li><em>entityRelationship.supplierStockLocationESCI</em> - returns an {@link * SupplierStockLocationRelationshipESCIEditor} * <li><em>entityRelationship.productReminder</em> - returns an {@link * ProductReminderRelationshipEditor} * <li><em>entityRelationship.scheduleDocumentTemplate</em> - returns an {@link * ScheduleTemplateRelationshipEditor} * <li><em>entityRelationship.worklistDocumentTemplate</em> - returns an {@link * ScheduleTemplateRelationshipEditor} * </ul> */ @Test public void testCreateRelationshipEditor() { String[] shortNames = DescriptorHelper.getShortNames("entityRelationship.*"); for (String shortName : shortNames) { if (shortName.equals("entityRelationship.patientOwner")) { checkCreate(shortName, PatientOwnerRelationshipEditor.class); } else if (shortName.equals("entityRelationship.documentTemplatePrinter")) { checkCreate(shortName, DocumentTemplatePrinterEditor.class); } else if (shortName.equals("entityRelationship.supplierStockLocationESCI")) { checkCreate(shortName, SupplierStockLocationRelationshipESCIEditor.class); } else if (shortName.equals("entityRelationship.productReminder")) { checkCreate(shortName, ProductReminderRelationshipEditor.class); } else if (shortName.equals("entityRelationship.reminderTypeTemplate")) { checkCreate(shortName, ReminderTypeTemplateEditor.class); } else if (shortName.equals("entityRelationship.scheduleDocumentTemplate") || shortName.equals("entityRelationship.worklistDocumentTemplate")) { checkCreate(shortName, ScheduleTemplateRelationshipEditor.class); } else if (shortName.equals("entityRelationship.productStockLocation")) { checkCreate(shortName, ProductStockLocationEditor.class); } else { checkCreate(shortName, EntityRelationshipEditor.class); } } }
/** * Sets the archetype short names that this property may support. * * <p>Wildcards are expanded. * * @param shortNames the archetype short names */ public void setArchetypeRange(String[] shortNames) { this.shortNames = DescriptorHelper.getShortNames(shortNames); }
/** * Returns the type of a contact. * * @param contact the contact * @return the type of the contact. May be {@code null} */ @Override public String getType(Contact contact) { return (contact.getParty() != null) ? DescriptorHelper.getDisplayName(contact.getParty()) : null; }