Java 类com.intellij.ui.FieldPanel 实例源码

项目:intellij-ce-playground    文件:JavaDocLocalInspection.java   
public FieldPanel createAdditionalJavadocTagsPanel(){
  FieldPanel additionalTagsPanel = new FieldPanel(InspectionsBundle.message("inspection.javadoc.label.text"), InspectionsBundle.message("inspection.javadoc.dialog.title"), null, null);
  additionalTagsPanel.setPreferredSize(new Dimension(150, additionalTagsPanel.getPreferredSize().height));
  additionalTagsPanel.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      final Document document = e.getDocument();
      try {
        final String text = document.getText(0, document.getLength());
        if (text != null) {
          myAdditionalJavadocTags = text.trim();
        }
      }
      catch (BadLocationException e1) {
         LOG.error(e1);
      }
    }
  });
  additionalTagsPanel.setText(myAdditionalJavadocTags);
  return additionalTagsPanel;
}
项目:intellij-ce-playground    文件:ProjectConfigurable.java   
private void createUIComponents() {
  myLanguageLevelCombo = new LanguageLevelCombo(JavaCoreBundle.message("default.language.level.description")) {
    @Override
    protected LanguageLevel getDefaultLevel() {
      Sdk sdk = myProjectJdkConfigurable.getSelectedProjectJdk();
      if (sdk == null) return null;
      JavaSdkVersion version = JavaSdk.getInstance().getVersion(sdk);
      return version == null ? null : version.getMaxLanguageLevel();
    }
  };
  final JTextField textField = new JTextField();
  final FileChooserDescriptor outputPathsChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
  InsertPathAction.addTo(textField, outputPathsChooserDescriptor);
  outputPathsChooserDescriptor.setHideIgnored(false);
  BrowseFilesListener listener = new BrowseFilesListener(textField, "", ProjectBundle.message("project.compiler.output"), outputPathsChooserDescriptor);
  myProjectCompilerOutput = new FieldPanel(textField, null, null, listener, EmptyRunnable.getInstance());
  FileChooserFactory.getInstance().installFileCompletion(myProjectCompilerOutput.getTextField(), outputPathsChooserDescriptor, true, null);
}
项目:tools-idea    文件:JavaDocLocalInspection.java   
public FieldPanel createAdditionalJavadocTagsPanel(){
  FieldPanel additionalTagsPanel = new FieldPanel(InspectionsBundle.message("inspection.javadoc.label.text"), InspectionsBundle.message("inspection.javadoc.dialog.title"), null, null);
  additionalTagsPanel.setPreferredSize(new Dimension(150, additionalTagsPanel.getPreferredSize().height));
  additionalTagsPanel.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      final Document document = e.getDocument();
      try {
        final String text = document.getText(0, document.getLength());
        if (text != null) {
          myAdditionalJavadocTags = text.trim();
        }
      }
      catch (BadLocationException e1) {
         LOG.error(e1);
      }
    }
  });
  additionalTagsPanel.setText(myAdditionalJavadocTags);
  return additionalTagsPanel;
}
项目:consulo-java    文件:JavaDocLocalInspection.java   
public FieldPanel createAdditionalJavadocTagsPanel(){
  FieldPanel additionalTagsPanel = new FieldPanel(InspectionsBundle.message("inspection.javadoc.label.text"), InspectionsBundle.message("inspection.javadoc.dialog.title"), null, null);
  additionalTagsPanel.setPreferredSize(new Dimension(150, additionalTagsPanel.getPreferredSize().height));
  additionalTagsPanel.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      final Document document = e.getDocument();
      try {
        final String text = document.getText(0, document.getLength());
        if (text != null) {
          myAdditionalJavadocTags = text.trim();
        }
      }
      catch (BadLocationException e1) {
         LOG.error(e1);
      }
    }
  });
  additionalTagsPanel.setText(myAdditionalJavadocTags);
  return additionalTagsPanel;
}
项目:intellij-ce-playground    文件:RequiredAttributesInspection.java   
@Override
@Nullable
public JComponent createOptionsPanel() {
  JPanel panel = new JPanel(new BorderLayout());
  FieldPanel additionalAttributesPanel = new FieldPanel(InspectionsBundle.message("inspection.javadoc.html.not.required.label.text"),
                                                        InspectionsBundle.message("inspection.javadoc.html.not.required.dialog.title"),
                                                        null, null);

  panel.add(additionalAttributesPanel, BorderLayout.NORTH);
  additionalAttributesPanel.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      final Document document = e.getDocument();
      try {
        final String text = document.getText(0, document.getLength());
        if (text != null) {
          myAdditionalRequiredHtmlAttributes = text.trim();
        }
      }
      catch (BadLocationException e1) {
        LOG.error(e1);
      }
    }
  });
  additionalAttributesPanel.setText(myAdditionalRequiredHtmlAttributes);
  return panel;
}
项目:intellij-ce-playground    文件:GroovyRunConfigurationEditor.java   
public GroovyRunConfigurationEditor() {

    scriptPathField = new JTextField();
    final BrowseFilesListener scriptBrowseListener = new BrowseFilesListener(scriptPathField,
        "Script Path",
        "Specify path to script",
        new FileChooserDescriptor(true, false, false, false, false, false) {
          @Override
          public boolean isFileSelectable(VirtualFile file) {
            return file.getFileType() == GroovyFileType.GROOVY_FILE_TYPE;
          }
        });
    final FieldPanel scriptFieldPanel = new FieldPanel(scriptPathField, null, null, scriptBrowseListener, null);
    scriptPathPanel.setLayout(new BorderLayout());
    scriptPathPanel.add(scriptFieldPanel, BorderLayout.CENTER);

    workDirField = new JTextField();
    final BrowseFilesListener workDirBrowseFilesListener = new BrowseFilesListener(workDirField,
        "Working directory",
        "Specify working directory",
        BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR);
    final FieldPanel workDirFieldPanel = new FieldPanel(workDirField, null, null, workDirBrowseFilesListener, null);
    workDirPanel.setLayout(new BorderLayout());
    workDirPanel.add(workDirFieldPanel, BorderLayout.CENTER);

    setAnchor(myEnvVariables.getLabel());
  }
项目:tools-idea    文件:ProjectConfigurable.java   
private void createUIComponents() {
  myLanguageLevelCombo = new LanguageLevelCombo();
  final JTextField textField = new JTextField();
  final FileChooserDescriptor outputPathsChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
  InsertPathAction.addTo(textField, outputPathsChooserDescriptor);
  outputPathsChooserDescriptor.setHideIgnored(false);
  BrowseFilesListener listener = new BrowseFilesListener(textField, "", ProjectBundle.message("project.compiler.output"), outputPathsChooserDescriptor);
  myProjectCompilerOutput = new FieldPanel(textField, null, null, listener, EmptyRunnable.getInstance());
  FileChooserFactory.getInstance().installFileCompletion(myProjectCompilerOutput.getTextField(), outputPathsChooserDescriptor, true, null);
}
项目:tools-idea    文件:RequiredAttributesInspection.java   
@Override
@Nullable
public JComponent createOptionsPanel() {
  JPanel panel = new JPanel(new BorderLayout());
  FieldPanel additionalAttributesPanel = new FieldPanel(InspectionsBundle.message("inspection.javadoc.html.not.required.label.text"),
                                                        InspectionsBundle.message("inspection.javadoc.html.not.required.dialog.title"),
                                                        null, null);

  panel.add(additionalAttributesPanel, BorderLayout.NORTH);
  additionalAttributesPanel.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      final Document document = e.getDocument();
      try {
        final String text = document.getText(0, document.getLength());
        if (text != null) {
          myAdditionalRequiredHtmlAttributes = text.trim();
        }
      }
      catch (BadLocationException e1) {
        RequiredAttributesInspection.LOG.error(e1);
      }
    }
  });
  additionalAttributesPanel.setText(myAdditionalRequiredHtmlAttributes);
  return panel;
}
项目:consulo-xml    文件:RequiredAttributesInspection.java   
@Override
@Nullable
public JComponent createOptionsPanel()
{
    JPanel panel = new JPanel(new BorderLayout());
    FieldPanel additionalAttributesPanel = new FieldPanel(InspectionsBundle.message("inspection.javadoc.html.not.required.label.text"), InspectionsBundle.message("inspection.javadoc.html.not" +
            ".required.dialog.title"), null, null);

    panel.add(additionalAttributesPanel, BorderLayout.NORTH);
    additionalAttributesPanel.getTextField().getDocument().addDocumentListener(new DocumentAdapter()
    {
        @Override
        protected void textChanged(DocumentEvent e)
        {
            final Document document = e.getDocument();
            try
            {
                final String text = document.getText(0, document.getLength());
                if(text != null)
                {
                    myAdditionalRequiredHtmlAttributes = text.trim();
                }
            }
            catch(BadLocationException e1)
            {
                LOG.error(e1);
            }
        }
    });
    additionalAttributesPanel.setText(myAdditionalRequiredHtmlAttributes);
    return panel;
}
项目:GravSupport    文件:ApplicationConfigForm.java   
public FieldPanel getFieldPanel() {
    return fieldPanel;
}
项目:GravSupport    文件:IntroStepGUI.java   
public FieldPanel getFieldPanel() {
    return fieldPanel;
}
项目:intellij-ce-playground    文件:SourcePathsStep.java   
private JComponent createComponentForEmptyRootCase() {
  final JPanel panel = new JPanel(new GridBagLayout());
  final String text = IdeBundle.message("prompt.please.specify.java.sources.directory");

  final JLabel label = new JLabel(text);
  label.setUI(new MultiLineLabelUI());
  panel.add(label, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(8, 10, 0, 10), 0, 0));

  myRbCreateSource = new JRadioButton(IdeBundle.message("radio.create.source.directory"), true);
  panel.add(myRbCreateSource, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(8, 10, 0, 10), 0, 0));

  myTfSourceDirectoryName = new JTextField(suggestSourceDirectoryName());
  final JLabel srcPathLabel = new JLabel(IdeBundle.message("prompt.enter.relative.path.to.module.content.root", File.separator));
  panel.add(srcPathLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(8, 30, 0, 0), 0, 0));
  final FileChooserDescriptor chooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
  chooserDescriptor.withTreeRootVisible(true);
  final FieldPanel fieldPanel = createFieldPanel(myTfSourceDirectoryName, null, new BrowsePathListener(myTfSourceDirectoryName, chooserDescriptor));
  panel.add(fieldPanel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(8, 30, 0, 10), 0, 0));

  myRbNoSource = new JRadioButton(IdeBundle.message("radio.do.not.create.source.directory"), true);
  panel.add(myRbNoSource, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(8, 10, 0, 10), 0, 0));

  final JLabel fullPathLabel = new JLabel(IdeBundle.message("label.source.directory"));
  panel.add(fullPathLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.SOUTHWEST, GridBagConstraints.NONE, new Insets(8, 10, 0, 10), 0, 0));

  myTfFullPath = new JTextField();
  myTfFullPath.setEditable(false);
  myTfFullPath.setOpaque(false);
  final Insets borderInsets = myTfFullPath.getBorder().getBorderInsets(myTfFullPath);
  myTfFullPath.setBorder(BorderFactory.createEmptyBorder(borderInsets.top, borderInsets.left, borderInsets.bottom, borderInsets.right));
  panel.add(myTfFullPath, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.SOUTHWEST, GridBagConstraints.HORIZONTAL, new Insets(8, 10, 8, 10), 0, 0));

  ButtonGroup group = new ButtonGroup();
  group.add(myRbCreateSource);
  group.add(myRbNoSource);
  myTfSourceDirectoryName.getDocument().addDocumentListener(new DocumentAdapter() {
    public void textChanged(DocumentEvent event) {
      updateFullPathField();
    }
  });

  myRbCreateSource.addItemListener(new ItemListener() {
    public void itemStateChanged(ItemEvent e) {
      final boolean enabled = e.getStateChange() == ItemEvent.SELECTED;
      srcPathLabel.setEnabled(enabled);
      fieldPanel.setEnabled(enabled);
      fullPathLabel.setVisible(enabled);
      myTfFullPath.setVisible(enabled);
      if (enabled) {
        myTfSourceDirectoryName.requestFocus();
      }
    }
  });
  return panel;
}
项目:intellij-ce-playground    文件:NamePathComponent.java   
public NamePathComponent(String nameLabelText,
                         String pathLabelText,
                         final String pathChooserTitle,
                         final String pathChooserDescription,
                         boolean hideIgnored,
                         boolean bold) {
  super(new GridBagLayout());

  myTfName = new JTextField();
  myTfName.setDocument(new NameFieldDocument());
  myTfName.setPreferredSize(new Dimension(200, myTfName.getPreferredSize().height));

  myTfPath = new JTextField();
  myTfPath.setDocument(new PathFieldDocument());
  myTfPath.setPreferredSize(new Dimension(200, myTfPath.getPreferredSize().height));

  myNameLabel = new JLabel(nameLabelText);
  if (bold) myNameLabel.setFont(UIUtil.getLabelFont().deriveFont(Font.BOLD));
  myNameLabel.setLabelFor(myTfName);
  Insets insets = new Insets(0, 0, 5, 4);
  this.add(myNameLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
                                               insets, 0, 0));

  insets = new Insets(0, 0, 5, 0);
  this.add(myTfName, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL,
                                            insets, 0, 0));
  // todo: review texts
  final FileChooserDescriptor chooserDescriptor = (FileChooserDescriptor)BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR.clone();
  chooserDescriptor.setHideIgnored(hideIgnored);
  final BrowseFilesListener browseButtonActionListener = new BrowseFilesListener(myTfPath, pathChooserTitle, pathChooserDescription, chooserDescriptor) {
    public void actionPerformed(ActionEvent e) {
      super.actionPerformed(e);
      myIsPathChangedByUser = true;
    }
  };
  myPathPanel = new FieldPanel(myTfPath, null, null, browseButtonActionListener, null);
  myPathLabel = new JLabel(pathLabelText);
  myPathLabel.setLabelFor(myTfPath);
  if (bold) myPathLabel.setFont(UIUtil.getLabelFont().deriveFont(Font.BOLD));
  insets = new Insets(0, 0, 5, 4);
  this.add(myPathLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
                                                 insets, 0, 0));
  insets = new Insets(0, 0, 5, 0);
  this.add(myPathPanel, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL,
                                               insets, 0, 0));
}
项目:intellij-ce-playground    文件:NamePathComponent.java   
@NotNull
public FieldPanel getPathPanel() {
  return myPathPanel;
}
项目:intellij-ce-playground    文件:ModuleWizardStep.java   
public static FieldPanel createFieldPanel(final JTextField field, final String labelText, final BrowseFilesListener browseButtonActionListener) {
  final FieldPanel fieldPanel = new FieldPanel(field, labelText, null, browseButtonActionListener, null);
  fieldPanel.getFieldLabel().setFont(UIUtil.getLabelFont().deriveFont(Font.BOLD));
  return fieldPanel;
}
项目:intellij-ocaml    文件:OCamlSourcesPathStep.java   
@NotNull
public JComponent getComponent() {
    final JPanel panel = new JPanel(new GridBagLayout());

    final JLabel label = new JLabel("Please specify module sources directory.");

    panel.add(label, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(8, 10, 0, 10), 0, 0));
    myRbCreateSource = new JRadioButton("Create source directory", myBuilder.isShouldCreateSourcesDir());
    panel.add(myRbCreateSource, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(8, 10, 0, 10), 0, 0));

    myTfSourceDirectoryName = new JTextField(myBuilder.getRelativeSourcesPath());
    final JLabel srcPathLabel = new JLabel("Enter relative path to module content root:");
    panel.add(srcPathLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(8, 30, 0, 0), 0, 0));
    final FileChooserDescriptor chooserDescriptor = new FileChooserDescriptor(false, true, false, false, false, false);
    chooserDescriptor.setIsTreeRootVisible(true);
    final FieldPanel fieldPanel = createFieldPanel(myTfSourceDirectoryName, null, new BrowsePathListener(myTfSourceDirectoryName, chooserDescriptor));
    panel.add(fieldPanel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(8, 30, 0, 10), 0, 0));

    myRbNoSource = new JRadioButton("Do not create source directory", !myBuilder.isShouldCreateSourcesDir());
    panel.add(myRbNoSource, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(8, 10, 0, 10), 0, 0));

    final JLabel fullPathLabel = new JLabel("The following directory will be marked as a source directory:");
    panel.add(fullPathLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.SOUTHWEST, GridBagConstraints.NONE, new Insets(8, 10, 0, 10), 0, 0));

    myTfFullPath = new JTextField();
    myTfFullPath.setEditable(false);
    final Insets borderInsets = myTfFullPath.getBorder().getBorderInsets(myTfFullPath);
    myTfFullPath.setBorder(BorderFactory.createEmptyBorder(borderInsets.top, borderInsets.left, borderInsets.bottom, borderInsets.right));
    panel.add(myTfFullPath, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.SOUTHWEST, GridBagConstraints.HORIZONTAL, new Insets(8, 10, 8, 10), 0, 0));

    ButtonGroup group = new ButtonGroup();
    group.add(myRbCreateSource);
    group.add(myRbNoSource);
    myTfSourceDirectoryName.getDocument().addDocumentListener(new DocumentAdapter() {
        public void textChanged(DocumentEvent event) {
            updateFullPathField();
        }
    });
    updateFullPathField();

    final StateUpdater stateUpdater = new StateUpdater() {
        public void updateState(final boolean shouldCreateSourcesDir) {
            srcPathLabel.setEnabled(shouldCreateSourcesDir);
            fieldPanel.setEnabled(shouldCreateSourcesDir);
            fullPathLabel.setVisible(shouldCreateSourcesDir);
            myTfFullPath.setVisible(shouldCreateSourcesDir);
            if (shouldCreateSourcesDir) {
                myTfSourceDirectoryName.requestFocus();
            }
        }
    };

    myRbCreateSource.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            stateUpdater.updateState(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    stateUpdater.updateState(myBuilder.isShouldCreateSourcesDir());

    return panel;
}
项目:tools-idea    文件:SourcePathsStep.java   
private JComponent createComponentForEmptyRootCase() {
  final JPanel panel = new JPanel(new GridBagLayout());
  final String text = IdeBundle.message("prompt.please.specify.java.sources.directory");

  final JLabel label = new JLabel(text);
  label.setUI(new MultiLineLabelUI());
  panel.add(label, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(8, 10, 0, 10), 0, 0));

  myRbCreateSource = new JRadioButton(IdeBundle.message("radio.create.source.directory"), true);
  panel.add(myRbCreateSource, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(8, 10, 0, 10), 0, 0));

  myTfSourceDirectoryName = new JTextField(suggestSourceDirectoryName());
  final JLabel srcPathLabel = new JLabel(IdeBundle.message("prompt.enter.relative.path.to.module.content.root", File.separator));
  panel.add(srcPathLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(8, 30, 0, 0), 0, 0));
  final FileChooserDescriptor chooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
  chooserDescriptor.setIsTreeRootVisible(true);
  final FieldPanel fieldPanel = createFieldPanel(myTfSourceDirectoryName, null, new BrowsePathListener(myTfSourceDirectoryName, chooserDescriptor));
  panel.add(fieldPanel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(8, 30, 0, 10), 0, 0));

  myRbNoSource = new JRadioButton(IdeBundle.message("radio.do.not.create.source.directory"), true);
  panel.add(myRbNoSource, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(8, 10, 0, 10), 0, 0));

  final JLabel fullPathLabel = new JLabel(IdeBundle.message("label.source.directory"));
  panel.add(fullPathLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.SOUTHWEST, GridBagConstraints.NONE, new Insets(8, 10, 0, 10), 0, 0));

  myTfFullPath = new JTextField();
  myTfFullPath.setEditable(false);
  myTfFullPath.setOpaque(false);
  final Insets borderInsets = myTfFullPath.getBorder().getBorderInsets(myTfFullPath);
  myTfFullPath.setBorder(BorderFactory.createEmptyBorder(borderInsets.top, borderInsets.left, borderInsets.bottom, borderInsets.right));
  panel.add(myTfFullPath, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.SOUTHWEST, GridBagConstraints.HORIZONTAL, new Insets(8, 10, 8, 10), 0, 0));

  ButtonGroup group = new ButtonGroup();
  group.add(myRbCreateSource);
  group.add(myRbNoSource);
  myTfSourceDirectoryName.getDocument().addDocumentListener(new DocumentAdapter() {
    public void textChanged(DocumentEvent event) {
      updateFullPathField();
    }
  });

  myRbCreateSource.addItemListener(new ItemListener() {
    public void itemStateChanged(ItemEvent e) {
      final boolean enabled = e.getStateChange() == ItemEvent.SELECTED;
      srcPathLabel.setEnabled(enabled);
      fieldPanel.setEnabled(enabled);
      fullPathLabel.setVisible(enabled);
      myTfFullPath.setVisible(enabled);
      if (enabled) {
        myTfSourceDirectoryName.requestFocus();
      }
    }
  });
  return panel;
}
项目:tools-idea    文件:NameLocationStep.java   
public NameLocationStep(WizardContext wizardContext, JavaModuleBuilder builder,
                        ModulesProvider modulesProvider,
                        Icon icon,
                        @NonNls String helpId) {
  myWizardContext = wizardContext;
  myBuilder = builder;
  myModulesProvider = modulesProvider;
  myIcon = icon;
  myHelpId = helpId;
  myPanel = new JPanel(new GridBagLayout());
  myPanel.setBorder(BorderFactory.createEtchedBorder());

  final String text = IdeBundle.message("prompt.please.specify.module.name.and.content.root");
  final JLabel textLabel = new JLabel(text);
  textLabel.setUI(new MultiLineLabelUI());
  myPanel.add(textLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(8, 10, 8, 10), 0, 0));

  myNamePathComponent = new NamePathComponent(IdeBundle.message("label.module.name"), IdeBundle.message("label.module.content.root"), 'M', 'r',
                                              IdeBundle.message("title.select.module.content.root"), "");
  //if (ModuleType.J2EE_APPLICATION.equals(moduleType)) {
  //  myNamePathComponent.setPathComponentVisible(false);
  //}

  myPanel.add(myNamePathComponent, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(8, 10, 0, 10), 0, 0));

  final JLabel label = new JLabel(IdeBundle.message("label.module.file.will.be.saved.in"));
  myPanel.add(label, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 1.0, 1.0, GridBagConstraints.SOUTHWEST, GridBagConstraints.HORIZONTAL, new Insets(30, 10, 0, 10), 0, 0));

  myTfModuleFilePath = new JTextField();
  myTfModuleFilePath.setEditable(false);
  final Insets borderInsets = myTfModuleFilePath.getBorder().getBorderInsets(myTfModuleFilePath);
  myTfModuleFilePath.setBorder(BorderFactory.createEmptyBorder(borderInsets.top, borderInsets.left, borderInsets.bottom, borderInsets.right));
  final FieldPanel fieldPanel = createFieldPanel(myTfModuleFilePath, null, null);
  myPanel.add(fieldPanel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 10, 10, 0), 0, 0));

  JButton browseButton = new JButton(IdeBundle.message("button.change.directory"));
  browseButton.addActionListener(new BrowseModuleFileDirectoryListener(myTfModuleFilePath));
  myPanel.add(browseButton, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 10, 10), 0, 0));

  final DocumentListener documentListener = new DocumentAdapter() {
    protected void textChanged(DocumentEvent e) {
      updateModuleFilePathField();
    }
  };
  myNamePathComponent.getNameComponent().getDocument().addDocumentListener(documentListener);
  myNamePathComponent.getPathComponent().getDocument().addDocumentListener(documentListener);
  myNamePathComponent.getPathComponent().getDocument().addDocumentListener(new DocumentAdapter() {
    public void textChanged(DocumentEvent event) {
      myWizardContext.requestWizardButtonsUpdate();
    }
  });
}
项目:tools-idea    文件:NamePathComponent.java   
public NamePathComponent(String nameLabelText,
                         String pathLabelText,
                         final String pathChooserTitle,
                         final String pathChooserDescription,
                         boolean hideIgnored,
                         boolean bold) {
  super(new GridBagLayout());

  myTfName = new JTextField();
  myTfName.setDocument(new NameFieldDocument());
  myTfName.setPreferredSize(new Dimension(200, myTfName.getPreferredSize().height));

  myTfPath = new JTextField();
  myTfPath.setDocument(new PathFieldDocument());
  myTfPath.setPreferredSize(new Dimension(200, myTfPath.getPreferredSize().height));

  myNameLabel = new JLabel(nameLabelText);
  if (bold) myNameLabel.setFont(UIUtil.getLabelFont().deriveFont(Font.BOLD));
  myNameLabel.setLabelFor(myTfName);
  Insets insets = new Insets(0, 0, 5, 4);
  this.add(myNameLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
                                               insets, 0, 0));

  insets = new Insets(0, 0, 5, 0);
  this.add(myTfName, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL,
                                            insets, 0, 0));
  // todo: review texts
  final FileChooserDescriptor chooserDescriptor = (FileChooserDescriptor)BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR.clone();
  chooserDescriptor.setHideIgnored(hideIgnored);
  final BrowseFilesListener browseButtonActionListener = new BrowseFilesListener(myTfPath, pathChooserTitle, pathChooserDescription, chooserDescriptor) {
    public void actionPerformed(ActionEvent e) {
      super.actionPerformed(e);
      myIsPathChangedByUser = true;
    }
  };
  myPathPanel = new FieldPanel(myTfPath, null, null, browseButtonActionListener, null);
  myPathLabel = new JLabel(pathLabelText);
  myPathLabel.setLabelFor(myTfPath);
  if (bold) myPathLabel.setFont(UIUtil.getLabelFont().deriveFont(Font.BOLD));
  insets = new Insets(0, 0, 5, 4);
  this.add(myPathLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
                                                 insets, 0, 0));
  insets = new Insets(0, 0, 5, 0);
  this.add(myPathPanel, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL,
                                               insets, 0, 0));
}
项目:tools-idea    文件:NamePathComponent.java   
@NotNull
public FieldPanel getPathPanel() {
  return myPathPanel;
}
项目:tools-idea    文件:ModuleWizardStep.java   
public static FieldPanel createFieldPanel(final JTextField field, final String labelText, final BrowseFilesListener browseButtonActionListener) {
  final FieldPanel fieldPanel = new FieldPanel(field, labelText, null, browseButtonActionListener, null);
  fieldPanel.getFieldLabel().setFont(UIUtil.getLabelFont().deriveFont(Font.BOLD));
  return fieldPanel;
}
项目:consulo    文件:ModuleWizardStep.java   
public static FieldPanel createFieldPanel(final JTextField field, final String labelText, final BrowseFilesListener browseButtonActionListener) {
  final FieldPanel fieldPanel = new FieldPanel(field, labelText, null, browseButtonActionListener, null);
  fieldPanel.getFieldLabel().setFont(UIUtil.getLabelFont().deriveFont(Font.BOLD));
  return fieldPanel;
}
项目:consulo    文件:ProjectConfigurable.java   
private void init() {
  myPanel = new JPanel(new VerticalFlowLayout(true, false));

  final JPanel namePanel = new JPanel(new BorderLayout());
  final JLabel label = new JLabel("<html><body><b>Project name:</b></body></html>", SwingConstants.LEFT);
  namePanel.add(label, BorderLayout.NORTH);

  myProjectName = new JTextField();
  myProjectName.setColumns(40);

  final JPanel nameFieldPanel = new JPanel();
  nameFieldPanel.setLayout(new BoxLayout(nameFieldPanel, BoxLayout.X_AXIS));
  nameFieldPanel.add(Box.createHorizontalStrut(4));
  nameFieldPanel.add(myProjectName);

  namePanel.add(nameFieldPanel, BorderLayout.CENTER);
  final JPanel wrapper = new JPanel(new FlowLayout(FlowLayout.LEFT));
  wrapper.add(namePanel);
  wrapper.setAlignmentX(0);
  myPanel.add(wrapper);

  myPanel.add(new JLabel(ProjectBundle.message("project.compiler.output")));

  final JTextField textField = new JTextField();
  final FileChooserDescriptor outputPathsChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
  InsertPathAction.addTo(textField, outputPathsChooserDescriptor);
  outputPathsChooserDescriptor.setHideIgnored(false);
  BrowseFilesListener listener = new BrowseFilesListener(textField, "", ProjectBundle.message("project.compiler.output"), outputPathsChooserDescriptor);
  myProjectCompilerOutput = new FieldPanel(textField, null, null, listener, EmptyRunnable.getInstance());
  FileChooserFactory.getInstance().installFileCompletion(myProjectCompilerOutput.getTextField(), outputPathsChooserDescriptor, true, null);

  myProjectCompilerOutput.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      if (myFreeze) return;
      myModulesConfigurator.processModuleCompilerOutputChanged(getCompilerOutputUrl());
    }
  });

  myPanel.add(myProjectCompilerOutput);
  myPanel.add(ScrollPaneFactory.createScrollPane(myErrorsComponent, true));
}
项目:consulo    文件:NamePathComponent.java   
public NamePathComponent(String nameLabelText,
                         String pathLabelText,
                         final String pathChooserTitle,
                         final String pathChooserDescription,
                         boolean hideIgnored,
                         boolean bold) {
  super(new GridBagLayout());

  myTfName = new JTextField();
  myTfName.setDocument(new NameFieldDocument());
  myTfName.setPreferredSize(new Dimension(200, myTfName.getPreferredSize().height));

  myTfPath = new JTextField();
  myTfPath.setDocument(new PathFieldDocument());
  myTfPath.setPreferredSize(new Dimension(200, myTfPath.getPreferredSize().height));

  myNameLabel = new JLabel(nameLabelText);
  if (bold) myNameLabel.setFont(UIUtil.getLabelFont().deriveFont(Font.BOLD));
  myNameLabel.setLabelFor(myTfName);
  Insets insets = new Insets(0, 0, 5, 4);
  this.add(myNameLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
                                               insets, 0, 0));

  insets = new Insets(0, 0, 5, 0);
  this.add(myTfName, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL,
                                            insets, 0, 0));
  // todo: review texts
  final FileChooserDescriptor chooserDescriptor = (FileChooserDescriptor)BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR.clone();
  chooserDescriptor.setHideIgnored(hideIgnored);
  final BrowseFilesListener browseButtonActionListener = new BrowseFilesListener(myTfPath, pathChooserTitle, pathChooserDescription, chooserDescriptor) {
    @Override
    public void actionPerformed(ActionEvent e) {
      super.actionPerformed(e);
      myIsPathChangedByUser = true;
    }
  };
  myPathPanel = new FieldPanel(myTfPath, null, null, browseButtonActionListener, null);
  myPathLabel = new JLabel(pathLabelText);
  myPathLabel.setLabelFor(myTfPath);
  if (bold) myPathLabel.setFont(UIUtil.getLabelFont().deriveFont(Font.BOLD));
  insets = new Insets(0, 0, 5, 4);
  this.add(myPathLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
                                                 insets, 0, 0));
  insets = new Insets(0, 0, 5, 0);
  this.add(myPathPanel, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL,
                                               insets, 0, 0));
}
项目:consulo    文件:NamePathComponent.java   
@Nonnull
public FieldPanel getPathPanel() {
  return myPathPanel;
}