示例#1
0
        internal override ISorterFactory Build()
        {
            var sorter = new TableSorter <TRequest, TEntity, TControl>(_defaultColumn);

            _controls
            .Zip(_directions, (c, d) => new { Control = c, Direction = d })
            .ToList()
            .ForEach(z => sorter.AddControl(z.Control, z.Direction));

            foreach (var(k, v) in _columns)
            {
                v.Build(sorter, k);
            }

            if (_controls.Count == 0)
            {
                throw new BadCrudConfigurationException(
                          $"Table sorting was set for request '{typeof(TRequest)}' and entity '{typeof(TEntity)}'" +
                          ", but no controls were defined.");
            }

            if (_defaultColumn == null && _columns.Count == 0)
            {
                throw new BadCrudConfigurationException(
                          $"Table sorting was set for request '{typeof(TRequest)}' and entity '{typeof(TEntity)}'" +
                          ", but no table properties were defined.");
            }

            return(InstanceSorterFactory.From(sorter));
        }
示例#2
0
 public void Build(TableSorter <TRequest, TEntity, TControl> sorter, TControl controlValue)
 {
     sorter.AddColumn(controlValue, Expression);
 }
示例#3
0
        public FactsPanel(JamochaGui gui)
            : base(gui)
        {
            //UPGRADE_ISSUE: Constructor 'java.awt.BorderLayout.BorderLayout' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtBorderLayout"'
            setLayout(new BorderLayout());

            dataModel = new FactsTableModel(this);
            TableSorter sorter = new TableSorter(new TableMap());
            ((TableMap) sorter.Model).setModel(dataModel);
            factsTable = new JTable(sorter);
            sorter.addMouseListenerToHeaderInTable(factsTable);

            factsTable.setShowHorizontalLines(true);
            factsTable.setRowSelectionAllowed(true);
            factsTable.TableHeader.setReorderingAllowed(false);
            factsTable.TableHeader.setToolTipText("Click to sort ascending. Click while pressing the shift-key down to sort descending");
            factsTable.SelectionModel.addListSelectionListener(this);
            dumpArea = new JTextArea();
            dumpArea.setLineWrap(true);
            dumpArea.setWrapStyleWord(true);
            dumpArea.setEditable(false);
            //UPGRADE_NOTE: If the given Font Name does not exist, a default Font instance is created. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1075"'
            //UPGRADE_TODO: Method 'java.awt.Font.Plain' was converted to 'System.Drawing.FontStyle.Regular' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_javaawtFontPLAIN_f"'
            dumpArea.setFont(new System.Drawing.Font("Courier", 12, (System.Drawing.FontStyle) System.Drawing.FontStyle.Regular));

            pane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, new JScrollPane(factsTable), new JScrollPane(dumpArea));
            //UPGRADE_ISSUE: Field 'java.awt.BorderLayout.CENTER' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtBorderLayout"'
            add(pane, BorderLayout.CENTER);
            pane.setDividerLocation(gui.Preferences.getInt("facts.dividerlocation", 300));
            reloadButton = new JButton("Reload Facts", IconLoader.getImageIcon("database_refresh"));
            reloadButton.addActionListener(this);
            assertButton = new JButton("Assert Fact", IconLoader.getImageIcon("database_add"));
            assertButton.addActionListener(this);
            JPanel buttonPanel = new JPanel();
            //UPGRADE_ISSUE: Constructor 'java.awt.FlowLayout.FlowLayout' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtFlowLayout"'
            //UPGRADE_ISSUE: Field 'java.awt.FlowLayout.RIGHT' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtFlowLayout"'
            buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 5, 1));
            buttonPanel.add(reloadButton);
            buttonPanel.add(assertButton);
            //UPGRADE_ISSUE: Field 'java.awt.BorderLayout' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000"'
            add(buttonPanel, BorderLayout.PAGE_END);

            initPopupMenu();
        }
示例#4
0
        static void Main(string[] args)
        {
            if (String.IsNullOrEmpty(Command))
            {
                Help.Print();
                return;
            }
#if !DEBUG
            try
            {
#endif
            switch (Command)
            {
            case "docs":
            {
                DocGenerator.Run();
                break;
            }

            case "sort":
            {
                TableSorter.Run();
                break;
            }

            case "pack":
            {
                PackGenerator.Run();
                break;
            }

            case "build":
            {
                // TODO: compiler command
                WriteLine("Sorry, this command isn't implemented yet :(");
                break;
            }

            case "help":
            {
                foreach (var name in GetPaths())
                {
                    WriteLine($"'{name}'");

                    switch (name.ToLower())
                    {
                    case "docs":
                        DocGenerator.GetHelp();
                        break;

                    case "sort":
                        TableSorter.GetHelp();
                        break;

                    case "pack":
                        PackGenerator.GetHelp();
                        break;

                    case "help":
                        WriteLine("Are you serious?");
                        break;

                    default:
                        WriteLine($"No help info found for '{name}'");
                        break;
                    }
                    WriteLine();
                }
                break;
            }

            default:
                WriteLine($"Unknown command: '{Command}'");
                break;
            }
#if !DEBUG
        }

        catch (Exception ex)
        {
            ForegroundColor = ConsoleColor.Red;
            WriteLine(ex.Message);
            ResetColor();
            Environment.Exit(1);
        }
#endif
        }