コード例 #1
0
 private void initRoot(DiscoveryDescriptor wizardDescriptor) {
   Object val = property.getValue();
   String output = null;
   if (val instanceof String) {
     output = (String) val;
   }
   if (output != null && output.length() > 0) {
     initFields(output);
     return;
   }
   initFields(wizardDescriptor.getRootFolder());
 }
コード例 #2
0
 public void store() {
   switch (property.getKind()) {
     case MakeLogFile:
     case Folder:
     case BinaryFile:
       property.setValue(getComboBoxText());
       storeHistory();
       break;
     case BinaryFiles:
       String text = getComboBoxText();
       StringTokenizer st = new StringTokenizer(text, LIST_LIST_DELIMITER); // NOI18N
       List<String> list = new ArrayList<String>();
       while (st.hasMoreTokens()) {
         list.add(st.nextToken());
       }
       property.setValue(list.toArray(new String[list.size()]));
       storeHistory();
       break;
     default:
       break;
   }
 }
コード例 #3
0
 private void initArray() {
   Object val = property.getValue();
   if (val instanceof String[]) {
     StringBuilder buf = new StringBuilder();
     for (String s : (String[]) val) {
       if (buf.length() > 0) {
         buf.append(LIST_LIST_DELIMITER);
       }
       buf.append(s);
     }
     initFields(buf.toString());
   } else {
     initFields(""); // NOI18N
   }
 }
コード例 #4
0
 public boolean valid() {
   String path = getComboBoxText();
   File file;
   switch (property.getKind()) {
     case Folder:
       if (path.length() == 0) {
         return false;
       }
       file = new File(path);
       if (file.exists() && file.isDirectory()) {
         return true;
       }
       break;
     case MakeLogFile:
     case BinaryFile:
       if (path.length() == 0) {
         return false;
       }
       file = new File(path);
       if (file.exists() && file.isFile()) {
         return true;
       }
       break;
     case BinaryFiles:
       String text = getComboBoxText();
       StringTokenizer st = new StringTokenizer(text, LIST_LIST_DELIMITER); // NOI18N
       while (st.hasMoreTokens()) {
         path = st.nextToken();
         if (path.length() == 0) {
           return false;
         }
         file = new File(path);
         if (!(file.exists() && file.isFile())) {
           return false;
         }
       }
       return true;
     default:
       break;
   }
   return false;
 }
コード例 #5
0
 public ProviderControl(
     String key,
     ProviderProperty property,
     DiscoveryDescriptor wizardDescriptor,
     JPanel panel,
     ChangeListener listener) {
   this.propertyKey = key;
   this.property = property;
   this.panel = panel;
   this.listener = listener;
   this.wizardDescriptor = wizardDescriptor;
   description = property.getDescription();
   label = new JLabel();
   Mnemonics.setLocalizedText(label, property.getName());
   switch (property.getKind()) {
     case MakeLogFile:
       field = new EditableComboBox();
       field.setEditable(true);
       chooserMode = JFileChooser.FILES_ONLY;
       initBuildOrRoot(wizardDescriptor);
       button = new JButton();
       Mnemonics.setLocalizedText(button, getString("ROOT_DIR_BROWSE_BUTTON_TXT"));
       layout(panel);
       button.addActionListener(
           new ActionListener() {
             @Override
             public void actionPerformed(ActionEvent evt) {
               rootFolderButtonActionPerformed(
                   evt,
                   ProviderControl.this.property.getKind() == PropertyKind.BinaryFile,
                   getString("LOG_FILE_CHOOSER_TITLE_TXT"));
             }
           });
       addListeners();
       break;
     case BinaryFile:
       field = new EditableComboBox();
       field.setEditable(true);
       chooserMode = JFileChooser.FILES_ONLY;
       initBuildOrRoot(wizardDescriptor);
       button = new JButton();
       Mnemonics.setLocalizedText(button, getString("ROOT_DIR_BROWSE_BUTTON_TXT"));
       layout(panel);
       button.addActionListener(
           new ActionListener() {
             @Override
             public void actionPerformed(ActionEvent evt) {
               rootFolderButtonActionPerformed(
                   evt,
                   ProviderControl.this.property.getKind() == PropertyKind.BinaryFile,
                   getString("BINARY_FILE_CHOOSER_TITLE_TXT"));
             }
           });
       addListeners();
       break;
     case Folder:
       field = new EditableComboBox();
       field.setEditable(true);
       chooserMode = JFileChooser.DIRECTORIES_ONLY;
       initRoot(wizardDescriptor);
       button = new JButton();
       Mnemonics.setLocalizedText(button, getString("ROOT_DIR_BROWSE_BUTTON_TXT"));
       layout(panel);
       button.addActionListener(
           new ActionListener() {
             @Override
             public void actionPerformed(ActionEvent evt) {
               rootFolderButtonActionPerformed(evt, true, getString("ROOT_DIR_CHOOSER_TITLE_TXT"));
             }
           });
       addListeners();
       break;
     case BinaryFiles:
       field = new EditableComboBox();
       field.setEditable(true);
       chooserMode = JFileChooser.FILES_ONLY;
       initArray();
       button = new JButton();
       Mnemonics.setLocalizedText(button, getString("ROOT_DIR_EDIT_BUTTON_TXT"));
       layout(panel);
       button.addActionListener(
           new ActionListener() {
             @Override
             public void actionPerformed(ActionEvent evt) {
               additionalLibrariesButtonActionPerformed(evt);
             }
           });
       addListeners();
       break;
     default:
       // unsuported UI
       break;
   }
 }