Merge branch 'release/5.11.0'
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / group / grantedauthority / CdmAuthorityRow.java
index 3966383494797ace20033db1409cc29c42730140..06442bf2b2bebb248bbc6a9bb08a8b0a25fcbcfd 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -29,7 +29,7 @@ import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityLabelT
 
 /**
  * Row widget for editing a single CDM Authority
- * 
+ *
  * @author cmathew
  * @created Mar 28, 2013
  *
@@ -41,37 +41,38 @@ public class CdmAuthorityRow extends Composite {
        private Label lblUuid;
        private CRUDOperationChooser operationChooser;
        private Button btnDelete;
-       
+
        private GrantedAuthorityImpl grantedAuthorityI;
        private Label lblDirtyFlag;
-       
+
        private CdmAuthorityCompositeViewer cdmaModel;
        private Label lblType;
-       
+
        /**
         * Create the composite, made up of 5 elements :
-        * 1. '*' or depending on whether the row is being edited 
-        * 2. Classname of entity (e.g. TAXONNODE) 
-        * 3. Uuid of entity 
-        * 4. CRUD operations edit widget (this is essentially 4 checkboxes to select the 4 possible operations) 
-        * 5. Delete button (to delete the row) 
-        * 
+        * 1. '*' or depending on whether the row is being edited
+        * 2. Classname of entity (e.g. TAXONNODE)
+        * 3. Uuid of entity
+        * 4. CRUD operations edit widget (this is essentially 4 checkboxes to select the 4 possible operations)
+        * 5. Delete button (to delete the row)
+        *
         * @param parent
         * @param style
         */
        public CdmAuthorityRow(Composite parent, int style) {
                super(parent, SWT.NONE);
                addDisposeListener(new DisposeListener() {
-                       public void widgetDisposed(DisposeEvent e) {
+                       @Override
+            public void widgetDisposed(DisposeEvent e) {
                                toolkit.dispose();
                        }
                });
                toolkit.adapt(this);
                toolkit.paintBordersFor(this);
                setLayout(new GridLayout(6, false));
-               
 
-               
+
+
                lblDirtyFlag = new Label(this, SWT.NONE);
                lblDirtyFlag.setAlignment(SWT.CENTER);
                GridData gd_lblDirtyFlag = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
@@ -79,7 +80,7 @@ public class CdmAuthorityRow extends Composite {
                lblDirtyFlag.setLayoutData(gd_lblDirtyFlag);
                toolkit.adapt(lblDirtyFlag, true, true);
                lblDirtyFlag.setText("*");
-               
+
                lblType = new Label(this, SWT.BORDER);
                GridData gd_lblType = new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1);
                gd_lblType.heightHint = 30;
@@ -88,7 +89,7 @@ public class CdmAuthorityRow extends Composite {
                lblType.setText("Type");
                lblType.setAlignment(SWT.CENTER);
                toolkit.adapt(lblType, true, true);
-               
+
                lblEntity = new Label(this, SWT.BORDER | SWT.WRAP | SWT.CENTER);
                GridData gd_lblEntity = new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1);
                gd_lblEntity.heightHint = 30;
@@ -96,14 +97,14 @@ public class CdmAuthorityRow extends Composite {
                lblEntity.setLayoutData(gd_lblEntity);
                lblEntity.setAlignment(SWT.CENTER);
                toolkit.adapt(lblEntity, true, true);
-               lblEntity.setText("Entity");
-               
-               
+               lblEntity.setText("Entity/Feature");
+
+
                operationChooser = new CRUDOperationChooser(this, SWT.BORDER);
                operationChooser.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
                toolkit.adapt(operationChooser);
                toolkit.paintBordersFor(operationChooser);
-               
+
                btnDelete = new Button(this, SWT.NONE);
 
                btnDelete.setImage(ImageResources.getImage(ImageResources.TRASH_ICON));
@@ -115,15 +116,15 @@ public class CdmAuthorityRow extends Composite {
                                        cdmaModel.removeCdmAuthority(grantedAuthorityI);
                                }
                        }
-               });             
-               
+               });
+
                toolkit.adapt(btnDelete, true, true);
 
        }
 
        /**
         * Sets the dirty flag for this row
-        * 
+        *
         * @param isDirty
         */
        public void setDirty(boolean isDirty) {
@@ -133,18 +134,18 @@ public class CdmAuthorityRow extends Composite {
                        lblDirtyFlag.setText(" ");
                }
        }
-       
+
        /**
         * Create a {@link CdmAuthority} from a {@link GrantedAuthorityImpl} and create a row from it.
-        * 
+        *
         * @param cdmaModel
         * @param grantedAuthorityI
         * @param isDirty
         */
        public void setRowCdmAuthority(CdmAuthorityCompositeViewer cdmaModel, GrantedAuthorityImpl grantedAuthorityI, boolean isDirty, boolean showUuid) {
-               this.grantedAuthorityI = grantedAuthorityI;             
+               this.grantedAuthorityI = grantedAuthorityI;
                this.cdmaModel = cdmaModel;
-               
+
                try {
                        CdmAuthority cdmAuthority = CdmAuthority.fromGrantedAuthority(grantedAuthorityI);
 
@@ -154,29 +155,29 @@ public class CdmAuthorityRow extends Composite {
                        lblType.setText(entityStr);
                        String targetLabelText = GrantedAuthorityLabelTextProvider.getTargetText(cdmAuthority);
                        lblEntity.setText(targetLabelText);
-                                               
+
                        setUuidCellVisible(showUuid);
                        if(lblUuid != null) {
                                String targetUuid = cdmAuthority.getTargetUUID().toString();
                                lblUuid.setText(targetUuid);
                        }
-                       
-                       operationChooser.setAuthority(cdmaModel, grantedAuthorityI, cdmAuthority);                              
-                       
+
+                       operationChooser.setAuthority(cdmaModel, grantedAuthorityI, cdmAuthority);
+
                } catch (Exception e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
 
        }
-       
+
        public void setUuidCellVisible(boolean visible) {
                if(visible) {
                        if(lblUuid == null) {
                                createUuidCell();
                        }
                        lblUuid.moveAbove(operationChooser);
-                       
+
                } else {
                        if(lblUuid != null) {
                                lblUuid.dispose();
@@ -185,7 +186,7 @@ public class CdmAuthorityRow extends Composite {
                }
                layout();
        }
-       
+
        private void createUuidCell() {
                lblUuid = new Label(this, SWT.BORDER | SWT.CENTER);
                GridData gd_lblUuid = new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1);