Exemplo n.º 1
0
        public void Properties()
        {
            DragDropList b = new DragDropList();

            // default
            Assert.AreEqual("dragDropList", b.TagName, "A1");
            Assert.AreEqual(null, b.AcceptedDataTypes, "A2");
            Assert.AreEqual(null, b.DataType, "A3");
            Assert.AreEqual(RepeatDirection.Vertical, b.Direction, "A4");
            Assert.AreEqual(DragMode.Copy, b.DragMode, "A5");
            Assert.AreEqual(null, b.FloatContainerCssClass, "A6");
            Assert.AreEqual(HtmlTextWriterTag.Div, b.FloatContainerTag, "A7");

            // getter/setter
            b.AcceptedDataTypes = "foo";
            Assert.AreEqual("foo", b.AcceptedDataTypes, "A8");
            b.DataType = "DataType";
            Assert.AreEqual("DataType", b.DataType, "A9");
            b.Direction = RepeatDirection.Vertical;
            Assert.AreEqual(RepeatDirection.Vertical, b.Direction, "A10");
            b.FloatContainerCssClass = "cssclass";
            Assert.AreEqual("cssclass", b.FloatContainerCssClass, "A11");
            b.FloatContainerTag = HtmlTextWriterTag.Span;
            Assert.AreEqual(HtmlTextWriterTag.Span, b.FloatContainerTag, "A12");

            // null setter
            b.AcceptedDataTypes = null;
            Assert.AreEqual(null, b.AcceptedDataTypes, "A13");
            b.DataType = null;
            Assert.AreEqual(null, b.DataType, "A14");
            b.FloatContainerCssClass = null;
            Assert.AreEqual(null, b.FloatContainerCssClass, "A15");
        }
Exemplo n.º 2
0
        protected override void OnDragDataReceived(Gdk.DragContext context, int x, int y,
                                                   Gtk.SelectionData data, uint info, uint time)
        {
            try {
                if (final_drag_start_time != context.StartTime || final_drag_source == null)
                {
                    Gtk.Drag.Finish(context, false, false, time);
                    return;
                }

                Source drop_source = final_drag_source;

                if (final_drag_source == NewPlaylistSource)
                {
                    PlaylistSource playlist = new PlaylistSource(Catalog.GetString("New Playlist"),
                                                                 (new_playlist_parent as PrimarySource));
                    playlist.Save();
                    playlist.PrimarySource.AddChildSource(playlist);
                    drop_source = playlist;
                }

                if (data.Target.Name == Banshee.Gui.DragDrop.DragDropTarget.Source.Target)
                {
                    DragDropList <Source> sources = data;
                    if (sources.Count > 0)
                    {
                        drop_source.MergeSourceInput(sources[0], SourceMergeType.Source);
                    }
                }
                else if (data.Target.Name == Banshee.Gui.DragDrop.DragDropTarget.UriList.Target)
                {
                    foreach (string uri in DragDropUtilities.SplitSelectionData(data))
                    {
                        // TODO if we dropped onto a playlist, add ourselves
                        // to it after importing (or if already imported, find
                        // and add to playlist)
                        ServiceManager.Get <Banshee.Library.LibraryImportManager> ().Enqueue(uri);
                    }
                }
                else if (data.Target.Name == Hyena.Data.Gui.ListViewDragDropTarget.ModelSelection.Target)
                {
                    // If the drag source is not the track list, it's a filter list, and instead of
                    // only merging the track model's selected tracks, we should merge all the tracks
                    // currently matching the active filters.
                    bool from_filter = !(Gtk.Drag.GetSourceWidget(context) is Banshee.Collection.Gui.BaseTrackListView);
                    drop_source.MergeSourceInput(
                        ServiceManager.SourceManager.ActiveSource,
                        from_filter ? SourceMergeType.Source : SourceMergeType.ModelSelection
                        );
                }
                else
                {
                    Hyena.Log.DebugFormat("SourceView got unknown drag target type: {0}", data.Target.Name);
                }

                Gtk.Drag.Finish(context, true, false, time);
            } finally {
                HideNewPlaylistRow();
            }
        }
Exemplo n.º 3
0
        protected override Control GetEditControl(string PropName, object CurrentValue, object CurrentObj)
        {
            VariableFilterSelection w;
            ObjectWrapper           placeHolder = CurrentObj as ObjectWrapper;

            // DragDropList selectedElement = placeHolder.SelectedObject as DragDropList;
            if (placeHolder.SelectedObject is DragDropList)
            {
                DragDropList variablelist = placeHolder.SelectedObject as DragDropList;
                //Added by Aaron 10/10/2013
                //This ensures that the variable filer dialog is opened with the correct filter settings for the number of
                //ordinal and nominal levels
                w = new VariableFilterSelection(variablelist.nomlevels, variablelist.ordlevels);
            }
            else if (placeHolder.SelectedObject is BSkyGroupingVariable)
            {
                BSkyGroupingVariable grouplist = placeHolder.SelectedObject as BSkyGroupingVariable;
                w = new VariableFilterSelection(grouplist.nomlevels, grouplist.ordlevels);
            }
            else if (placeHolder.SelectedObject is BSkyAggregateCtrl)
            {
                BSkyAggregateCtrl agglist = placeHolder.SelectedObject as BSkyAggregateCtrl;
                w = new VariableFilterSelection(agglist.nomlevels, agglist.ordlevels);
            }

            else
            {
                BSkySortCtrl sortlist = placeHolder.SelectedObject as BSkySortCtrl;
                w = new VariableFilterSelection(sortlist.nomlevels, sortlist.ordlevels);
            }

            w.Filter = CurrentValue.ToString();
            return(w);
        }
Exemplo n.º 4
0
        public void IsTypeDescriptorClosed()
        {
            DragDropList         a    = new DragDropList();
            ScriptTypeDescriptor desc = ((IScriptObject)a).GetTypeDescriptor();

            desc.AddEvent(new ScriptEventDescriptor("testEvent", true));
        }
Exemplo n.º 5
0
        protected override object GetEditedValue(Control EditControl, string PropertyName, object oldValue, object currentObj)
        {
            ObjectWrapper placeHolder = currentObj as ObjectWrapper;

            if (placeHolder.SelectedObject is BSkyTextBox)
            {
                BSkyTextBox tb = placeHolder.SelectedObject as BSkyTextBox;
                //if (w.OverwriteVariables.is

                //tb.PromptforOverwrite=
                //w = new OverwriteSetting(tb.PromptforOverwrite);
            }
            else if (placeHolder.SelectedObject is DragDropList)
            {
                DragDropList dd = placeHolder.SelectedObject as DragDropList;
                //  w = new OverwriteSetting(dd.PromptforOverwrite);
            }

            if (EditControl is OverwriteSettings)
            {
                OverwriteSettings w = EditControl as OverwriteSettings;


                //tb.PrefixTxt = w.PrefixString.Text;
                FrameworkElement selectedElement = currentObj as FrameworkElement;
                if (w.DialogResult.HasValue && w.DialogResult.Value)
                {
                    return(w.OverwriteSetting);
                }
                return(oldValue);
            }
            return(false);
        }
Exemplo n.º 6
0
        public void TypeDescriptor()
        {
            DragDropList         a    = new DragDropList();
            ScriptTypeDescriptor desc = ((IScriptObject)a).GetTypeDescriptor();

            Assert.AreEqual(a, desc.ScriptObject, "A1");

            // events
            IEnumerable <ScriptEventDescriptor> events = desc.GetEvents();

            Assert.IsNotNull(events, "A2");

            IEnumerator <ScriptEventDescriptor> ee = events.GetEnumerator();

            Assert.IsTrue(ee.MoveNext(), "A3");
            DoEvent(ee.Current, "propertyChanged", true);
            Assert.IsFalse(ee.MoveNext(), "A4");

            // methods
            IEnumerable <ScriptMethodDescriptor> methods = desc.GetMethods();

            Assert.IsNotNull(methods, "A5");

            IEnumerator <ScriptMethodDescriptor> me = methods.GetEnumerator();

            Assert.IsFalse(me.MoveNext());

            // properties
            IEnumerable <ScriptPropertyDescriptor> props = desc.GetProperties();

            Assert.IsNotNull(props, "A6");

            IEnumerator <ScriptPropertyDescriptor> pe = props.GetEnumerator();

            Assert.IsTrue(pe.MoveNext(), "A7");
            DoProperty(pe.Current, "bindings", ScriptType.Array, true, "Bindings");
            Assert.IsTrue(pe.MoveNext(), "A8");
            DoProperty(pe.Current, "dataContext", ScriptType.Object, false, "");
            Assert.IsTrue(pe.MoveNext(), "A9");
            DoProperty(pe.Current, "id", ScriptType.String, false, "ID");
            Assert.IsTrue(pe.MoveNext(), "A9");
            DoProperty(pe.Current, "acceptedDataTypes", ScriptType.Array, false, "AcceptedDataTypes");
            Assert.IsTrue(pe.MoveNext(), "A10");
            DoProperty(pe.Current, "dataType", ScriptType.String, false, "DataType");
            Assert.IsTrue(pe.MoveNext(), "A11");
            DoProperty(pe.Current, "dragMode", ScriptType.Enum, false, "DragMode");
            Assert.IsTrue(pe.MoveNext(), "A12");
            DoProperty(pe.Current, "direction", ScriptType.Enum, false, "Direction");
            Assert.IsTrue(pe.MoveNext(), "A12");
            DoProperty(pe.Current, "dropCueTemplate", ScriptType.Object, false, "");
            Assert.IsTrue(pe.MoveNext(), "A13");
            DoProperty(pe.Current, "emptyTemplate", ScriptType.Object, false, "");
            Assert.IsTrue(pe.MoveNext(), "A14");
            DoProperty(pe.Current, "floatContainerTemplate", ScriptType.Object, false, "");
            Assert.IsFalse(pe.MoveNext(), "A15");
        }
Exemplo n.º 7
0
        public void Render()
        {
            DragDropList     b = new DragDropList();
            StringWriter     sw;
            ScriptTextWriter w;

            sw = new StringWriter();
            w  = new ScriptTextWriter(sw);
            ((IScriptComponent)b).RenderScript(w);

            Assert.AreEqual("", sw.ToString(), "A1");
        }
Exemplo n.º 8
0
        protected override Control GetEditControl(string PropName, object CurrentValue, object CurrentObj)
        {
            ObjectWrapper placeHolder = CurrentObj as ObjectWrapper;

            // DragDropList selectedElement = placeHolder.SelectedObject as DragDropList;
            if (placeHolder.SelectedObject is BSkyGroupingVariable)
            {
                BSkyGroupingVariable draglist = placeHolder.SelectedObject as BSkyGroupingVariable;
                SubstitutionSettings w        = new SubstitutionSettings(draglist.PrefixTxt, draglist.SepCharacter);
                w.SubstituteSettings = CurrentValue.ToString();
                return(w);
            }
            if (placeHolder.SelectedObject is BSkyAggregateCtrl)
            {
                BSkyAggregateCtrl    agglist = placeHolder.SelectedObject as BSkyAggregateCtrl;
                SubstitutionSettings w       = new SubstitutionSettings(agglist.PrefixTxt, agglist.SepCharacter);
                w.SubstituteSettings = CurrentValue.ToString();
                return(w);
            }

            if (placeHolder.SelectedObject is BSkySortCtrl)
            {
                BSkySortCtrl         sortlist = placeHolder.SelectedObject as BSkySortCtrl;
                SubstitutionSettings w        = new SubstitutionSettings(sortlist.PrefixTxt, sortlist.SepCharacter);
                w.SubstituteSettings = CurrentValue.ToString();
                return(w);
            }


            if (placeHolder.SelectedObject is DragDropList)
            {
                DragDropList         draglist = placeHolder.SelectedObject as DragDropList;
                SubstitutionSettings w        = new SubstitutionSettings(draglist.PrefixTxt, draglist.SepCharacter);
                w.SubstituteSettings = CurrentValue.ToString();
                return(w);
            }
            else if (placeHolder.SelectedObject is BSkyListBoxwBorderForDatasets)
            {
                BSkyListBoxwBorderForDatasets draglist = placeHolder.SelectedObject as BSkyListBoxwBorderForDatasets;
                SubsSettingsForDatasets       w        = new SubsSettingsForDatasets(draglist.PrefixTxt, draglist.SepCharacter);
                w.SubstituteSettings = CurrentValue.ToString();
                return(w);
            }
            return(null);
        }
Exemplo n.º 9
0
        protected override Control GetEditControl(string PropName, object CurrentValue, object CurrentObj)
        {
            OverwriteSettings w;
            ObjectWrapper     placeHolder = CurrentObj as ObjectWrapper;

            // DragDropList selectedElement = placeHolder.SelectedObject as DragDropList;

            if (placeHolder.SelectedObject is BSkyTextBox)
            {
                BSkyTextBox tb = placeHolder.SelectedObject as BSkyTextBox;
                w = new OverwriteSettings(tb.OverwriteSettings);
            }
            else
            {
                DragDropList dd = placeHolder.SelectedObject as DragDropList;
                w = new OverwriteSettings(dd.OverwriteSettings);
            }


            //if (CurrentValue == null) w.SubstituteSettings = "";
            //else
            //    w.SubstituteSettings = CurrentValue.ToString();
            return(w);
        }
Exemplo n.º 10
0
        protected override object GetEditedValue(Control EditControl, string PropertyName, object oldValue, object currentObj)
        {
            ObjectWrapper        placeHolder = currentObj as ObjectWrapper;
            double               result;
            DragDropList         variablelist = null;
            BSkyGroupingVariable grouplist    = null;
            BSkyAggregateCtrl    aggList      = null;
            BSkySortCtrl         sortList     = null;

            // This function is called by both the DragdropList and BSkyGroupingVariable controls
            //to get the filter value. The vale of number of ordinal and nominal levels are stored in
            //properties of the dragdroplist class to ensure that when the dialog is saved and opened again
            //the variable filter is populated with the saved values


            if (placeHolder.SelectedObject is DragDropList)
            {
                variablelist = placeHolder.SelectedObject as DragDropList;
            }
            else if (placeHolder.SelectedObject is BSkyGroupingVariable)
            {
                grouplist = placeHolder.SelectedObject as BSkyGroupingVariable;
            }
            else if (placeHolder.SelectedObject is BSkyAggregateCtrl)
            {
                aggList = placeHolder.SelectedObject as BSkyAggregateCtrl;
            }
            else
            {
                sortList = placeHolder.SelectedObject as BSkySortCtrl;
            }

            if (EditControl is VariableFilterSelection)
            {
                //Aaron 10/08/2013
                // I store the value ofthe number or levels I want an ordinal variable to have and the number of levels I want a nominal
                //variable to have as a property in dragdrop list
                //This is done so when I initialize the variable list, I can set the values correctly in the constructor
                VariableFilterSelection w = EditControl as VariableFilterSelection;
                if (w.chkordlevels.Text != "" && Double.TryParse(w.chkordlevels.Text, out result))
                {
                    if (placeHolder.SelectedObject is DragDropList)
                    {
                        variablelist.ordlevels = w.chkordlevels.Text;
                    }
                    else if (placeHolder.SelectedObject is BSkyAggregateCtrl)
                    {
                        aggList.ordlevels = w.chkordlevels.Text;
                    }
                    else if (placeHolder.SelectedObject is BSkySortCtrl)
                    {
                        sortList.ordlevels = w.chkordlevels.Text;
                    }
                    else if (placeHolder.SelectedObject is BSkyGroupingVariable)
                    {
                        grouplist.ordlevels = w.chkordlevels.Text;
                    }
                }
                //Aaron 10/08/2013
                // The else part handles the case where I have entered number of levels =5 and then when I bring up the variable filterdialog, I
                // reset the number of levels to blank.
                else
                {
                    if (placeHolder.SelectedObject is DragDropList)
                    {
                        variablelist.ordlevels = "";
                    }
                    else if (placeHolder.SelectedObject is BSkyGroupingVariable)
                    {
                        grouplist.ordlevels = "";
                    }
                    else if (placeHolder.SelectedObject is BSkyAggregateCtrl)
                    {
                        aggList.ordlevels = "";
                    }
                    else if (placeHolder.SelectedObject is BSkySortCtrl)
                    {
                        sortList.ordlevels = "";
                    }

                    //  else aggList.ordlevels = "";
                }
                if (w.chkNomlevels.Text != "" && Double.TryParse(w.chkNomlevels.Text, out result))
                {
                    if (placeHolder.SelectedObject is DragDropList)
                    {
                        variablelist.nomlevels = w.chkNomlevels.Text;
                    }
                    else if (placeHolder.SelectedObject is BSkyGroupingVariable)
                    {
                        grouplist.nomlevels = w.chkNomlevels.Text;
                    }

                    else if (placeHolder.SelectedObject is BSkyAggregateCtrl)
                    {
                        aggList.nomlevels = w.chkNomlevels.Text;
                    }
                    else if (placeHolder.SelectedObject is BSkySortCtrl)
                    {
                        sortList.nomlevels = w.chkNomlevels.Text;
                    }
                }
                //Aaron 10/08/2013
                // The else part handles the case where I have entered number of levels =5 and then when I bring up the variable filterdialog, I
                // reset the number of levels to blank.
                else
                {
                    if (placeHolder.SelectedObject is DragDropList)
                    {
                        variablelist.nomlevels = "";
                    }
                    else if (placeHolder.SelectedObject is BSkyGroupingVariable)
                    {
                        grouplist.nomlevels = "";
                    }
                    else if (placeHolder.SelectedObject is BSkyAggregateCtrl)
                    {
                        aggList.nomlevels = "";
                    }
                    else if (placeHolder.SelectedObject is BSkySortCtrl)
                    {
                        sortList.nomlevels = "";
                    }
                }
                //Added by Aaron:commented line below on 12/02/2013
                //  FrameworkElement selectedElement = placeHolder.SelectedObject as FrameworkElement;
                if (w.DialogResult.HasValue && w.DialogResult.Value)
                {
                    return(w.Filter);
                }
                return(oldValue);
            }
            return(false);
        }
Exemplo n.º 11
0
        protected override object GetEditedValue(Control EditControl, string PropertyName, object oldValue, object currentObj)
        {
            ObjectWrapper placeHolder = currentObj as ObjectWrapper;

            // DragDropList selectedElement = placeHolder.SelectedObject as DragDropList;

            if (placeHolder.SelectedObject is DragDropList)
            {
                DragDropList draglist = placeHolder.SelectedObject as DragDropList;
                if (EditControl is SubstitutionSettings)
                {
                    SubstitutionSettings w = EditControl as SubstitutionSettings;
                    draglist.PrefixTxt    = w.PrefixString.Text;
                    draglist.SepCharacter = w.SepCharacter.Text;
                    FrameworkElement selectedElement = currentObj as FrameworkElement;
                    if (w.DialogResult.HasValue && w.DialogResult.Value)
                    {
                        return(w.SubstituteSettings);
                    }
                    return(oldValue);
                }
                return(false);
            }
            else if (placeHolder.SelectedObject is BSkyListBoxwBorderForDatasets)
            {
                BSkyListBoxwBorderForDatasets draglist = placeHolder.SelectedObject as BSkyListBoxwBorderForDatasets;
                if (EditControl is SubsSettingsForDatasets)
                {
                    SubsSettingsForDatasets w = EditControl as SubsSettingsForDatasets;
                    draglist.PrefixTxt    = w.PrefixString.Text;
                    draglist.SepCharacter = w.SepCharacter.Text;
                    FrameworkElement selectedElement = currentObj as FrameworkElement;
                    if (w.DialogResult.HasValue && w.DialogResult.Value)
                    {
                        return(w.SubstituteSettings);
                    }
                    return(oldValue);
                }
                return(false);
            }
            if (placeHolder.SelectedObject is BSkyGroupingVariable)
            {
                BSkyGroupingVariable draglist = placeHolder.SelectedObject as BSkyGroupingVariable;
                if (EditControl is SubstitutionSettings)
                {
                    SubstitutionSettings w = EditControl as SubstitutionSettings;
                    draglist.PrefixTxt    = w.PrefixString.Text;
                    draglist.SepCharacter = w.SepCharacter.Text;
                    FrameworkElement selectedElement = currentObj as FrameworkElement;
                    if (w.DialogResult.HasValue && w.DialogResult.Value)
                    {
                        return(w.SubstituteSettings);
                    }
                    return(oldValue);
                }
                return(false);
            }
            if (placeHolder.SelectedObject is BSkyAggregateCtrl)
            {
                BSkyAggregateCtrl agglist = placeHolder.SelectedObject as BSkyAggregateCtrl;
                if (EditControl is SubstitutionSettings)
                {
                    SubstitutionSettings w = EditControl as SubstitutionSettings;
                    agglist.PrefixTxt    = w.PrefixString.Text;
                    agglist.SepCharacter = w.SepCharacter.Text;
                    FrameworkElement selectedElement = currentObj as FrameworkElement;
                    if (w.DialogResult.HasValue && w.DialogResult.Value)
                    {
                        return(w.SubstituteSettings);
                    }
                    return(oldValue);
                }
                return(false);
            }

            if (placeHolder.SelectedObject is BSkySortCtrl)
            {
                BSkySortCtrl sortlist = placeHolder.SelectedObject as BSkySortCtrl;
                if (EditControl is SubstitutionSettings)
                {
                    SubstitutionSettings w = EditControl as SubstitutionSettings;
                    sortlist.PrefixTxt    = w.PrefixString.Text;
                    sortlist.SepCharacter = w.SepCharacter.Text;
                    FrameworkElement selectedElement = currentObj as FrameworkElement;
                    if (w.DialogResult.HasValue && w.DialogResult.Value)
                    {
                        return(w.SubstituteSettings);
                    }
                    return(oldValue);
                }
                return(false);
            }


            return(false);
        }