Пример #1
0
  // {{{createCenterPanelAll() method
  public JPanel createCenterPanelAll() {
    long filesSize = 0L;
    JPanel centerPanel = new JPanel(new BorderLayout());

    for (VFSFile selectedFile : selectedFiles) {
      if (selectedFile.getType() == VFSFile.DIRECTORY) {
        File ioFile = new File(selectedFile.getPath());
        filesSize += IOUtilities.fileLength(ioFile);
      } else if (selectedFile.getType() == VFSFile.FILE) filesSize += selectedFile.getLength();
    }

    JPanel propField = new JPanel();
    propField.setLayout(new GridLayout(2, 1));
    String path = local.getPath();
    if (OperatingSystem.isWindows()
        || OperatingSystem.isWindows9x()
        || OperatingSystem.isWindowsNT()) {
      path = path.substring(0, path.lastIndexOf(92)); // 92 = '\'
    } else {
      path = path.substring(0, path.lastIndexOf('/'));
    }
    propField.add(new JLabel(jEdit.getProperty("fileprop.path") + ": " + path));
    propField.add(
        new JLabel(
            jEdit.getProperty("fileprop.size")
                + ": "
                + StandardUtilities.formatFileSize(filesSize)));
    Border etch = BorderFactory.createEtchedBorder();
    propField.setBorder(
        BorderFactory.createTitledBorder(etch, jEdit.getProperty("fileprop.properties")));
    centerPanel.add(BorderLayout.CENTER, propField);

    return centerPanel;
  } // }}}
Пример #2
0
  // {{{ createCenterPanel() method
  public JPanel createCenterPanel() {
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm");

    JPanel centerPanel = new JPanel(new BorderLayout());

    JPanel propField = new JPanel();
    propField.setLayout(new GridLayout(4, 1));
    propField.add(new JLabel(jEdit.getProperty("fileprop.name") + ": " + local.getName()));
    propField.add(new JLabel(jEdit.getProperty("fileprop.path") + ": " + local.getPath()));

    // Show last modified property only for LocalFile
    if (local instanceof LocalFile) {
      propField.add(
          new JLabel(
              jEdit.getProperty("fileprop.lastmod")
                  + ": "
                  + sdf.format(new Date(((LocalFile) local).getModified()))));
    }
    if (local.getType() == VFSFile.DIRECTORY) {
      File ioFile = new File(local.getPath());
      propField.add(
          new JLabel(
              jEdit.getProperty("fileprop.size")
                  + ": "
                  + StandardUtilities.formatFileSize(IOUtilities.fileLength(ioFile))));
    } else {
      propField.add(
          new JLabel(
              jEdit.getProperty("fileprop.size")
                  + ": "
                  + StandardUtilities.formatFileSize(local.getLength())));
    }
    Border etch = BorderFactory.createEtchedBorder();
    propField.setBorder(
        BorderFactory.createTitledBorder(etch, jEdit.getProperty("fileprop.properties")));
    centerPanel.add(BorderLayout.CENTER, propField);

    JPanel attributeField = new JPanel();
    attributeField.setLayout(new GridLayout(1, 2));
    readable = new JCheckBox(jEdit.getProperty("fileprop.readable"));
    readable.setSelected(local.isReadable());
    readable.setEnabled(false);
    attributeField.add(readable);

    write = new JCheckBox(jEdit.getProperty("fileprop.writeable"));
    write.setSelected(local.isWriteable());
    write.setEnabled(false);
    attributeField.add(write);
    attributeField.setBorder(
        BorderFactory.createTitledBorder(etch, jEdit.getProperty("fileprop.attribute")));
    centerPanel.add(BorderLayout.SOUTH, attributeField);

    return centerPanel;
  } // }}}