Beispiel #1
0
    def set_settings(self):
        self.settings = JPanel()
        layout = GroupLayout(self.settings)
        self.settings.setLayout(layout)
        layout.setAutoCreateGaps(True)

        load_file_button = JButton("Load JSON File")
        load_file_button.setActionCommand("load")
        load_file_button.addActionListener(SettingsAction(self, load_file_button, None))
        save_file_button = JButton("Save JSON File")
        save_file_button.setActionCommand("save")
        save_file_button.addActionListener(SettingsAction(None, save_file_button, self.tabbed_panes))

        horizontal_group1 = layout.createParallelGroup(GroupLayout.Alignment.LEADING)
        horizontal_group1.addComponent(load_file_button)
        horizontal_group1.addComponent(save_file_button)

        horizontal_group = layout.createSequentialGroup()
        horizontal_group.addGroup(horizontal_group1)

        layout.setHorizontalGroup(horizontal_group)

        vertical_group1 = layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
        vertical_group1.addComponent(load_file_button)
        vertical_group2 = layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
        vertical_group2.addComponent(save_file_button)

        vertical_group = layout.createSequentialGroup()
        vertical_group.addGroup(vertical_group1)
        vertical_group.addGroup(vertical_group2)

        layout.setVerticalGroup(vertical_group)
Beispiel #2
0
    def __init__(self, frame, chart, pingFun):
        JDialog(frame)
        self.setTitle("Chart Settings")
        self.setModal(True)
        self.pingFun = pingFun
        pane = self.getRootPane().getContentPane()
        pane.setLayout(GridLayout(7, 2))
        pane.add(JLabel("Marker color"))
        self.markerPanel = self.createColorPanel(chart.markerColor, pane)
        pane.add(JLabel("Positive selection color"))
        self.posPanel = self.createColorPanel(chart.posColor, pane)
        pane.add(JLabel("Neutral color"))
        self.neuPanel = self.createColorPanel(chart.neuColor, pane)
        pane.add(JLabel("Balancing selection color "))
        self.balPanel = self.createColorPanel(chart.balColor, pane)

        self.add(JLabel("Label candidate selected loci"))
        self.selLabel = JCheckBox()
        self.selLabel.setSelected(chart.labelSelected)
        self.add(self.selLabel)
        self.add(JLabel("Label candidate neutral loci"))
        self.neuLabel = JCheckBox()
        self.neuLabel.setSelected(chart.labelNeutral)
        self.add(self.neuLabel)

        change = JButton("Change")
        change.setActionCommand("Change")
        change.addActionListener(self)
        pane.add(change)
        exit = JButton("Exit")
        exit.setActionCommand("Exit")
        exit.addActionListener(self)
        pane.add(exit)
        self.pack()
Beispiel #3
0
def getControlPanel():
    global controlPanel
    controlPanel = JPanel()
    controlPanel.setLayout(BoxLayout(controlPanel, BoxLayout.Y_AXIS))
    for row in keyLayout:
        rowPanel = JPanel()
        rowPanel.setLayout(BoxLayout(rowPanel, BoxLayout.X_AXIS))
        controlPanel.add(rowPanel)
        for key in row:
            button = JButton(key[0], actionPerformed=handleKeyButton)
            button.setActionCommand(key[1])
            rowPanel.add(button)

    global terminalResult
    terminalResult = JTextArea()
    scroller = JScrollPane(terminalResult)
    terminalResult.setLineWrap(True)
    scroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS)
    scroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)
    controlPanel.add(scroller)

    global terminalInput
    termInputPanel = JPanel()
    termInputPanel.setLayout(BoxLayout(termInputPanel, BoxLayout.X_AXIS))
    termInputLabel = JLabel("Command")
    termInputPanel.add(termInputLabel)
    terminalInput = JTextField(actionPerformed=handleTerminalInput)
    minimumSize = terminalInput.getMinimumSize()
    maximumSize = terminalInput.getMaximumSize()
    terminalInput.setMaximumSize(Dimension(maximumSize.width, minimumSize.height))

    termInputPanel.add(terminalInput)
    controlPanel.add(termInputPanel)

    return controlPanel
Beispiel #4
0
    def __init__(self, frame, what, entries, pingFun):
        JDialog(frame, what)
        self.frame   = frame
        self.entries = entries
        self.pingFun = pingFun
        pane = self.getRootPane().getContentPane()

        self.ent_pane, self.ent_list, self.ent = self.createList(entries)
        pane.add(self.ent_pane, BorderLayout.WEST)

        actionPanel = JPanel()
        actionPanel.setLayout(GridLayout(20, 1))
        self.text = JTextField(20)
        actionPanel.add(self.text)
        change = JButton('Change')
        change.setActionCommand('Change')
        change.addActionListener(self)
        actionPanel.add(change)
        actionPanel.add(JLabel(''))
        quit = JButton('Exit')
        quit.setActionCommand('Exit')
        quit.addActionListener(self)
        actionPanel.add(quit)
        actionPanel.add(JLabel(''))
        pane.add(actionPanel, BorderLayout.CENTER)

        self.pack()
Beispiel #5
0
    def __init__(self, frame, what, entries, pingFun):
        JDialog(frame, what)
        self.frame = frame
        self.entries = entries
        self.pingFun = pingFun
        pane = self.getRootPane().getContentPane()

        self.ent_pane, self.ent_list, self.ent = self.createList(entries)
        pane.add(self.ent_pane, BorderLayout.WEST)

        actionPanel = JPanel()
        actionPanel.setLayout(GridLayout(20, 1))
        self.text = JTextField(20)
        actionPanel.add(self.text)
        change = JButton('Change')
        change.setActionCommand('Change')
        change.addActionListener(self)
        actionPanel.add(change)
        actionPanel.add(JLabel(''))
        quit = JButton('Exit')
        quit.setActionCommand('Exit')
        quit.addActionListener(self)
        actionPanel.add(quit)
        actionPanel.add(JLabel(''))
        pane.add(actionPanel, BorderLayout.CENTER)

        self.pack()
Beispiel #6
0
 def createButton(self, text, command):
     """Generate a new button with a given text and command"""
     button = JButton(text)
     button.setAlignmentX(Component.CENTER_ALIGNMENT)
     button.setActionCommand(command)
     button.addActionListener(self._button_listener)
     return button
Beispiel #7
0
    def __init__(self, frame, chart, pingFun):
        JDialog(frame)
        self.setTitle('Chart Settings')
        self.setModal(True)
        self.pingFun = pingFun
        pane = self.getRootPane().getContentPane()
        pane.setLayout(GridLayout(7, 2))
        pane.add(JLabel('Marker color'))
        self.markerPanel = self.createColorPanel(chart.markerColor, pane)
        pane.add(JLabel('Positive selection color'))
        self.posPanel = self.createColorPanel(chart.posColor, pane)
        pane.add(JLabel('Neutral color'))
        self.neuPanel = self.createColorPanel(chart.neuColor, pane)
        pane.add(JLabel('Balancing selection color '))
        self.balPanel = self.createColorPanel(chart.balColor, pane)

        self.add(JLabel('Label candidate selected loci'))
        self.selLabel = JCheckBox()
        self.selLabel.setSelected(chart.labelSelected)
        self.add(self.selLabel)
        self.add(JLabel('Label candidate neutral loci'))
        self.neuLabel = JCheckBox()
        self.neuLabel.setSelected(chart.labelNeutral)
        self.add(self.neuLabel)

        change = JButton('Change')
        change.setActionCommand('Change')
        change.addActionListener(self)
        pane.add(change)
        exit = JButton('Exit')
        exit.setActionCommand('Exit')
        exit.addActionListener(self)
        pane.add(exit)
        self.pack()
Beispiel #8
0
 def createButton(self, text, command, tooltip):
     """Create a new button with the given text and command"""
     button = JButton(text)
     button.setAlignmentX(Component.CENTER_ALIGNMENT)
     button.setActionCommand(command)
     button.addActionListener(self._button_listener)
     button.setToolTipText(tooltip)
     return button
Beispiel #9
0
 def add_button(self, text, action):
     index = len(self.actions)
     name = "button%i" % index
     button = JButton(text)
     self.panel.add(button)
     button.setActionCommand(name)
     button.addActionListener(self)
     self.actions[name] = action
     return button
Beispiel #10
0
 def add_button(self, text, action):
     index = len(self.actions)
     name = "button%i" % index
     button = JButton(text)
     self.panel.add(button)
     button.setActionCommand(name)
     button.addActionListener(self)
     self.actions[name] = action
     return button
Beispiel #11
0
    def __init__(self, frame, what, all, removed, pingFun):
        JDialog.__init__(self, frame, what)
        self.frame = frame
        self.all = all
        self.removed = removed
        self.pingFun = pingFun
        pane = self.getRootPane().getContentPane()

        self.sel_pane, self.sel_list, self.sel = self.createList(all)
        pane.add(self.sel_pane, BorderLayout.WEST)

        button_panel = JPanel()
        button_panel.setLayout(GridLayout(8, 1))
        button_panel.add(JLabel('<-- Selected'))
        button_panel.add(JLabel('Removed -->'))
        select = JButton('Select')
        select.setActionCommand('Select')
        select.addActionListener(self)
        button_panel.add(select)
        button_panel.add(JLabel(''))
        restrict = JButton('Remove')
        restrict.setActionCommand('Remove')
        restrict.addActionListener(self)
        button_panel.add(restrict)
        button_panel.add(JLabel(''))
        quit = JButton('Exit')
        quit.setActionCommand('Exit')
        quit.addActionListener(self)
        button_panel.add(quit)
        button_panel.add(JLabel(''))
        pane.add(button_panel, BorderLayout.CENTER)

        self.rem_pane, self.rem_list, self.rem = self.createList(removed)
        pane.add(self.rem_pane, BorderLayout.EAST)

        warning_panel = JPanel()
        warning_panel.add(
            JLabel(
                "Warning: Removing/adding loci or pops might take some time!"))
        pane.add(warning_panel, BorderLayout.NORTH)

        self.pack()
Beispiel #12
0
    def __init__(self, frame, what, all, removed, pingFun):
        JDialog.__init__(self,frame, what)
        self.frame   = frame
        self.all     = all
        self.removed = removed 
        self.pingFun = pingFun
        pane = self.getRootPane().getContentPane()

        self.sel_pane, self.sel_list, self.sel = self.createList(all)
        pane.add(self.sel_pane, BorderLayout.WEST)

        button_panel = JPanel()
        button_panel.setLayout(GridLayout(8,1))
        button_panel.add(JLabel('<-- Selected'))
        button_panel.add(JLabel('Removed -->'))
        select = JButton('Select')
        select.setActionCommand('Select')
        select.addActionListener(self)
        button_panel.add(select)
        button_panel.add(JLabel(''))
        restrict = JButton('Remove')
        restrict.setActionCommand('Remove')
        restrict.addActionListener(self)
        button_panel.add(restrict)
        button_panel.add(JLabel(''))
        quit = JButton('Exit')
        quit.setActionCommand('Exit')
        quit.addActionListener(self)
        button_panel.add(quit)
        button_panel.add(JLabel(''))
        pane.add(button_panel, BorderLayout.CENTER)

        self.rem_pane, self.rem_list, self.rem = self.createList(removed)
        pane.add(self.rem_pane, BorderLayout.EAST)


        warning_panel = JPanel()
        warning_panel.add(JLabel("Warning: Removing/adding loci or pops might take some time!"))
        pane.add(warning_panel, BorderLayout.NORTH)

        self.pack()
Beispiel #13
0
    def __init__(self, frame, chart, lociNames, pv,
                 ci, confLines, locusFst, isDominant, fdr):
        JDialog(frame)
        self.chart = chart
        self.frame = frame
        self.confLines = confLines
        self.isDominant = isDominant
        self.fdr = fdr
        pane = self.getRootPane().getContentPane()

        pane.setLayout(BorderLayout())

        self.initTable(lociNames, pv, ci, locusFst)
        scrollPane = JScrollPane(self.table)
        osName = System.getProperty('os.name').lower()

        if not System.getProperty('java.specification.version')[-1] == '5':
            self.table.setFillsViewportHeight(True)
        pane.add(scrollPane, BorderLayout.CENTER)

        buttonPane = JPanel()
        sll = JButton('Save loci list')
        sll.addActionListener(self)
        sll.setActionCommand('SLL')
        buttonPane.add(sll)
        sci = JButton('Save confidence intervals')
        sci.addActionListener(self)
        sci.setActionCommand('SCI')
        buttonPane.add(sci)
        close = JButton('Close')
        close.addActionListener(self)
        close.setActionCommand('Close')
        buttonPane.add(close)
        pane.add(buttonPane, BorderLayout.PAGE_END)


        self.pack()
Beispiel #14
0
    def __init__(self, frame, chart, lociNames, pv, ci, confLines, locusFst,
                 isDominant, fdr):
        JDialog(frame)
        self.chart = chart
        self.frame = frame
        self.confLines = confLines
        self.isDominant = isDominant
        self.fdr = fdr
        pane = self.getRootPane().getContentPane()

        pane.setLayout(BorderLayout())

        self.initTable(lociNames, pv, ci, locusFst)
        scrollPane = JScrollPane(self.table)
        osName = System.getProperty('os.name').lower()

        if not System.getProperty('java.specification.version')[-1] == '5':
            self.table.setFillsViewportHeight(True)
        pane.add(scrollPane, BorderLayout.CENTER)

        buttonPane = JPanel()
        sll = JButton('Save loci list')
        sll.addActionListener(self)
        sll.setActionCommand('SLL')
        buttonPane.add(sll)
        sci = JButton('Save confidence intervals')
        sci.addActionListener(self)
        sci.setActionCommand('SCI')
        buttonPane.add(sci)
        close = JButton('Close')
        close.addActionListener(self)
        close.setActionCommand('Close')
        buttonPane.add(close)
        pane.add(buttonPane, BorderLayout.PAGE_END)

        self.pack()
Beispiel #15
0
    def initComponents(self):
        TabbedPane1 = JTabbedPane()
        GeneratorScrollPane = JScrollPane()
        GeneratorPanel = JPanel()
        jlbl1 = JLabel()
        jlbl2 = JLabel()
        spanePayloadList = JScrollPane()
        self.listPayloads = JList()
        pastePayloadButton = JButton(
            actionPerformed=self.pastePayloadButtonAction)
        removePayloadButton = JButton(
            actionPerformed=self.removePayloadButtonAction)
        clearPayloadButton = JButton(
            actionPerformed=self.clearPayloadButtonAction)
        self.textNewPayload = JTextField()
        addPayloadButton = JButton(actionPerformed=self.addPayloadButtonAction)
        jSeparator1 = JSeparator()
        jlbl3 = JLabel()
        jlbl4 = JLabel()
        self.chkGeneral = JCheckBox()
        self.chkMAXDB = JCheckBox()
        self.chkMSSQL = JCheckBox()
        self.chkMSAccess = JCheckBox()
        self.chkPostgres = JCheckBox()
        self.chkOracle = JCheckBox()
        self.chkSqlite = JCheckBox()
        self.chkMysql = JCheckBox()
        jlbl5 = JLabel()
        toClipboardButton = JButton(
            actionPerformed=self.toClipboardButtonAction)
        toFileButton = JButton(actionPerformed=self.toFileButtonAction)
        ProcessorScrollPane = JScrollPane()
        ProcessorPanel = JPanel()
        jLabel1 = JLabel()
        self.comboProcessorTech = JComboBox()
        jSeparator2 = JSeparator()
        jLabel2 = JLabel()
        jLabel3 = JLabel()
        jScrollPane1 = JScrollPane()
        self.textPlainPayload = JTextArea()
        jLabel4 = JLabel()
        jScrollPane2 = JScrollPane()
        self.textTamperedPayload = JTextArea()
        tamperPayloadButton = JButton(
            actionPerformed=self.tamperPayloadButtonAction)

        jlbl1.setForeground(Color(255, 102, 51))
        jlbl1.setFont(Font(jlbl1.getFont().toString(), 1, 14))
        jlbl1.setText("User-Defiend Payloads")

        jlbl2.setText(
            "This payload type lets you configure a simple list of strings that are used as payloads."
        )

        spanePayloadList.setViewportView(self.listPayloads)
        self.extender.PayloadList = [
            "%", "'", "\"\"", "''", "'", "'--", "; waitfor delay '0:30:0'--",
            "1;waitfor delay '0:30:0'--", "(\",)')(,(("
        ]
        self.listPayloads.setListData(self.extender.PayloadList)

        pastePayloadButton.setText("Paste")
        pastePayloadButton.setActionCommand("pastePayloadButton")
        # pastePayloadButton.addActionListener()

        removePayloadButton.setText("Remove")

        clearPayloadButton.setText("Clear")

        self.textNewPayload.setToolTipText("")

        addPayloadButton.setText("Add")

        jlbl3.setForeground(Color(255, 102, 51))
        jlbl3.setFont(Font(jlbl3.getFont().toString(), 1, 14))
        jlbl3.setText("Tamper Techniques")

        jlbl4.setText(
            "You can select the techniques that you want to perform processing tasks on each user-defined payload"
        )

        self.chkGeneral.setText("General")
        self.chkGeneral.setSelected(True)

        self.chkMAXDB.setText("SAP MAX DB")

        self.chkMSSQL.setText("MS SQL Server")

        self.chkMSAccess.setText("MS Access")

        self.chkPostgres.setText("Postgres SQL")

        self.chkOracle.setText("Oracle")

        self.chkSqlite.setText("Sqlite")

        self.chkMysql.setText("MySql")

        jlbl5.setText("[?] Save the Generated/Tampered Payloads to :")

        toClipboardButton.setText("Clipboard")

        toFileButton.setText("File")

        GeneratorPanelLayout = GroupLayout(GeneratorPanel)
        GeneratorPanel.setLayout(GeneratorPanelLayout)
        GeneratorPanelLayout.setHorizontalGroup(
            GeneratorPanelLayout.createParallelGroup(
                GroupLayout.Alignment.LEADING).
            addGroup(GeneratorPanelLayout.createSequentialGroup(
            ).addContainerGap().addGroup(
                GeneratorPanelLayout.createParallelGroup(
                    GroupLayout.Alignment.TRAILING).addComponent(
                        jlbl2, GroupLayout.DEFAULT_SIZE,
                        GroupLayout.DEFAULT_SIZE,
                        Short.MAX_VALUE).addComponent(
                            jlbl4, GroupLayout.Alignment.LEADING,
                            GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                            Short.MAX_VALUE).addComponent(
                                jSeparator1, GroupLayout.Alignment.LEADING).
                addGroup(GeneratorPanelLayout.createSequentialGroup().addGap(
                    6, 6, 6).addGroup(
                        GeneratorPanelLayout.createParallelGroup(
                            GroupLayout.Alignment.LEADING).addGroup(
                                GeneratorPanelLayout.createSequentialGroup(
                                ).addGroup(
                                    GeneratorPanelLayout.createParallelGroup(
                                        GroupLayout.Alignment.LEADING,
                                        False).addComponent(
                                            removePayloadButton,
                                            GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE,
                                            Short.MAX_VALUE).addComponent(
                                                clearPayloadButton,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                Short.MAX_VALUE).
                                    addComponent(pastePayloadButton,
                                                 GroupLayout.DEFAULT_SIZE,
                                                 GroupLayout.DEFAULT_SIZE,
                                                 Short.MAX_VALUE).addComponent(
                                                     addPayloadButton,
                                                     GroupLayout.DEFAULT_SIZE,
                                                     GroupLayout.DEFAULT_SIZE,
                                                     Short.MAX_VALUE)).
                                addGap(21, 21, 21).addGroup(
                                    GeneratorPanelLayout.createParallelGroup(
                                        GroupLayout.Alignment.LEADING).
                                    addComponent(
                                        self.textNewPayload).addComponent(
                                            spanePayloadList))).addComponent(
                                                jlbl1).addComponent(jlbl3).
                        addGroup(GeneratorPanelLayout.createSequentialGroup(
                        ).addGroup(
                            GeneratorPanelLayout.createParallelGroup(
                                GroupLayout.Alignment.LEADING).addComponent(
                                    self.chkGeneral).addComponent(
                                        self.chkMSSQL)
                        ).addGap(18, 18, 18).addGroup(
                            GeneratorPanelLayout.createParallelGroup(
                                GroupLayout.Alignment.LEADING).addComponent(
                                    self.chkPostgres).addComponent(
                                        self.chkMAXDB)
                        ).addGap(18, 18, 18).addGroup(
                            GeneratorPanelLayout.createParallelGroup(
                                GroupLayout.Alignment.LEADING).addComponent(
                                    self.chkMSAccess).addComponent(
                                        self.chkOracle)
                        ).addGap(18, 18, 18).addGroup(
                            GeneratorPanelLayout.createParallelGroup(
                                GroupLayout.Alignment.LEADING).addComponent(
                                    self.chkSqlite).addComponent(self.chkMysql)
                        )).addGroup(GeneratorPanelLayout.createSequentialGroup(
                        ).addComponent(jlbl5).addPreferredGap(
                            LayoutStyle.ComponentPlacement.
                            UNRELATED).addComponent(toClipboardButton).addGap(
                                18, 18,
                                18).addComponent(toFileButton,
                                                 GroupLayout.PREFERRED_SIZE,
                                                 97, GroupLayout.PREFERRED_SIZE
                                                 ))))).addContainerGap()))
        GeneratorPanelLayout.setVerticalGroup(
            GeneratorPanelLayout.createParallelGroup(
                GroupLayout.Alignment.LEADING).
            addGroup(GeneratorPanelLayout.createSequentialGroup(
            ).addContainerGap().addComponent(jlbl1).addPreferredGap(
                LayoutStyle.ComponentPlacement.RELATED).addComponent(
                    jlbl2, GroupLayout.PREFERRED_SIZE, 21,
                    GroupLayout.PREFERRED_SIZE).addGap(18, 18, 18).addGroup(
                        GeneratorPanelLayout.createParallelGroup(
                            GroupLayout.Alignment.LEADING).addComponent(
                                spanePayloadList, GroupLayout.PREFERRED_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.PREFERRED_SIZE).
                        addGroup(GeneratorPanelLayout.createSequentialGroup(
                        ).addComponent(pastePayloadButton).addPreferredGap(
                            LayoutStyle.ComponentPlacement.UNRELATED
                        ).addComponent(removePayloadButton).addPreferredGap(
                            LayoutStyle.ComponentPlacement.UNRELATED).
                                 addComponent(clearPayloadButton))).
                     addPreferredGap(
                         LayoutStyle.ComponentPlacement.RELATED).addGroup(
                             GeneratorPanelLayout.createParallelGroup(
                                 GroupLayout.Alignment.BASELINE).addComponent(
                                     self.textNewPayload,
                                     GroupLayout.PREFERRED_SIZE,
                                     GroupLayout.DEFAULT_SIZE,
                                     GroupLayout.PREFERRED_SIZE).
                             addComponent(addPayloadButton)).addPreferredGap(
                                 LayoutStyle.ComponentPlacement.UNRELATED).
                     addComponent(jSeparator1, GroupLayout.PREFERRED_SIZE, 10,
                                  GroupLayout.PREFERRED_SIZE).addPreferredGap(
                                      LayoutStyle.ComponentPlacement.RELATED).
                     addComponent(jlbl3).addPreferredGap(
                         LayoutStyle.ComponentPlacement.UNRELATED
                     ).addComponent(jlbl4).addPreferredGap(
                         LayoutStyle.ComponentPlacement.UNRELATED).addGroup(
                             GeneratorPanelLayout.createParallelGroup(
                                 GroupLayout.Alignment.BASELINE).addComponent(
                                     self.chkGeneral).addComponent(
                                         self.chkMAXDB).addComponent(
                                             self.chkOracle).addComponent(
                                                 self.chkSqlite)).
                     addPreferredGap(
                         LayoutStyle.ComponentPlacement.UNRELATED).addGroup(
                             GeneratorPanelLayout.createParallelGroup(
                                 GroupLayout.Alignment.BASELINE).addComponent(
                                     self.chkMSSQL).addComponent(
                                         self.chkPostgres).addComponent(
                                             self.chkMSAccess).addComponent(
                                                 self.chkMysql)
                         ).addGap(18, 18, 18).addGroup(
                             GeneratorPanelLayout.createParallelGroup(
                                 GroupLayout.Alignment.BASELINE).addComponent(
                                     jlbl5).addComponent(toClipboardButton).
                             addComponent(toFileButton)).addGap(20, 20, 20)))

        GeneratorScrollPane.setViewportView(GeneratorPanel)

        TabbedPane1.addTab("Generator", GeneratorScrollPane)

        for item in self.extender.getTamperFuncsName():
            self.comboProcessorTech.addItem(item)
        self.comboProcessorTech.setSelectedIndex(0)

        jLabel1.setText("Processor Technique :")

        jLabel2.setText(
            "Modify Plain Payloads based on the selected Processor Technique. Write one payload per line."
        )

        jLabel3.setText("Plain Payloads:")

        self.textPlainPayload.setColumns(20)
        self.textPlainPayload.setRows(5)
        jScrollPane1.setViewportView(self.textPlainPayload)

        jLabel4.setText("Tampered Payloads:")

        self.textTamperedPayload.setColumns(20)
        self.textTamperedPayload.setRows(5)
        jScrollPane2.setViewportView(self.textTamperedPayload)

        tamperPayloadButton.setText("Tamper Payload")

        ProcessorPanelLayout = GroupLayout(ProcessorPanel)
        ProcessorPanel.setLayout(ProcessorPanelLayout)
        ProcessorPanelLayout.setHorizontalGroup(
            ProcessorPanelLayout.
            createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(
                GroupLayout.Alignment.TRAILING,
                ProcessorPanelLayout.createSequentialGroup().addContainerGap(
                    GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(
                        tamperPayloadButton).addContainerGap(
                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            ).addGroup(ProcessorPanelLayout.createSequentialGroup(
            ).addContainerGap().addGroup(
                ProcessorPanelLayout.createParallelGroup(
                    GroupLayout.Alignment.LEADING).addComponent(jSeparator2).
                addComponent(jScrollPane1).addComponent(jScrollPane2).addGroup(
                    ProcessorPanelLayout.createSequentialGroup().addGroup(
                        ProcessorPanelLayout.createParallelGroup(
                            GroupLayout.Alignment.LEADING).addComponent(
                                jLabel3).addComponent(jLabel4).addGroup(
                                    ProcessorPanelLayout.createSequentialGroup(
                                    ).addComponent(jLabel1).addPreferredGap(
                                        LayoutStyle.ComponentPlacement.
                                        UNRELATED).addComponent(
                                            self.comboProcessorTech,
                                            GroupLayout.PREFERRED_SIZE, 286,
                                            GroupLayout.PREFERRED_SIZE)).
                        addComponent(jLabel2)).addGap(
                            0, 78, Short.MAX_VALUE))).addContainerGap()))
        ProcessorPanelLayout.setVerticalGroup(
            ProcessorPanelLayout.createParallelGroup(
                GroupLayout.Alignment.LEADING).addGroup(
                    ProcessorPanelLayout.createSequentialGroup().addGap(
                        33, 33, 33).addGroup(
                            ProcessorPanelLayout.createParallelGroup(
                                GroupLayout.Alignment.BASELINE).
                            addComponent(jLabel1).addComponent(
                                self.comboProcessorTech,
                                GroupLayout.PREFERRED_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.PREFERRED_SIZE)).addGap(
                                    18, 18, 18).addComponent(
                                        jSeparator2,
                                        GroupLayout.PREFERRED_SIZE, 10,
                                        GroupLayout.PREFERRED_SIZE).addGap(
                                            12, 12,
                                            12).addComponent(jLabel2).addGap(
                                                18, 18, 18).
                    addComponent(jLabel3).addPreferredGap(
                        LayoutStyle.ComponentPlacement.UNRELATED).addComponent(
                            jScrollPane1, GroupLayout.PREFERRED_SIZE,
                            GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE).addPreferredGap(
                                LayoutStyle.ComponentPlacement.UNRELATED).
                    addComponent(jLabel4).addPreferredGap(
                        LayoutStyle.ComponentPlacement.UNRELATED).addComponent(
                            jScrollPane2, GroupLayout.PREFERRED_SIZE,
                            GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE).addPreferredGap(
                                LayoutStyle.ComponentPlacement.UNRELATED).
                    addComponent(tamperPayloadButton).addGap(36, 36, 36)))

        ProcessorScrollPane.setViewportView(ProcessorPanel)

        TabbedPane1.addTab("Processor", ProcessorScrollPane)

        self.mainPanel = JPanel()
        layout = GroupLayout(self.mainPanel)
        self.mainPanel.setLayout(layout)
        layout.setHorizontalGroup(
            layout.createParallelGroup(
                GroupLayout.Alignment.LEADING).addComponent(
                    TabbedPane1, GroupLayout.DEFAULT_SIZE, 701,
                    Short.MAX_VALUE))
        layout.setVerticalGroup(
            layout.createParallelGroup(
                GroupLayout.Alignment.LEADING).addComponent(TabbedPane1))

        TabbedPane1.getAccessibleContext().setAccessibleName("Generator")
Beispiel #16
0
    def __init__(self, menuHandles, manager, isDominant, systemPanel, isTemporal=False):
        self.systemPanel = systemPanel
        self.knownPops = 0
        self.ignoreChanges = True
        JPanel()
        self.menuHandles = menuHandles
        self.isDominant = isDominant
        self.isTemporal = isTemporal
        if isDominant:
            self.setLayout(GridLayout(8, 2))
        else:
            self.setLayout(GridLayout(5, 2))
        if isTemporal:
            self.add(JLabel("Ne"))
            ne = JFormattedTextField(NumberFormat.getNumberInstance(Locale.US))
            ne.addPropertyChangeListener(self)
            self.ne = ne
            self.add(ne)
        else:
            self.add(JLabel("Attempted Fst"))
            fst = JFormattedTextField(NumberFormat.getNumberInstance(Locale.US))
            fst.addPropertyChangeListener(self)
            self.fst = fst
            self.add(fst)
        self.add(JLabel("Expected total pops"))
        pops = JFormattedTextField(NumberFormat.getIntegerInstance(Locale.US))
        pops.addPropertyChangeListener(self)
        # self.pops = JComboBox(['1', '2', '4', '8', '12', '16'])
        self.pops = pops
        self.add(self.pops)
        if not isDominant and not isTemporal:
            self.add(JLabel("Mutation model"))
            self.mut = JComboBox(["Infinite Alleles", "Stepwise"])
            self.mut.addItemListener(self)
            self.add(self.mut)
        self.add(JLabel("Subsample size"))
        sampleSize = JFormattedTextField(NumberFormat.getIntegerInstance(Locale.US))
        sampleSize.addPropertyChangeListener(self)
        self.sampleSize = sampleSize
        self.add(self.sampleSize)
        if isDominant:
            self.add(JLabel("Theta"))
            theta = JFormattedTextField(NumberFormat.getNumberInstance(Locale.US))
            theta.addPropertyChangeListener(self)
            self.theta = theta
            self.add(theta)
            theta.setValue(0.1)

            self.add(JLabel("Beta-a"))
            beta1 = JFormattedTextField(NumberFormat.getNumberInstance(Locale.US))
            beta1.addPropertyChangeListener(self)
            self.beta1 = beta1
            self.add(beta1)
            beta1.setValue(0.25)

            self.add(JLabel("Beta-b"))
            beta2 = JFormattedTextField(NumberFormat.getNumberInstance(Locale.US))
            beta2.addPropertyChangeListener(self)
            self.beta2 = beta2
            self.add(beta2)
            beta2.setValue(0.25)

            self.add(JLabel("Critical frequency"))
            crit = JFormattedTextField(NumberFormat.getNumberInstance(Locale.US))
            crit.addPropertyChangeListener(self)
            self.crit = crit
            self.add(crit)
            crit.setValue(0.99)

        run = JButton("Run!")
        run.addActionListener(manager)
        run.setActionCommand("RunFDist")
        self.run = run
        self.add(run)
        cancel = JButton("Stop")
        cancel.addActionListener(manager)
        cancel.setActionCommand("CancelFDist")
        self.cancel = cancel
Beispiel #17
0
    def __init__(self,
                 menuHandles,
                 manager,
                 isDominant,
                 systemPanel,
                 isTemporal=False):
        self.systemPanel = systemPanel
        self.knownPops = 0
        self.ignoreChanges = True
        JPanel()
        self.menuHandles = menuHandles
        self.isDominant = isDominant
        self.isTemporal = isTemporal
        if isDominant:
            self.setLayout(GridLayout(8, 2))
        else:
            self.setLayout(GridLayout(5, 2))
        if isTemporal:
            self.add(JLabel('Ne'))
            ne = JFormattedTextField(NumberFormat.getNumberInstance(Locale.US))
            ne.addPropertyChangeListener(self)
            self.ne = ne
            self.add(ne)
            self.add(JLabel('Expected total samples'))
        else:
            self.add(JLabel('Attempted Fst'))
            fst = JFormattedTextField(NumberFormat.getNumberInstance(
                Locale.US))
            fst.addPropertyChangeListener(self)
            self.fst = fst
            self.add(fst)
            self.add(JLabel('Expected total pops'))
        pops = JFormattedTextField(NumberFormat.getIntegerInstance(Locale.US))
        pops.addPropertyChangeListener(self)
        # self.pops = JComboBox(['1', '2', '4', '8', '12', '16'])
        self.pops = pops
        self.add(self.pops)
        if not isDominant and not isTemporal:
            self.add(JLabel('Mutation model'))
            self.mut = JComboBox(['Infinite Alleles', 'Stepwise'])
            self.mut.addItemListener(self)
            self.add(self.mut)
        else:
            self.mut = None
        self.add(JLabel('Subsample size'))
        sampleSize = JFormattedTextField(
            NumberFormat.getIntegerInstance(Locale.US))
        sampleSize.addPropertyChangeListener(self)
        self.sampleSize = sampleSize
        self.add(self.sampleSize)
        if isDominant:
            self.add(JLabel('Theta'))
            theta = JFormattedTextField(
                NumberFormat.getNumberInstance(Locale.US))
            theta.addPropertyChangeListener(self)
            self.theta = theta
            self.add(theta)
            theta.setValue(0.1)

            self.add(JLabel('Beta-a'))
            beta1 = JFormattedTextField(
                NumberFormat.getNumberInstance(Locale.US))
            beta1.addPropertyChangeListener(self)
            self.beta1 = beta1
            self.add(beta1)
            beta1.setValue(0.25)

            self.add(JLabel('Beta-b'))
            beta2 = JFormattedTextField(
                NumberFormat.getNumberInstance(Locale.US))
            beta2.addPropertyChangeListener(self)
            self.beta2 = beta2
            self.add(beta2)
            beta2.setValue(0.25)

            self.add(JLabel('Critical frequency'))
            crit = JFormattedTextField(
                NumberFormat.getNumberInstance(Locale.US))
            crit.addPropertyChangeListener(self)
            self.crit = crit
            self.add(crit)
            crit.setValue(0.99)

        run = JButton('Run!')
        run.addActionListener(manager)
        run.setActionCommand('RunFDist')
        self.run = run
        self.add(run)
Beispiel #18
0
def createButton(text, command, manager):
    button = JButton(text)
    button.setActionCommand(command)
    button.addActionListener(manager)
    return button