Example #1
0
    def __init__(self, parent, title, modal, app):
        border = BorderFactory.createEmptyBorder(5, 7, 5, 7)
        self.getContentPane().setBorder(border)
        self.setLayout(BoxLayout(self.getContentPane(), BoxLayout.Y_AXIS))

        #Intro
        falsePositivePng = File.separator.join(
            [app.SCRIPTDIR, "images", "icons", "not_error36.png"])
        introLbl = JMultilineLabel(
            app.strings.getString("manual_false_positives_info"))
        introLbl.setMaxWidth(600)

        #Table
        table = JTable()
        columns = [
            app.strings.getString("Tool"),
            app.strings.getString("Check"),
            app.strings.getString("Error_id"),
            app.strings.getString("OSM_id")
        ]
        self.tableModel = MyTableModel([], columns)
        table.setModel(self.tableModel)
        scrollPane = JScrollPane(table)
        scrollPane.setAlignmentX(0.0)

        #OK button
        btnPanel = JPanel(FlowLayout(FlowLayout.CENTER))
        okBtn = JButton("OK",
                        ImageProvider.get("ok"),
                        actionPerformed=self.on_okBtn_clicked)
        btnPanel.add(okBtn)
        btnPanel.setAlignmentX(0.0)

        #Layout
        headerPnl = JPanel()
        headerPnl.setLayout(BoxLayout(headerPnl, BoxLayout.X_AXIS))
        headerPnl.add(JLabel(ImageIcon(falsePositivePng)))
        headerPnl.add(Box.createRigidArea(Dimension(10, 0)))
        headerPnl.add(introLbl)
        headerPnl.setAlignmentX(0.0)
        self.add(headerPnl)
        self.add(Box.createRigidArea(Dimension(0, 10)))
        self.add(scrollPane)
        self.add(Box.createRigidArea(Dimension(0, 10)))
        self.add(btnPanel)

        self.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE)
        self.pack()
Example #2
0
    def __init__(self, parent, title, modal, app):
        """Restore the tools data by:
           - downloading the tools list
           - downloading the tools jar files
           - extracting the tools data from jar files
        """
        self.app = app
        border = BorderFactory.createEmptyBorder(5, 7, 5, 7)
        mainPane = self.getContentPane()
        mainPane.setLayout(BorderLayout(5, 5))
        mainPane.setBorder(border)
        self.setPreferredSize(Dimension(400, 200))
        self.taskOutput = JMultilineLabel(
            self.app.strings.getString("checking_for_updates"))
        self.taskOutput.setMaxWidth(350)
        self.progressBar = JProgressBar(0, 100, value=0, stringPainted=True)
        self.progressBar.setIndeterminate(True)
        self.cancelBtn = JButton("Cancel",
                                 actionPerformed=self.on_cancelBtn_clicked,
                                 enabled=True)
        self.okBtn = JButton("Ok",
                             actionPerformed=self.on_okBtn_clicked,
                             enabled=False)

        mainPane.add(self.taskOutput, BorderLayout.CENTER)
        bottomPanel = JPanel(BorderLayout(5, 5))
        bottomPanel.add(self.progressBar, BorderLayout.PAGE_START)
        buttonsPanel = JPanel()
        buttonsPanel.add(self.okBtn)
        buttonsPanel.add(self.cancelBtn)
        bottomPanel.add(buttonsPanel, BorderLayout.PAGE_END)
        mainPane.add(bottomPanel, BorderLayout.PAGE_END)
        self.pack()

        self.task = DownloaderTask(self)
        self.task.addPropertyChangeListener(self)
        self.task.execute()