You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2007/07/31 18:51:06 UTC
svn commit: r561394 -
/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/
Author: pamarcelot
Date: Tue Jul 31 09:51:05 2007
New Revision: 561394
URL: http://svn.apache.org/viewvc?view=rev&rev=561394
Log:
Added LabelProviders implementations and Sorting to the lists.
Modified:
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewObjectClassContentWizardPage.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewObjectClassMandatoryAttributesPage.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewObjectClassOptionalAttributesPage.java
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewObjectClassContentWizardPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewObjectClassContentWizardPage.java?view=diff&rev=561394&r1=561393&r2=561394
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewObjectClassContentWizardPage.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewObjectClassContentWizardPage.java Tue Jul 31 09:51:05 2007
@@ -21,12 +21,15 @@
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.List;
import org.apache.directory.shared.ldap.schema.ObjectClassTypeEnum;
import org.apache.directory.studio.apacheds.schemaeditor.Activator;
import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
import org.apache.directory.studio.apacheds.schemaeditor.model.ObjectClassImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.view.ViewUtils;
import org.apache.directory.studio.apacheds.schemaeditor.view.dialogs.ObjectClassSelectionDialog;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.viewers.ArrayContentProvider;
@@ -39,6 +42,7 @@
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -111,7 +115,41 @@
superiorsTableGridData.heightHint = 100;
superiorsTable.setLayoutData( superiorsTableGridData );
superiorsTableViewer = new TableViewer( superiorsTable );
- superiorsTableViewer.setLabelProvider( new LabelProvider() );
+ superiorsTableViewer.setLabelProvider( new LabelProvider()
+ {
+ public Image getImage( Object element )
+ {
+ if ( element instanceof ObjectClassImpl )
+ {
+ return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+ PluginConstants.IMG_OBJECT_CLASS ).createImage();
+ }
+
+ // Default
+ return super.getImage( element );
+ }
+
+
+ public String getText( Object element )
+ {
+ if ( element instanceof ObjectClassImpl )
+ {
+ ObjectClassImpl oc = ( ObjectClassImpl ) element;
+
+ String[] names = oc.getNames();
+ if ( ( names != null ) && ( names.length > 0 ) )
+ {
+ return ViewUtils.concateAliases( names ) + " - (" + oc.getOid() + ")";
+ }
+ else
+ {
+ return "(None) - (" + oc.getOid() + ")";
+ }
+ }
+ // Default
+ return super.getText( element );
+ }
+ } );
superiorsTableViewer.setContentProvider( new ArrayContentProvider() );
superiorsTableViewer.setInput( superiorsList );
superiorsTableViewer.addSelectionChangedListener( new ISelectionChangedListener()
@@ -241,6 +279,23 @@
*/
private void updateSuperiorsTable()
{
+ Collections.sort( superiorsList, new Comparator<ObjectClassImpl>()
+ {
+ public int compare( ObjectClassImpl o1, ObjectClassImpl o2 )
+ {
+ String[] at1Names = o1.getNames();
+ String[] at2Names = o2.getNames();
+
+ if ( ( at1Names != null ) && ( at2Names != null ) && ( at1Names.length > 0 ) && ( at2Names.length > 0 ) )
+ {
+ return at1Names[0].compareToIgnoreCase( at2Names[0] );
+ }
+
+ // Default
+ return 0;
+ }
+ } );
+
superiorsTableViewer.refresh();
}
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewObjectClassMandatoryAttributesPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewObjectClassMandatoryAttributesPage.java?view=diff&rev=561394&r1=561393&r2=561394
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewObjectClassMandatoryAttributesPage.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewObjectClassMandatoryAttributesPage.java Tue Jul 31 09:51:05 2007
@@ -21,11 +21,14 @@
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.List;
import org.apache.directory.studio.apacheds.schemaeditor.Activator;
import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
import org.apache.directory.studio.apacheds.schemaeditor.model.AttributeTypeImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.view.ViewUtils;
import org.apache.directory.studio.apacheds.schemaeditor.view.dialogs.AttributeTypeSelectionDialog;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.viewers.ArrayContentProvider;
@@ -38,6 +41,7 @@
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -102,7 +106,41 @@
mandatoryAttributeTypesTable.setLayoutData( mandatoryAttributeTypesTableGridData );
mandatoryAttributeTypesTableViewer = new TableViewer( mandatoryAttributeTypesTable );
mandatoryAttributeTypesTableViewer.setContentProvider( new ArrayContentProvider() );
- mandatoryAttributeTypesTableViewer.setLabelProvider( new LabelProvider() );
+ mandatoryAttributeTypesTableViewer.setLabelProvider( new LabelProvider()
+ {
+ public Image getImage( Object element )
+ {
+ if ( element instanceof AttributeTypeImpl )
+ {
+ return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+ PluginConstants.IMG_ATTRIBUTE_TYPE ).createImage();
+ }
+
+ // Default
+ return super.getImage( element );
+ }
+
+
+ public String getText( Object element )
+ {
+ if ( element instanceof AttributeTypeImpl )
+ {
+ AttributeTypeImpl at = ( AttributeTypeImpl ) element;
+
+ String[] names = at.getNames();
+ if ( ( names != null ) && ( names.length > 0 ) )
+ {
+ return ViewUtils.concateAliases( names ) + " - (" + at.getOid() + ")";
+ }
+ else
+ {
+ return "(None) - (" + at.getOid() + ")";
+ }
+ }
+ // Default
+ return super.getText( element );
+ }
+ } );
mandatoryAttributeTypesTableViewer.setInput( mandatoryAttributeTypesList );
mandatoryAttributeTypesTableViewer.addSelectionChangedListener( new ISelectionChangedListener()
{
@@ -175,6 +213,23 @@
*/
private void updateMandatoryAttributeTypesTableTable()
{
+ Collections.sort( mandatoryAttributeTypesList, new Comparator<AttributeTypeImpl>()
+ {
+ public int compare( AttributeTypeImpl o1, AttributeTypeImpl o2 )
+ {
+ String[] at1Names = o1.getNames();
+ String[] at2Names = o2.getNames();
+
+ if ( ( at1Names != null ) && ( at2Names != null ) && ( at1Names.length > 0 ) && ( at2Names.length > 0 ) )
+ {
+ return at1Names[0].compareToIgnoreCase( at2Names[0] );
+ }
+
+ // Default
+ return 0;
+ }
+ } );
+
mandatoryAttributeTypesTableViewer.refresh();
}
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewObjectClassOptionalAttributesPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewObjectClassOptionalAttributesPage.java?view=diff&rev=561394&r1=561393&r2=561394
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewObjectClassOptionalAttributesPage.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewObjectClassOptionalAttributesPage.java Tue Jul 31 09:51:05 2007
@@ -21,11 +21,14 @@
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.List;
import org.apache.directory.studio.apacheds.schemaeditor.Activator;
import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
import org.apache.directory.studio.apacheds.schemaeditor.model.AttributeTypeImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.view.ViewUtils;
import org.apache.directory.studio.apacheds.schemaeditor.view.dialogs.AttributeTypeSelectionDialog;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.viewers.ArrayContentProvider;
@@ -38,6 +41,7 @@
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -102,7 +106,41 @@
optionalAttributeTypesTable.setLayoutData( optionalAttributeTypesTableGridData );
optionalAttributeTypesTableViewer = new TableViewer( optionalAttributeTypesTable );
optionalAttributeTypesTableViewer.setContentProvider( new ArrayContentProvider() );
- optionalAttributeTypesTableViewer.setLabelProvider( new LabelProvider() );
+ optionalAttributeTypesTableViewer.setLabelProvider( new LabelProvider()
+ {
+ public Image getImage( Object element )
+ {
+ if ( element instanceof AttributeTypeImpl )
+ {
+ return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+ PluginConstants.IMG_ATTRIBUTE_TYPE ).createImage();
+ }
+
+ // Default
+ return super.getImage( element );
+ }
+
+
+ public String getText( Object element )
+ {
+ if ( element instanceof AttributeTypeImpl )
+ {
+ AttributeTypeImpl at = ( AttributeTypeImpl ) element;
+
+ String[] names = at.getNames();
+ if ( ( names != null ) && ( names.length > 0 ) )
+ {
+ return ViewUtils.concateAliases( names ) + " - (" + at.getOid() + ")";
+ }
+ else
+ {
+ return "(None) - (" + at.getOid() + ")";
+ }
+ }
+ // Default
+ return super.getText( element );
+ }
+ } );
optionalAttributeTypesTableViewer.setInput( optionalAttributeTypesList );
optionalAttributeTypesTableViewer.addSelectionChangedListener( new ISelectionChangedListener()
{
@@ -175,6 +213,23 @@
*/
private void updateOptionalAttributeTypesTableTable()
{
+ Collections.sort( optionalAttributeTypesList, new Comparator<AttributeTypeImpl>()
+ {
+ public int compare( AttributeTypeImpl o1, AttributeTypeImpl o2 )
+ {
+ String[] at1Names = o1.getNames();
+ String[] at2Names = o2.getNames();
+
+ if ( ( at1Names != null ) && ( at2Names != null ) && ( at1Names.length > 0 ) && ( at2Names.length > 0 ) )
+ {
+ return at1Names[0].compareToIgnoreCase( at2Names[0] );
+ }
+
+ // Default
+ return 0;
+ }
+ } );
+
optionalAttributeTypesTableViewer.refresh();
}