public TabularDataViewer(IBioLinkReport report, DataMatrix data, IProgressObserver progress)
        {
            InitializeComponent();
            this.Data = data;
            _progress = progress;
            _report = report;
            var view = new GridView();

            var columns = report.DisplayColumns;
            if (columns == null || columns.Count == 0) {
                columns = GenerateDefaultColumns(data);
            }

            var hcs = viewerGrid.Resources["hcs"] as Style;

            foreach (DisplayColumnDefinition c in columns) {
                DisplayColumnDefinition coldef = c;
                var column = new GridViewColumn { Header = BuildColumnHeader(coldef), DisplayMemberBinding = new Binding(String.Format("[{0}]", data.IndexOf(coldef.ColumnName))), HeaderContainerStyle = hcs };
                view.Columns.Add(column);
            }

            lvw.AddHandler(ButtonBase.ClickEvent, new RoutedEventHandler(GridViewColumnHeaderClickedHandler));

            lvw.MouseRightButtonUp += new System.Windows.Input.MouseButtonEventHandler(lvw_MouseRightButtonUp);

            lvw.ItemsSource = Data.Rows;
            this.lvw.View = view;
        }
Exemple #2
0
        public TabularDataViewer(IBioLinkReport report, DataMatrix data, IProgressObserver progress)
        {
            InitializeComponent();
            this.Data = data;
            _progress = progress;
            _report   = report;
            var view = new GridView();

            var columns = report.DisplayColumns;

            if (columns == null || columns.Count == 0)
            {
                columns = GenerateDefaultColumns(data);
            }

            var hcs = viewerGrid.Resources["hcs"] as Style;

            foreach (DisplayColumnDefinition c in columns)
            {
                DisplayColumnDefinition coldef = c;
                var column = new GridViewColumn {
                    Header = BuildColumnHeader(coldef), DisplayMemberBinding = new Binding(String.Format("[{0}]", data.IndexOf(coldef.ColumnName))), HeaderContainerStyle = hcs
                };
                view.Columns.Add(column);
            }

            lvw.AddHandler(ButtonBase.ClickEvent, new RoutedEventHandler(GridViewColumnHeaderClickedHandler));

            lvw.MouseRightButtonUp += new System.Windows.Input.MouseButtonEventHandler(lvw_MouseRightButtonUp);

            lvw.ItemsSource = Data.Rows;
            this.lvw.View   = view;
        }
Exemple #3
0
        public FrameworkElement ConstructView(IBioLinkReport report, DataMatrix reportData, IProgressObserver progress)
        {
            TabularDataViewer viewer = new TabularDataViewer(report, reportData, progress);

            viewer.ContextMenuHandler = ContextMenuHandler;
            return(viewer);
        }
Exemple #4
0
        public ReportResults(IBioLinkReport report)
        {
            InitializeComponent();
            progressBar.Visibility = System.Windows.Visibility.Hidden;

            this.Report = report;
            this.Loaded += new RoutedEventHandler(ReportResults_Loaded);
        }
        public ReportResults(IBioLinkReport report)
        {
            InitializeComponent();
            progressBar.Visibility = System.Windows.Visibility.Hidden;

            this.Report  = report;
            this.Loaded += new RoutedEventHandler(ReportResults_Loaded);
        }
        public FrameworkElement ConstructView(IBioLinkReport report, Data.DataMatrix reportData, Utilities.IProgressObserver progress)
        {
            var viewer = new RTFReportViewer();

            viewer.ReportName = report.Name;
            viewer.rtf.Rtf    = reportData.Rows[0][0] as string;
            return(viewer);
        }
Exemple #7
0
        public AssociateReportsViewer(IBioLinkReport report, DataMatrix data, IProgressObserver progress)
        {
            InitializeComponent();
            this.Report     = report;
            this.DataMatrix = data;
            this.Progress   = progress;

            Loaded += new RoutedEventHandler(AssociateReportsViewer_Loaded);
        }
 public void RunReport(IBioLinkPlugin owner, IBioLinkReport report)
 {
     if (report.DisplayOptions(User, ParentWindow))
     {
         var results = new ReportResults(report);
         AddDocumentContent(owner, results, new DockableContentOptions {
             Title = report.Name, IsFloating = Preferences.OpenReportResultsInFloatingWindow.Value
         });
     }
 }
Exemple #9
0
        private static MenuItem CreateReportMenuItems(SiteExplorerNodeViewModel node, MaterialExplorer explorer)
        {
            var builder = new MenuItemBuilder();

            MenuItem reports = builder.New("Reports").MenuItem;
            var      list    = explorer.Owner.GetReportsForNode(node);

            foreach (IBioLinkReport report in list)
            {
                IBioLinkReport reportToExecute = report;
                reports.Items.Add(builder.New(report.Name).Handler(() => { PluginManager.Instance.RunReport(explorer.Owner, reportToExecute); }).MenuItem);
            }

            return(reports);
        }
Exemple #10
0
        private MenuItem CreateReportMenuItems()
        {
            MenuItem reports = _builder.New("Reports").MenuItem;
            var      taxa    = new List <TaxonViewModel>();

            taxa.Add(Taxon);
            var list = Explorer.Owner.GetReportsForTaxon(taxa);

            foreach (IBioLinkReport report in list)
            {
                IBioLinkReport reportToExecute = report;
                reports.Items.Add(_builder.New(report.Name).Handler(() => { Explorer.RunReport(reportToExecute); }).MenuItem);
            }

            return(reports);
        }
        public MultimediaThumbnailViewer(IBioLinkReport report, Data.DataMatrix reportData, Utilities.IProgressObserver progress)
        {
            InitializeComponent();
            this.Report = report;
            this.ReportData = reportData;
            this.Progress = progress;

            var service = new SupportService(PluginManager.Instance.User);

            _tempFileManager = new KeyedObjectTempFileManager<int?>((mmId) => {
                if (mmId.HasValue) {
                    byte[] bytes = service.GetMultimediaBytes(mmId.Value);
                    if (bytes != null) {
                        return new MemoryStream(bytes);
                    }
                }
                return null;
            });

            Loaded += new RoutedEventHandler(MultimediaThumbnailViewer_Loaded);
        }
Exemple #12
0
        public MultimediaThumbnailViewer(IBioLinkReport report, Data.DataMatrix reportData, Utilities.IProgressObserver progress)
        {
            InitializeComponent();
            this.Report     = report;
            this.ReportData = reportData;
            this.Progress   = progress;

            var service = new SupportService(PluginManager.Instance.User);

            _tempFileManager = new KeyedObjectTempFileManager <int?>((mmId) => {
                if (mmId.HasValue)
                {
                    byte[] bytes = service.GetMultimediaBytes(mmId.Value);
                    if (bytes != null)
                    {
                        return(new MemoryStream(bytes));
                    }
                }
                return(null);
            });

            Loaded += new RoutedEventHandler(MultimediaThumbnailViewer_Loaded);
        }
Exemple #13
0
 public FrameworkElement ConstructView(IBioLinkReport report, Data.DataMatrix reportData, Utilities.IProgressObserver progress)
 {
     var viewer = new RTFReportViewer();
     viewer.ReportName = report.Name;
     viewer.rtf.Rtf = reportData.Rows[0][0] as string;
     return viewer;
 }
Exemple #14
0
        public FrameworkElement ConstructView(IBioLinkReport report, Data.DataMatrix reportData, Utilities.IProgressObserver progress)
        {
            var viewer = new MultimediaThumbnailViewer(report, reportData, progress);

            return(viewer);
        }
Exemple #15
0
 internal void RunReport(IBioLinkReport report)
 {
     PluginManager.Instance.RunReport(Owner, report);
 }
Exemple #16
0
        public System.Windows.FrameworkElement ConstructView(IBioLinkReport report, DataMatrix reportData, IProgressObserver progress)
        {
            var options = (report as ReferenceLinksReport).Options;

            var viewer = new RTFReportViewer {ReportName = report.Name};
            var rtf = new RTFReportBuilder();
            rtf.AppendFullHeader();
            rtf.ReportHeading(options.BibliographyTitle);

            var idx = 1;
            var colIndex = reportData.IndexOf("RefID");

            var refIds = new List<Int32>();
            for (var i = 0; i < reportData.Rows.Count; ++i ) {
                refIds.Add(i);
            }

            int sortColumnIdx = reportData.IndexOf(options.SortColumn);
            int refTypeIndex = reportData.IndexOf("RefType");
            refIds.Sort((idx1, idx2) => {
                            // If grouping, first check the ref type
                            if (options.GroupByReferenceType) {
                                var refType1 = reportData.Rows[idx1][refTypeIndex] as String;
                                var refType2 = reportData.Rows[idx2][refTypeIndex] as String;
                                if (!refType1.Equals(refType2)) {
                                    return String.Compare(refType1, refType2, true);
                                }
                            }

                            // then by the nominated sort column
                            var objVal1 = reportData.Rows[idx1][sortColumnIdx];
                            var objVal2 = reportData.Rows[idx2][sortColumnIdx];
                            var val1 = RTFUtils.StripMarkup(objVal1 == null ? "" : objVal1.ToString());
                            var val2 = RTFUtils.StripMarkup(objVal2 == null ? "" : objVal2.ToString());

                            if (options.SortAscending) {
                                return String.Compare((String)val1, (String)val2, true);
                            } else {
                                return String.Compare((String)val2, (String)val1, true);
                            }
                        });

            var lastRefType = "";
            String[] allowedKeywords = { "b", "i", "sub", "super", "strike", "ul", "ulnone", "nosupersub" };
            foreach (var rowIdx in refIds) {
                var row = reportData.Rows[rowIdx];

                if (options.GroupByReferenceType) {
                    var refType = row["RefType"] as String;
                    if (!String.Equals(refType, lastRefType, StringComparison.CurrentCultureIgnoreCase)) {
                        rtf.Par();
                        rtf.Append(@" \pard\fs24\b\f1 ");
                        rtf.Append(refType);
                        rtf.Append(@" \b0");
                        rtf.Par();
                        lastRefType = refType;
                    }
                }

                rtf.Par();
                rtf.Append(@" \pard\fs20\f1 ");
                if (options.BibliographyIndexStyle != BibliographyIndexStyle.None) {
                    rtf.Append("[");
                    switch (options.BibliographyIndexStyle) {
                        case BibliographyIndexStyle.Number:
                            rtf.Append(idx);
                            break;
                        case BibliographyIndexStyle.RefCode:
                            rtf.Append(row["RefCode"]);
                            break;
                    }
                    rtf.Append("] ");
                }
                idx++;

                var fullRTF = RTFUtils.filter(row["FullRTF"] as string, true, false, allowedKeywords);
                rtf.Append(fullRTF);

                var bits = new List<String>();
                if (!String.IsNullOrWhiteSpace(row["LinkPage"] as String)) {
                    bits.Add(String.Format("page {0}", row["LinkPage"] as String));
                }

                if (options.IncludeQualification) {
                    var qual = row["LinkQualificationRTF"] as string;
                    if (!String.IsNullOrEmpty(qual)  ) {
                        bits.Add(RTFUtils.filter(qual, true, true, allowedKeywords).Trim());
                    }
                }

                if (bits.Count > 0) {
                    rtf.Append(" (").Append(bits.Join("; ").Trim()).Append(")");
                }

                rtf.Par();
            }

            Console.WriteLine(rtf.RTF);

            viewer.rtf.Rtf = rtf.RTF;

            return viewer;
        }
        public FrameworkElement ConstructView(IBioLinkReport report, Data.DataMatrix reportData, Utilities.IProgressObserver progress)
        {
            var viewer = new MultimediaThumbnailViewer(report, reportData, progress);

            return viewer;
        }
Exemple #18
0
        public FrameworkElement ConstructView(IBioLinkReport report, DataMatrix reportData, IProgressObserver progress)
        {
            AssociateReportsViewer viewer = new AssociateReportsViewer(report, reportData, progress);

            return(viewer);
        }
 public FrameworkElement ConstructView(IBioLinkReport report, DataMatrix reportData, IProgressObserver progress)
 {
     TabularDataViewer viewer = new TabularDataViewer(report, reportData, progress);
     viewer.ContextMenuHandler = ContextMenuHandler;
     return viewer;
 }
        public System.Windows.FrameworkElement ConstructView(IBioLinkReport report, DataMatrix reportData, IProgressObserver progress)
        {
            var options = (report as ReferenceLinksReport).Options;

            var viewer = new RTFReportViewer {
                ReportName = report.Name
            };
            var rtf = new RTFReportBuilder();

            rtf.AppendFullHeader();
            rtf.ReportHeading(options.BibliographyTitle);

            var idx      = 1;
            var colIndex = reportData.IndexOf("RefID");

            var refIds = new List <Int32>();

            for (var i = 0; i < reportData.Rows.Count; ++i)
            {
                refIds.Add(i);
            }

            int sortColumnIdx = reportData.IndexOf(options.SortColumn);
            int refTypeIndex  = reportData.IndexOf("RefType");

            refIds.Sort((idx1, idx2) => {
                // If grouping, first check the ref type
                if (options.GroupByReferenceType)
                {
                    var refType1 = reportData.Rows[idx1][refTypeIndex] as String;
                    var refType2 = reportData.Rows[idx2][refTypeIndex] as String;
                    if (!refType1.Equals(refType2))
                    {
                        return(String.Compare(refType1, refType2, true));
                    }
                }

                // then by the nominated sort column
                var objVal1 = reportData.Rows[idx1][sortColumnIdx];
                var objVal2 = reportData.Rows[idx2][sortColumnIdx];
                var val1    = RTFUtils.StripMarkup(objVal1 == null ? "" : objVal1.ToString());
                var val2    = RTFUtils.StripMarkup(objVal2 == null ? "" : objVal2.ToString());

                if (options.SortAscending)
                {
                    return(String.Compare((String)val1, (String)val2, true));
                }
                else
                {
                    return(String.Compare((String)val2, (String)val1, true));
                }
            });


            var lastRefType = "";

            String[] allowedKeywords = { "b", "i", "sub", "super", "strike", "ul", "ulnone", "nosupersub" };
            foreach (var rowIdx in refIds)
            {
                var row = reportData.Rows[rowIdx];

                if (options.GroupByReferenceType)
                {
                    var refType = row["RefType"] as String;
                    if (!String.Equals(refType, lastRefType, StringComparison.CurrentCultureIgnoreCase))
                    {
                        rtf.Par();
                        rtf.Append(@" \pard\fs24\b\f1 ");
                        rtf.Append(refType);
                        rtf.Append(@" \b0");
                        rtf.Par();
                        lastRefType = refType;
                    }
                }

                rtf.Par();
                rtf.Append(@" \pard\fs20\f1 ");
                if (options.BibliographyIndexStyle != BibliographyIndexStyle.None)
                {
                    rtf.Append("[");
                    switch (options.BibliographyIndexStyle)
                    {
                    case BibliographyIndexStyle.Number:
                        rtf.Append(idx);
                        break;

                    case BibliographyIndexStyle.RefCode:
                        rtf.Append(row["RefCode"]);
                        break;
                    }
                    rtf.Append("] ");
                }
                idx++;

                var fullRTF = RTFUtils.filter(row["FullRTF"] as string, true, false, allowedKeywords);
                rtf.Append(fullRTF);

                var bits = new List <String>();
                if (!String.IsNullOrWhiteSpace(row["LinkPage"] as String))
                {
                    bits.Add(String.Format("page {0}", row["LinkPage"] as String));
                }

                if (options.IncludeQualification)
                {
                    var qual = row["LinkQualificationRTF"] as string;
                    if (!String.IsNullOrEmpty(qual))
                    {
                        bits.Add(RTFUtils.filter(qual, true, true, allowedKeywords).Trim());
                    }
                }

                if (bits.Count > 0)
                {
                    rtf.Append(" (").Append(bits.Join("; ").Trim()).Append(")");
                }

                rtf.Par();
            }

            Console.WriteLine(rtf.RTF);

            viewer.rtf.Rtf = rtf.RTF;

            return(viewer);
        }