Java 类com.intellij.openapi.ui.ex.MultiLineLabel 实例源码

项目:intellij-ce-playground    文件:LocalChangesWouldBeOverwrittenHelper.java   
private static void showErrorDialog(@NotNull Project project, @NotNull String operationName, @NotNull List<Change> changes,
                                    @NotNull Collection<String> absolutePaths) {
  String title = "Local Changes Prevent from " + StringUtil.capitalize(operationName);
  String description = getErrorDialogDescription();
  if (changes.isEmpty()) {
    GitUtil.showPathsInDialog(project, absolutePaths, title, description);
  }
  else {
    DialogBuilder builder = new DialogBuilder(project);
    builder.setNorthPanel(new MultiLineLabel(description));
    builder.setCenterPanel(new ChangesBrowserWithRollback(project, changes));
    builder.addOkAction();
    builder.setTitle(title);
    builder.show();
  }
}
项目:intellij-ce-playground    文件:GitUtil.java   
public static void showPathsInDialog(@NotNull Project project, @NotNull Collection<String> absolutePaths, @NotNull String title,
                                     @Nullable String description) {
  DialogBuilder builder = new DialogBuilder(project);
  builder.setCenterPanel(new GitSimplePathsBrowser(project, absolutePaths));
  if (description != null) {
    builder.setNorthPanel(new MultiLineLabel(description));
  }
  builder.addOkAction();
  builder.setTitle(title);
  builder.show();
}
项目:intellij-ce-playground    文件:GenerateTemplateConfigurable.java   
public JComponent createComponent() {
  final JComponent component = myEditor.getComponent();
  if (availableImplicits.isEmpty()) {
    return component;
  }
  final JPanel panel = new JPanel(new BorderLayout());
  panel.add(component, BorderLayout.CENTER);
  MultiLineLabel label =
    new MultiLineLabel("<html>Available implicit variables:\n" + StringUtil.join(availableImplicits, ", ") + "</html>");
  label.setPreferredSize(JBUI.size(250, 30));
  panel.add(label, BorderLayout.SOUTH);
  return panel;
}
项目:tools-idea    文件:CodeStyleImportsPanel.java   
private JPanel createJspImportLayoutPanel() {
  ButtonGroup buttonGroup = new ButtonGroup();
  myJspImportCommaSeparated = new JRadioButton(ApplicationBundle.message("radio.prefer.comma.separated.import.list"));
  myJspOneImportPerDirective = new JRadioButton(ApplicationBundle.message("radio.prefer.one.import.statement.per.page.directive"));
  buttonGroup.add(myJspImportCommaSeparated);
  buttonGroup.add(myJspOneImportPerDirective);
  JPanel btnPanel = new JPanel(new BorderLayout());
  btnPanel.add(myJspImportCommaSeparated, BorderLayout.NORTH);
  btnPanel.add(myJspOneImportPerDirective, BorderLayout.CENTER);

  //noinspection HardCodedStringLiteral
  final MultiLineLabel commaSeparatedLabel = new MultiLineLabel("<% page import=\"com.company.Boo, \n" +
                                                                "                 com.company.Far\"%>");
  //noinspection HardCodedStringLiteral
  final MultiLineLabel oneImportPerDirectiveLabel = new MultiLineLabel("<% page import=\"com.company.Boo\"%>\n" +
                                                                       "<% page import=\"com.company.Far\"%>");
  final JPanel labelPanel = new JPanel(new BorderLayout());
  labelPanel.setBorder(
    BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(20, 10, 0, 0), IdeBorderFactory.createTitledBorder(
      ApplicationBundle.message("title.preview"), false)));

  JPanel resultPanel = new JPanel(new BorderLayout());
  resultPanel.add(btnPanel, BorderLayout.NORTH);
  resultPanel.add(labelPanel, BorderLayout.CENTER);
  resultPanel.setBorder(IdeBorderFactory.createTitledBorder(ApplicationBundle.message("title.jsp.imports.layout"), true));


  ActionListener actionListener = new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      boolean isComma = myJspImportCommaSeparated.isSelected();
      labelPanel.removeAll();
      labelPanel.add(isComma ? commaSeparatedLabel : oneImportPerDirectiveLabel, BorderLayout.NORTH);
      labelPanel.repaint();
      labelPanel.revalidate();
    }
  };
  myJspImportCommaSeparated.addActionListener(actionListener);
  myJspOneImportPerDirective.addActionListener(actionListener);
  return resultPanel;
}
项目:consulo-java    文件:GenerateTemplateConfigurable.java   
@Override
public JComponent createComponent()
{
    final JComponent component = myEditor.getComponent();
    if(myAvailableImplicits.isEmpty())
    {
        return component;
    }
    final JPanel panel = new JPanel(new BorderLayout());
    panel.add(component, BorderLayout.CENTER);
    MultiLineLabel label = new MultiLineLabel("<html>Available implicit variables:\n" + StringUtil.join(myAvailableImplicits, ", ") + "</html>");
    label.setPreferredSize(JBUI.size(250, 30));
    panel.add(label, BorderLayout.SOUTH);
    return panel;
}
项目:consulo-java    文件:CodeStyleImportsPanel.java   
private JPanel createJspImportLayoutPanel() {
  ButtonGroup buttonGroup = new ButtonGroup();
  myJspImportCommaSeparated = new JRadioButton(ApplicationBundle.message("radio.prefer.comma.separated.import.list"));
  myJspOneImportPerDirective = new JRadioButton(ApplicationBundle.message("radio.prefer.one.import.statement.per.page.directive"));
  buttonGroup.add(myJspImportCommaSeparated);
  buttonGroup.add(myJspOneImportPerDirective);
  JPanel btnPanel = new JPanel(new BorderLayout());
  btnPanel.add(myJspImportCommaSeparated, BorderLayout.NORTH);
  btnPanel.add(myJspOneImportPerDirective, BorderLayout.CENTER);

  //noinspection HardCodedStringLiteral
  final MultiLineLabel commaSeparatedLabel = new MultiLineLabel("<% page import=\"com.company.Boo, \n" +
                                                                "                 com.company.Far\"%>");
  //noinspection HardCodedStringLiteral
  final MultiLineLabel oneImportPerDirectiveLabel = new MultiLineLabel("<% page import=\"com.company.Boo\"%>\n" +
                                                                       "<% page import=\"com.company.Far\"%>");
  final JPanel labelPanel = new JPanel(new BorderLayout());
  labelPanel.setBorder(
    BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(20, 10, 0, 0), IdeBorderFactory.createTitledBorder(
      ApplicationBundle.message("title.preview"), false)));

  JPanel resultPanel = new JPanel(new BorderLayout());
  resultPanel.add(btnPanel, BorderLayout.NORTH);
  resultPanel.add(labelPanel, BorderLayout.CENTER);
  resultPanel.setBorder(IdeBorderFactory.createTitledBorder(ApplicationBundle.message("title.jsp.imports.layout"), true));


  ActionListener actionListener = new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      boolean isComma = myJspImportCommaSeparated.isSelected();
      labelPanel.removeAll();
      labelPanel.add(isComma ? commaSeparatedLabel : oneImportPerDirectiveLabel, BorderLayout.NORTH);
      labelPanel.repaint();
      labelPanel.revalidate();
    }
  };
  myJspImportCommaSeparated.addActionListener(actionListener);
  myJspOneImportPerDirective.addActionListener(actionListener);
  return resultPanel;
}
项目:intellij-ce-playground    文件:ProjectLayoutPanel.java   
public ProjectLayoutPanel(final ModuleInsight insight) {
  super(new BorderLayout());
  setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5));
  myInsight = insight;

  myEntriesChooser = new ElementsChooser<T>(true) {
    public String getItemText(@NotNull T element) {
      return getElementText(element);
    }
  };
  myDependenciesList = createList();

  final Splitter splitter = new Splitter(false);

  final JPanel entriesPanel = new JPanel(new BorderLayout());
  entriesPanel.add(myEntriesChooser, BorderLayout.CENTER);
  entriesPanel.setBorder(IdeBorderFactory.createTitledBorder(StringUtil.capitalize(StringUtil.pluralize(getElementTypeName())), false));
  splitter.setFirstComponent(entriesPanel);

  final JScrollPane depsPane = ScrollPaneFactory.createScrollPane(myDependenciesList);
  final JPanel depsPanel = new JPanel(new BorderLayout());
  depsPanel.add(depsPane, BorderLayout.CENTER);
  depsPanel.setBorder(IdeBorderFactory.createTitledBorder(getDependenciesTitle(), false));
  splitter.setSecondComponent(depsPanel);

  JPanel groupPanel = new JPanel(new BorderLayout());
  groupPanel.add(createEntriesActionToolbar().getComponent(), BorderLayout.NORTH);
  groupPanel.add(splitter, BorderLayout.CENTER);
  groupPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));

  final MultiLineLabel description = new MultiLineLabel(getStepDescriptionText());
  add(description, BorderLayout.NORTH);
  add(groupPanel, BorderLayout.CENTER);

  myEntriesChooser.addListSelectionListener(new ListSelectionListener() {
    public void valueChanged(final ListSelectionEvent e) {
      if (e.getValueIsAdjusting()) {
        return;
      }
      final List<T> entries = getSelectedEntries();
      final Collection deps = getDependencies(entries);

      final DefaultListModel depsModel = (DefaultListModel)myDependenciesList.getModel();
      depsModel.clear();
      for (Object dep : alphaSortList(new ArrayList(deps))) {
        depsModel.addElement(dep);
      }
    }
  });
}
项目:intellij-ce-playground    文件:PropertyInspector.java   
public PropertyInspector(Project project, @NotNull final ComponentTree componentTree) {
  super(new CardLayout());

  myInspectorTable = new PropertyInspectorTable(project, componentTree);
  myComponentTree = componentTree;

  // Card with property inspector
  final JPanel inspectorCard = new JPanel(new GridBagLayout());
  final JScrollPane inspectorScrollPane = ScrollPaneFactory.createScrollPane(myInspectorTable);
  inspectorScrollPane.setBorder(IdeBorderFactory.createBorder(SideBorder.BOTTOM));
  inspectorCard.add(inspectorScrollPane,
    new GridBagConstraints(0, 0, 0, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)
  );
  final JCheckBox chkShowExpertProperties = new JCheckBox(UIDesignerBundle.message("chk.show.expert.properties"));
  inspectorCard.add(
    chkShowExpertProperties,
    new GridBagConstraints(0, 1, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)
  );
  chkShowExpertProperties.addActionListener(
    new ActionListener() {
      public void actionPerformed(final ActionEvent e) {
        myInspectorTable.setShowExpertProperties(chkShowExpertProperties.isSelected());
      }
    }
  );
  add(inspectorCard, INSPECTOR_CARD);

  // Empty card
  final MultiLineLabel label = new MultiLineLabel(UIDesignerBundle.message("label.select.single.component.to.edit.its.properties")){
    public void updateUI() {
      super.updateUI();
      setBackground(myInspectorTable.getBackground());
    }
  };
  label.setOpaque(true);
  label.setHorizontalAlignment(SwingConstants.CENTER);
  add(label, EMPTY_CARD);
  add(myCustomPropertiesScrollPane, CUSTOM_CARD);

  myComponentSelectionListener = new MyComponentSelectionListener();
  synchWithTree(false);

  // Install light bulb
  myQuickFixManager = new QuickFixManagerImpl(null, myInspectorTable, inspectorScrollPane.getViewport());

  myCustomPropertiesChangeListener = new ChangeListener() {
    public void stateChanged(ChangeEvent e) {
      if (myPropertiesPanelContainer != null) {
        myPropertiesPanelContainer.revalidate();
      }
      if (myEditor.ensureEditable()) {
        myEditor.refreshAndSave(true);
      }
    }
  };
}
项目:tools-idea    文件:ProjectLayoutPanel.java   
public ProjectLayoutPanel(final ModuleInsight insight) {
  super(new BorderLayout());
  setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5));
  myInsight = insight;

  myEntriesChooser = new ElementsChooser<T>(true) {
    public String getItemText(@NotNull T element) {
      return getElementText(element);
    }
  };
  myDependenciesList = createList();

  final Splitter splitter = new Splitter(false);

  final JPanel entriesPanel = new JPanel(new BorderLayout());
  entriesPanel.add(myEntriesChooser, BorderLayout.CENTER);
  entriesPanel.setBorder(IdeBorderFactory.createTitledBorder(StringUtil.capitalize(StringUtil.pluralize(getElementTypeName())), false));
  splitter.setFirstComponent(entriesPanel);

  final JScrollPane depsPane = ScrollPaneFactory.createScrollPane(myDependenciesList);
  final JPanel depsPanel = new JPanel(new BorderLayout());
  depsPanel.add(depsPane, BorderLayout.CENTER);
  depsPanel.setBorder(IdeBorderFactory.createTitledBorder(getDependenciesTitle(), false));
  splitter.setSecondComponent(depsPanel);

  JPanel groupPanel = new JPanel(new BorderLayout());
  groupPanel.add(createEntriesActionToolbar().getComponent(), BorderLayout.NORTH);
  groupPanel.add(splitter, BorderLayout.CENTER);
  groupPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));

  final MultiLineLabel description = new MultiLineLabel(getStepDescriptionText());
  add(description, BorderLayout.NORTH);
  add(groupPanel, BorderLayout.CENTER);

  myEntriesChooser.addListSelectionListener(new ListSelectionListener() {
    public void valueChanged(final ListSelectionEvent e) {
      if (e.getValueIsAdjusting()) {
        return;
      }
      final List<T> entries = getSelectedEntries();
      final Collection deps = getDependencies(entries);

      final DefaultListModel depsModel = (DefaultListModel)myDependenciesList.getModel();
      depsModel.clear();
      for (Object dep : alphaSortList(new ArrayList(deps))) {
        depsModel.addElement(dep);
      }
    }
  });
}
项目:tools-idea    文件:PropertyInspector.java   
public PropertyInspector(Project project, @NotNull final ComponentTree componentTree) {
  super(new CardLayout());

  myInspectorTable = new PropertyInspectorTable(project, componentTree);
  myComponentTree = componentTree;

  // Card with property inspector
  final JPanel inspectorCard = new JPanel(new GridBagLayout());
  final JScrollPane inspectorScrollPane = ScrollPaneFactory.createScrollPane(myInspectorTable);
  inspectorScrollPane.setBorder(IdeBorderFactory.createBorder(SideBorder.BOTTOM));
  inspectorCard.add(inspectorScrollPane,
    new GridBagConstraints(0, 0, 0, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)
  );
  final JCheckBox chkShowExpertProperties = new JCheckBox(UIDesignerBundle.message("chk.show.expert.properties"));
  inspectorCard.add(
    chkShowExpertProperties,
    new GridBagConstraints(0, 1, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)
  );
  chkShowExpertProperties.addActionListener(
    new ActionListener() {
      public void actionPerformed(final ActionEvent e) {
        myInspectorTable.setShowExpertProperties(chkShowExpertProperties.isSelected());
      }
    }
  );
  add(inspectorCard, INSPECTOR_CARD);

  // Empty card
  final MultiLineLabel label = new MultiLineLabel(UIDesignerBundle.message("label.select.single.component.to.edit.its.properties")){
    public void updateUI() {
      super.updateUI();
      setBackground(myInspectorTable.getBackground());
    }
  };
  label.setOpaque(true);
  label.setHorizontalAlignment(SwingConstants.CENTER);
  add(label, EMPTY_CARD);
  add(myCustomPropertiesScrollPane, CUSTOM_CARD);

  myComponentSelectionListener = new MyComponentSelectionListener();
  synchWithTree(false);

  // Install light bulb
  myQuickFixManager = new QuickFixManagerImpl(null, myInspectorTable, inspectorScrollPane.getViewport());

  myCustomPropertiesChangeListener = new ChangeListener() {
    public void stateChanged(ChangeEvent e) {
      if (myPropertiesPanelContainer != null) {
        myPropertiesPanelContainer.revalidate();
      }
      if (myEditor.ensureEditable()) {
        myEditor.refreshAndSave(true);
      }
    }
  };
}
项目:consulo-ui-designer    文件:PropertyInspector.java   
public PropertyInspector(Project project, @NotNull final ComponentTree componentTree) {
  super(new CardLayout());

  myInspectorTable = new PropertyInspectorTable(project, componentTree);
  myComponentTree = componentTree;

  // Card with property inspector
  final JPanel inspectorCard = new JPanel(new GridBagLayout());
  final JScrollPane inspectorScrollPane = ScrollPaneFactory.createScrollPane(myInspectorTable);
  inspectorScrollPane.setBorder(IdeBorderFactory.createBorder(SideBorder.BOTTOM));
  inspectorCard.add(inspectorScrollPane,
    new GridBagConstraints(0, 0, 0, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)
  );
  final JCheckBox chkShowExpertProperties = new JCheckBox(UIDesignerBundle.message("chk.show.expert.properties"));
  inspectorCard.add(
    chkShowExpertProperties,
    new GridBagConstraints(0, 1, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)
  );
  chkShowExpertProperties.addActionListener(
    new ActionListener() {
      public void actionPerformed(final ActionEvent e) {
        myInspectorTable.setShowExpertProperties(chkShowExpertProperties.isSelected());
      }
    }
  );
  add(inspectorCard, INSPECTOR_CARD);

  // Empty card
  final MultiLineLabel label = new MultiLineLabel(UIDesignerBundle.message("label.select.single.component.to.edit.its.properties")){
    public void updateUI() {
      super.updateUI();
      setBackground(myInspectorTable.getBackground());
    }
  };
  label.setOpaque(true);
  label.setHorizontalAlignment(SwingConstants.CENTER);
  add(label, EMPTY_CARD);
  add(myCustomPropertiesScrollPane, CUSTOM_CARD);

  myComponentSelectionListener = new MyComponentSelectionListener();
  synchWithTree(false);

  // Install light bulb
  myQuickFixManager = new QuickFixManagerImpl(null, myInspectorTable, inspectorScrollPane.getViewport());

  myCustomPropertiesChangeListener = new ChangeListener() {
    public void stateChanged(ChangeEvent e) {
      if (myPropertiesPanelContainer != null) {
        myPropertiesPanelContainer.revalidate();
      }
      if (myEditor.ensureEditable()) {
        myEditor.refreshAndSave(true);
      }
    }
  };
}