directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r525855 - in /directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration: editor/ model/
Date Thu, 05 Apr 2007 16:22:51 GMT
Author: pamarcelot
Date: Thu Apr  5 09:22:49 2007
New Revision: 525855

URL: http://svn.apache.org/viewvc?view=rev&rev=525855
Log:
Added the Extended Operations Page.

Added:
    directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ExtendedOperationDetailsPage.java
    directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ExtendedOperationsMasterDetailsBlock.java
    directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/model/ExtendedOperation.java
Modified:
    directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ExtendedOperationsPage.java
    directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/InterceptorsMasterDetailsBlock.java

Added: directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ExtendedOperationDetailsPage.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ExtendedOperationDetailsPage.java?view=auto&rev=525855
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ExtendedOperationDetailsPage.java
(added)
+++ directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ExtendedOperationDetailsPage.java
Thu Apr  5 09:22:49 2007
@@ -0,0 +1,196 @@
+/*
+ *  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.ldapstudio.apacheds.configuration.editor;
+
+
+import org.apache.directory.ldapstudio.apacheds.configuration.model.ExtendedOperation;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.IDetailsPage;
+import org.eclipse.ui.forms.IFormPart;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+
+
+/**
+ * This class represents the Details Page of the Server Configuration Editor for the Extended
Operation type
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ExtendedOperationDetailsPage implements IDetailsPage
+{
+    /** The Managed Form */
+    private IManagedForm mform;
+
+    /** The input Interceptor */
+    private ExtendedOperation input;
+
+    // UI fields
+    private Text classTypeText;
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.forms.IDetailsPage#createContents(org.eclipse.swt.widgets.Composite)
+     */
+    public void createContents( Composite parent )
+    {
+        FormToolkit toolkit = mform.getToolkit();
+        TableWrapLayout layout = new TableWrapLayout();
+        layout.topMargin = 5;
+        layout.leftMargin = 5;
+        layout.rightMargin = 2;
+        layout.bottomMargin = 2;
+        parent.setLayout( layout );
+
+        createDetailsSection( parent, toolkit );
+    }
+
+
+    /**
+     * Creates the Details Section
+     *
+     * @param parent
+     *      the parent composite
+     * @param toolkit
+     *      the toolkit to use
+     */
+    private void createDetailsSection( Composite parent, FormToolkit toolkit )
+    {
+        Section section = toolkit.createSection( parent, Section.DESCRIPTION | Section.TITLE_BAR
);
+        section.marginWidth = 10;
+        section.setText( "Extended Operation Details" ); //$NON-NLS-1$
+        section.setDescription( "Set the properties of the extended operation." ); //$NON-NLS-1$
+        TableWrapData td = new TableWrapData( TableWrapData.FILL, TableWrapData.TOP );
+        td.grabHorizontal = true;
+        section.setLayoutData( td );
+        Composite client = toolkit.createComposite( section );
+        toolkit.paintBordersFor( client );
+        GridLayout glayout = new GridLayout( 3, false );
+        client.setLayout( glayout );
+        section.setClient( client );
+
+        // Class
+        toolkit.createLabel( client, "Class:" );
+        classTypeText = toolkit.createText( client, "" );
+        classTypeText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 2, 1
) );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.forms.IPartSelectionListener#selectionChanged(org.eclipse.ui.forms.IFormPart,
org.eclipse.jface.viewers.ISelection)
+     */
+    public void selectionChanged( IFormPart part, ISelection selection )
+    {
+        IStructuredSelection ssel = ( IStructuredSelection ) selection;
+        if ( ssel.size() == 1 )
+        {
+            input = ( ExtendedOperation ) ssel.getFirstElement();
+        }
+        else
+        {
+            input = null;
+        }
+        refresh();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.forms.IFormPart#commit(boolean)
+     */
+    public void commit( boolean onSave )
+    {
+        input.setClassType( classTypeText.getText() );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.forms.IFormPart#dispose()
+     */
+    public void dispose()
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.forms.IFormPart#initialize(org.eclipse.ui.forms.IManagedForm)
+     */
+    public void initialize( IManagedForm form )
+    {
+        this.mform = form;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.forms.IFormPart#isDirty()
+     */
+    public boolean isDirty()
+    {
+        // TODO Auto-generated method stub
+        return true;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.forms.IFormPart#isStale()
+     */
+    public boolean isStale()
+    {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.forms.IFormPart#refresh()
+     */
+    public void refresh()
+    {
+        classTypeText.setText( input.getClassType() );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.forms.IFormPart#setFocus()
+     */
+    public void setFocus()
+    {
+        classTypeText.setFocus();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.forms.IFormPart#setFormInput(java.lang.Object)
+     */
+    public boolean setFormInput( Object input )
+    {
+        return false;
+    }
+}

Added: directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ExtendedOperationsMasterDetailsBlock.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ExtendedOperationsMasterDetailsBlock.java?view=auto&rev=525855
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ExtendedOperationsMasterDetailsBlock.java
(added)
+++ directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ExtendedOperationsMasterDetailsBlock.java
Thu Apr  5 09:22:49 2007
@@ -0,0 +1,170 @@
+/*
+ *  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.ldapstudio.apacheds.configuration.editor;
+
+
+import org.apache.directory.ldapstudio.apacheds.configuration.Activator;
+import org.apache.directory.ldapstudio.apacheds.configuration.PluginConstants;
+import org.apache.directory.ldapstudio.apacheds.configuration.model.ExtendedOperation;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.ui.forms.DetailsPart;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.MasterDetailsBlock;
+import org.eclipse.ui.forms.SectionPart;
+import org.eclipse.ui.forms.editor.FormPage;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+
+
+/**
+ * This class represents the Extended Operations Master/Details Block used in the Extended
Operations Page.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ExtendedOperationsMasterDetailsBlock extends MasterDetailsBlock
+{
+    /** The associated page */
+    private FormPage page;
+
+
+    /**
+     * Creates a new instance of ExtendedOperationsMasterDetailsBlock.
+     *
+     * @param page
+     */
+    public ExtendedOperationsMasterDetailsBlock( FormPage page )
+    {
+        this.page = page;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.forms.MasterDetailsBlock#createMasterPart(org.eclipse.ui.forms.IManagedForm,
org.eclipse.swt.widgets.Composite)
+     */
+    protected void createMasterPart( final IManagedForm managedForm, Composite parent )
+    {
+        FormToolkit toolkit = managedForm.getToolkit();
+
+        // Creating the Section
+        Section section = toolkit.createSection( parent, Section.TITLE_BAR );
+        section.setText( "All Extended Operations" );
+        section.marginWidth = 10;
+        section.marginHeight = 5;
+        Composite client = toolkit.createComposite( section, SWT.WRAP );
+        GridLayout layout = new GridLayout();
+        layout.numColumns = 2;
+        layout.marginWidth = 2;
+        layout.marginHeight = 2;
+        client.setLayout( layout );
+        toolkit.paintBordersFor( client );
+        section.setClient( client );
+
+        // Creatig the Table and Table Viewer
+        Table table = toolkit.createTable( client, SWT.NULL );
+        GridData gd = new GridData( GridData.FILL_BOTH );
+        gd.heightHint = 20;
+        gd.widthHint = 100;
+        table.setLayoutData( gd );
+        final SectionPart spart = new SectionPart( section );
+        managedForm.addPart( spart );
+        TableViewer viewer = new TableViewer( table );
+        viewer.addSelectionChangedListener( new ISelectionChangedListener()
+        {
+            public void selectionChanged( SelectionChangedEvent event )
+            {
+                managedForm.fireSelectionChanged( spart, event.getSelection() );
+            }
+        } );
+        viewer.setContentProvider( new ArrayContentProvider() );
+        viewer.setLabelProvider( new LabelProvider() );
+        viewer
+            .setInput( new Object[]
+                {
+                    new ExtendedOperation( "org.apache.directory.server.ldap.support.extended.GracefulShutdownHandler"
),
+                    new ExtendedOperation(
+                        "org.apache.directory.server.ldap.support.extended.LaunchDiagnosticUiHandler"
) } );
+
+        // Creating the button(s)
+        Button b = toolkit.createButton( client, "Add...", SWT.PUSH ); //$NON-NLS-1$
+        gd = new GridData( GridData.VERTICAL_ALIGN_BEGINNING );
+        b.setLayoutData( gd );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.forms.MasterDetailsBlock#createToolBarActions(org.eclipse.ui.forms.IManagedForm)
+     */
+    protected void createToolBarActions( IManagedForm managedForm )
+    {
+        final ScrolledForm form = managedForm.getForm();
+
+        // Horizontal layout Action
+        Action horizontalAction = new Action( "Horizontal layout", Action.AS_RADIO_BUTTON
) { //$NON-NLS-1$
+            public void run()
+            {
+                sashForm.setOrientation( SWT.HORIZONTAL );
+                form.reflow( true );
+            }
+        };
+        horizontalAction.setChecked( true );
+        horizontalAction.setToolTipText( "Horizontal Orientation" ); //$NON-NLS-1$
+        horizontalAction.setImageDescriptor( Activator.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+            PluginConstants.IMG_HORIZONTAL_ORIENTATION ) );
+
+        // Vertical layout Action
+        Action verticalAction = new Action( "Vertical Orientation", Action.AS_RADIO_BUTTON
) { //$NON-NLS-1$
+            public void run()
+            {
+                sashForm.setOrientation( SWT.VERTICAL );
+                form.reflow( true );
+            }
+        };
+        verticalAction.setChecked( false );
+        verticalAction.setToolTipText( "Vertical Orientation" ); //$NON-NLS-1$
+        verticalAction.setImageDescriptor( Activator.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+            PluginConstants.IMG_VERTICAL_ORIENTATION ) );
+
+        form.getToolBarManager().add( horizontalAction );
+        form.getToolBarManager().add( verticalAction );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.forms.MasterDetailsBlock#registerPages(org.eclipse.ui.forms.DetailsPart)
+     */
+    protected void registerPages( DetailsPart detailsPart )
+    {
+        detailsPart.registerPage( ExtendedOperation.class, new ExtendedOperationDetailsPage()
);
+    }
+
+}

Modified: directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ExtendedOperationsPage.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ExtendedOperationsPage.java?view=diff&rev=525855&r1=525854&r2=525855
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ExtendedOperationsPage.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ExtendedOperationsPage.java
Thu Apr  5 09:22:49 2007
@@ -40,6 +40,9 @@
     /** The Page Title */
     private static final String TITLE = "Extended Operations";
 
+    /** The Master/Details Block */
+    private ExtendedOperationsMasterDetailsBlock masterDetailsBlock;
+
 
     /**
      * Creates a new instance of ExtendedOperationsPage.
@@ -50,6 +53,7 @@
     public ExtendedOperationsPage( FormEditor editor )
     {
         super( editor, ID, TITLE );
+        masterDetailsBlock = new ExtendedOperationsMasterDetailsBlock( this );
     }
 
 
@@ -60,5 +64,6 @@
     {
         final ScrolledForm form = managedForm.getForm();
         form.setText( "Extended Operations" );
+        masterDetailsBlock.createContent( managedForm );
     }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/InterceptorsMasterDetailsBlock.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/InterceptorsMasterDetailsBlock.java?view=diff&rev=525855&r1=525854&r2=525855
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/InterceptorsMasterDetailsBlock.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/InterceptorsMasterDetailsBlock.java
Thu Apr  5 09:22:49 2007
@@ -23,7 +23,6 @@
 import org.apache.directory.ldapstudio.apacheds.configuration.Activator;
 import org.apache.directory.ldapstudio.apacheds.configuration.PluginConstants;
 import org.apache.directory.ldapstudio.apacheds.configuration.model.Interceptor;
-import org.apache.directory.ldapstudio.apacheds.configuration.model.Partition;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.viewers.ArrayContentProvider;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -47,7 +46,7 @@
 
 
 /**
- * This class represents the Interceptors Master/Details Block used in the Partitions Page.
+ * This class represents the Interceptors Master/Details Block used in the Interceptors Page.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$

Added: directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/model/ExtendedOperation.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/model/ExtendedOperation.java?view=auto&rev=525855
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/model/ExtendedOperation.java
(added)
+++ directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/model/ExtendedOperation.java
Thu Apr  5 09:22:49 2007
@@ -0,0 +1,78 @@
+/*
+ *  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.ldapstudio.apacheds.configuration.model;
+
+
+/**
+ * This class represents an Extended Operation.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ExtendedOperation
+{
+    /** The class of the partition */
+    private String classType;
+
+
+    /**
+     * Creates a new instance of Partition.
+     *
+     * @param classType
+     *      the classType of the partition
+     */
+    public ExtendedOperation( String classType )
+    {
+        this.classType = classType;
+    }
+
+
+    /**
+     * Gets the class type of the partition.
+     *
+     * @return
+     *      the class type of the partition
+     */
+    public String getClassType()
+    {
+        return this.classType;
+    }
+
+
+    /**
+     * Sets the class type of the partition.
+     *
+     * @param classType
+     *      the new class type to set
+     */
+    public void setClassType( String classType )
+    {
+        this.classType = classType;
+    }
+
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#toString()
+     */
+    public String toString()
+    {
+        return classType;
+    }
+}



Mime
View raw message