You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2015/06/16 10:57:48 UTC
svn commit: r1685738 - in /directory/studio/trunk/plugins:
common.ui/src/main/java/org/apache/directory/studio/common/ui/
common.ui/src/main/java/org/apache/directory/studio/common/ui/widgets/
openldap.config.editor/src/main/java/org/apache/directory/s...
Author: elecharny
Date: Tue Jun 16 08:57:47 2015
New Revision: 1685738
URL: http://svn.apache.org/r1685738
Log:
o Added a TableDecorator, containing the comparator, labelProvider and Dialog, for any elements managed by a TableWidget.
o Created the TableDecorators for Ssf, TcpBuffer, PasswordHashEnum and ServerId
o Removed the useless classes.
Added:
directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/TableDecorator.java
directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/PasswordHashDecorator.java
directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/ServerIdDecorator.java
directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/SsDecorator.java
directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/TcpBufferDecorator.java
Removed:
directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/ServerIdWrapperLabelProvider.java
directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/ServerIdWrapperViewerSorter.java
directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/SsfLabelProvider.java
directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/TcpBufferWrapperLabelProvider.java
Modified:
directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/widgets/TableWidget.java
directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OverviewPage.java
directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/SecurityPage.java
directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/TuningPage.java
directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/ServerIdWrapper.java
Added: directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/TableDecorator.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/TableDecorator.java?rev=1685738&view=auto
==============================================================================
--- directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/TableDecorator.java (added)
+++ directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/TableDecorator.java Tue Jun 16 08:57:47 2015
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.directory.studio.common.ui;
+
+import org.eclipse.jface.viewers.LabelProvider;
+
+/**
+ * An Class used to store the comparator and labelProvider used by the TableWidget.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public abstract class TableDecorator<E> extends LabelProvider
+{
+ /** The Dialog instance */
+ private AddEditDialog<E> dialog;
+
+ /**
+ * Create a new instance of a TableDecorator
+ */
+ public TableDecorator()
+ {
+ }
+
+
+ /**
+ * @return the dialog
+ */
+ public AddEditDialog<E> getDialog()
+ {
+ return dialog;
+ }
+
+
+ /**
+ * @param dialog the dialog to set
+ */
+ public void setDialog( AddEditDialog<E> dialog )
+ {
+ this.dialog = dialog;
+ }
+
+
+ /**
+ * Compare two elements.
+ * @param e1 The first element
+ * @param e2 The second element
+ * @return A negative value when e1 < e2, positive when e1 > e2, and 0 when e1 = e2
+ */
+ public abstract int compare( E e1, E e2 );
+}
Modified: directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/widgets/TableWidget.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/widgets/TableWidget.java?rev=1685738&r1=1685737&r2=1685738&view=diff
==============================================================================
--- directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/widgets/TableWidget.java (original)
+++ directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/widgets/TableWidget.java Tue Jun 16 08:57:47 2015
@@ -23,15 +23,14 @@ package org.apache.directory.studio.comm
import java.util.ArrayList;
import java.util.List;
-import org.apache.directory.studio.common.ui.AddEditDialog;
import org.apache.directory.studio.common.ui.Messages;
+import org.apache.directory.studio.common.ui.TableDecorator;
import org.apache.directory.studio.common.ui.widgets.BaseWidgetUtils;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
@@ -67,12 +66,6 @@ public class TableWidget<E> extends Abst
{
/** The element list */
private List<E> elements = new ArrayList<E>();
-
- /** The associated Dialog for the addition or edition of elements */
- private AddEditDialog<E> elementDialog;
-
- /** The LabelProvider for the elements */
- private LabelProvider labelProvider;
/** A flag set to tell if we have a Edit button */
private boolean hasEdit;
@@ -84,6 +77,9 @@ public class TableWidget<E> extends Abst
private Button addButton;
private Button editButton;
private Button deleteButton;
+
+ /** The decorator */
+ private TableDecorator<E> decorator;
// A listener on the Elements table, that modifies the button when an Element is selected
private ISelectionChangedListener tableViewerSelectionChangedListener = new ISelectionChangedListener()
@@ -140,9 +136,12 @@ public class TableWidget<E> extends Abst
/**
* Creates a new instance of TableWidget.
+ *
+ * @param decorator the decoartor to use, containing the Dialog comparator and labelProvider
*/
- public TableWidget()
+ public TableWidget( TableDecorator<E> decorator )
{
+ this.decorator = decorator;
}
@@ -246,7 +245,7 @@ public class TableWidget<E> extends Abst
elementTableViewer.setContentProvider( new ArrayContentProvider() );
// The LabelProvider
- elementTableViewer.setLabelProvider( labelProvider );
+ elementTableViewer.setLabelProvider( decorator );
elementTableViewer.addSelectionChangedListener( tableViewerSelectionChangedListener );
// Listeners : we want to catch changes and double clicks (if we have an edit button)
@@ -358,17 +357,31 @@ public class TableWidget<E> extends Abst
*/
private void addElement()
{
- elementDialog.addNewElement();
- elementDialog.setElements( elements );
+ decorator.getDialog().addNewElement();
+ decorator.getDialog().setElements( elements );
- if ( elementDialog.open() == Dialog.OK )
+ if ( decorator.getDialog().open() == Dialog.OK )
{
- E newElement = elementDialog.getEditedElement();
+ E newElement = decorator.getDialog().getEditedElement();
if ( !elements.contains( newElement ) )
{
String elementStr = newElement.toString();
- elements.add( newElement );
+ int pos = 0;
+
+ for ( E element : elements )
+ {
+ if ( decorator.compare( element, newElement ) > 0 )
+ {
+ break;
+ }
+ else
+ {
+ pos++;
+ }
+ }
+
+ elements.add( pos, newElement );
elementTableViewer.refresh();
elementTableViewer.setSelection( new StructuredSelection( elementStr ) );
}
@@ -389,12 +402,12 @@ public class TableWidget<E> extends Abst
if ( !selection.isEmpty() )
{
E selectedElement = (E)selection.getFirstElement();
- elementDialog.setEditedElement( selectedElement );
+ decorator.getDialog().setEditedElement( selectedElement );
// Open the element dialog, with the selected index
- if ( elementDialog.open() == Dialog.OK )
+ if ( decorator.getDialog().open() == Dialog.OK )
{
- E newElement = elementDialog.getEditedElement();
+ E newElement = decorator.getDialog().getEditedElement();
if ( elements.contains( newElement ) )
{
@@ -403,13 +416,43 @@ public class TableWidget<E> extends Abst
// Replace the existing element with the new one
elements.remove( newElement );
- elements.add( newElement );
+
+ int pos = 0;
+
+ for ( E element : elements )
+ {
+ if ( decorator.compare( element, newElement ) > 0 )
+ {
+ break;
+ }
+ else
+ {
+ pos++;
+ }
+ }
+
+ elements.add( pos, newElement );
}
else
{
// We will remove the modified element, and replace it with the new element
elements.remove( selectedElement );
- elements.add( newElement );
+
+ int pos = 0;
+
+ for ( E element : elements )
+ {
+ if ( decorator.compare( element, newElement ) > 0 )
+ {
+ break;
+ }
+ else
+ {
+ pos++;
+ }
+ }
+
+ elements.add( pos, newElement );
}
elementTableViewer.refresh();
@@ -437,22 +480,4 @@ public class TableWidget<E> extends Abst
notifyListeners();
}
}
-
-
- /**
- * @param elementDialog the elementDialog to set
- */
- public void setElementDialog( AddEditDialog<E> elementDialog )
- {
- this.elementDialog = elementDialog;
- }
-
-
- /**
- * @param labelProvider the labelProvider to set
- */
- public void setLabelProvider( LabelProvider labelProvider )
- {
- this.labelProvider = labelProvider;
- }
}
Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OverviewPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OverviewPage.java?rev=1685738&r1=1685737&r2=1685738&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OverviewPage.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OverviewPage.java Tue Jun 16 08:57:47 2015
@@ -32,7 +32,6 @@ import org.apache.directory.studio.openl
import org.apache.directory.studio.openldap.common.ui.dialogs.LogLevelDialog;
import org.apache.directory.studio.openldap.config.OpenLdapConfigurationPluginUtils;
import org.apache.directory.studio.openldap.config.editor.OpenLDAPServerConfigurationEditor;
-import org.apache.directory.studio.openldap.config.editor.dialogs.ServerIdDialog;
import org.apache.directory.studio.openldap.config.editor.overlays.ModuleWrapper;
import org.apache.directory.studio.openldap.config.editor.overlays.ModuleWrapperLabelProvider;
import org.apache.directory.studio.openldap.config.editor.overlays.ModuleWrapperViewerSorter;
@@ -40,8 +39,8 @@ import org.apache.directory.studio.openl
import org.apache.directory.studio.openldap.config.editor.wrappers.DatabaseWrapper;
import org.apache.directory.studio.openldap.config.editor.wrappers.DatabaseWrapperLabelProvider;
import org.apache.directory.studio.openldap.config.editor.wrappers.DatabaseWrapperViewerSorter;
+import org.apache.directory.studio.openldap.config.editor.wrappers.ServerIdDecorator;
import org.apache.directory.studio.openldap.config.editor.wrappers.ServerIdWrapper;
-import org.apache.directory.studio.openldap.config.editor.wrappers.ServerIdWrapperLabelProvider;
import org.apache.directory.studio.openldap.config.model.OlcModuleList;
import org.apache.directory.studio.openldap.config.model.database.OlcDatabaseConfig;
import org.eclipse.jface.viewers.ArrayContentProvider;
@@ -462,9 +461,7 @@ public class OverviewPage extends OpenLD
serverIdLabel.setLayoutData( new GridData( SWT.FILL, SWT.FILL, false, false, 5, 1 ) );
// The ServerID widget
- serverIdTableWidget = new TableWidget<ServerIdWrapper>();
- serverIdTableWidget.setLabelProvider( new ServerIdWrapperLabelProvider() );
- serverIdTableWidget.setElementDialog( new ServerIdDialog( null ) );
+ serverIdTableWidget = new TableWidget<ServerIdWrapper>( new ServerIdDecorator( section.getShell() ) );
serverIdTableWidget.createWidgetWithEdit( globalSectionComposite, toolkit );
serverIdTableWidget.getControl().setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 5, 1 ) );
Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/SecurityPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/SecurityPage.java?rev=1685738&r1=1685737&r2=1685738&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/SecurityPage.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/SecurityPage.java Tue Jun 16 08:57:47 2015
@@ -48,12 +48,10 @@ import org.apache.directory.studio.commo
import org.apache.directory.studio.openldap.common.ui.model.PasswordHashEnum;
import org.apache.directory.studio.openldap.config.editor.OpenLDAPServerConfigurationEditor;
import org.apache.directory.studio.openldap.config.editor.dialogs.OverlayDialog;
-import org.apache.directory.studio.openldap.config.editor.dialogs.PasswordHashDialog;
import org.apache.directory.studio.openldap.config.editor.dialogs.SaslSecPropsDialog;
-import org.apache.directory.studio.openldap.config.editor.dialogs.SsfDialog;
-import org.apache.directory.studio.openldap.config.editor.wrappers.SsfLabelProvider;
+import org.apache.directory.studio.openldap.config.editor.wrappers.PasswordHashDecorator;
import org.apache.directory.studio.openldap.config.editor.wrappers.SsfWrapper;
-import org.apache.directory.studio.openldap.config.editor.wrappers.TcpBufferWrapperLabelProvider;
+import org.apache.directory.studio.openldap.config.editor.wrappers.SsDecorator;
import org.apache.directory.studio.openldap.config.model.OlcGlobal;
@@ -765,9 +763,7 @@ public class SecurityPage extends OpenLD
Label passwordHashLabel = toolkit.createLabel( miscSectionComposite, Messages.getString( "OpenLDAPSecurityPage.PasswordHash" ) ); //$NON-NLS-1$
passwordHashLabel.setLayoutData( new GridData( SWT.FILL, SWT.FILL, false, false, 4, 1 ) );
- passwordHashTableWidget = new TableWidget<PasswordHashEnum>();
- passwordHashTableWidget.setLabelProvider( new TcpBufferWrapperLabelProvider() );
- passwordHashTableWidget.setElementDialog( new PasswordHashDialog( null ) );
+ passwordHashTableWidget = new TableWidget<PasswordHashEnum>( new PasswordHashDecorator( miscSectionComposite.getShell() ) );
passwordHashTableWidget.createWidgetNoEdit( miscSectionComposite, toolkit );
passwordHashTableWidget.getControl().setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 4, 1 ) );
@@ -783,9 +779,7 @@ public class SecurityPage extends OpenLD
Label securityLabel = toolkit.createLabel( miscSectionComposite, Messages.getString( "OpenLDAPSecurityPage.Security" ) ); //$NON-NLS-1$
securityLabel.setLayoutData( new GridData( SWT.FILL, SWT.FILL, false, false, 4, 1 ) );
- securityTableWidget = new TableWidget<SsfWrapper>();
- securityTableWidget.setLabelProvider( new SsfLabelProvider() );
- securityTableWidget.setElementDialog( new SsfDialog( null) );
+ securityTableWidget = new TableWidget<SsfWrapper>( new SsDecorator( miscSectionComposite.getShell() ) );
securityTableWidget.createWidgetWithEdit( miscSectionComposite, toolkit );
securityTableWidget.getControl().setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 4, 1 ) );
Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/TuningPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/TuningPage.java?rev=1685738&r1=1685737&r2=1685738&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/TuningPage.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/TuningPage.java Tue Jun 16 08:57:47 2015
@@ -50,8 +50,8 @@ import org.apache.directory.studio.openl
import org.apache.directory.studio.openldap.config.editor.dialogs.SizeLimitDialog;
import org.apache.directory.studio.openldap.config.editor.dialogs.TcpBufferDialog;
import org.apache.directory.studio.openldap.config.editor.dialogs.TimeLimitDialog;
+import org.apache.directory.studio.openldap.config.editor.wrappers.TcpBufferDecorator;
import org.apache.directory.studio.openldap.config.editor.wrappers.TcpBufferWrapper;
-import org.apache.directory.studio.openldap.config.editor.wrappers.TcpBufferWrapperLabelProvider;
/**
@@ -864,9 +864,7 @@ public class TuningPage extends OpenLDAP
serverIdLabel.setLayoutData( new GridData( SWT.FILL, SWT.FILL, false, false, 2, 1 ) );
// The TCPBuffers widget
- tcpBufferTableWidget = new TableWidget<TcpBufferWrapper>();
- tcpBufferTableWidget.setLabelProvider( new TcpBufferWrapperLabelProvider() );
- tcpBufferTableWidget.setElementDialog( new TcpBufferDialog( null ) );
+ tcpBufferTableWidget = new TableWidget<TcpBufferWrapper>( new TcpBufferDecorator( networkSectionComposite.getShell() ) );
tcpBufferTableWidget.createWidgetWithEdit( networkSectionComposite, toolkit );
tcpBufferTableWidget.getControl().setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 4, 1 ) );
Added: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/PasswordHashDecorator.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/PasswordHashDecorator.java?rev=1685738&view=auto
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/PasswordHashDecorator.java (added)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/PasswordHashDecorator.java Tue Jun 16 08:57:47 2015
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.directory.studio.openldap.config.editor.wrappers;
+
+import org.apache.directory.studio.common.ui.TableDecorator;
+import org.apache.directory.studio.openldap.common.ui.model.PasswordHashEnum;
+import org.apache.directory.studio.openldap.config.editor.dialogs.PasswordHashDialog;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * A decorator for the PasswordHash table.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class PasswordHashDecorator extends TableDecorator<PasswordHashEnum>
+{
+ /**
+ * Create a new instance of PasswordHashDecorator
+ * @param parentShell The parent Shell
+ */
+ public PasswordHashDecorator( Shell parentShell )
+ {
+ setDialog( new PasswordHashDialog( parentShell ) );
+ }
+
+ /**
+ * Construct the label for a PasswordHash.
+ *
+ */
+ public String getText( Object element )
+ {
+ if ( element instanceof PasswordHashEnum )
+ {
+ String passwordHash = ( ( PasswordHashEnum ) element ).toString();
+
+ return passwordHash;
+ }
+
+ return super.getText( element );
+ };
+
+
+ /**
+ * Get the image. We have none (may be we could add one for URLs ?)
+ */
+ public Image getImage( Object element )
+ {
+ return null;
+ };
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int compare( PasswordHashEnum e1, PasswordHashEnum e2 )
+ {
+ if ( e1 != null )
+ {
+ if ( e2 == null )
+ {
+ return 1;
+ }
+ else
+ {
+ return e1.getName().compareTo( e2.getName() );
+ }
+ }
+ else
+ {
+ if ( e2 == null )
+ {
+ return 0;
+ }
+ else
+ {
+ return 1;
+ }
+ }
+ }
+}
Added: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/ServerIdDecorator.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/ServerIdDecorator.java?rev=1685738&view=auto
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/ServerIdDecorator.java (added)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/ServerIdDecorator.java Tue Jun 16 08:57:47 2015
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.directory.studio.openldap.config.editor.wrappers;
+
+import org.apache.directory.studio.common.ui.TableDecorator;
+import org.apache.directory.studio.openldap.config.editor.dialogs.ServerIdDialog;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * A decorator for the ServerID table.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ServerIdDecorator extends TableDecorator<ServerIdWrapper>
+{
+ /**
+ * Create a new instance of ServerIdDecorator
+ * @param parentShell The parent Shell
+ */
+ public ServerIdDecorator( Shell parentShell )
+ {
+ setDialog( new ServerIdDialog( parentShell ) );
+ }
+
+ /**
+ * Construct the label for a ServerID. It can be a number in [0..999], or an URL
+ */
+ public String getText( Object element )
+ {
+ if ( element instanceof ServerIdWrapper )
+ {
+ String serverIdtext = ( ( ServerIdWrapper ) element ).toString();
+
+ return serverIdtext;
+ }
+
+ return super.getText( element );
+ };
+
+
+ /**
+ * Get the image. We have none (may be we could add one for URLs ?)
+ */
+ public Image getImage( Object element )
+ {
+ return null;
+ };
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int compare( ServerIdWrapper e1, ServerIdWrapper e2 )
+ {
+ if ( e1 != null )
+ {
+ return e1.compareTo( e2 );
+ }
+ else
+ {
+ if ( e2 == null )
+ {
+ return 0;
+ }
+ else
+ {
+ return 1;
+ }
+ }
+ }
+}
Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/ServerIdWrapper.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/ServerIdWrapper.java?rev=1685738&r1=1685737&r2=1685738&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/ServerIdWrapper.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/ServerIdWrapper.java Tue Jun 16 08:57:47 2015
@@ -41,6 +41,13 @@ public class ServerIdWrapper implements
/**
* Creates a new instance of ServerIdWrapper.
+ */
+ public ServerIdWrapper()
+ {
+ }
+
+ /**
+ * Creates a new instance of ServerIdWrapper.
*
* @param serverId the serverID
*/
Added: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/SsDecorator.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/SsDecorator.java?rev=1685738&view=auto
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/SsDecorator.java (added)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/SsDecorator.java Tue Jun 16 08:57:47 2015
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.directory.studio.openldap.config.editor.wrappers;
+
+import org.apache.directory.studio.common.ui.TableDecorator;
+import org.apache.directory.studio.openldap.config.editor.dialogs.SsfDialog;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * A decorator for the SsfWrapper table.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class SsDecorator extends TableDecorator<SsfWrapper>
+{
+ /**
+ * Create a new instance of SsfDecorator
+ * @param parentShell The parent Shell
+ */
+ public SsDecorator( Shell parentShell )
+ {
+ setDialog( new SsfDialog( parentShell ) );
+ }
+
+ /**
+ * Construct the label for a TCPBuffer. It can be one of :
+ *
+ */
+ public String getText( Object element )
+ {
+ if ( element instanceof SsfWrapper )
+ {
+ String ssfText = ( ( SsfWrapper ) element ).toString();
+
+ return ssfText;
+ }
+
+ return super.getText( element );
+ };
+
+
+ /**
+ * Get the image. We have none (may be we could add one for URLs ?)
+ */
+ public Image getImage( Object element )
+ {
+ return null;
+ };
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int compare( SsfWrapper e1, SsfWrapper e2 )
+ {
+ if ( e1 != null )
+ {
+ return e1.compareTo( e2 );
+ }
+ else
+ {
+ if ( e2 == null )
+ {
+ return 0;
+ }
+ else
+ {
+ return 1;
+ }
+ }
+ }
+}
Added: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/TcpBufferDecorator.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/TcpBufferDecorator.java?rev=1685738&view=auto
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/TcpBufferDecorator.java (added)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/TcpBufferDecorator.java Tue Jun 16 08:57:47 2015
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.directory.studio.openldap.config.editor.wrappers;
+
+import org.apache.directory.studio.common.ui.TableDecorator;
+import org.apache.directory.studio.openldap.config.editor.dialogs.TcpBufferDialog;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * A decorator for the TcpBuffer table.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class TcpBufferDecorator extends TableDecorator<TcpBufferWrapper>
+{
+ /**
+ * Create a new instance of TcpBufferDecorator
+ * @param parentShell The parent Shell
+ */
+ public TcpBufferDecorator( Shell parentShell )
+ {
+ setDialog( new TcpBufferDialog( parentShell ) );
+ }
+
+ /**
+ * Construct the label for a TCPBuffer.
+ *
+ */
+ public String getText( Object element )
+ {
+ if ( element instanceof TcpBufferWrapper )
+ {
+ String tcpBufferText = ( ( TcpBufferWrapper ) element ).toString();
+
+ return tcpBufferText;
+ }
+
+ return super.getText( element );
+ };
+
+
+ /**
+ * Get the image. We have none (may be we could add one for URLs ?)
+ */
+ public Image getImage( Object element )
+ {
+ return null;
+ };
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int compare( TcpBufferWrapper e1, TcpBufferWrapper e2 )
+ {
+ if ( e1 != null )
+ {
+ return e1.compareTo( e2 );
+ }
+ else
+ {
+ if ( e2 == null )
+ {
+ return 0;
+ }
+ else
+ {
+ return 1;
+ }
+ }
+ }
+}