]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - server/plugins/org.argeo.jcr.ui.explorer/src/main/java/org/argeo/jcr/ui/explorer/editors/GenericNodePage.java
Add dep folder
[lgpl/argeo-commons.git] / server / plugins / org.argeo.jcr.ui.explorer / src / main / java / org / argeo / jcr / ui / explorer / editors / GenericNodePage.java
index 0be0f19497825ac3a7a5606405f38153e8450e9a..fd4dafe762a92ae0666360c3d867101ff24b0e38 100644 (file)
@@ -1,3 +1,18 @@
+/*
+ * Copyright (C) 2007-2012 Argeo GmbH
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.argeo.jcr.ui.explorer.editors;
 
 import java.text.DateFormat;
@@ -13,8 +28,6 @@ import javax.jcr.PropertyIterator;
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.argeo.ArgeoException;
 import org.argeo.jcr.JcrUtils;
 import org.argeo.jcr.ui.explorer.JcrExplorerConstants;
@@ -24,7 +37,6 @@ import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Text;
 import org.eclipse.ui.forms.AbstractFormPart;
 import org.eclipse.ui.forms.IManagedForm;
@@ -33,8 +45,13 @@ import org.eclipse.ui.forms.editor.FormPage;
 import org.eclipse.ui.forms.widgets.FormToolkit;
 import org.eclipse.ui.forms.widgets.ScrolledForm;
 
+/**
+ * Main node editor page. Lists all properties of the current node and enable
+ * access and editing for some of them.
+ */
+
 public class GenericNodePage extends FormPage implements JcrExplorerConstants {
-       private final static Log log = LogFactory.getLog(GenericNodePage.class);
+       // private final static Log log = LogFactory.getLog(GenericNodePage.class);
 
        // local constants
        private final static String JCR_PROPERTY_NAME = "jcr:name";
@@ -55,18 +72,13 @@ public class GenericNodePage extends FormPage implements JcrExplorerConstants {
        }
 
        protected void createFormContent(IManagedForm managedForm) {
-               try {
-                       tk = managedForm.getToolkit();
-                       ScrolledForm form = managedForm.getForm();
-                       GridLayout twt = new GridLayout(3, false);
-                       twt.marginWidth = twt.marginHeight = 0;
+               tk = managedForm.getToolkit();
+               ScrolledForm form = managedForm.getForm();
+               GridLayout twt = new GridLayout(3, false);
+               twt.marginWidth = twt.marginHeight = 5;
 
-                       form.getBody().setLayout(twt);
-
-                       createPropertiesPart(form.getBody());
-               } catch (Exception e) {
-                       e.printStackTrace();
-               }
+               form.getBody().setLayout(twt);
+               createPropertiesPart(form.getBody());
        }
 
        private void createPropertiesPart(Composite parent) {
@@ -118,12 +130,12 @@ public class GenericNodePage extends FormPage implements JcrExplorerConstants {
        private void addPropertyLine(Composite parent, AbstractFormPart part,
                        Property prop) {
                try {
-                       Label lbl = tk.createLabel(parent, prop.getName());
-                       lbl = tk.createLabel(parent,
+                       tk.createLabel(parent, prop.getName());
+                       tk.createLabel(parent,
                                        "[" + JcrUtils.getPropertyDefinitionAsString(prop) + "]");
 
                        if (prop.getDefinition().isProtected()) {
-                               lbl = tk.createLabel(parent, formatReadOnlyPropertyValue(prop));
+                               tk.createLabel(parent, formatReadOnlyPropertyValue(prop));
                        } else
                                addModifyableValueWidget(parent, part, prop);
                } catch (RepositoryException re) {