Package net.pms.configuration

Examples of net.pms.configuration.DownloadPlugins


      @Override
      public String getToolTipText(MouseEvent e) {
        java.awt.Point p = e.getPoint();
        int rowIndex = rowAtPoint(p);

        DownloadPlugins plugin = plugins.get(rowIndex);
        return plugin.htmlString();
      }
    };

    refresh(table, cols);

    table.setRowHeight(22);
    table.setIntercellSpacing(new Dimension(8, 0));

    // Define column widths
    TableColumn nameColumn = table.getColumnModel().getColumn(0);
    nameColumn.setMinWidth(70);
    TableColumn versionColumn = table.getColumnModel().getColumn(2);
    versionColumn.setPreferredWidth(45);
    TableColumn ratingColumn = table.getColumnModel().getColumn(2);
    ratingColumn.setPreferredWidth(45);
    TableColumn authorColumn = table.getColumnModel().getColumn(3);
    authorColumn.setMinWidth(150);
    TableColumn descriptionColumn = table.getColumnModel().getColumn(4);
    descriptionColumn.setMinWidth(300);

    JScrollPane pane = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    pane.setBorder(BorderFactory.createEmptyBorder());
    pane.setPreferredSize(new Dimension(200, 139));
    builder.add(pane, FormLayoutUtil.flip(cc.xyw(1, 3, 9), colSpec, orientation));

    CustomJButton install = new CustomJButton(Messages.getString("NetworkTab.39"));
    builder.add(install, FormLayoutUtil.flip(cc.xy(1, 5), colSpec, orientation));
    install.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        if (!ExternalFactory.localPluginsInstalled()) {
          JOptionPane.showMessageDialog(
            looksFrame,
            Messages.getString("NetworkTab.40")
          );
          return;
        }

        if (!configuration.isAdmin()) {
          JOptionPane.showMessageDialog(
            looksFrame,
            Messages.getString("PluginTab.15"),
            Messages.getString("Dialog.PermissionsError"),
            JOptionPane.ERROR_MESSAGE
          );

          return;
        }

        final int[] rows = table.getSelectedRows();
        JPanel panel = new JPanel();
        GridLayout layout = new GridLayout(3, 1);
        panel.setLayout(layout);
        final JFrame frame = new JFrame(Messages.getString("NetworkTab.46"));
        frame.setSize(250, 110);
        JProgressBar progressBar = new JProgressBar();
        progressBar.setIndeterminate(true);
        panel.add(progressBar);
        final JLabel label = new JLabel("");
        final JLabel inst = new JLabel("");
        panel.add(inst);
        panel.add(label);
        frame.add(panel);

        // Center the installation progress window
        frame.setLocationRelativeTo(null);
        Runnable r = new Runnable() {
          @Override
          public void run() {
            for (int i = 0; i < rows.length; i++) {
              DownloadPlugins plugin = plugins.get(rows[i]);
              if (plugin.isOld()) {
                // This plugin requires newer UMS
                // display error and skip it.
                JOptionPane.showMessageDialog(
                    looksFrame,
                    "Plugin " + plugin.getName() + " requires a newer version of UMS. Please upgrade.",
                    "Version Error",
                    JOptionPane.ERROR_MESSAGE
                  );
                  frame.setVisible(false);
                  continue;
              }
              frame.setVisible(true);
              inst.setText(Messages.getString("NetworkTab.50") + ": " + plugin.getName());
              try {
                plugin.install(label);
              } catch (Exception e) {
                LOGGER.debug("An error occurred when trying to install the plugin: " + plugin.getName());
                LOGGER.debug("Full error: " + e);
              }
            }
            frame.setVisible(false);
          }
View Full Code Here


    DefaultTableModel tableModel = (DefaultTableModel) table.getModel();
    tableModel.setRowCount(0);

    for (int i = 0; i < plugins.size(); i++) {
      tableModel.insertRow(i, (Object[]) null);
      DownloadPlugins p = plugins.get(i);
      table.setValueAt(p.getName(), i, 0);
      table.setValueAt(p.getVersion(), i, 1);
      table.setValueAt(p.getRating(), i, 2);
      table.setValueAt(p.getAuthor(), i, 3);
      table.setValueAt(p.getDescription(), i, 4);
    }
    tableModel.fireTableDataChanged();
  }
View Full Code Here

TOP

Related Classes of net.pms.configuration.DownloadPlugins

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.