Project

General

Profile

« Previous | Next » 

Revision 139902da

Added by Patrick Plitzner almost 11 years ago

  • completely removed DetailType enum and all its uses

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java
118 118
import eu.etaxonomy.taxeditor.ui.section.classification.ClassificationDetailSection;
119 119
import eu.etaxonomy.taxeditor.ui.section.classification.TaxonNodeDetailElement;
120 120
import eu.etaxonomy.taxeditor.ui.section.classification.TaxonNodeDetailSection;
121
import eu.etaxonomy.taxeditor.ui.section.common.ReferenceEntityDetailElement;
121 122
import eu.etaxonomy.taxeditor.ui.section.common.ReferencedEntityDetailSection;
122
import eu.etaxonomy.taxeditor.ui.section.common.RefereneEntityDetailElement;
123 123
import eu.etaxonomy.taxeditor.ui.section.description.DerivedUnitElement;
124 124
import eu.etaxonomy.taxeditor.ui.section.description.DescribedSpecimenSection;
125 125
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailElement;
......
1314 1314
        return element;
1315 1315
    }
1316 1316

  
1317
    // SIMPLIFY
1318

  
1319
    /**
1320
     * Used to define which {@link AbstractCdmDetailSection} or
1321
     * {@link AbstractCdmDetailElement} should be created with
1322
     * {@link CdmFormFactory#createCdmDetailSection(DetailType, ConversationHolder, ICdmFormElement, ISelectionProvider, int)}
1323
     * or
1324
     * {@link CdmFormFactory#createCdmDetailElement(DetailType, ICdmFormElement, int)}
1325
     */
1326
    public static enum DetailType {
1327
        AUTHORSHIP,
1328
        CLASSIFICATION,
1329
        COLLECTION,
1330
        DERIVED_UNIT,
1331
        DERIVED_UNIT_FACADE,
1332
        DERIVED_UNIT_GENERAL,
1333
        DESCRIPTION,
1334
        DESCRIPTIONELEMENT,
1335
        DETERMINATION,
1336
        FEATURE_DISTRIBUTION,
1337
        FIELD_OBSERVATION,
1338
        GATHERING_EVENT,
1339
        GRANTEDAUTHORITY,
1340
        GROUP,
1341
        HYBRID,
1342
        INSTITUTION,
1343
        MEDIA,
1344
        NAMED_AREA,
1345
        NAMED_AREA_LEVEL,
1346
        NAMERELATIONSHIP,//never used
1347
        NATURAL_LANGUAGE,
1348
        NOMENCLATURALREFERENCE,
1349
        NONVIRALNAME,
1350
        PARSINGMESSAGE,
1351
        PERSON,
1352
        POLYTOMOUS_KEY,
1353
        POLYTOMOUS_KEY_NODE,
1354
        REFERENCEBASE,
1355
        REFERENCED_ENTITY,
1356
        SCIENTIFICNAME,
1357
        TAXON_NODE,
1358
        TAXON_RELATIONSHIP,
1359
        TAXONBASE,
1360
        TEAM,
1361
        TEAMORPERSONBASE,
1362
        TERM_VOCABULARY,
1363
        USE_RECORD,
1364
        USER
1365
    }
1366

  
1367 1317
    public AbstractFormSection createDefinedTermDetailSection(Class definedTermClass, ConversationHolder conversation,
1368 1318
            ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
1369 1319

  
......
1382 1332
     * @param style
1383 1333
     * @return
1384 1334
     */
1385
    public AbstractCdmDetailElement createDefinedTermDetailElement(Class definedTermClass,
1386
            AbstractCdmDetailSection parentElement, int style) {
1335
    public AbstractCdmDetailElement createDefinedTermDetailElement(Class definedTermClass, AbstractCdmDetailSection parentElement, int style) {
1387 1336
        AbstractCdmDetailElement element = null;
1388 1337

  
1389 1338
        if (NamedArea.class.isAssignableFrom(definedTermClass)) {
......
1397 1346
        return element;
1398 1347
    }
1399 1348

  
1400
    /**
1401
     * <p>
1402
     * createCdmDetailSection
1403
     * </p>
1404
     *
1405
     * @param detailType
1406
     *            a
1407
     *            {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType}
1408
     *            object.
1409
     * @param parentElement
1410
     *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1411
     *            object.
1412
     * @param selectionProvider
1413
     *            a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
1414
     * @param style
1415
     *            a int.
1416
     * @param conversation
1417
     *            a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
1418
     *            object.
1419
     * @return a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
1420
     *         object.
1421
     */
1422
    public AbstractFormSection createCdmDetailSection(DetailType detailType, ConversationHolder conversation,
1423
            ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
1424
        AbstractFormSection section = null;
1425

  
1426
        switch (detailType) {
1427
        case SCIENTIFICNAME:
1428
            section = new NameDetailSection(this, conversation, parentElement, selectionProvider, style);
1429
            break;
1430
        case REFERENCEBASE:
1431
            section = new ReferenceDetailSection(this, conversation, parentElement, selectionProvider, style);
1432
            break;
1433
        case NOMENCLATURALREFERENCE:
1434
            section = new NomenclaturalReferenceDetailSection(this, conversation, parentElement, selectionProvider,
1435
                    style);
1436
            break;
1437
        case TAXONBASE:
1438
            section = new TaxonBaseDetailSection(this, conversation, parentElement, selectionProvider, style);
1439
            break;
1440
        case AUTHORSHIP:
1441
            section = new AuthorshipDetailSection(this, conversation, parentElement, selectionProvider, style);
1442
            break;
1443
        case TEAMORPERSONBASE:
1444
            section = new TeamOrPersonBaseDetailSection(this, conversation, parentElement, selectionProvider, style);
1445
            break;
1446
        case TEAM:
1447
            section = new TeamDetailSection(this, conversation, parentElement, null, style);
1448
            break;
1449
        case PERSON:
1450
            section = new PersonDetailSection(this, conversation, parentElement, null, style);
1451
            break;
1452
        case DESCRIPTION:
1453
            section = new DescriptionDetailSection(this, conversation, parentElement, selectionProvider, style);
1454
            break;
1455
        case DESCRIPTIONELEMENT:
1456
            section = new DescriptionElementDetailSection(this, conversation, parentElement, selectionProvider, style);
1457
            break;
1458
        case PARSINGMESSAGE:
1459
            section = new ParsingMessagesSection(this, conversation, parentElement, selectionProvider, style);
1460
            break;
1461
        case NONVIRALNAME:
1462
            section = new NonViralNameDetailSection(this, conversation, parentElement, selectionProvider, style);
1463
            break;
1464
        case MEDIA:
1465
            section = new eu.etaxonomy.taxeditor.ui.section.description.MediaDetailsSection(this, conversation,
1466
                    parentElement, selectionProvider, style);
1467
            break;
1468
        case DERIVED_UNIT_FACADE:
1469
            section = new DerivedUnitFacadeDetailSection(this, conversation, parentElement, selectionProvider, style);
1470
            break;
1471
        case FIELD_OBSERVATION:
1472
            section = new FieldObservationDetailSection(this, conversation, parentElement, selectionProvider, style);
1473
            break;
1474
        case GATHERING_EVENT:
1475
            section = new GatheringEventDetailSection(this, conversation, parentElement, selectionProvider, style);
1476
            break;
1477
        case DERIVED_UNIT:
1478
            section = new DerivedUnitBaseDetailSection(this, conversation, parentElement, selectionProvider, style);
1479
            break;
1480
        case NATURAL_LANGUAGE:
1481
            section = new NaturalLanguageSection(this, conversation, parentElement, selectionProvider, style);
1482
            break;
1483
        case FEATURE_DISTRIBUTION:
1484
            section = new FeatureDistributionDetailSection(this, conversation, parentElement, selectionProvider, style);
1485
            break;
1486
        case CLASSIFICATION:
1487
            section = new ClassificationDetailSection(this, conversation, parentElement, selectionProvider, style);
1488
            break;
1489
        case TAXON_NODE:
1490
            section = new TaxonNodeDetailSection(this, conversation, parentElement, selectionProvider, style);
1491
            break;
1492
        case POLYTOMOUS_KEY:
1493
            section = new PolytomousKeyDetailSection(this, conversation, parentElement, selectionProvider, style);
1494
            break;
1495
        case POLYTOMOUS_KEY_NODE:
1496
            section = new PolytomousKeyNodeDetailSection(this, conversation, parentElement, selectionProvider, style);
1497
            break;
1498
        case INSTITUTION:
1499
            section = new InstitutionDetailSection(this, conversation, parentElement, selectionProvider, style);
1500
            break;
1501
        case DERIVED_UNIT_GENERAL:
1502
            section = new GeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1503
            break;
1504
        case HYBRID:
1505
            section = new HybridDetailSection(this, conversation, parentElement, selectionProvider, style);
1506
            break;
1507
        case USER:
1508
            section = new UserDetailSection(this, conversation, parentElement, selectionProvider, style);
1509
            break;
1510
        case GROUP:
1511
            section = new GroupDetailSection(this, conversation, parentElement, selectionProvider, style);
1512
            break;
1513
        case DETERMINATION:
1514
            section = new DeterminationDetailSection(this, conversation, parentElement, selectionProvider, style);
1515
            break;
1516
        case TAXON_RELATIONSHIP:
1517
            section = new TaxonRelationshipDetailSection(this, conversation, parentElement, selectionProvider, style);
1518
            break;
1519
        case REFERENCED_ENTITY:
1520
            section = new ReferencedEntityDetailSection(this, conversation, parentElement, selectionProvider, style);
1521
            break;
1522
        case TERM_VOCABULARY:
1523
            section = new TermVocabularyDetailSection(this, conversation, parentElement, selectionProvider, style);
1524
            break;
1525
        case NAMED_AREA:
1526
            section = new NamedAreaDetailSection(this, conversation, parentElement, selectionProvider, style);
1527
            break;
1528
        case USE_RECORD:
1529
            section = new UseRecordDetailSection(this, conversation, parentElement, selectionProvider, style);
1530
            break;
1531
        }
1532

  
1533
        if (section == null) {
1534
            throw new RuntimeException("You tried to create a cdm detail section that is not implemented yet.");
1535
        }
1536

  
1537
        parentElement.addElement(section);
1538
        adapt(section);
1539
        return section;
1540
    }
1541

  
1542 1349
    public NameDetailSection createNameDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1543 1350
        NameDetailSection section = new NameDetailSection(this, conversation, parentElement, selectionProvider, style);
1544
        addAndAdapt(parentElement, section);
1351
        addAndAdaptSection(parentElement, section);
1545 1352
        return section;
1546 1353
    }
1547 1354

  
1548 1355
    public ReferenceDetailSection createReferenceDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1549 1356
        ReferenceDetailSection section = new ReferenceDetailSection(this, conversation, parentElement, selectionProvider, style);
1550
        addAndAdapt(parentElement, section);
1357
        addAndAdaptSection(parentElement, section);
1551 1358
        return section;
1552 1359
    }
1553 1360

  
1554 1361
    public NomenclaturalReferenceDetailSection createNomenclaturalReferenceDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1555 1362
        NomenclaturalReferenceDetailSection section = new NomenclaturalReferenceDetailSection(this, conversation, parentElement, selectionProvider, style);
1556
        addAndAdapt(parentElement, section);
1363
        addAndAdaptSection(parentElement, section);
1557 1364
        return section;
1558 1365
    }
1559 1366

  
1560 1367
    public TaxonBaseDetailSection createTaxonBaseDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1561 1368
        TaxonBaseDetailSection section = new TaxonBaseDetailSection(this, conversation, parentElement, selectionProvider, style);
1562
        addAndAdapt(parentElement, section);
1369
        addAndAdaptSection(parentElement, section);
1563 1370
        return section;
1564 1371
    }
1565 1372

  
1566 1373
    public AuthorshipDetailSection createAuthorshipDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1567 1374
        AuthorshipDetailSection section = new AuthorshipDetailSection(this, conversation, parentElement, selectionProvider, style);
1568
        addAndAdapt(parentElement, section);
1375
        addAndAdaptSection(parentElement, section);
1569 1376
        return section;
1570 1377
    }
1571 1378

  
1572 1379
    public TeamOrPersonBaseDetailSection createTeamOrPersonBaseDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1573 1380
        TeamOrPersonBaseDetailSection section = new TeamOrPersonBaseDetailSection(this, conversation, parentElement, selectionProvider, style);
1574
        addAndAdapt(parentElement, section);
1381
        addAndAdaptSection(parentElement, section);
1575 1382
        return section;
1576 1383
    }
1577 1384

  
1578 1385
    public TeamDetailSection createTeamDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
1579 1386
        TeamDetailSection section = new TeamDetailSection(this, conversation, parentElement, null, style);
1580
        addAndAdapt(parentElement, section);
1387
        addAndAdaptSection(parentElement, section);
1581 1388
        return section;
1582 1389
    }
1583 1390

  
1584 1391
    public PersonDetailSection createPersonDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
1585 1392
        PersonDetailSection section = new PersonDetailSection(this, conversation, parentElement, null, style);
1586
        addAndAdapt(parentElement, section);
1393
        addAndAdaptSection(parentElement, section);
1587 1394
        return section;
1588 1395
    }
1589 1396

  
1590 1397
    public DescriptionDetailSection createDescriptionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1591 1398
        DescriptionDetailSection section = new DescriptionDetailSection(this, conversation, parentElement, selectionProvider, style);
1592
        addAndAdapt(parentElement, section);
1399
        addAndAdaptSection(parentElement, section);
1593 1400
        return section;
1594 1401
    }
1595 1402

  
1596 1403
    public DescriptionElementDetailSection createDescriptionElementDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1597 1404
        DescriptionElementDetailSection section = new DescriptionElementDetailSection(this, conversation, parentElement, selectionProvider, style);
1598
        addAndAdapt(parentElement, section);
1405
        addAndAdaptSection(parentElement, section);
1599 1406
        return section;
1600 1407
    }
1601 1408

  
1602 1409
    public ParsingMessagesSection createParsingMessagesSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1603 1410
        ParsingMessagesSection section = new ParsingMessagesSection(this, conversation, parentElement, selectionProvider, style);
1604
        addAndAdapt(parentElement, section);
1411
        addAndAdaptSection(parentElement, section);
1605 1412
        return section;
1606 1413
    }
1607 1414

  
1608 1415
    public NonViralNameDetailSection createNonViralNameDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1609 1416
        NonViralNameDetailSection section = new NonViralNameDetailSection(this, conversation, parentElement, selectionProvider, style);
1610
        addAndAdapt(parentElement, section);
1417
        addAndAdaptSection(parentElement, section);
1611 1418
        return section;
1612 1419
    }
1613 1420

  
1614 1421
    public MediaDetailsSection createMediaDetailsSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1615 1422
        MediaDetailsSection section = new MediaDetailsSection(this, conversation, parentElement, selectionProvider, style);
1616
        addAndAdapt(parentElement, section);
1423
        addAndAdaptSection(parentElement, section);
1617 1424
        return section;
1618 1425
    }
1619 1426

  
1620 1427
    public DerivedUnitFacadeDetailSection createDerivedUnitFacadeDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1621 1428
        DerivedUnitFacadeDetailSection section = new DerivedUnitFacadeDetailSection(this, conversation, parentElement, selectionProvider, style);
1622
        addAndAdapt(parentElement, section);
1429
        addAndAdaptSection(parentElement, section);
1623 1430
        return section;
1624 1431
    }
1625 1432

  
1626 1433
    public FieldObservationDetailSection createFieldObservationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1627 1434
        FieldObservationDetailSection section = new FieldObservationDetailSection(this, conversation, parentElement, selectionProvider, style);
1628
        addAndAdapt(parentElement, section);
1435
        addAndAdaptSection(parentElement, section);
1629 1436
        return section;
1630 1437
    }
1631 1438

  
1632 1439
    public GatheringEventDetailSection createGatheringEventDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1633 1440
        GatheringEventDetailSection section = new GatheringEventDetailSection(this, conversation, parentElement, selectionProvider, style);
1634
        addAndAdapt(parentElement, section);
1441
        addAndAdaptSection(parentElement, section);
1635 1442
        return section;
1636 1443
    }
1637 1444

  
1638 1445
    public DerivedUnitBaseDetailSection createDerivedUnitBaseDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1639 1446
        DerivedUnitBaseDetailSection section = new DerivedUnitBaseDetailSection(this, conversation, parentElement, selectionProvider, style);
1640
        addAndAdapt(parentElement, section);
1447
        addAndAdaptSection(parentElement, section);
1641 1448
        return section;
1642 1449
    }
1643 1450

  
1644 1451
    public NaturalLanguageSection createNaturalLanguageSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1645 1452
        NaturalLanguageSection section = new NaturalLanguageSection(this, conversation, parentElement, selectionProvider, style);
1646
        addAndAdapt(parentElement, section);
1453
        addAndAdaptSection(parentElement, section);
1647 1454
        return section;
1648 1455
    }
1649 1456

  
1650 1457
    public FeatureDistributionDetailSection createFeatureDistributionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1651 1458
        FeatureDistributionDetailSection section = new FeatureDistributionDetailSection(this, conversation, parentElement, selectionProvider, style);
1652
        addAndAdapt(parentElement, section);
1459
        addAndAdaptSection(parentElement, section);
1653 1460
        return section;
1654 1461
    }
1655 1462

  
1656 1463
    public ClassificationDetailSection createClassificationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1657 1464
        ClassificationDetailSection section = new ClassificationDetailSection(this, conversation, parentElement, selectionProvider, style);
1658
        addAndAdapt(parentElement, section);
1465
        addAndAdaptSection(parentElement, section);
1659 1466
        return section;
1660 1467
    }
1661 1468

  
1662 1469
    public TaxonNodeDetailSection createTaxonNodeDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1663 1470
        TaxonNodeDetailSection section = new TaxonNodeDetailSection(this, conversation, parentElement, selectionProvider, style);
1664
        addAndAdapt(parentElement, section);
1471
        addAndAdaptSection(parentElement, section);
1665 1472
        return section;
1666 1473
    }
1667 1474

  
1668 1475
    public PolytomousKeyDetailSection createPolytomousKeyDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1669 1476
        PolytomousKeyDetailSection section = new PolytomousKeyDetailSection(this, conversation, parentElement, selectionProvider, style);
1670
        addAndAdapt(parentElement, section);
1477
        addAndAdaptSection(parentElement, section);
1671 1478
        return section;
1672 1479
    }
1673 1480

  
1674 1481
    public PolytomousKeyNodeDetailSection createPolytomousKeyNodeDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1675 1482
        PolytomousKeyNodeDetailSection section = new PolytomousKeyNodeDetailSection(this, conversation, parentElement, selectionProvider, style);
1676
        addAndAdapt(parentElement, section);
1483
        addAndAdaptSection(parentElement, section);
1677 1484
        return section;
1678 1485
    }
1679 1486

  
1680 1487
    public InstitutionDetailSection createInstitutionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1681 1488
        InstitutionDetailSection section = new InstitutionDetailSection(this, conversation, parentElement, selectionProvider, style);
1682
        addAndAdapt(parentElement, section);
1489
        addAndAdaptSection(parentElement, section);
1683 1490
        return section;
1684 1491
    }
1685 1492

  
1686 1493
    public GeneralDetailSection createGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1687 1494
        GeneralDetailSection section = new GeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1688
        addAndAdapt(parentElement, section);
1495
        addAndAdaptSection(parentElement, section);
1689 1496
        return section;
1690 1497
    }
1691 1498

  
1692 1499
    public HybridDetailSection createHybridDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1693 1500
        HybridDetailSection section = new HybridDetailSection(this, conversation, parentElement, selectionProvider, style);
1694
        addAndAdapt(parentElement, section);
1501
        addAndAdaptSection(parentElement, section);
1695 1502
        return section;
1696 1503
    }
1697 1504

  
1698 1505
    public UserDetailSection createUserDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1699 1506
        UserDetailSection section = new UserDetailSection(this, conversation, parentElement, selectionProvider, style);
1700
        addAndAdapt(parentElement, section);
1507
        addAndAdaptSection(parentElement, section);
1701 1508
        return section;
1702 1509
    }
1703 1510

  
1704 1511
    public GroupDetailSection createGroupDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1705 1512
        GroupDetailSection section = new GroupDetailSection(this, conversation, parentElement, selectionProvider, style);
1706
        addAndAdapt(parentElement, section);
1513
        addAndAdaptSection(parentElement, section);
1707 1514
        return section;
1708 1515
    }
1709 1516

  
1710 1517
    public DeterminationDetailSection createDeterminationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1711 1518
        DeterminationDetailSection section = new DeterminationDetailSection(this, conversation, parentElement, selectionProvider, style);
1712
        addAndAdapt(parentElement, section);
1519
        addAndAdaptSection(parentElement, section);
1713 1520
        return section;
1714 1521
    }
1715 1522

  
1716 1523
    public TaxonRelationshipDetailSection createTaxonRelationshipDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1717 1524
        TaxonRelationshipDetailSection section = new TaxonRelationshipDetailSection(this, conversation, parentElement, selectionProvider, style);
1718
        addAndAdapt(parentElement, section);
1525
        addAndAdaptSection(parentElement, section);
1719 1526
        return section;
1720 1527
    }
1721 1528

  
1722 1529
    public ReferencedEntityDetailSection createReferencedEntityDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1723 1530
        ReferencedEntityDetailSection section = new ReferencedEntityDetailSection(this, conversation, parentElement, selectionProvider, style);
1724
        addAndAdapt(parentElement, section);
1531
        addAndAdaptSection(parentElement, section);
1725 1532
        return section;
1726 1533
    }
1727 1534

  
1728 1535
    public TermVocabularyDetailSection createTermVocabularyDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1729 1536
        TermVocabularyDetailSection section = new TermVocabularyDetailSection(this, conversation, parentElement, selectionProvider, style);
1730
        addAndAdapt(parentElement, section);
1537
        addAndAdaptSection(parentElement, section);
1731 1538
        return section;
1732 1539
    }
1733 1540

  
1734 1541

  
1735 1542
    public NamedAreaDetailSection createNamedAreaDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1736 1543
        NamedAreaDetailSection section = new NamedAreaDetailSection(this, conversation, parentElement, selectionProvider, style);
1737
        addAndAdapt(parentElement, section);
1544
        addAndAdaptSection(parentElement, section);
1738 1545
        return section;
1739 1546
    }
1740 1547

  
1741 1548
    public UseRecordDetailSection createUseRecordDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1742 1549
        UseRecordDetailSection section = new UseRecordDetailSection(this, conversation, parentElement, selectionProvider, style);
1743
        addAndAdapt(parentElement, section);
1550
        addAndAdaptSection(parentElement, section);
1744 1551
        return section;
1745 1552
    }
1746 1553

  
1747 1554
    public GeneralDetailSection createFOSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1748 1555
        GeneralDetailSection section = new GeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
1749
        addAndAdapt(parentElement, section);
1556
        addAndAdaptSection(parentElement, section);
1750 1557
        return section;
1751 1558
    }
1752 1559

  
1753 1560
    public GatheringEventDetailSection createGatheringSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1754 1561
        GatheringEventDetailSection section = new GatheringEventDetailSection(this, conversation, parentElement, selectionProvider, style);
1755
        addAndAdapt(parentElement, section);
1562
        addAndAdaptSection(parentElement, section);
1756 1563
        return section;
1757 1564
    }
1758 1565

  
1759 1566
    public FieldObservationDetailSection createFODetailsSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1760
        FieldObservationDetailSection foDetailsSection = new FieldObservationDetailSection(this, conversation, parentElement, selectionProvider, style);
1761
        parentElement.addElement(foDetailsSection);
1762
        adapt(foDetailsSection);
1763
        return foDetailsSection;
1567
        FieldObservationDetailSection section = new FieldObservationDetailSection(this, conversation, parentElement, selectionProvider, style);
1568
        addAndAdaptSection(parentElement, section);
1569
        return section;
1764 1570
    }
1765 1571

  
1766
    private void addAndAdapt(ICdmFormElement parentElement, AbstractFormSection<?> section) {
1572
    private void addAndAdaptSection(ICdmFormElement parentElement, AbstractFormSection<?> section) {
1767 1573
        parentElement.addElement(section);
1768 1574
        adapt(section);
1769 1575
    }
1770 1576

  
1771 1577

  
1772
    /**
1773
     * <p>
1774
     * createCdmDetailElement
1775
     * </p>
1776
     *
1777
     * @param detailType
1778
     *            a
1779
     *            {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType}
1780
     *            object.
1781
     * @param style
1782
     *            a int.
1783
     * @param parentElement
1784
     *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
1785
     *            object.
1786
     * @return a
1787
     *         {@link eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement}
1788
     *         object.
1789
     */
1790
    public AbstractCdmDetailElement createCdmDetailElement(DetailType detailType, ICdmFormElement parentElement, int style) {
1791
        AbstractCdmDetailElement element = null;
1578
    public UseRecordDetailElement createUseRecordDetailElement(ICdmFormElement parentElement){
1579
        UseRecordDetailElement element = new UseRecordDetailElement(this, parentElement);
1580
        addAndAdaptElement(parentElement, element);
1581
        return element;
1582
    }
1792 1583

  
1793
        switch (detailType) {
1794
        case SCIENTIFICNAME:
1795
            element = new NameDetailElement(this, parentElement, style);
1796
            break;
1797
        case REFERENCEBASE:
1798
            element = new ReferenceDetailElement(this, parentElement, style);
1799
            break;
1800
        case NOMENCLATURALREFERENCE:
1801
            element = new NomenclaturalReferenceDetailElement(this, parentElement, style);
1802
            break;
1803
        case TAXONBASE:
1804
            element = new TaxonBaseDetailElement(this, parentElement, style);
1805
            break;
1806
        case AUTHORSHIP:
1807
            element = new AuthorshipDetailElement(this, parentElement, style);
1808
            break;
1809
        case TEAM:
1810
            element = new TeamDetailElement(this, parentElement, style);
1811
            break;
1812
        case PERSON:
1813
            element = new PersonDetailElement(this, parentElement, style);
1814
            break;
1815
        case DESCRIPTION:
1816
            element = new DescriptionDetailElement(this, parentElement, style);
1817
            break;
1818
        case DESCRIPTIONELEMENT:
1819
            element = new DescriptionElementDetailElement(this, parentElement, style);
1820
            break;
1821
        case NONVIRALNAME:
1822
            element = new NonViralNameDetailElement(this, parentElement);
1823
            break;
1824
        case DERIVED_UNIT_FACADE:
1825
            element = new DerivedUnitFacadeDetailElement(this, parentElement);
1826
            break;
1827
        case FIELD_OBSERVATION:
1828
            element = new FieldObservationDetailElement(this, parentElement);
1829
            break;
1830
        case GATHERING_EVENT:
1831
            element = new GatheringEventDetailElement(this, parentElement);
1832
            break;
1833
        case DERIVED_UNIT:
1834
            element = new DerivedUnitBaseDetailElement(this, parentElement);
1835
            break;
1836
        case NATURAL_LANGUAGE:
1837
            element = new NaturalLanguageDetailElement(this, parentElement);
1838
            break;
1839
        case FEATURE_DISTRIBUTION:
1840
            element = new FeatureDistributionDetailElement(this, parentElement);
1841
            break;
1842
        case CLASSIFICATION:
1843
            element = new ClassificationDetailElement(this, parentElement);
1844
            break;
1845
        case TAXON_NODE:
1846
            element = new TaxonNodeDetailElement(this, parentElement);
1847
            break;
1848
        case COLLECTION:
1849
            element = new CollectionDetailElement(this, parentElement);
1850
            break;
1851
        case POLYTOMOUS_KEY:
1852
            element = new PolytomousKeyDetailElement(this, parentElement);
1853
            break;
1854
        case POLYTOMOUS_KEY_NODE:
1855
            element = new PolytomousKeyNodeDetailElement(this, parentElement);
1856
            break;
1857
        case INSTITUTION:
1858
            element = new InstitutionDetailElement(this, parentElement);
1859
            break;
1860
        case DERIVED_UNIT_GENERAL:
1861
            element = new GeneralDetailElement(this, parentElement);
1862
            break;
1863
        case HYBRID:
1864
            element = new HybridDetailElement(this, parentElement);
1865
            break;
1866
        case USER:
1867
            element = new UserDetailElement(this, parentElement);
1868
            break;
1869
        case GROUP:
1870
            element = new GroupDetailElement(this, parentElement);
1871
            break;
1872
        case GRANTEDAUTHORITY:
1873
            element = new GrantedAuthorityDetailElement(this, parentElement);
1874
            break;
1875
        case DETERMINATION:
1876
            element = new DeterminationDetailElement(this, parentElement);
1877
            break;
1878
        case TAXON_RELATIONSHIP:
1879
            element = new TaxonRelationshipDetailElement(this, parentElement);
1880
            break;
1881
        case REFERENCED_ENTITY:
1882
            element = new RefereneEntityDetailElement(this, parentElement);
1883
            break;
1884
        case TERM_VOCABULARY:
1885
            element = new TermVocabularyDetailElement(this, parentElement);
1886
            break;
1887
        case NAMED_AREA:
1888
            element = new eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement(this, parentElement);
1889
            break;
1890
        case NAMED_AREA_LEVEL:
1891
            element = new DefinedTermDetailElement<NamedAreaLevel>(this, parentElement);
1892
            break;
1893
        case USE_RECORD:
1894
            // element = new UseRecordDetailElement(this, parentElement, style);
1895
            element = new UseRecordDetailElement(this, parentElement);
1896
            break;
1897
        }
1584
    public DefinedTermDetailElement<NamedAreaLevel> createNamedAreaLevelElement(ICdmFormElement parentElement){
1585
        DefinedTermDetailElement<NamedAreaLevel> element = new DefinedTermDetailElement<NamedAreaLevel>(this, parentElement);
1586
        addAndAdaptElement(parentElement, element);
1587
        return element;
1588
    }
1898 1589

  
1899
        if (element == null) {
1900
            AbstractUtility.error(this.getClass(),
1901
                    "Detail element was not created. Seems like the case was not implemented for the requested detail type: "
1902
                            + detailType, null);
1903
        }
1590
    public eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement createNamedAreaDetailElement(ICdmFormElement parentElement){
1591
        eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement element = new eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement(this, parentElement);
1592
        addAndAdaptElement(parentElement, element);
1593
        return element;
1594
    }
1904 1595

  
1905
        adapt(element);
1906
        parentElement.addElement(element);
1596
    public TermVocabularyDetailElement createTermVocabularyDetailElement(ICdmFormElement parentElement){
1597
        TermVocabularyDetailElement element = new TermVocabularyDetailElement(this, parentElement);
1598
        addAndAdaptElement(parentElement, element);
1599
        return element;
1600
    }
1601

  
1602
    public ReferenceEntityDetailElement createReferenceEntityDetailElement(ICdmFormElement parentElement){
1603
        ReferenceEntityDetailElement element = new ReferenceEntityDetailElement(this, parentElement);
1604
        addAndAdaptElement(parentElement, element);
1605
        return element;
1606
    }
1607

  
1608
    public TaxonRelationshipDetailElement createTaxonRelationshipDetailElement(ICdmFormElement parentElement){
1609
        TaxonRelationshipDetailElement element = new TaxonRelationshipDetailElement(this, parentElement);
1610
        addAndAdaptElement(parentElement, element);
1611
        return element;
1612
    }
1613

  
1614
    public GrantedAuthorityDetailElement createGrantedAuthorityDetailElement(ICdmFormElement parentElement){
1615
        GrantedAuthorityDetailElement element = new GrantedAuthorityDetailElement(this, parentElement);
1616
        addAndAdaptElement(parentElement, element);
1617
        return element;
1618
    }
1619

  
1620
    public GroupDetailElement createGroupDetailElement(ICdmFormElement parentElement){
1621
        GroupDetailElement element = new GroupDetailElement(this, parentElement);
1622
        addAndAdaptElement(parentElement, element);
1623
        return element;
1624
    }
1625

  
1626
    public UserDetailElement createUserDetailElement(ICdmFormElement parentElement){
1627
        UserDetailElement element = new UserDetailElement(this, parentElement);
1628
        addAndAdaptElement(parentElement, element);
1629
        return element;
1630
    }
1631

  
1632
    public HybridDetailElement createHybridDetailElement(ICdmFormElement parentElement){
1633
        HybridDetailElement element = new HybridDetailElement(this, parentElement);
1634
        addAndAdaptElement(parentElement, element);
1635
        return element;
1636
    }
1637

  
1638
    public InstitutionDetailElement createInstitutionDetailElement(ICdmFormElement parentElement){
1639
        InstitutionDetailElement element = new InstitutionDetailElement(this, parentElement);
1640
        addAndAdaptElement(parentElement, element);
1641
        return element;
1642
    }
1643

  
1644
    public PolytomousKeyNodeDetailElement createPolytomousKeyNodeDetailElement(ICdmFormElement parentElement){
1645
        PolytomousKeyNodeDetailElement element = new PolytomousKeyNodeDetailElement(this, parentElement);
1646
        addAndAdaptElement(parentElement, element);
1647
        return element;
1648
    }
1649

  
1650
    public PolytomousKeyDetailElement createPolytomousKeyDetailElement(ICdmFormElement parentElement){
1651
        PolytomousKeyDetailElement element = new PolytomousKeyDetailElement(this, parentElement);
1652
        addAndAdaptElement(parentElement, element);
1653
        return element;
1654
    }
1655

  
1656
    public CollectionDetailElement createCollectionDetailElement(ICdmFormElement parentElement){
1657
        CollectionDetailElement element = new CollectionDetailElement(this, parentElement);
1658
        addAndAdaptElement(parentElement, element);
1659
        return element;
1660
    }
1661

  
1662
    public TaxonNodeDetailElement createTaxonNodeDetailElement(ICdmFormElement parentElement){
1663
        TaxonNodeDetailElement element = new TaxonNodeDetailElement(this, parentElement);
1664
        addAndAdaptElement(parentElement, element);
1665
        return element;
1666
    }
1667

  
1668
    public ClassificationDetailElement createClassificationDetailElement(ICdmFormElement parentElement){
1669
        ClassificationDetailElement element = new ClassificationDetailElement(this, parentElement);
1670
        addAndAdaptElement(parentElement, element);
1671
        return element;
1672
    }
1673

  
1674
    public FeatureDistributionDetailElement createFeatureDistributionDetailElement(ICdmFormElement parentElement){
1675
        FeatureDistributionDetailElement element = new FeatureDistributionDetailElement(this, parentElement);
1676
        addAndAdaptElement(parentElement, element);
1677
        return element;
1678
    }
1679

  
1680
    public NaturalLanguageDetailElement createNaturalLanguageDetailElement(ICdmFormElement parentElement){
1681
        NaturalLanguageDetailElement element = new NaturalLanguageDetailElement(this, parentElement);
1682
        addAndAdaptElement(parentElement, element);
1683
        return element;
1684
    }
1685

  
1686
    public DerivedUnitFacadeDetailElement createDerivedUnitFacadeDetailElement(ICdmFormElement parentElement){
1687
        DerivedUnitFacadeDetailElement element = new DerivedUnitFacadeDetailElement(this, parentElement);
1688
        addAndAdaptElement(parentElement, element);
1689
        return element;
1690
    }
1691

  
1692
    public NonViralNameDetailElement createNonViralNameDetailElement(ICdmFormElement parentElement){
1693
        NonViralNameDetailElement element = new NonViralNameDetailElement(this, parentElement);
1694
        addAndAdaptElement(parentElement, element);
1695
        return element;
1696
    }
1697

  
1698
    public DescriptionElementDetailElement createDescriptionElementDetailElement(ICdmFormElement parentElement, int style){
1699
        DescriptionElementDetailElement element = new DescriptionElementDetailElement(this, parentElement, style);
1700
        addAndAdaptElement(parentElement, element);
1701
        return element;
1702
    }
1703

  
1704
    public DescriptionDetailElement createDescriptionDetailElement(ICdmFormElement parentElement, int style){
1705
        DescriptionDetailElement element = new DescriptionDetailElement(this, parentElement, style);
1706
        addAndAdaptElement(parentElement, element);
1707
        return element;
1708
    }
1709

  
1710
    public PersonDetailElement createPersonDetailElement(ICdmFormElement parentElement, int style){
1711
        PersonDetailElement element = new PersonDetailElement(this, parentElement, style);
1712
        addAndAdaptElement(parentElement, element);
1713
        return element;
1714
    }
1715

  
1716
    public TeamDetailElement createTeamDetailElement(ICdmFormElement parentElement, int style){
1717
        TeamDetailElement element = new TeamDetailElement(this, parentElement, style);
1718
        addAndAdaptElement(parentElement, element);
1719
        return element;
1720
    }
1721

  
1722
    public AuthorshipDetailElement createAuthorshipDetailElement(ICdmFormElement parentElement, int style){
1723
        AuthorshipDetailElement element = new AuthorshipDetailElement(this, parentElement, style);
1724
        addAndAdaptElement(parentElement, element);
1907 1725
        return element;
1908 1726
    }
1909 1727

  
1728
    public TaxonBaseDetailElement createTaxonBaseDetailElement(ICdmFormElement parentElement, int style){
1729
        TaxonBaseDetailElement element = new TaxonBaseDetailElement(this, parentElement, style);
1730
        addAndAdaptElement(parentElement, element);
1731
        return element;
1732
    }
1733

  
1734
    public NameDetailElement createNameDetailElement(ICdmFormElement parentElement, int style){
1735
        NameDetailElement element = new NameDetailElement(this, parentElement, style);
1736
        addAndAdaptElement(parentElement, element);
1737
        return element;
1738
    }
1739

  
1740
    public ReferenceDetailElement createReferenceDetailElement(ICdmFormElement parentElement, int style){
1741
        ReferenceDetailElement element = new ReferenceDetailElement(this, parentElement, style);
1742
        addAndAdaptElement(parentElement, element);
1743
        return element;
1744
    }
1745

  
1746
    public NomenclaturalReferenceDetailElement createNomenclaturalReferenceDetailElement(ICdmFormElement parentElement, int style){
1747
        NomenclaturalReferenceDetailElement element = new NomenclaturalReferenceDetailElement(this, parentElement, style);
1748
        addAndAdaptElement(parentElement, element);
1749
        return element;
1750
    }
1751

  
1752

  
1910 1753
    public GeneralDetailElement createGeneralDetailElement(ICdmFormElement parentElement){
1911 1754
        GeneralDetailElement element = new GeneralDetailElement(this, parentElement);
1912
        addAndAdapt(parentElement, element);
1755
        addAndAdaptElement(parentElement, element);
1913 1756
        return element;
1914 1757
    }
1915 1758

  
1916 1759
    public GatheringEventDetailElement createGatheringEventDetailElement(ICdmFormElement parentElement) {
1917 1760
        GatheringEventDetailElement element = new GatheringEventDetailElement(this, parentElement);
1918
        addAndAdapt(parentElement, element);
1761
        addAndAdaptElement(parentElement, element);
1919 1762
        return element;
1920 1763
    }
1921 1764

  
1922 1765
    public FieldObservationDetailElement createFieldObservationDetailElement(ICdmFormElement parentElement) {
1923 1766
        FieldObservationDetailElement element = new FieldObservationDetailElement(this, parentElement);
1924
        addAndAdapt(parentElement, element);
1767
        addAndAdaptElement(parentElement, element);
1925 1768
        return element;
1926 1769
    }
1927 1770

  
1928 1771
    public DerivedUnitBaseDetailElement createDerivedUnitBaseDetailElement(ICdmFormElement parentElement) {
1929 1772
        DerivedUnitBaseDetailElement element = new DerivedUnitBaseDetailElement(this, parentElement);
1930
        addAndAdapt(parentElement, element);
1773
        addAndAdaptElement(parentElement, element);
1931 1774
        return element;
1932 1775
    }
1933 1776

  
1934 1777
    public DeterminationDetailElement createDeterminationDetailElement(ICdmFormElement parentElement) {
1935 1778
        DeterminationDetailElement element = new DeterminationDetailElement(this, parentElement);
1936
        addAndAdapt(parentElement, element);
1779
        addAndAdaptElement(parentElement, element);
1937 1780
        return element;
1938 1781
    }
1939 1782

  
......
1941 1784
     * @param parentElement
1942 1785
     * @param element
1943 1786
     */
1944
    private void addAndAdapt(ICdmFormElement parentElement, AbstractCdmDetailElement<?> element) {
1787
    private void addAndAdaptElement(ICdmFormElement parentElement, AbstractCdmDetailElement<?> element) {
1945 1788
        adapt(element);
1946 1789
        parentElement.addElement(element);
1947 1790
    }

Also available in: Unified diff