Exemple #1
0
        protected override void OnViewControlsCreated()
        {
            base.OnViewControlsCreated();
            GridListEditor gridListEditor = View.Editor as GridListEditor;

            if (gridListEditor != null)
            {
                GridView gridView = gridListEditor.GridView;
                gridListEditor.Grid.HandleCreated += (s, e) => {
                    gridView.OptionsView.ShowColumnHeaders = false;
                    gridView.OptionsView.ShowIndicator     = false;
                    gridView.OptionsView.ShowVerticalLines = DefaultBoolean.False;
                    GridColumn emailColumn = gridView.Columns["Email"];
                    if (emailColumn != null)
                    {
                        emailColumn.MinWidth = 150;
                    }
                    GridColumn photoColumn = gridView.Columns["Photo"];
                    if (photoColumn != null)
                    {
                        photoColumn.MinWidth = photoColumn.MaxWidth = 150;
                        ((RepositoryItemPictureEdit)photoColumn.ColumnEdit).ZoomPercent = 80;
                    }
                };
                gridView.CalcRowHeight += (s, e) => {
                    e.RowHeight = 100;
                };
            }
        }
Exemple #2
0
        private void PasteRowValues(PasteParam pasteParam)
        {
            // create Paste Processor
            var clipboard                 = new Clipboard();
            var clipboardParser           = new CopyParser(clipboard);
            var newRowPasteProcessor      = new NewRowPasteProcessor(clipboardParser, this.View);
            var existingRowPasteProcessor = new ExistingRowPasteProcessor(clipboardParser, this.View);


            string[][] copiedValues = clipboardParser.ToArray();
            if (copiedValues == null)
            {
                return;
            }

            GridListEditor listEditor = ((ListView)View).Editor as GridListEditor;

            if (listEditor != null)
            {
                var gridView = listEditor.GridView;

                if ((gridView.IsNewItemRow(gridView.FocusedRowHandle)))
                {
                    // paste to new rows
                    newRowPasteProcessor.Process(pasteParam);
                }
                else
                {
                    // paste to selected rows
                    int[] selectedRowHandles = gridView.GetSelectedRows();
                    existingRowPasteProcessor.Process(selectedRowHandles, pasteParam);
                }
            }
        }
Exemple #3
0
        protected override void OnViewControlsCreated()
        {
            base.OnViewControlsCreated();
            // Access and customize the target View control.
            GridListEditor gridListEditor = View.Editor as GridListEditor;

            if (gridListEditor != null)
            {
                GridView gridView = gridListEditor.GridView;
                gridListEditor.Grid.HandleCreated += (s, e) =>
                {
                    gridView.OptionsView.ShowColumnHeaders = true;
                    gridView.OptionsView.ShowIndicator     = false;
                    gridView.OptionsView.ShowVerticalLines = DefaultBoolean.False;
                    //gridView.Columns["Air Craft Count"].SortMode = DevExpress.XtraGrid.ColumnSortMode.Value;
                    //GridColumn AircraftCountColumn = gridView.Columns["AirCraftCount"];
                    //if (AircraftCountColumn !=null)
                    //{
                    //    //AircraftCountColumn.OptionsFilter.AllowFilter = true;
                    //    //AircraftCountColumn.OptionsFilter.AllowFilterModeChanging = DefaultBoolean.True;
                    //    ////AircraftCountColumn.OptionsColumn.allow
                    //    //AircraftCountColumn.OptionsColumn.AllowSort = DefaultBoolean.True;
                    //    //AircraftCountColumn.OptionsFilter.AllowFilter = true;
                    //}
                };
                gridView.CalcRowHeight += (s, e) =>
                {
                    e.RowHeight = 20;
                };
            }
            //XPCollection<rb_Aircraft> xpCollection1 = new XPCollection<rb_Aircraft>();
            //SortingCollection sorting = new SortingCollection();
            //sorting.Add(new SortProperty("AirCraftCount", DevExpress.Xpo.DB.SortingDirection.Ascending));
            //xpCollection1.Sorting = sorting;
        }
Exemple #4
0
        // note that the new row must be focused for this to work
        public void Process(int[] selectedRowHandles, PasteParam pasteParam)
        {
            var            listview     = (ListView)view;
            GridListEditor listEditor   = listview.Editor as GridListEditor;
            var            gridView     = listEditor.GridView;
            var            copiedValues = copyParser.ToArray();

            // paste rows
            for (int r = 0; r < copiedValues.Length; r++)
            {
                // ignore row with empty string
                if (copiedValues[r].Length == 1 && string.IsNullOrWhiteSpace(copiedValues[r][0]))
                {
                    continue;
                }

                // add new row in gridview
                gridView.FocusedRowHandle = selectedRowHandles[r];

                // paste cells
                pasteUtils.PasteColumnsToRow(copiedValues[r], gridView.FocusedRowHandle,
                                             listview, pasteParam);

                gridView.UpdateCurrentRow();
            }
        }
Exemple #5
0
        public void ProcessOffline(PasteParam pasteParam)
        {
            var            listview     = (ListView)view;
            GridListEditor listEditor   = listview.Editor as GridListEditor;
            var            gridView     = listEditor.GridView;
            var            copiedValues = copyParser.ToArray();
            var            newRowHandle = gridView.FocusedRowHandle;
            var            os           = listview.ObjectSpace;

            if (!gridView.IsNewItemRow(gridView.FocusedRowHandle))
            {
                return;
            }

            int pasteCount = 0;

            // paste rows
            for (int r = 0; r < copiedValues.Length; r++)
            {
                // ignore row with empty string
                if (copiedValues[r].Length == 1 && string.IsNullOrWhiteSpace(copiedValues[r][0]))
                {
                    continue;
                }
                var obj = (IXPObject)os.CreateObject(view.ObjectTypeInfo.Type);
                offlinePasteUtils.PasteColumnsToRow(copiedValues[r], obj,
                                                    listview, pasteParam);

                pasteCount++;
            }
            offlinePasteUtils.Logger.Log("{0} rows inserted", pasteCount++);
        }
        protected override void OnViewControlsCreated()
        {
            base.OnViewControlsCreated();
            IModelListViewExtender modelListView = View.Model as IModelListViewExtender;

            if (modelListView != null && modelListView.IsGroupFooterVisible)
            {
                GridListEditor gridListEditor = View.Editor as GridListEditor;
                if (gridListEditor != null)
                {
                    GridView gridView = gridListEditor.GridView;
                    gridView.OptionsView.GroupFooterShowMode = GroupFooterShowMode.VisibleAlways;
                    foreach (IModelColumn modelColumn in View.Model.Columns)
                    {
                        IModelColumnExtender modelColumnExtender = modelColumn as IModelColumnExtender;
                        if (modelColumnExtender != null &&
                            modelColumnExtender.GroupFooterSummaryType != SummaryItemType.None)
                        {
                            GridColumn gridColumn = gridView.Columns[
                                modelColumn.ModelMember.MemberInfo.BindingName];
                            gridView.GroupSummary.Add(modelColumnExtender.GroupFooterSummaryType,
                                                      modelColumn.Id, gridColumn);
                        }
                    }
                }
            }
        }
Exemple #7
0
        public void PasteColumn(string[] copiedValues, GridListEditor listEditor, ListView view)
        {
            var gridView   = listEditor.GridView;
            var gridColumn = gridView.FocusedColumn;
            var columnKey  = gridColumn.FieldName.Replace("!", string.Empty);
            var member     = listEditor.Model.Columns[gridColumn.Name];
            var memberInfo = member.ModelMember.MemberInfo;

            if (!member.AllowEdit)
            {
                throw new InvalidOperationException("Column '" + gridView.FocusedColumn.Caption + "' is not editable.");
            }

            var objs      = view.SelectedObjects;
            int copyIndex = 0;

            foreach (IXPObject obj in objs)
            {
                string copiedValue = copiedValues[copyIndex];

                // paste object to focused cell
                xpoFieldMapper.SetMemberValue(obj, memberInfo, copiedValue);

                if (copyIndex >= copiedValues.Length - 1)
                {
                    // reset copied row counter to the beginning after the last row is reached
                    copyIndex = 0;
                }
                else
                {
                    // go to next copied value
                    copyIndex++;
                }
            }
        }
Exemple #8
0
        public void ProcessOffline(PasteParam pasteParam)
        {
            var            listview   = (ListView)view;
            GridListEditor listEditor = listview.Editor as GridListEditor;
            var            gridView   = listEditor.GridView;

            int[] selectedRowHandles = gridView.GetSelectedRows();
            var   gridColumn         = gridView.FocusedColumn;
            var   copiedValues       = copyParser.ToArray();
            var   objs = view.SelectedObjects;

            int pasteCount = 0;

            // paste rows
            for (int r = 0; r < copiedValues.Length; r++)
            {
                // ignore row with empty string
                if (copiedValues[r].Length == 1 && string.IsNullOrWhiteSpace(copiedValues[r][0]))
                {
                    continue;
                }

                // select next row in gridview
                var obj = (IXPObject)objs[r];

                // paste cells
                offlinePasteUtils.PasteColumnsToRow(copiedValues[r], obj,
                                                    listview, pasteParam, gridColumn.VisibleIndex);

                pasteCount++;
            }
            offlinePasteUtils.Logger.Log("{0} rows updated", pasteCount++);
        }
 public GridListEditorSynchronizer(GridListEditor gridListEditor, IModelListView model)
     : base(gridListEditor, model) {
     modelSynchronizerList = new ModelSynchronizerList { new GridViewOptionsModelSynchronizer(gridListEditor.GridView, model) };
     foreach (var modelColumn in model.Columns) {
         modelSynchronizerList.Add(new ColumnOptionsModelSynchronizer(gridListEditor.GridView, modelColumn));
     }
 }
Exemple #10
0
        protected override void OnViewControlsCreated()
        {
            base.OnViewControlsCreated();
            // Access and customize the target View control.
            GridListEditor gridListEditor = View.Editor as GridListEditor;

            if (gridListEditor != null)
            {
                GridView gridView = gridListEditor.GridView;
                gridListEditor.Grid.HandleCreated += (s, e) =>
                {
                    gridView.OptionsView.ShowColumnHeaders = true;
                    gridView.OptionsView.ShowIndicator     = false;
                    gridView.OptionsView.ShowVerticalLines = DefaultBoolean.False;
                };
                gridView.CalcRowHeight += (s, e) =>
                {
                    e.RowHeight = 20;
                };
                gridView.CustomDrawColumnHeader += (s, e) =>
                {
                    if (e.Column == null)
                    {
                        return;
                    }
                    if (e.Column.AppearanceHeader.BackColor != Color.Empty)
                    {
                        e.Info.AllowColoring = true;
                    }
                    e.Column.AppearanceHeader.Font = new Font(new FontFamily("Tahoma"), 10f, FontStyle.Bold);
                };
            }
        }
Exemple #11
0
        private void simpleAction1_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            XtraReport11   r          = new XtraReport11();
            GridListEditor listEditor = ((ListView)View).Editor as GridListEditor;

            InTrucTiepGridControl.XemVaIn(listEditor.Grid, r, PaperKind.A4, false);
        }
Exemple #12
0
        private void ExportRegister_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            GridListEditor listEditor = ((DevExpress.ExpressApp.ListView)View).Editor as GridListEditor;
            Type           TypeObject = View.ObjectTypeInfo.Type;
            string         strObj     = "";

            foreach (BaseObject obj in View.SelectedObjects)
            {
                strObj = (strObj == "" ? string.Format("Oid='{0}'", obj.Oid) : string.Format("{0} or Oid='{1}'", strObj, obj.Oid));
            }
            if (strObj != "")
            {
                if (listEditor != null)
                {
                    GridView gv = (listEditor.Grid as GridControl).MainView as GridView;
                    using (SaveFileDialog sfd = new SaveFileDialog())
                    {
                        sfd.Filter = "xls files (*.xls)|*.xls|All files (*.*)|*.*";
                        if (sfd.ShowDialog() == DialogResult.OK)
                        {
                            XlsExportOptions xlsExportOptions = new DevExpress.XtraPrinting.XlsExportOptions();
                            xlsExportOptions.SheetName      = View.Caption.Replace(" ", "");
                            xlsExportOptions.TextExportMode = DevExpress.XtraPrinting.TextExportMode.Value;
                            xlsExportOptions.ShowGridLines  = true;
                            gv.GridControl.DataSource       = new XPCollection(View.ObjectSpace.Session, TypeObject,
                                                                               CriteriaOperator.Parse(strObj));

                            gv.ExportToXls(sfd.FileName, xlsExportOptions);
                        }
                    }
                }
            }
        }
Exemple #13
0
        protected override void OnViewControlsCreated()
        {
            base.OnViewControlsCreated();
            // Access and customize the target View control.
            ListView curView = (ListView)View;

            if (!curView.Id.Contains("LookupListView"))
            {
                curView.Model.IsFooterVisible = true;
                GridListEditor gridListEditor = curView.Editor as GridListEditor;
                if (gridListEditor != null)
                {
                    gridListEditor.GridView.OptionsCustomization.AllowSort            = true;
                    gridListEditor.GridView.OptionsBehavior.AllowGroupExpandAnimation = DevExpress.Utils.DefaultBoolean.True;
                    gridListEditor.GridView.OptionsCustomization.AllowGroup           = true;
                    gridListEditor.GridView.OptionsFilter.AllowFilterEditor           = true;
                    gridListEditor.GridView.OptionsView.AllowHtmlDrawHeaders          = true;
                    gridListEditor.GridView.OptionsView.AnimationType            = DevExpress.XtraGrid.Views.Base.GridAnimationType.AnimateFocusedItem;
                    gridListEditor.GridView.OptionsView.AutoCalcPreviewLineCount = true;

                    gridListEditor.GridView.OptionsView.ColumnAutoWidth = true;
                    gridListEditor.GridView.OptionsView.ShowGroupPanelColumnsAsSingleRow = false;
                    gridListEditor.GridView.OptionsView.EnableAppearanceOddRow           = true;
                    gridListEditor.GridView.Appearance.OddRow.BackColor = System.Drawing.Color.FromArgb(244, 244, 244);
                    gridListEditor.GridView.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Style3D;
                    //gridListEditor.ColumnView.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Style3D;
                    gridListEditor.GridView.RowHeight = 60;

                    gridListEditor.Grid.UseEmbeddedNavigator = true;
                }
            }
        }
Exemple #14
0
        private void ClearColumnValues()
        {
            GridListEditor listEditor = ((ListView)View).Editor as GridListEditor;

            if (listEditor == null)
            {
                return;
            }
            var gridView   = listEditor.GridView;
            var gridColumn = gridView.FocusedColumn;
            var columnKey  = gridColumn.FieldName.Replace("!", string.Empty);
            var member     = listEditor.Model.ModelClass.OwnMembers[columnKey]; // TODO: remove ! suffice when column is a lookup

            if (!member.AllowEdit)
            {
                throw new InvalidOperationException("Column '" + gridView.FocusedColumn.Caption + "' is not editable.");
            }

            int[] selectedRows = gridView.GetSelectedRows();
            foreach (int rowHandle in selectedRows)
            {
                // paste object to focused cell
                gridView.SetRowCellValue(rowHandle, gridView.FocusedColumn, null);
            }
        }
 protected override void OnDeactivated()
 {
     if (gridListEditor != null)
     {
         gridListEditor = null;
     }
     base.OnDeactivated();
 }
 protected override void OnActivated() {
     base.OnActivated();
     var listView = View as ListView;
     if (listView != null && listView.Editor != null && listView.Editor.GetType() == typeof(GridListEditor)) {
         _gridListEditor = (GridListEditor)listView.Editor;
         _gridListEditor.CreateCustomModelSynchronizer += GridListEditorOnCreateCustomModelSynchronizer;
     }
 }
 protected override void OnActivated()
 {
     base.OnActivated();
     // Perform various tasks depending on the target View.
     gridListEditor = View.Editor as GridListEditor;
     if (gridListEditor != null)
     {
     }
 }
        private void ObjectSpace_ObjectChanged(object sender, ObjectChangedEventArgs e)
        {
            GridListEditor editor = View.Editor as GridListEditor;

            if (editor != null && editor.GridView != null && editor.GridView.FocusedRowHandle >= 0)
            {
                editor.GridView.RefreshRow(editor.GridView.FocusedRowHandle);
            }
        }
Exemple #19
0
 protected override void OnViewControlsCreated()
 {
     base.OnViewControlsCreated();
     gridListEditor = ((ListView)View).Editor as GridListEditor;
     if (gridListEditor != null && gridListEditor.GridView != null)
     {
         gridListEditor.GridView.MouseDown += GridView_MouseDown;
     }
 }
 protected override void OnViewControlsCreated()
 {
     base.OnViewControlsCreated();
     gridListEditor = View.Editor as GridListEditor;
     if (gridListEditor != null)
     {
         InitGridView();
         InitButtonColumn();
     }
 }
        protected override void OnViewControlsCreated()
        {
            base.OnViewControlsCreated();
            GridListEditor gridListEditor = View.Editor as GridListEditor;

            if (gridListEditor != null)
            {
                gridListEditor.GridView.OptionsCustomization.AllowSort = false;
            }
        }
Exemple #22
0
 public GridListEditorSynchronizer(GridListEditor gridListEditor, IModelListView model)
     : base(gridListEditor, model)
 {
     modelSynchronizerList = new ModelSynchronizerList {
         new GridViewOptionsModelSynchronizer(gridListEditor.GridView, model)
     };
     foreach (var modelColumn in model.Columns)
     {
         modelSynchronizerList.Add(new ColumnOptionsModelSynchronizer(gridListEditor.GridView, modelColumn));
     }
 }
        public void Process(string[] copiedValues)
        {
            GridListEditor listEditor = ((ListView)view).Editor as GridListEditor;

            if (listEditor == null)
            {
                return;
            }

            pasteUtils.PasteColumn(copiedValues, listEditor, view.ObjectSpace);
        }
Exemple #24
0
        private void WinAlternatingRowsController_ViewControlsCreated(object sender, EventArgs e)
        {
            GridListEditor listEditor = ((ListView)View).Editor as GridListEditor;

            if (listEditor != null)
            {
                GridView gridView = listEditor.GridView;
                gridView.OptionsView.EnableAppearanceOddRow = true;
                gridView.Appearance.OddRow.BackColor        = Color.FromArgb(244, 244, 244);
            }
        }
Exemple #25
0
        protected override void OnViewControlsCreated()
        {
            base.OnViewControlsCreated();
            // whether copying will include column headers
            GridListEditor listEditor = ((ListView)View).Editor as GridListEditor;

            if (listEditor != null)
            {
                listEditor.GridView.OptionsClipboard.CopyColumnHeaders = copyColumnHeaders;
            }
        }
        /// <summary>
        /// Quando os controles forem criados
        /// </summary>
        protected override void OnViewControlsCreated()
        {
            base.OnViewControlsCreated();

            GridListEditor listEditor = ((ListView)View).Editor as GridListEditor;

            if (listEditor != null)
            {
                listEditor.GridView.OptionsView.RowAutoHeight = true;
            }
        }
Exemple #27
0
 /// <summary>
 /// Configures the supplied ListView grid to show word wrapped column captions.
 /// </summary>
 /// <param name="view"></param>
 /// <param name="lineCount">The number of lines of text required in the column header.</param>
 internal static void SetColumnHeadingRowHeight(ListView view, int lineCount)
 {
     if (view != null && lineCount > 1)
     {
         GridListEditor listEditor = view.Editor as GridListEditor;
         if (listEditor != null)
         {
             GridHeaderHeightHelper.SetGridEditorHeaderHeight(listEditor, lineCount);
         }
     }
 }
        private void WinAlternatingRowsController_ViewControlsCreated(object sender, EventArgs e)
        {
            GridListEditor listEditor = ((ListView)View).Editor as GridListEditor;

            if (listEditor != null)
            {
                GridView gridView = listEditor.GridView;

                SetListView(gridView);
            }
        }
Exemple #29
0
        protected override void OnActivated()
        {
            base.OnActivated();
            var listView = View as ListView;

            if (listView != null && listView.Editor != null && listView.Editor.GetType() == typeof(GridListEditor))
            {
                _gridListEditor = (GridListEditor)listView.Editor;
                _gridListEditor.CreateCustomModelSynchronizer += GridListEditorOnCreateCustomModelSynchronizer;
            }
        }
        private void WinTooltipController_ViewControlsCreated(object sender, EventArgs e)
        {
            GridListEditor listEditor = ((ListView)View).Editor as GridListEditor;

            if (listEditor != null)
            {
                foreach (GridColumn column in listEditor.GridView.Columns)
                {
                    column.ToolTip = "Click to sort by " + column.Caption;
                }
            }
        }
Exemple #31
0
        protected override void OnActivated()
        {
            base.OnActivated();
            var listView = View as ListView;

            if (listView != null && listView.Editor != null && listView.Editor.GetType() == typeof(GridListEditor))
            {
                _gridListEditor               = (GridListEditor)listView.Editor;
                _gridListEditor.ModelSaved   += GridListEditorOnModelSaved;
                _gridListEditor.ModelApplied += GridListEditorOnModelApplied;
            }
        }
Exemple #32
0
        private void SetSelectedContainer()
        {
            GridListEditor listEditor = ((ListView)View).Editor as GridListEditor;

            if (listEditor != null)
            {
                //var lastHandle = listEditor.GridView.DataRowCount - 1;
                var lastHandle = 0;
                listEditor.GridView.RefreshData();
                listEditor.GridView.SelectRow(lastHandle);
            }
        }
Exemple #33
0
 public XpandXafGridColumn(ITypeInfo typeInfo, GridListEditor gridListEditor)
     : base(typeInfo, gridListEditor) {
 }
Exemple #34
0
 public XpandXafGridView(GridListEditor gridListEditor) {
     _gridListEditor = gridListEditor;
 }
Exemple #35
0
 public static void ForEachColumnLink(this IEnumerable<IModelColumn> columns, Action<IModelGridColumnOptions, GridColumn> action,GridListEditor gridListEditor) {
     columns.Each(unbound => action.Invoke(((IModelColumnOptions)unbound).GridColumnOptions,gridListEditor.GridView.Columns[unbound.PropertyName]));
 }
 protected override void OnViewControlsCreated() {
     base.OnViewControlsCreated();
     gridListEditor = ((ListView)View).Editor as GridListEditor;
     if (gridListEditor != null)
         gridListEditor.GridView.MouseDown += GridView_MouseDown;
 }
 public MasterDetailXafGridView(GridListEditor gridListEditor) {
     _gridListEditor = gridListEditor;
 }