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/07/10 00:38:31 UTC
svn commit: r1690183 - in
/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor:
dialogs/ pages/ wrappers/
Author: elecharny
Date: Thu Jul 9 22:38:30 2015
New Revision: 1690183
URL: http://svn.apache.org/r1690183
Log:
o The Tuning page was using a single value for the olcTimeLimit parameter, when it's a MV attribute. Replaced by a Table
o Refactored the TimeLimit/SizeLimit and the associated classes (wrapper, dialog, decorator) to be able to use them in a TableWidget
o Some Javadoc fixes
Added:
directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/LimitDecorator.java
directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/LimitWrapper.java
directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/TimeLimitDecorator.java
Modified:
directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/AbstractLimitDialog.java
directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/SizeLimitDialog.java
directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/StringValueDialog.java
directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/TimeLimitDialog.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/AbstractLimitWrapper.java
directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/SizeLimitWrapper.java
directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/SsfDecorator.java
directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/TimeLimitWrapper.java
Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/AbstractLimitDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/AbstractLimitDialog.java?rev=1690183&r1=1690182&r2=1690183&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/AbstractLimitDialog.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/AbstractLimitDialog.java Thu Jul 9 22:38:30 2015
@@ -20,10 +20,11 @@
package org.apache.directory.studio.openldap.config.editor.dialogs;
import org.apache.directory.api.util.Strings;
+import org.apache.directory.studio.common.ui.AddEditDialog;
import org.apache.directory.studio.openldap.config.editor.wrappers.AbstractLimitWrapper;
+import org.apache.directory.studio.openldap.config.editor.wrappers.LimitWrapper;
import org.apache.directory.studio.openldap.config.editor.wrappers.SizeLimitWrapper;
import org.apache.directory.studio.openldap.config.editor.wrappers.TimeLimitWrapper;
-import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
@@ -42,7 +43,7 @@ import org.eclipse.swt.widgets.Text;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public abstract class AbstractLimitDialog extends Dialog
+public abstract class AbstractLimitDialog<E> extends AddEditDialog<E>
{
// UI widgets
/** The SoftLimit Text and checkboxes */
@@ -64,8 +65,8 @@ public abstract class AbstractLimitDialo
/** The modified Limit, as a String */
protected String newLimitStr;
- /** The wrapper (either time or size) used to store tghe parameters */
- protected AbstractLimitWrapper limitWrapper;
+ /** The wrapper (either time or size) used to store the parameters */
+ //protected AbstractLimitWrapper limitWrapper;
/**
@@ -201,6 +202,7 @@ public abstract class AbstractLimitDialo
// The possible values are : 'unlimited' | 'none' | INT | -1
String softLimitStr = softLimitText.getText();
+ LimitWrapper limitWrapper = ((LimitWrapper)getEditedElement());
if ( Strings.isEmpty( softLimitStr ) )
{
@@ -288,6 +290,7 @@ public abstract class AbstractLimitDialo
// The possible values are : 'unlimited' | 'none' | 'soft' | INT | -1
String hardLimitStr = hardLimitText.getText();
+ LimitWrapper limitWrapper = (LimitWrapper)getEditedElement();
if ( Strings.isEmpty( hardLimitStr ) )
{
@@ -370,7 +373,8 @@ public abstract class AbstractLimitDialo
// The possible values are : 'unlimited' | 'none' | INT | -1
String globalLimitStr = globalLimitText.getText();
-
+ LimitWrapper limitWrapper = (LimitWrapper)getEditedElement();
+
if ( Strings.isEmpty( globalLimitStr ) )
{
// Check the case we don't have anything
@@ -428,6 +432,7 @@ public abstract class AbstractLimitDialo
{
Display display = softLimitText.getDisplay();
Button okButton = getButton( IDialogConstants.OK_ID );
+ LimitWrapper limitWrapper = (LimitWrapper)getEditedElement();
if ( softUnlimitedCheckbox.getSelection() )
{
@@ -464,6 +469,7 @@ public abstract class AbstractLimitDialo
{
Display display = hardLimitText.getDisplay();
Button okButton = getButton( IDialogConstants.OK_ID );
+ LimitWrapper limitWrapper = (LimitWrapper)getEditedElement();
if ( hardUnlimitedCheckbox.getSelection() )
{
@@ -495,6 +501,7 @@ public abstract class AbstractLimitDialo
{
Display display = hardLimitText.getDisplay();
Button okButton = getButton( IDialogConstants.OK_ID );
+ LimitWrapper limitWrapper = (LimitWrapper)getEditedElement();
if ( hardSoftCheckbox.getSelection() )
{
@@ -544,6 +551,7 @@ public abstract class AbstractLimitDialo
{
Display display = globalLimitText.getDisplay();
Button okButton = getButton( IDialogConstants.OK_ID );
+ LimitWrapper limitWrapper = (LimitWrapper)getEditedElement();
if ( globalUnlimitedCheckbox.getSelection() )
{
@@ -569,7 +577,7 @@ public abstract class AbstractLimitDialo
*/
protected void okPressed()
{
- newLimitStr = limitWrapper.toString();
+ newLimitStr = getEditedElement().toString();
super.okPressed();
}
@@ -586,8 +594,10 @@ public abstract class AbstractLimitDialo
/**
* Initializes the UI from the Limit
*/
- protected void initFromLimit()
+ protected void initDialog()
{
+ LimitWrapper limitWrapper = (LimitWrapper)getEditedElement();
+
if ( limitWrapper != null )
{
// The SoftLimit
Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/SizeLimitDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/SizeLimitDialog.java?rev=1690183&r1=1690182&r2=1690183&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/SizeLimitDialog.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/SizeLimitDialog.java Thu Jul 9 22:38:30 2015
@@ -38,6 +38,7 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
+import org.apache.directory.studio.openldap.config.editor.wrappers.LimitWrapper;
import org.apache.directory.studio.openldap.config.editor.wrappers.SizeLimitWrapper;
@@ -92,7 +93,7 @@ import org.apache.directory.studio.openl
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class SizeLimitDialog extends AbstractLimitDialog
+public class SizeLimitDialog extends AbstractLimitDialog<SizeLimitWrapper>
{
/** The UncheckedLimit Text and checkboxes */
private Text uncheckedLimitText;
@@ -133,7 +134,7 @@ public class SizeLimitDialog extends Abs
super( parentShell );
super.setShellStyle( super.getShellStyle() | SWT.RESIZE );
- limitWrapper = new SizeLimitWrapper( sizeLimitStr );
+ setEditedElement( new SizeLimitWrapper( sizeLimitStr ) );
}
@@ -260,23 +261,25 @@ public class SizeLimitDialog extends Abs
return;
}
+ SizeLimitWrapper sizeLimitWrapper = (SizeLimitWrapper)getEditedElement();
+
// The possible values are : 'unlimited' | 'none' | 'disabled' | INT
String uncheckedLimitStr = uncheckedLimitText.getText();
if ( Strings.isEmpty( uncheckedLimitStr ) )
{
// Check the case we don't have anything
- ((SizeLimitWrapper)limitWrapper).setUncheckedLimit( null );
+ sizeLimitWrapper.setUncheckedLimit( null );
}
else if ( SizeLimitWrapper.UNLIMITED_STR.equalsIgnoreCase( uncheckedLimitStr ) ||
SizeLimitWrapper.NONE_STR.equalsIgnoreCase( uncheckedLimitStr ) )
{
- ((SizeLimitWrapper)limitWrapper).setUncheckedLimit( SizeLimitWrapper.UNLIMITED );
+ sizeLimitWrapper.setUncheckedLimit( SizeLimitWrapper.UNLIMITED );
unlimited = true;
}
else if ( SizeLimitWrapper.DISABLED_STR.equalsIgnoreCase( uncheckedLimitStr ) )
{
- ((SizeLimitWrapper)limitWrapper).setUncheckedLimit( SizeLimitWrapper.PR_DISABLED );
+ sizeLimitWrapper.setUncheckedLimit( SizeLimitWrapper.PR_DISABLED );
disabled = true;
}
else
@@ -293,17 +296,17 @@ public class SizeLimitDialog extends Abs
}
else if ( value == SizeLimitWrapper.UNLIMITED )
{
- ((SizeLimitWrapper)limitWrapper).setUncheckedLimit( SizeLimitWrapper.UNLIMITED );
+ sizeLimitWrapper.setUncheckedLimit( SizeLimitWrapper.UNLIMITED );
unlimited = true;
}
else if ( value == SizeLimitWrapper.UC_DISABLED )
{
- ((SizeLimitWrapper)limitWrapper).setUncheckedLimit( SizeLimitWrapper.UC_DISABLED );
+ sizeLimitWrapper.setUncheckedLimit( SizeLimitWrapper.UC_DISABLED );
disabled = true;
}
else
{
- ((SizeLimitWrapper)limitWrapper).setUncheckedLimit( value );
+ sizeLimitWrapper.setUncheckedLimit( value );
}
}
catch ( NumberFormatException nfe )
@@ -316,7 +319,7 @@ public class SizeLimitDialog extends Abs
uncheckedLimitText.setForeground( display.getSystemColor( color ) );
uncheckedUnlimitedCheckbox.setSelection( unlimited );
uncheckedDisabledCheckbox.setSelection( disabled );
- limitText.setText( limitWrapper.toString() );
+ limitText.setText( getEditedElement().toString() );
okButton.setEnabled( isValid() );
}
};
@@ -340,18 +343,20 @@ public class SizeLimitDialog extends Abs
return;
}
+ SizeLimitWrapper sizeLimitWrapper = (SizeLimitWrapper)getEditedElement();
+
// The possible values are : 'unlimited' | 'none' | 'noEstimate' | INT
String prLimitStr = prLimitText.getText();
if ( Strings.isEmpty( prLimitStr ) )
{
// Check the case we don't have anything
- ((SizeLimitWrapper)limitWrapper).setPrLimit( null );
+ sizeLimitWrapper.setPrLimit( null );
}
else if ( SizeLimitWrapper.UNLIMITED_STR.equalsIgnoreCase( prLimitStr ) ||
SizeLimitWrapper.NONE_STR.equalsIgnoreCase( prLimitStr ) )
{
- ((SizeLimitWrapper)limitWrapper).setPrLimit( SizeLimitWrapper.UNLIMITED );
+ sizeLimitWrapper.setPrLimit( SizeLimitWrapper.UNLIMITED );
unlimited = true;
}
else
@@ -368,12 +373,12 @@ public class SizeLimitDialog extends Abs
}
else if ( value == SizeLimitWrapper.UNLIMITED )
{
- ((SizeLimitWrapper)limitWrapper).setPrLimit( SizeLimitWrapper.UNLIMITED );
+ sizeLimitWrapper.setPrLimit( SizeLimitWrapper.UNLIMITED );
unlimited = true;
}
else
{
- ((SizeLimitWrapper)limitWrapper).setPrLimit( value );
+ sizeLimitWrapper.setPrLimit( value );
}
}
catch ( NumberFormatException nfe )
@@ -385,7 +390,7 @@ public class SizeLimitDialog extends Abs
prLimitText.setForeground( display.getSystemColor( color ) );
prUnlimitedCheckbox.setSelection( unlimited );
- limitText.setText( limitWrapper.toString() );
+ limitText.setText( getEditedElement().toString() );
okButton.setEnabled( isValid() );
}
};
@@ -413,28 +418,30 @@ public class SizeLimitDialog extends Abs
return;
}
+ SizeLimitWrapper sizeLimitWrapper = (SizeLimitWrapper)getEditedElement();
+
// The possible values are : 'unlimited' | 'none' | 'disabled' | 'hard' | INT
String prTotalLimitStr = prTotalLimitText.getText();
if ( Strings.isEmpty( prTotalLimitStr ) )
{
// Check the case we don't have anything
- ((SizeLimitWrapper)limitWrapper).setPrTotalLimit( null );
+ sizeLimitWrapper.setPrTotalLimit( null );
}
else if ( SizeLimitWrapper.UNLIMITED_STR.equalsIgnoreCase( prTotalLimitStr ) ||
SizeLimitWrapper.NONE_STR.equalsIgnoreCase( prTotalLimitStr ) )
{
- ((SizeLimitWrapper)limitWrapper).setPrTotalLimit( SizeLimitWrapper.UNLIMITED );
+ sizeLimitWrapper.setPrTotalLimit( SizeLimitWrapper.UNLIMITED );
unlimited = true;
}
else if ( SizeLimitWrapper.HARD_STR.equalsIgnoreCase( prTotalLimitStr ) )
{
- ((SizeLimitWrapper)limitWrapper).setPrTotalLimit( SizeLimitWrapper.PR_HARD );
+ sizeLimitWrapper.setPrTotalLimit( SizeLimitWrapper.PR_HARD );
hard = true;
}
else if ( SizeLimitWrapper.DISABLED_STR.equalsIgnoreCase( prTotalLimitStr ) )
{
- ((SizeLimitWrapper)limitWrapper).setPrTotalLimit( SizeLimitWrapper.PR_DISABLED );
+ sizeLimitWrapper.setPrTotalLimit( SizeLimitWrapper.PR_DISABLED );
disabled = true;
}
else
@@ -451,21 +458,21 @@ public class SizeLimitDialog extends Abs
}
else if ( value == SizeLimitWrapper.PR_DISABLED )
{
- ((SizeLimitWrapper)limitWrapper).setPrTotalLimit( SizeLimitWrapper.PR_DISABLED );
+ sizeLimitWrapper.setPrTotalLimit( SizeLimitWrapper.PR_DISABLED );
disabled = true;
}
else if ( value == SizeLimitWrapper.UNLIMITED )
{
- ((SizeLimitWrapper)limitWrapper).setPrTotalLimit( SizeLimitWrapper.UNLIMITED );
+ sizeLimitWrapper.setPrTotalLimit( SizeLimitWrapper.UNLIMITED );
unlimited = true;
}
else if ( value == SizeLimitWrapper.PR_HARD )
{
- ((SizeLimitWrapper)limitWrapper).setPrTotalLimit( SizeLimitWrapper.PR_HARD );
+ sizeLimitWrapper.setPrTotalLimit( SizeLimitWrapper.PR_HARD );
}
else
{
- ((SizeLimitWrapper)limitWrapper).setPrTotalLimit( value );
+ sizeLimitWrapper.setPrTotalLimit( value );
}
}
catch ( NumberFormatException nfe )
@@ -479,7 +486,7 @@ public class SizeLimitDialog extends Abs
prTotalUnlimitedCheckbox.setSelection( unlimited );
prTotalDisabledCheckbox.setSelection( disabled );
prTotalHardCheckbox.setSelection( hard );
- limitText.setText( limitWrapper.toString() );
+ limitText.setText( getEditedElement().toString() );
okButton.setEnabled( isValid() );
}
};
@@ -495,20 +502,22 @@ public class SizeLimitDialog extends Abs
Display display = uncheckedLimitText.getDisplay();
Button okButton = getButton( IDialogConstants.OK_ID );
+ SizeLimitWrapper sizeLimitWrapper = (SizeLimitWrapper)getEditedElement();
+
if ( uncheckedUnlimitedCheckbox.getSelection() )
{
uncheckedLimitText.setText( SizeLimitWrapper.UNLIMITED_STR );
uncheckedDisabledCheckbox.setSelection( false );
- ((SizeLimitWrapper)limitWrapper).setUncheckedLimit( SizeLimitWrapper.UNLIMITED );
+ sizeLimitWrapper.setUncheckedLimit( SizeLimitWrapper.UNLIMITED );
}
else
{
uncheckedLimitText.setText( "" );
- ((SizeLimitWrapper)limitWrapper).setUncheckedLimit( null );
+ sizeLimitWrapper.setUncheckedLimit( null );
}
uncheckedLimitText.setForeground( display.getSystemColor( SWT.COLOR_BLACK ) );
- limitText.setText( limitWrapper.toString() );
+ limitText.setText( getEditedElement().toString() );
okButton.setEnabled( isValid() );
}
};
@@ -524,20 +533,22 @@ public class SizeLimitDialog extends Abs
Display display = uncheckedLimitText.getDisplay();
Button okButton = getButton( IDialogConstants.OK_ID );
+ SizeLimitWrapper sizeLimitWrapper = (SizeLimitWrapper)getEditedElement();
+
if ( uncheckedDisabledCheckbox.getSelection() )
{
uncheckedLimitText.setText( SizeLimitWrapper.DISABLED_STR );
uncheckedUnlimitedCheckbox.setSelection( false );
- ((SizeLimitWrapper)limitWrapper).setUncheckedLimit( SizeLimitWrapper.UC_DISABLED );
+ sizeLimitWrapper.setUncheckedLimit( SizeLimitWrapper.UC_DISABLED );
}
else
{
uncheckedLimitText.setText( "" );
- ((SizeLimitWrapper)limitWrapper).setUncheckedLimit( null );
+ sizeLimitWrapper.setUncheckedLimit( null );
}
uncheckedLimitText.setForeground( display.getSystemColor( SWT.COLOR_BLACK ) );
- limitText.setText( limitWrapper.toString() );
+ limitText.setText( getEditedElement().toString() );
okButton.setEnabled( isValid() );
}
};
@@ -553,19 +564,21 @@ public class SizeLimitDialog extends Abs
Display display = prLimitText.getDisplay();
Button okButton = getButton( IDialogConstants.OK_ID );
+ SizeLimitWrapper sizeLimitWrapper = (SizeLimitWrapper)getEditedElement();
+
if ( prUnlimitedCheckbox.getSelection() )
{
prLimitText.setText( SizeLimitWrapper.UNLIMITED_STR );
- ((SizeLimitWrapper)limitWrapper).setPrLimit( SizeLimitWrapper.UNLIMITED );
+ sizeLimitWrapper.setPrLimit( SizeLimitWrapper.UNLIMITED );
}
else
{
prLimitText.setText( "" );
- ((SizeLimitWrapper)limitWrapper).setPrLimit( null );
+ sizeLimitWrapper.setPrLimit( null );
}
prLimitText.setForeground( display.getSystemColor( SWT.COLOR_BLACK ) );
- limitText.setText( limitWrapper.toString() );
+ limitText.setText( getEditedElement().toString() );
okButton.setEnabled( isValid() );
}
};
@@ -580,8 +593,10 @@ public class SizeLimitDialog extends Abs
{
Button okButton = getButton( IDialogConstants.OK_ID );
- ((SizeLimitWrapper)limitWrapper).setNoEstimate( prNoEstimateCheckbox.getSelection() );
- limitText.setText( limitWrapper.toString() );
+ SizeLimitWrapper sizeLimitWrapper = (SizeLimitWrapper)getEditedElement();
+
+ sizeLimitWrapper.setNoEstimate( prNoEstimateCheckbox.getSelection() );
+ limitText.setText( getEditedElement().toString() );
okButton.setEnabled( isValid() );
}
};
@@ -597,21 +612,23 @@ public class SizeLimitDialog extends Abs
Display display = prTotalLimitText.getDisplay();
Button okButton = getButton( IDialogConstants.OK_ID );
+ SizeLimitWrapper sizeLimitWrapper = (SizeLimitWrapper)getEditedElement();
+
if ( prTotalUnlimitedCheckbox.getSelection() )
{
prTotalLimitText.setText( SizeLimitWrapper.UNLIMITED_STR );
- ((SizeLimitWrapper)limitWrapper).setPrTotalLimit( SizeLimitWrapper.UNLIMITED );
+ sizeLimitWrapper.setPrTotalLimit( SizeLimitWrapper.UNLIMITED );
}
else
{
prTotalLimitText.setText( "" );
- ((SizeLimitWrapper)limitWrapper).setPrTotalLimit( null );
+ sizeLimitWrapper.setPrTotalLimit( null );
}
prTotalLimitText.setForeground( display.getSystemColor( SWT.COLOR_BLACK ) );
prTotalDisabledCheckbox.setSelection( false );
prTotalHardCheckbox.setSelection( false );
- limitText.setText( limitWrapper.toString() );
+ limitText.setText( getEditedElement().toString() );
okButton.setEnabled( isValid() );
}
};
@@ -627,21 +644,23 @@ public class SizeLimitDialog extends Abs
Display display = prTotalLimitText.getDisplay();
Button okButton = getButton( IDialogConstants.OK_ID );
+ SizeLimitWrapper sizeLimitWrapper = (SizeLimitWrapper)getEditedElement();
+
if ( prTotalDisabledCheckbox.getSelection() )
{
prTotalLimitText.setText( SizeLimitWrapper.DISABLED_STR );
- ((SizeLimitWrapper)limitWrapper).setPrTotalLimit( SizeLimitWrapper.PR_DISABLED );
+ sizeLimitWrapper.setPrTotalLimit( SizeLimitWrapper.PR_DISABLED );
}
else
{
prTotalLimitText.setText( "" );
- ((SizeLimitWrapper)limitWrapper).setPrTotalLimit( null );
+ sizeLimitWrapper.setPrTotalLimit( null );
}
prTotalLimitText.setForeground( display.getSystemColor( SWT.COLOR_BLACK ) );
prTotalUnlimitedCheckbox.setSelection( false );
prTotalHardCheckbox.setSelection( false );
- limitText.setText( limitWrapper.toString() );
+ limitText.setText( getEditedElement().toString() );
okButton.setEnabled( isValid() );
}
};
@@ -657,6 +676,8 @@ public class SizeLimitDialog extends Abs
Display display = prTotalLimitText.getDisplay();
Button okButton = getButton( IDialogConstants.OK_ID );
+ SizeLimitWrapper sizeLimitWrapper = (SizeLimitWrapper)getEditedElement();
+
if ( prTotalHardCheckbox.getSelection() )
{
String hardStr = hardLimitText.getText();
@@ -670,12 +691,12 @@ public class SizeLimitDialog extends Abs
prTotalLimitText.setText( SizeLimitWrapper.HARD_STR );
}
- ((SizeLimitWrapper)limitWrapper).setPrTotalLimit( SizeLimitWrapper.PR_HARD );
+ sizeLimitWrapper.setPrTotalLimit( SizeLimitWrapper.PR_HARD );
}
else
{
prTotalLimitText.setText( "" );
- ((SizeLimitWrapper)limitWrapper).setPrTotalLimit( null );
+ sizeLimitWrapper.setPrTotalLimit( null );
}
if ( isValid() )
@@ -691,7 +712,7 @@ public class SizeLimitDialog extends Abs
prTotalUnlimitedCheckbox.setSelection( false );
prTotalDisabledCheckbox.setSelection( false );
- limitText.setText( limitWrapper.toString() );
+ limitText.setText( getEditedElement().toString() );
}
};
@@ -743,8 +764,9 @@ public class SizeLimitDialog extends Abs
createSizeLimitEditGroup( composite );
createSizeLimitShowGroup( composite );
- initFromLimit();
-
+ initDialog();
+ addListeners();
+
applyDialogFont( composite );
return composite;
@@ -785,11 +807,9 @@ public class SizeLimitDialog extends Abs
// SoftLimit Text
BaseWidgetUtils.createLabel( sizeLimitGroup, "Soft Limit :", 1 );
softLimitText = BaseWidgetUtils.createText( sizeLimitGroup, "", 1 );
- softLimitText.addModifyListener( softLimitTextListener );
// Soft Limit unlimited checkbox Button
softUnlimitedCheckbox = BaseWidgetUtils.createCheckbox( sizeLimitGroup, "Unlimited", 2 );
- softUnlimitedCheckbox.addSelectionListener( softUnlimitedCheckboxSelectionListener );
// 4 tabs to fill the line
BaseWidgetUtils.createLabel( sizeLimitGroup, "", 4 );
@@ -798,15 +818,12 @@ public class SizeLimitDialog extends Abs
// HardLimit Text
BaseWidgetUtils.createLabel( sizeLimitGroup, "Hard Limit :", 1 );
hardLimitText = BaseWidgetUtils.createText( sizeLimitGroup, "", 1 );
- hardLimitText.addModifyListener( hardLimitTextListener );
// Hard Limit unlimited checkbox Button
hardUnlimitedCheckbox = BaseWidgetUtils.createCheckbox( sizeLimitGroup, "Unlimited", 2 );
- hardUnlimitedCheckbox.addSelectionListener( hardUnlimitedCheckboxSelectionListener );
// HardLimit soft checkbox Button
hardSoftCheckbox = BaseWidgetUtils.createCheckbox( sizeLimitGroup, "Soft", 2 );
- hardSoftCheckbox.addSelectionListener( hardSoftCheckboxSelectionListener );
// 2 tabs to fill the line
BaseWidgetUtils.createLabel( sizeLimitGroup, "", 2 );
@@ -815,11 +832,9 @@ public class SizeLimitDialog extends Abs
// GlobalLimit Text
BaseWidgetUtils.createLabel( sizeLimitGroup, "Global Limit :", 1 );
globalLimitText = BaseWidgetUtils.createText( sizeLimitGroup, "", 1 );
- globalLimitText.addModifyListener( globalLimitTextListener );
// GLobal Limit unlimited checkbox Button
globalUnlimitedCheckbox = BaseWidgetUtils.createCheckbox( sizeLimitGroup, "Unlimited", 2 );
- globalUnlimitedCheckbox.addSelectionListener( globalUnlimitedCheckboxSelectionListener );
// 4 tabs to fill the line
BaseWidgetUtils.createLabel( sizeLimitGroup, "", 4 );
@@ -828,15 +843,12 @@ public class SizeLimitDialog extends Abs
// Unchecked Text
BaseWidgetUtils.createLabel( sizeLimitGroup, "Unchecked Limit :", 1 );
uncheckedLimitText = BaseWidgetUtils.createText( sizeLimitGroup, "", 1 );
- uncheckedLimitText.addModifyListener( uncheckedLimitTextListener );
// Unchecked Limit unlimited checkbox Button
uncheckedUnlimitedCheckbox = BaseWidgetUtils.createCheckbox( sizeLimitGroup, "Unlimited", 2 );
- uncheckedUnlimitedCheckbox.addSelectionListener( uncheckedUnlimitedCheckboxSelectionListener );
// Unchecked Limit unlimited checkbox Button
uncheckedDisabledCheckbox = BaseWidgetUtils.createCheckbox( sizeLimitGroup, "Disabled", 2 );
- uncheckedDisabledCheckbox.addSelectionListener( uncheckedDisabledCheckboxSelectionListener );
// 2 tabs to fill the line
BaseWidgetUtils.createLabel( sizeLimitGroup, "", 2 );
@@ -845,15 +857,12 @@ public class SizeLimitDialog extends Abs
// Paged Results Search Text
BaseWidgetUtils.createLabel( sizeLimitGroup, "Paged Results Limit :", 1 );
prLimitText = BaseWidgetUtils.createText( sizeLimitGroup, "", 1 );
- prLimitText.addModifyListener( prLimitTextListener );
// Paged Results Limit unlimited checkbox Button
prUnlimitedCheckbox = BaseWidgetUtils.createCheckbox( sizeLimitGroup, "Unlimited", 2 );
- prUnlimitedCheckbox.addSelectionListener( prUnlimitedCheckboxSelectionListener );
// Paged Results Limit noEstimate checkbox Button
prNoEstimateCheckbox = BaseWidgetUtils.createCheckbox( sizeLimitGroup, "No Estimate", 2 );
- prNoEstimateCheckbox.addSelectionListener( prNoEstimateCheckboxSelectionListener );
// 2 tabs to fill the line
BaseWidgetUtils.createLabel( sizeLimitGroup, "", 2 );
@@ -862,19 +871,15 @@ public class SizeLimitDialog extends Abs
// Paged Results Search Text
BaseWidgetUtils.createLabel( sizeLimitGroup, "Paged Results Total :", 1 );
prTotalLimitText = BaseWidgetUtils.createText( sizeLimitGroup, "", 1 );
- prTotalLimitText.addModifyListener( prTotalLimitTextListener );
// Paged Results Limit unlimited checkbox Button
prTotalUnlimitedCheckbox = BaseWidgetUtils.createCheckbox( sizeLimitGroup, "Unlimited", 2 );
- prTotalUnlimitedCheckbox.addSelectionListener( prTotalUnlimitedCheckboxSelectionListener );
// Paged Results Limit disabled checkbox Button
prTotalDisabledCheckbox = BaseWidgetUtils.createCheckbox( sizeLimitGroup, "Disabled", 2 );
- prTotalDisabledCheckbox.addSelectionListener( prTotalDisabledCheckboxSelectionListener );
// Paged Results Limit hard checkbox Button
prTotalHardCheckbox = BaseWidgetUtils.createCheckbox( sizeLimitGroup, "Hard", 2 );
- prTotalHardCheckbox.addSelectionListener( prTotalHardCheckboxSelectionListener );
}
@@ -907,14 +912,41 @@ public class SizeLimitDialog extends Abs
/**
+ * Adds listeners.
+ */
+ private void addListeners()
+ {
+ softLimitText.addModifyListener( softLimitTextListener );
+ softUnlimitedCheckbox.addSelectionListener( softUnlimitedCheckboxSelectionListener );
+ hardLimitText.addModifyListener( hardLimitTextListener );
+ hardUnlimitedCheckbox.addSelectionListener( hardUnlimitedCheckboxSelectionListener );
+ hardSoftCheckbox.addSelectionListener( hardSoftCheckboxSelectionListener );
+ globalLimitText.addModifyListener( globalLimitTextListener );
+ globalUnlimitedCheckbox.addSelectionListener( globalUnlimitedCheckboxSelectionListener );
+ uncheckedLimitText.addModifyListener( uncheckedLimitTextListener );
+ uncheckedUnlimitedCheckbox.addSelectionListener( uncheckedUnlimitedCheckboxSelectionListener );
+ uncheckedDisabledCheckbox.addSelectionListener( uncheckedDisabledCheckboxSelectionListener );
+ prLimitText.addModifyListener( prLimitTextListener );
+ prUnlimitedCheckbox.addSelectionListener( prUnlimitedCheckboxSelectionListener );
+ prNoEstimateCheckbox.addSelectionListener( prNoEstimateCheckboxSelectionListener );
+ prTotalLimitText.addModifyListener( prTotalLimitTextListener );
+ prTotalUnlimitedCheckbox.addSelectionListener( prTotalUnlimitedCheckboxSelectionListener );
+ prTotalDisabledCheckbox.addSelectionListener( prTotalDisabledCheckboxSelectionListener );
+ prTotalHardCheckbox.addSelectionListener( prTotalHardCheckboxSelectionListener );
+ }
+
+
+ /**
* Initializes the UI from the Limit
*/
- protected void initFromLimit()
+ protected void initDialog()
{
- super.initFromLimit();
+ super.initDialog();
// Deal with specific SizeLimit fields
- if ( limitWrapper != null )
+ LimitWrapper limitWrapper = (LimitWrapper)getEditedElement();
+
+ if ( getEditedElement() != null )
{
SizeLimitWrapper sizeLimitWrapper = (SizeLimitWrapper)limitWrapper;
@@ -1008,4 +1040,11 @@ public class SizeLimitDialog extends Abs
}
}
}
+
+
+ @Override
+ public void addNewElement()
+ {
+ setEditedElement( new SizeLimitWrapper( "" ) );
+ }
}
Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/StringValueDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/StringValueDialog.java?rev=1690183&r1=1690182&r2=1690183&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/StringValueDialog.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/StringValueDialog.java Thu Jul 9 22:38:30 2015
@@ -68,11 +68,11 @@ public class StringValueDialog extends A
*
* @param parentShell The parent Shell
*/
- public StringValueDialog( Shell parentShell, String atttributeName )
+ public StringValueDialog( Shell parentShell, String attributeName )
{
super( parentShell );
super.setShellStyle( super.getShellStyle() | SWT.RESIZE );
- this.attributeName = atttributeName;
+ this.attributeName = attributeName;
}
Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/TimeLimitDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/TimeLimitDialog.java?rev=1690183&r1=1690182&r2=1690183&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/TimeLimitDialog.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/dialogs/TimeLimitDialog.java Thu Jul 9 22:38:30 2015
@@ -72,7 +72,7 @@ import org.apache.directory.studio.openl
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class TimeLimitDialog extends AbstractLimitDialog
+public class TimeLimitDialog extends AbstractLimitDialog<TimeLimitWrapper>
{
/**
* Create a new instance of the TimeLimitDialog
@@ -97,7 +97,7 @@ public class TimeLimitDialog extends Abs
super( parentShell );
super.setShellStyle( super.getShellStyle() | SWT.RESIZE );
- limitWrapper = new TimeLimitWrapper( timeLimitStr );
+ setEditedElement( new TimeLimitWrapper( timeLimitStr ) );
}
@@ -142,10 +142,11 @@ public class TimeLimitDialog extends Abs
createTimeLimitEditGroup( composite );
createTimeLimitShowGroup( composite );
- initFromLimit();
+ initDialog();
+ addListeners();
applyDialogFont( composite );
-
+
return composite;
}
@@ -177,11 +178,9 @@ public class TimeLimitDialog extends Abs
// SoftLimit Text
BaseWidgetUtils.createLabel( timeLimitGroup, "Soft Limit :", 1 );
softLimitText = BaseWidgetUtils.createText( timeLimitGroup, "", 1 );
- softLimitText.addModifyListener( softLimitTextListener );
// Soft Limit unlimited checkbox Button
softUnlimitedCheckbox = BaseWidgetUtils.createCheckbox( timeLimitGroup, "Unlimited", 2 );
- softUnlimitedCheckbox.addSelectionListener( softUnlimitedCheckboxSelectionListener );
// 2 tabs to fill the line
BaseWidgetUtils.createLabel( timeLimitGroup, "", 2 );
@@ -189,24 +188,19 @@ public class TimeLimitDialog extends Abs
// HardLimit Text
BaseWidgetUtils.createLabel( timeLimitGroup, "Hard Limit :", 1 );
hardLimitText = BaseWidgetUtils.createText( timeLimitGroup, "", 1 );
- hardLimitText.addModifyListener( hardLimitTextListener );
// Hard Limit unlimited checkbox Button
hardUnlimitedCheckbox = BaseWidgetUtils.createCheckbox( timeLimitGroup, "Unlimited", 2 );
- hardUnlimitedCheckbox.addSelectionListener( hardUnlimitedCheckboxSelectionListener );
// HardLimit soft checkbox Button
hardSoftCheckbox = BaseWidgetUtils.createCheckbox( timeLimitGroup, "Soft", 2 );
- hardSoftCheckbox.addSelectionListener( hardSoftCheckboxSelectionListener );
// GlobalLimit Text
BaseWidgetUtils.createLabel( timeLimitGroup, "Global Limit :", 1 );
globalLimitText = BaseWidgetUtils.createText( timeLimitGroup, "", 1 );
- globalLimitText.addModifyListener( globalLimitTextListener );
// GLobal Limit unlimited checkbox Button
globalUnlimitedCheckbox = BaseWidgetUtils.createCheckbox( timeLimitGroup, "Unlimited", 2 );
- globalUnlimitedCheckbox.addSelectionListener( globalUnlimitedCheckboxSelectionListener );
// 2 tabs to fill the line
BaseWidgetUtils.createLabel( timeLimitGroup, "", 2 );
@@ -239,4 +233,26 @@ public class TimeLimitDialog extends Abs
limitText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
limitText.setEditable( false );
}
+
+
+ /**
+ * Adds listeners.
+ */
+ private void addListeners()
+ {
+ softLimitText.addModifyListener( softLimitTextListener );
+ softUnlimitedCheckbox.addSelectionListener( softUnlimitedCheckboxSelectionListener );
+ hardLimitText.addModifyListener( hardLimitTextListener );
+ hardUnlimitedCheckbox.addSelectionListener( hardUnlimitedCheckboxSelectionListener );
+ hardSoftCheckbox.addSelectionListener( hardSoftCheckboxSelectionListener );
+ globalLimitText.addModifyListener( globalLimitTextListener );
+ globalUnlimitedCheckbox.addSelectionListener( globalUnlimitedCheckboxSelectionListener );
+ }
+
+
+ @Override
+ public void addNewElement()
+ {
+ setEditedElement( new TimeLimitWrapper( "" ) );
+ }
}
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=1690183&r1=1690182&r2=1690183&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 Thu Jul 9 22:38:30 2015
@@ -46,12 +46,17 @@ import org.apache.directory.studio.commo
import org.apache.directory.studio.common.ui.widgets.TableWidget;
import org.apache.directory.studio.common.ui.widgets.WidgetModifyEvent;
import org.apache.directory.studio.common.ui.widgets.WidgetModifyListener;
+import org.apache.directory.studio.common.ui.wrappers.StringValueWrapper;
+import org.apache.directory.studio.openldap.common.ui.model.RequireConditionEnum;
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.SizeLimitDialog;
import org.apache.directory.studio.openldap.config.editor.dialogs.TimeLimitDialog;
+import org.apache.directory.studio.openldap.config.editor.wrappers.LimitWrapper;
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.TimeLimitDecorator;
+import org.apache.directory.studio.openldap.config.editor.wrappers.TimeLimitWrapper;
import org.apache.directory.studio.openldap.config.model.OlcGlobal;
@@ -119,9 +124,12 @@ import org.apache.directory.studio.openl
* | | Idle Timeout :â[ââââââ]â | |âSubany Indices Length â:â[ââââââ]â| |
* | | Size Limit : [ ] (Edit) | |âSubany Indices Step â :â[ââââââ]â| |
* | | Time Limit : [ ] (Edit) | |âSub indices Max length :â[ââââââ]â| |
- * | | | |âSub indices Min length :â[ââââââ]â| |
- * | +-------------------------------------+ +-------------------------------------+ |
- * | |
+ * | |â+-----------------------+âââââââââââ| |âSub indices Min length :â[ââââââ]â| |
+ * | |â|âxyzâââââââââââââââââââ|â(Add)âââââ| +-------------------------------------+ |
+ * | |â|âabcâââââââââââââââââââ|â(Edit)ââââ| |
+ * | |â|âââââââââââââââââââââââ|â(Delete)ââ| |
+ * | |â+-----------------------+âââââââââââ| |
+ * | +-------------------------------------+ |
* +---------------------------------------------------------------------------------+
* </pre>
*
@@ -171,11 +179,8 @@ public class TuningPage extends OpenLDAP
/** The SizeLimit edit Button */
private Button sizeLimitEditButton;
- /** The olcTimeLimit */
- private Text timeLimitText;
-
/** The TimeLimit edit Button */
- private Button timeLimitEditButton;
+ private TableWidget<TimeLimitWrapper> timeLimitTableViewer;
/** The olcWriteTimeout */
private Text writeTimeoutText;
@@ -692,27 +697,18 @@ public class TuningPage extends OpenLDAP
};
- /**
- * The listener for the timeLimit Text
- */
- private SelectionListener timeLimitEditSelectionListener = new SelectionAdapter()
+ private WidgetModifyListener timeLimitTableListener = new WidgetModifyListener()
{
- public void widgetSelected( SelectionEvent e )
+ public void widgetModified( WidgetModifyEvent e )
{
- TimeLimitDialog dialog = new TimeLimitDialog( timeLimitText.getShell(), timeLimitText.getText() );
-
- if ( dialog.open() == OverlayDialog.OK )
+ List<String> timeLimits = new ArrayList<String>();
+
+ for ( LimitWrapper limitWrapper : timeLimitTableViewer.getElements() )
{
- String newTimeLimitStr = dialog.getNewLimit();
-
- if ( newTimeLimitStr != null )
- {
- timeLimitText.setText( newTimeLimitStr );
- List<String> timeLimitList = new ArrayList<String>();
- timeLimitList.add( newTimeLimitStr );
- getConfiguration().getGlobal().setOlcTimeLimit( timeLimitList );
- }
+ timeLimits.add( limitWrapper.toString() );
}
+
+ getConfiguration().getGlobal().setOlcTimeLimit( timeLimits );
}
};
@@ -969,7 +965,12 @@ public class TuningPage extends OpenLDAP
* | Write Timeout :â[ââââââ]â|
* | Idle Timeout :â[ââââââ]â|
* | Size Limit : [ ] |
- * | Time Limit : [ ] |
+ * | Time Limit : |
+ * |â+-----------------------+âââââââââââ|
+ * |â|âxyzâââââââââââââââââââ|â(Add)âââââ|
+ * |â|âabcâââââââââââââââââââ|â(Edit)ââââ|
+ * |â|âââââââââââââââââââââââ|â(Delete)ââ|
+ * |â+-----------------------+âââââââââââ|
* | |
* +-------------------------------------+
* </pre>
@@ -992,8 +993,8 @@ public class TuningPage extends OpenLDAP
writeTimeoutText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, false, false ) );
// Attach a listener to check the value
writeTimeoutText.addModifyListener( writeTimeoutTextListener );
- toolkit.createLabel( ldapLimitSectionComposite, "" );
- toolkit.createLabel( ldapLimitSectionComposite, "" );
+ //toolkit.createLabel( ldapLimitSectionComposite, "" );
+ //toolkit.createLabel( ldapLimitSectionComposite, "" );
// The olcIdleTimeout parameter.
toolkit.createLabel( ldapLimitSectionComposite,
@@ -1002,30 +1003,39 @@ public class TuningPage extends OpenLDAP
idleTimeoutText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, false, false ) );
// Attach a listener to check the value
idleTimeoutText.addModifyListener( idleTimeoutTextListener );
- toolkit.createLabel( ldapLimitSectionComposite, "" );
- toolkit.createLabel( ldapLimitSectionComposite, "" );
+ //toolkit.createLabel( ldapLimitSectionComposite, "" );
+ //toolkit.createLabel( ldapLimitSectionComposite, "" );
// The olcSizeLimit parameter.
toolkit.createLabel( ldapLimitSectionComposite,
Messages.getString( "OpenLDAPTuningPage.SizeLimit" ) ); //$NON-NLS-1$
sizeLimitText = toolkit.createText( ldapLimitSectionComposite, "" );
- GridData sizeLimitData= new GridData( SWT.FILL, SWT.NONE, false, false, 2, 1 );
+ GridData sizeLimitData= new GridData( SWT.FILL, SWT.NONE, false, false, 1, 1 );
sizeLimitData.horizontalAlignment = SWT.FILL;
Rectangle rect = sizeLimitText.getShell().getMonitor().getClientArea();
- sizeLimitData.widthHint = rect.width/8;
+ sizeLimitData.widthHint = rect.width/12;
sizeLimitText.setLayoutData(sizeLimitData );
sizeLimitText.setEditable( false );
-
// The SizeLimit edit button
sizeLimitEditButton = BaseWidgetUtils.createButton( ldapLimitSectionComposite,
Messages.getString( "OpenLDAPSecurityPage.Edit" ), 1 ); //$NON-NLS-1$
sizeLimitEditButton.setLayoutData( new GridData( SWT.RIGHT, SWT.CENTER, false, false ) );
sizeLimitEditButton.addSelectionListener( sizeLimitEditSelectionListener );
+ toolkit.createLabel( ldapLimitSectionComposite, "" );
// The olcTimeLimit parameter.
toolkit.createLabel( ldapLimitSectionComposite,
Messages.getString( "OpenLDAPTuningPage.TimeLimit" ) ); //$NON-NLS-1$
+ timeLimitTableViewer = new TableWidget<TimeLimitWrapper>( new TimeLimitDecorator( ldapLimitSectionComposite.getShell() ) );
+
+ timeLimitTableViewer.createWidgetWithEdit( ldapLimitSectionComposite, toolkit );
+ timeLimitTableViewer.getControl().setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 4, 1 ) );
+ timeLimitTableViewer.addWidgetModifyListener( timeLimitTableListener );
+
+ /*
+ toolkit.createLabel( ldapLimitSectionComposite,
+ Messages.getString( "OpenLDAPTuningPage.TimeLimit" ) ); //$NON-NLS-1$
timeLimitText = toolkit.createText( ldapLimitSectionComposite, "" );
timeLimitText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 2, 1 ) );
timeLimitText.setEditable( false );
@@ -1035,6 +1045,7 @@ public class TuningPage extends OpenLDAP
Messages.getString( "OpenLDAPSecurityPage.Edit" ), 1 );
timeLimitEditButton.setLayoutData( new GridData( SWT.RIGHT, SWT.CENTER, false, false ) );
timeLimitEditButton.addSelectionListener( timeLimitEditSelectionListener );
+ */
}
@@ -1189,14 +1200,16 @@ public class TuningPage extends OpenLDAP
// TimeLimit Text Text
List<String> timeLimitList = getConfiguration().getGlobal().getOlcTimeLimit();
-
+ List<TimeLimitWrapper> limitWrappers = new ArrayList<TimeLimitWrapper>();
+
if ( ( timeLimitList != null ) && ( timeLimitList.size() > 0 ) )
{
- timeLimitText.setText( timeLimitList.get( 0 ) );
- }
- else
- {
- timeLimitText.setText( "" );
+ for ( String timeLimit : timeLimitList )
+ {
+ limitWrappers.add( new TimeLimitWrapper( timeLimit ) );
+ }
+
+ timeLimitTableViewer.setElements( limitWrappers );
}
}
@@ -1226,7 +1239,7 @@ public class TuningPage extends OpenLDAP
addDirtyListener( writeTimeoutText );
addDirtyListener( idleTimeoutText);
addDirtyListener( sizeLimitText );
- addDirtyListener( timeLimitText );
+ addDirtyListener( timeLimitTableViewer );
}
@@ -1252,6 +1265,6 @@ public class TuningPage extends OpenLDAP
removeDirtyListener( writeTimeoutText );
removeDirtyListener( idleTimeoutText);
removeDirtyListener( sizeLimitText );
- removeDirtyListener( timeLimitText );
+ removeDirtyListener( timeLimitTableViewer );
}
}
Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/AbstractLimitWrapper.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/AbstractLimitWrapper.java?rev=1690183&r1=1690182&r2=1690183&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/AbstractLimitWrapper.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/AbstractLimitWrapper.java Thu Jul 9 22:38:30 2015
@@ -24,7 +24,7 @@ package org.apache.directory.studio.open
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public abstract class AbstractLimitWrapper
+public abstract class AbstractLimitWrapper implements LimitWrapper, Comparable<LimitWrapper>
{
/** The global limit */
protected Integer globalLimit;
@@ -34,19 +34,10 @@ public abstract class AbstractLimitWrapp
/** The hard limit */
protected Integer hardLimit;
-
- // Define some of the used constants
- public static final Integer HARD_SOFT = Integer.valueOf( -3 );
- public static final Integer UNLIMITED = Integer.valueOf( -1 );
-
- public static final String HARD_STR = "hard";
- public static final String NONE_STR = "none";
- public static final String SOFT_STR = "soft";
- public static final String UNLIMITED_STR = "unlimited";
/**
- * Create a LimitWrapper instance
+ * Create a AbstractLimitWrapper instance
*/
public AbstractLimitWrapper()
{
@@ -54,7 +45,7 @@ public abstract class AbstractLimitWrapp
/**
- * Create a SizeLimitWrapper instance
+ * Create an AbstractLimitWrapper instance
*
* @param globalLimit The global limit
* @param hardLimit The hard limit
@@ -160,12 +151,6 @@ public abstract class AbstractLimitWrapp
/**
- * @return The Limit's type
- */
- protected abstract String getType();
-
-
- /**
* @see Object#toString()
*/
public String toString()
@@ -296,4 +281,18 @@ public abstract class AbstractLimitWrapp
return sb.toString();
}
+
+
+ /**
+ * @see Comparable#compareTo()
+ */
+ public int compareTo( LimitWrapper that )
+ {
+ if ( that == null )
+ {
+ return 1;
+ }
+
+ return toString().compareTo( that.toString() );
+ }
}
Added: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/LimitDecorator.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/LimitDecorator.java?rev=1690183&view=auto
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/LimitDecorator.java (added)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/LimitDecorator.java Thu Jul 9 22:38:30 2015
@@ -0,0 +1,56 @@
+/*
+ * 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.eclipse.swt.graphics.Image;
+
+/**
+ * A decorator for the TimeLimitWrapper class.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public abstract class LimitDecorator<E> extends TableDecorator<E>
+{
+ /**
+ * Construct the label for a TimeLimit. It can be one of :
+ *
+ */
+ public String getText( Object element )
+ {
+ if ( element instanceof LimitWrapper )
+ {
+ String limitText = ( ( LimitWrapper ) element ).toString();
+
+ return limitText;
+ }
+
+ 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;
+ };
+}
Added: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/LimitWrapper.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/LimitWrapper.java?rev=1690183&view=auto
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/LimitWrapper.java (added)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/LimitWrapper.java Thu Jul 9 22:38:30 2015
@@ -0,0 +1,85 @@
+/*
+ * 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;
+
+/**
+ * An interface for the TimeLimitWrapper and SizeLimitWrapper
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public interface LimitWrapper
+{
+ // Define some of the used constants
+ public static final Integer HARD_SOFT = Integer.valueOf( -3 );
+ public static final Integer UNLIMITED = Integer.valueOf( -1 );
+
+ public static final String HARD_STR = "hard";
+ public static final String NONE_STR = "none";
+ public static final String SOFT_STR = "soft";
+ public static final String UNLIMITED_STR = "unlimited";
+
+
+ /**
+ * Clear the TimeLimitWrapper (reset all the values to null)
+ */
+ void clear();
+
+
+ /**
+ * @return the globalLimit
+ */
+ Integer getGlobalLimit();
+
+
+ /**
+ * @param globalLimit the globalLimit to set
+ */
+ void setGlobalLimit( Integer globalLimit );
+
+
+ /**
+ * @return the softLimit
+ */
+ Integer getSoftLimit();
+
+
+ /**
+ * @param softLimit the softLimit to set
+ */
+ void setSoftLimit( Integer softLimit );
+
+
+ /**
+ * @return the hardLimit
+ */
+ Integer getHardLimit();
+
+
+ /**
+ * @param hardLimit the hardLimit to set
+ */
+ void setHardLimit( Integer hardLimit );
+
+
+ /**
+ * @return The Limit's type
+ */
+ String getType();
+}
Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/SizeLimitWrapper.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/SizeLimitWrapper.java?rev=1690183&r1=1690182&r2=1690183&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/SizeLimitWrapper.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/SizeLimitWrapper.java Thu Jul 9 22:38:30 2015
@@ -644,7 +644,7 @@ public class SizeLimitWrapper extends Ab
/**
* @return The Limit's type
*/
- protected String getType()
+ public String getType()
{
return "size";
}
Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/SsfDecorator.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/SsfDecorator.java?rev=1690183&r1=1690182&r2=1690183&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/SsfDecorator.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/SsfDecorator.java Thu Jul 9 22:38:30 2015
@@ -41,7 +41,7 @@ public class SsfDecorator extends TableD
}
/**
- * Construct the label for a TCPBuffer. It can be one of :
+ * Construct the label for a SSF. It can be one of :
*
*/
public String getText( Object element )
@@ -58,7 +58,7 @@ public class SsfDecorator extends TableD
/**
- * Get the image. We have none (may be we could add one for URLs ?)
+ * Get the image. We have none
*/
public Image getImage( Object element )
{
Added: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/TimeLimitDecorator.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/TimeLimitDecorator.java?rev=1690183&view=auto
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/TimeLimitDecorator.java (added)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/TimeLimitDecorator.java Thu Jul 9 22:38:30 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.TimeLimitDialog;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * A decorator for the TimeLimitWrapper class.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class TimeLimitDecorator extends TableDecorator<TimeLimitWrapper>
+{
+ /**
+ * Create a new instance of TImeLimitDecorator
+ * @param parentShell The parent Shell
+ */
+ public TimeLimitDecorator( Shell parentShell )
+ {
+ setDialog( new TimeLimitDialog( parentShell ) );
+ }
+
+ /**
+ * Construct the label for a TimeLimit. It can be one of :
+ *
+ */
+ public String getText( Object element )
+ {
+ if ( element instanceof TimeLimitWrapper )
+ {
+ String timeLimitText = ( ( TimeLimitWrapper ) element ).toString();
+
+ return timeLimitText;
+ }
+
+ 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( TimeLimitWrapper e1, TimeLimitWrapper 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/TimeLimitWrapper.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/TimeLimitWrapper.java?rev=1690183&r1=1690182&r2=1690183&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/TimeLimitWrapper.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/TimeLimitWrapper.java Thu Jul 9 22:38:30 2015
@@ -347,7 +347,7 @@ public class TimeLimitWrapper extends Ab
/**
* @return The Limit's type
*/
- protected String getType()
+ public String getType()
{
return "time";
}