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

项目:camel-idea-plugin    文件:CamelIgnoreAndExcludePage.java   
AddEditRemovePanel<String> getExcludePropertyFilePanel() {
    return excludePropertyFilePanel;
}
项目:camel-idea-plugin    文件:CamelIgnoreAndExcludePage.java   
AddEditRemovePanel<String> getIgnorePropertyFilePanel() {
    return ignorePropertyFilePanel;
}
项目:intellij-ce-playground    文件:ExternalResourceConfigurable.java   
@Override
public JComponent createComponent() {
  myPanel = new JPanel(new GridBagLayout()) {
    @Override
    public Dimension getPreferredSize() {
      return new Dimension(-1, 400);
    }
  };

  myExtPanel = new AddEditRemovePanel<NameLocationPair>(new ExtUrlsTableModel(), myPairs, XmlBundle.message("label.edit.external.resource.configure.external.resources")) {
    @Override
    protected NameLocationPair addItem() {
      return addExtLocation();
    }

    @Override
    protected boolean removeItem(NameLocationPair o) {
      setModified(true);
      return true;
    }

    @Override
    protected NameLocationPair editItem(NameLocationPair o) {
      return editExtLocation(o);
    }
  };
  myExtPanel.getTable().setShowColumns(true);

  myExtPanel.setRenderer(1, new PathRenderer());

  JTable table = myExtPanel.getTable();
  if (myProject != null) {
    TableColumn column = table.getColumn(table.getColumnName(2));
    column.setMaxWidth(50);
    column.setCellEditor(JBTable.createBooleanEditor());
  }

  table.getModel().addTableModelListener(new TableModelListener() {
    @Override
    public void tableChanged(TableModelEvent e) {
      setModified(true);
    }
  });
  myIgnorePanel = new AddEditRemovePanel<String>(new IgnoredUrlsModel(), myIgnoredUrls, XmlBundle.message("label.edit.external.resource.configure.ignored.resources")) {
    @Override
    protected String addItem() {
      return addIgnoreLocation();
    }

    @Override
    protected boolean removeItem(String o) {
      setModified(true);
      return true;
    }

    @Override
    protected String editItem(String o) {
      return editIgnoreLocation(o);
    }
  };

  myPanel.add(myExtPanel,
              new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
  myPanel.add(myIgnorePanel,
              new GridBagConstraints(0, 1, 1, 1, 1, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));

  myExtPanel.setData(myPairs);
  myIgnorePanel.setData(myIgnoredUrls);

  myExtPanel.getEmptyText().setText(XmlBundle.message("no.external.resources"));
  myIgnorePanel.getEmptyText().setText(XmlBundle.message("no.ignored.resources"));

  return myPanel;
}
项目:tools-idea    文件:ExternalResourceConfigurable.java   
public JComponent createComponent() {
  myPanel = new JPanel(new GridBagLayout()) {
    public Dimension getPreferredSize() {
      return new Dimension(-1, 400);
    }
  };

  myExtPanel = new AddEditRemovePanel<NameLocationPair>(new ExtUrlsTableModel(), myPairs, XmlBundle.message("label.edit.external.resource.configure.external.resources")) {
    protected NameLocationPair addItem() {
      return addExtLocation();
    }

    protected boolean removeItem(NameLocationPair o) {
      setModified(true);
      return true;
    }

    protected NameLocationPair editItem(NameLocationPair o) {
      return editExtLocation(o);
    }
  };

  myExtPanel.setRenderer(1, new PathRenderer());

  JTable table = myExtPanel.getTable();
  if (myProject != null) {
    TableColumn column = table.getColumn(table.getColumnName(2));
    column.setMaxWidth(50);
    column.setCellEditor(JBTable.createBooleanEditor());
  }

  table.getModel().addTableModelListener(new TableModelListener() {
    public void tableChanged(TableModelEvent e) {
      setModified(true);
    }
  });
  myIgnorePanel = new AddEditRemovePanel<String>(new IgnoredUrlsModel(), myIgnoredUrls, XmlBundle.message("label.edit.external.resource.configure.ignored.resources")) {
    protected String addItem() {
      return addIgnoreLocation();
    }

    protected boolean removeItem(String o) {
      setModified(true);
      return true;
    }

    protected String editItem(String o) {
      return editIgnoreLocation(o);
    }
  };
  if (myProject != null) {
    myHtmlLanguageLevelForm = new HtmlLanguageLevelForm(myProject);
    myHtmlLanguageLevelForm.addListener(new HtmlLanguageLevelForm.MyListener() {
      @Override
      public void doctypeChanged() {
        if (!myHtmlLanguageLevelForm.getDoctype().equals(myDefaultHtmlDoctype)) {
          setModified(true);
        }
      }
    });
  }

  myPanel.add(myExtPanel,
              new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
  myPanel.add(myIgnorePanel,
              new GridBagConstraints(0, 1, 1, 1, 1, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
  if (myProject != null) {
    myPanel.add(myHtmlLanguageLevelForm.getContentPanel(),
                new GridBagConstraints(0, 2, 1, 1, 1, 0, GridBagConstraints.SOUTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0),
                                       0, 0));
  }

  myExtPanel.setData(myPairs);
  myIgnorePanel.setData(myIgnoredUrls);

  myExtPanel.getEmptyText().setText(XmlBundle.message("no.external.resources"));
  myIgnorePanel.getEmptyText().setText(XmlBundle.message("no.ignored.resources"));

  return myPanel;
}
项目:consulo-xml    文件:ExternalResourceConfigurable.java   
public JComponent createComponent() {
  myPanel = new JPanel(new GridBagLayout()) {
    public Dimension getPreferredSize() {
      return new Dimension(-1, 400);
    }
  };

  myExtPanel = new AddEditRemovePanel<NameLocationPair>(new ExtUrlsTableModel(), myPairs, XmlBundle.message("label.edit.external.resource.configure.external.resources")) {
    protected NameLocationPair addItem() {
      return addExtLocation();
    }

    protected boolean removeItem(NameLocationPair o) {
      setModified(true);
      return true;
    }

    protected NameLocationPair editItem(NameLocationPair o) {
      return editExtLocation(o);
    }
  };

  myExtPanel.setRenderer(1, new PathRenderer());

  JTable table = myExtPanel.getTable();
  if (myProject != null) {
    TableColumn column = table.getColumn(table.getColumnName(2));
    column.setMaxWidth(50);
    column.setCellEditor(JBTable.createBooleanEditor());
  }

  table.getModel().addTableModelListener(new TableModelListener() {
    public void tableChanged(TableModelEvent e) {
      setModified(true);
    }
  });
  myIgnorePanel = new AddEditRemovePanel<String>(new IgnoredUrlsModel(), myIgnoredUrls, XmlBundle.message("label.edit.external.resource.configure.ignored.resources")) {
    protected String addItem() {
      return addIgnoreLocation();
    }

    protected boolean removeItem(String o) {
      setModified(true);
      return true;
    }

    protected String editItem(String o) {
      return editIgnoreLocation(o);
    }
  };
  if (myProject != null) {
    myHtmlLanguageLevelForm = new HtmlLanguageLevelForm(myProject);
    myHtmlLanguageLevelForm.addListener(new HtmlLanguageLevelForm.MyListener() {
      @Override
      public void doctypeChanged() {
        if (!myHtmlLanguageLevelForm.getDoctype().equals(myDefaultHtmlDoctype)) {
          setModified(true);
        }
      }
    });
  }

  myPanel.add(myExtPanel,
              new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
  myPanel.add(myIgnorePanel,
              new GridBagConstraints(0, 1, 1, 1, 1, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
  if (myProject != null) {
    myPanel.add(myHtmlLanguageLevelForm.getContentPanel(),
                new GridBagConstraints(0, 2, 1, 1, 1, 0, GridBagConstraints.SOUTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0),
                                       0, 0));
  }

  myExtPanel.setData(myPairs);
  myIgnorePanel.setData(myIgnoredUrls);

  myExtPanel.getEmptyText().setText(XmlBundle.message("no.external.resources"));
  myIgnorePanel.getEmptyText().setText(XmlBundle.message("no.ignored.resources"));

  return myPanel;
}