当前位置: 首页>>代码示例>>Java>>正文


Java JBTable.setStriped方法代码示例

本文整理汇总了Java中com.intellij.ui.table.JBTable.setStriped方法的典型用法代码示例。如果您正苦于以下问题:Java JBTable.setStriped方法的具体用法?Java JBTable.setStriped怎么用?Java JBTable.setStriped使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.ui.table.JBTable的用法示例。


在下文中一共展示了JBTable.setStriped方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupDataSplitPane

import com.intellij.ui.table.JBTable; //导入方法依赖的package包/类
private void setupDataSplitPane(Project project) {
    RestClientService restClientService = ServiceManager.getService(project, RestClientService.class);
    SimpleNode dataRootNode = new DataExplorerRootNode(project, restClientService, "sObjects");

    SimpleTree dataTree = new SimpleTree();
    dataTree.setShowsRootHandles(true);
    SimpleTreeBuilder dataTreeBuilder = new SimpleTreeBuilder(dataTree, (DefaultTreeModel) dataTree.getModel(), new ExplorerTreeStructure(dataRootNode), null);
    Disposer.register(project, dataTreeBuilder);
    dataTree.addTreeExpansionListener(new ExplorerTreeExpansionListener(dataTreeBuilder));
    dataTree.setCellRenderer(new ExplorerCellRenderer());
    JBTable dataTable = new JBTable();
    dataTable.setStriped(true);
    dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

    // Setup left panel which will display all the available sObjects
    SimpleToolWindowPanel treePanel = new SimpleToolWindowPanel(true, true);
    ActionToolbar treeToolbar = createTreeToolbar(dataRootNode, dataTreeBuilder);
    treeToolbar.setTargetComponent(treePanel);
    treePanel.setToolbar(treeToolbar.getComponent());
    treePanel.setContent(ScrollPaneFactory.createScrollPane(dataTree));
    dataSplitPane.add(treePanel, JSplitPane.LEFT);

    // Setup right panel which will display the data in the selected sObject
    SimpleToolWindowPanel dataPanel = new SimpleToolWindowPanel(true, true);
    ActionToolbar dataToolbar = createDataToolbar(dataTable);
    dataToolbar.setTargetComponent(dataPanel);
    dataPanel.setToolbar(dataToolbar.getComponent());
    dataPanel.setContent(ScrollPaneFactory.createScrollPane(dataTable));
    dataSplitPane.add(dataPanel, JSplitPane.RIGHT);

    dataSplitPane.getLeftComponent().setPreferredSize(new Dimension(250, 0));
    dataSplitPane.getRightComponent().setPreferredSize(new Dimension(0, 0));

    dataTree.addMouseListener(new DataExplorerMouseListener(dataTable, dataTree));

}
 
开发者ID:polyglot-mark,项目名称:salesforce-plugin,代码行数:37,代码来源:DataExplorerToolWindowFactory.java

示例2: setupToolingDataSplitPane

import com.intellij.ui.table.JBTable; //导入方法依赖的package包/类
private void setupToolingDataSplitPane(Project project) {
    ToolingRestClientService toolingRestClientService = ServiceManager.getService(project, ToolingRestClientService.class);
    SimpleNode toolingDataRootNode = new DataExplorerRootNode(project, toolingRestClientService, "Tooling sObjects");

    SimpleTree toolingDataTree = new SimpleTree();
    toolingDataTree.setShowsRootHandles(true);
    SimpleTreeBuilder toolingDataTreeBuilder = new SimpleTreeBuilder(toolingDataTree, (DefaultTreeModel) toolingDataTree.getModel(), new ExplorerTreeStructure(toolingDataRootNode), null);
    Disposer.register(project, toolingDataTreeBuilder);
    toolingDataTree.addTreeExpansionListener(new ExplorerTreeExpansionListener(toolingDataTreeBuilder));
    toolingDataTree.setCellRenderer(new ExplorerCellRenderer());
    JBTable toolingDataTable = new JBTable();
    toolingDataTable.setStriped(true);
    toolingDataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

    // Setup left panel which will display all the available sObjects
    SimpleToolWindowPanel treePanel = new SimpleToolWindowPanel(true, true);
    ActionToolbar treeToolbar = createTreeToolbar(toolingDataRootNode, toolingDataTreeBuilder);
    treeToolbar.setTargetComponent(treePanel);
    treePanel.setToolbar(treeToolbar.getComponent());
    treePanel.setContent(ScrollPaneFactory.createScrollPane(toolingDataTree));
    toolingDataSplitPane.add(treePanel, JSplitPane.LEFT);

    // Setup right panel which will display the data in the selected sObject
    SimpleToolWindowPanel dataPanel = new SimpleToolWindowPanel(true, true);
    ActionToolbar dataToolbar = createDataToolbar(toolingDataTable);
    dataToolbar.setTargetComponent(dataPanel);
    dataPanel.setToolbar(dataToolbar.getComponent());
    dataPanel.setContent(ScrollPaneFactory.createScrollPane(toolingDataTable));
    toolingDataSplitPane.add(dataPanel, JSplitPane.RIGHT);

    toolingDataSplitPane.getLeftComponent().setPreferredSize(new Dimension(250, 0));
    toolingDataSplitPane.getRightComponent().setPreferredSize(new Dimension(0, 0));

    toolingDataTree.addMouseListener(new DataExplorerMouseListener(toolingDataTable, toolingDataTree));
}
 
开发者ID:polyglot-mark,项目名称:salesforce-plugin,代码行数:36,代码来源:DataExplorerToolWindowFactory.java

示例3: createUIComponents

import com.intellij.ui.table.JBTable; //导入方法依赖的package包/类
/** Create UI components. */
private void createUIComponents() {
    templatesListPanel = new TemplatesListPanel();
    editorPanel = new EditorPanel();
    editorPanel.setPreferredSize(new Dimension(Integer.MAX_VALUE, 200));

    templatesSplitter = new Splitter(false, 0.3f);
    templatesSplitter.setFirstComponent(templatesListPanel);
    templatesSplitter.setSecondComponent(editorPanel);

    languagesTable = new JBTable();
    languagesTable.setModel(new LanguagesTableModel());
    languagesTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    languagesTable.setColumnSelectionAllowed(false);
    languagesTable.setRowHeight(22);
    languagesTable.setPreferredScrollableViewportSize(new Dimension(-1,
            languagesTable.getRowHeight() * IgnoreBundle.LANGUAGES.size() / 2));

    languagesTable.setStriped(true);
    languagesTable.setShowGrid(false);
    languagesTable.setBorder(createEmptyBorder());
    languagesTable.setDragEnabled(false);

    languagesPanel = ScrollPaneFactory.createScrollPane(languagesTable);

    donatePanel = new JBPanel(new BorderLayout());
    donatePanel.setBorder(new EmptyBorder(10, 0, 10, 0));
    donatePanel.add(new JBLabel(IgnoreBundle.message("settings.general.donate")), BorderLayout.WEST);
    donatePanel.add(createLink(
            "Donate with PayPal",
            "https://www.paypal.me/hsz"
    ), BorderLayout.CENTER);
}
 
开发者ID:hsz,项目名称:idea-gitignore,代码行数:34,代码来源:IgnoreSettingsPanel.java

示例4: apply

import com.intellij.ui.table.JBTable; //导入方法依赖的package包/类
public static void apply(@Nonnull JBTable table) {
  table.setAutoResizeMode(AUTO_RESIZE_OFF);
  table.setTableHeader(createTableHeader(table.getColumnModel()));
  table.getTableHeader().setReorderingAllowed(false);
  //setOpaque(false);
  table.setGridColor(GRID_COLOR);
  table.setIntercellSpacing(new Dimension(1, 0));
  table.setShowGrid(false);
  table.setStriped(true);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:11,代码来源:StripeTable.java

示例5: createCenterPanel

import com.intellij.ui.table.JBTable; //导入方法依赖的package包/类
protected JComponent createCenterPanel() {
  myTable = new JBTable(myTableModel);
  myTable.setStriped(true);
  TableColumn nameColumn = myTable.getColumnModel().getColumn(NAME_COLUMN);
  TableColumn valueColumn = myTable.getColumnModel().getColumn(VALUE_COLUMN);
  Project project = myClass.getProject();
  nameColumn.setCellRenderer(new MyCellRenderer());
  nameColumn.setCellEditor(new StringTableCellEditor(project));
  valueColumn.setCellRenderer(new MyCodeFragmentTableCellRenderer());
  valueColumn.setCellEditor(new JavaCodeFragmentTableCellEditor(project));

  myTable.setPreferredScrollableViewportSize(new Dimension(210, myTable.getRowHeight() * 4));
  myTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  myTable.getSelectionModel().setSelectionInterval(0, 0);
  myTable.setSurrendersFocusOnKeystroke(true);
  myTable.setCellSelectionEnabled(true);
  myTable.setFocusCycleRoot(true);

  if (myHideDefaultValueColumn) {
    final TableColumn defaultValue = myTable.getColumnModel().getColumn(VALUE_COLUMN);
    myTable.removeColumn(defaultValue);
    myTable.getModel().addTableModelListener(new TableModelListener() {
      @Override
      public void tableChanged(TableModelEvent e) {
        if (e.getType() == TableModelEvent.INSERT) {
          myTable.getModel().removeTableModelListener(this);
          final TableColumnAnimator animator = new TableColumnAnimator(myTable);
          animator.setStep(20);
          animator.addColumn(defaultValue, myTable.getWidth() / 2);
          animator.startAndDoWhenDone(new Runnable() {
            @Override
            public void run() {
              myTable.editCellAt(myTable.getRowCount() - 1, 0);
            }
          });
          animator.start();
        }
      }
    });
  }

  final JPanel panel = new JPanel(new BorderLayout());
  panel.add(SeparatorFactory.createSeparator(RefactoringBundle.message("changeClassSignature.parameters.panel.border.title"), myTable), BorderLayout.NORTH);
  panel.add(ToolbarDecorator.createDecorator(myTable).createPanel(), BorderLayout.CENTER);
  return panel;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:47,代码来源:ChangeClassSignatureDialog.java

示例6: createAdditionalPanels

import com.intellij.ui.table.JBTable; //导入方法依赖的package包/类
@NotNull
protected List<Pair<String,JPanel>> createAdditionalPanels() {
  // this method is invoked before constructor body
  myExceptionsModel = new ExceptionsTableModel(myMethod.getMethod().getThrowsList());
  myExceptionsModel.setTypeInfos(myMethod.getMethod());

  final JBTable table = new JBTable(myExceptionsModel);
  table.setStriped(true);
  table.setRowHeight(20);
  table.getColumnModel().getColumn(0).setCellRenderer(new CodeFragmentTableCellRenderer(myProject));
  final JavaCodeFragmentTableCellEditor cellEditor = new JavaCodeFragmentTableCellEditor(myProject);
  cellEditor.addDocumentListener(new DocumentAdapter() {
    @Override
    public void documentChanged(DocumentEvent e) {
      final int row = table.getSelectedRow();
      final int col = table.getSelectedColumn();
      myExceptionsModel.setValueAt(cellEditor.getCellEditorValue(), row, col);
      updateSignature();
    }
  });
  table.getColumnModel().getColumn(0).setCellEditor(cellEditor);
  table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  table.getSelectionModel().setSelectionInterval(0, 0);
  table.setSurrendersFocusOnKeystroke(true);

  myPropExceptionsButton = new AnActionButton(RefactoringBundle.message("changeSignature.propagate.exceptions.title"), null, AllIcons.Hierarchy.Caller) {
    @Override
    public void actionPerformed(AnActionEvent e) {
      final Ref<JavaCallerChooser> chooser = new Ref<JavaCallerChooser>();
      Consumer<Set<PsiMethod>> callback = new Consumer<Set<PsiMethod>>() {
        @Override
        public void consume(Set<PsiMethod> psiMethods) {
          myMethodsToPropagateExceptions = psiMethods;
          myExceptionPropagationTree = chooser.get().getTree();
        }
      };
      chooser.set(new JavaCallerChooser(myMethod.getMethod(),
                                        myProject,
                                        RefactoringBundle.message("changeSignature.exception.caller.chooser"),
                                        myExceptionPropagationTree,
                                        callback));
      chooser.get().show();
    }
  };
  myPropExceptionsButton.setShortcut(CustomShortcutSet.fromString("alt X"));

  final JPanel panel = ToolbarDecorator.createDecorator(table).addExtraAction(myPropExceptionsButton).createPanel();
  panel.setBorder(IdeBorderFactory.createEmptyBorder());

  myExceptionsModel.addTableModelListener(mySignatureUpdater);

  final ArrayList<Pair<String, JPanel>> result = new ArrayList<Pair<String, JPanel>>();
  final String message = RefactoringBundle.message("changeSignature.exceptions.panel.border.title");
  result.add(Pair.create(message, panel));
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:57,代码来源:JavaChangeSignatureDialog.java

示例7: createAdditionalPanels

import com.intellij.ui.table.JBTable; //导入方法依赖的package包/类
@NotNull
@Override
protected List<Pair<String, JPanel>> createAdditionalPanels() {
  // this method is invoked before constructor body
  myExceptionsModel = new ExceptionsTableModel(myMethod.getMethod().getThrowsList());
  myExceptionsModel.setTypeInfos(myMethod.getMethod());

  final JBTable table = new JBTable(myExceptionsModel);
  table.setStriped(true);
  table.setRowHeight(20);
  table.getColumnModel().getColumn(0).setCellRenderer(new CodeFragmentTableCellRenderer(myProject));
  final JavaCodeFragmentTableCellEditor cellEditor = new JavaCodeFragmentTableCellEditor(myProject);
  cellEditor.addDocumentListener(new DocumentAdapter() {
    @Override
    public void documentChanged(DocumentEvent e) {
      final int row = table.getSelectedRow();
      final int col = table.getSelectedColumn();
      myExceptionsModel.setValueAt(cellEditor.getCellEditorValue(), row, col);
      updateSignature();
    }
  });
  table.getColumnModel().getColumn(0).setCellEditor(cellEditor);
  table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  table.getSelectionModel().setSelectionInterval(0, 0);
  table.setSurrendersFocusOnKeystroke(true);

 /* myPropExceptionsButton = new AnActionButton(              //todo propagate parameters
    RefactoringBundle.message("changeSignature.propagate.exceptions.title"), null, PlatformIcons.NEW_EXCEPTION) {
    @Override
    public void actionPerformed(AnActionEvent e) {
      final Ref<JavaCallerChooser> chooser = new Ref<JavaCallerChooser>();
      Consumer<Set<PsiMethod>> callback = new Consumer<Set<PsiMethod>>() {
        @Override
        public void consume(Set<PsiMethod> psiMethods) {
          myMethodsToPropagateExceptions = psiMethods;
          myExceptionPropagationTree = chooser.get().getTree();
        }
      };
      chooser.set(new JavaCallerChooser(myMethod.getMethod(),
                                        myProject,
                                        RefactoringBundle.message("changeSignature.exception.caller.chooser"),
                                        myExceptionPropagationTree,
                                        callback));
      chooser.get().show();
    }
  };
  myPropExceptionsButton.setShortcut(CustomShortcutSet.fromString("alt X"));*/

  final JPanel panel = ToolbarDecorator.createDecorator(table).createPanel();
    //.addExtraAction(myPropExceptionsButton).createPanel();
  panel.setBorder(IdeBorderFactory.createEmptyBorder());

  myExceptionsModel.addTableModelListener(mySignatureUpdater);

  final ArrayList<Pair<String, JPanel>> result = new ArrayList<Pair<String, JPanel>>();
  final String message = RefactoringBundle.message("changeSignature.exceptions.panel.border.title");
  result.add(Pair.create(message, panel));
  return result;

}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:61,代码来源:GrChangeSignatureDialog.java

示例8: createAdditionalPanels

import com.intellij.ui.table.JBTable; //导入方法依赖的package包/类
@NotNull
protected List<Pair<String,JPanel>> createAdditionalPanels() {
  // this method is invoked before constructor body
  myExceptionsModel = new ExceptionsTableModel(myMethod.getMethod().getThrowsList());
  myExceptionsModel.setTypeInfos(myMethod.getMethod());

  final JBTable table = new JBTable(myExceptionsModel);
  table.setStriped(true);
  table.setRowHeight(20);
  table.getColumnModel().getColumn(0).setCellRenderer(new CodeFragmentTableCellRenderer(myProject));
  final JavaCodeFragmentTableCellEditor cellEditor = new JavaCodeFragmentTableCellEditor(myProject);
  cellEditor.addDocumentListener(new DocumentAdapter() {
    @Override
    public void documentChanged(DocumentEvent e) {
      final int row = table.getSelectedRow();
      final int col = table.getSelectedColumn();
      myExceptionsModel.setValueAt(cellEditor.getCellEditorValue(), row, col);
      updateSignature();
    }
  });
  table.getColumnModel().getColumn(0).setCellEditor(cellEditor);
  table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  table.getSelectionModel().setSelectionInterval(0, 0);
  table.setSurrendersFocusOnKeystroke(true);

  myPropExceptionsButton = new AnActionButton(RefactoringBundle.message("changeSignature.propagate.exceptions.title"), null, PlatformIcons.NEW_EXCEPTION) {
    @Override
    public void actionPerformed(AnActionEvent e) {
      final Ref<JavaCallerChooser> chooser = new Ref<JavaCallerChooser>();
      Consumer<Set<PsiMethod>> callback = new Consumer<Set<PsiMethod>>() {
        @Override
        public void consume(Set<PsiMethod> psiMethods) {
          myMethodsToPropagateExceptions = psiMethods;
          myExceptionPropagationTree = chooser.get().getTree();
        }
      };
      chooser.set(new JavaCallerChooser(myMethod.getMethod(),
                                        myProject,
                                        RefactoringBundle.message("changeSignature.exception.caller.chooser"),
                                        myExceptionPropagationTree,
                                        callback));
      chooser.get().show();
    }
  };
  myPropExceptionsButton.setShortcut(CustomShortcutSet.fromString("alt X"));

  final JPanel panel = ToolbarDecorator.createDecorator(table).addExtraAction(myPropExceptionsButton).createPanel();
  panel.setBorder(IdeBorderFactory.createEmptyBorder());

  myExceptionsModel.addTableModelListener(mySignatureUpdater);

  final ArrayList<Pair<String, JPanel>> result = new ArrayList<Pair<String, JPanel>>();
  final String message = RefactoringBundle.message("changeSignature.exceptions.panel.border.title");
  result.add(Pair.create(message, panel));
  return result;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:57,代码来源:JavaChangeSignatureDialog.java

示例9: RegistryUi

import com.intellij.ui.table.JBTable; //导入方法依赖的package包/类
public RegistryUi() {
  myContent.setLayout(new BorderLayout(UIUtil.DEFAULT_HGAP, UIUtil.DEFAULT_VGAP));

  myModel = new MyTableModel();
  myTable = new JBTable(myModel);
  myTable.setCellSelectionEnabled(true);
  myTable.setEnableAntialiasing(true);
  final MyRenderer r = new MyRenderer();

  final TableColumn c0 = myTable.getColumnModel().getColumn(0);
  c0.setCellRenderer(r);
  c0.setMaxWidth(RESTART_ICON.getIconWidth() + 12);
  c0.setMinWidth(RESTART_ICON.getIconWidth() + 12);
  c0.setHeaderValue(null);

  final TableColumn c1 = myTable.getColumnModel().getColumn(1);
  c1.setCellRenderer(r);
  c1.setHeaderValue("Key");

  final TableColumn c2 = myTable.getColumnModel().getColumn(2);
  c2.setCellRenderer(r);
  c2.setHeaderValue("Value");
  c2.setCellEditor(new MyEditor());
  myTable.setStriped(true);

  myDescriptionLabel = new JTextArea(3, 50);
  myDescriptionLabel.setEditable(false);
  final JScrollPane label = ScrollPaneFactory.createScrollPane(myDescriptionLabel);
  final JPanel descriptionPanel = new JPanel(new BorderLayout());
  descriptionPanel.add(label, BorderLayout.CENTER);
  descriptionPanel.setBorder(IdeBorderFactory.createTitledBorder("Description", false));

  myContent.add(ScrollPaneFactory.createScrollPane(myTable), BorderLayout.CENTER);
  myContent.add(descriptionPanel, BorderLayout.SOUTH);

  myTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
    @Override
    public void valueChanged(ListSelectionEvent e) {
      if (e.getValueIsAdjusting()) return;

      final int selected = myTable.getSelectedRow();
      if (selected != -1) {
        final RegistryValue value = myModel.getRegistryValue(selected);
        String desc = value.getDescription();
        if (value.isRestartRequired()) {
          String required = "Requires IDE restart.";
          if (desc.endsWith(".")) {
            desc += required;
          } else {
            desc += (". " + required);
          }
        }
        myDescriptionLabel.setText(desc);
      } else {
        myDescriptionLabel.setText(null);
      }
    }
  });

  myRestoreDefaultsAction = new RestoreDefaultsAction();

  final DefaultActionGroup tbGroup = new DefaultActionGroup();
  tbGroup.add(new EditAction());
  tbGroup.add(new RevertAction());

  final ActionToolbar tb = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, tbGroup, true);
  tb.setTargetComponent(myTable);

  myContent.add(tb.getComponent(), BorderLayout.NORTH);
  new TableSpeedSearch(myTable).setComparator(new SpeedSearchComparator(false));
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:72,代码来源:RegistryUi.java

示例10: createCommitsPane

import com.intellij.ui.table.JBTable; //导入方法依赖的package包/类
@NotNull
private JPanel createCommitsPane() {
  @SuppressWarnings("UseOfObsoleteCollectionType")
  final Vector<String> commitColumnNames = new Vector<String>();
  commitColumnNames.add(CrucibleBundle.message("crucible.commit"));
  commitColumnNames.add(CrucibleBundle.message("crucible.author"));
  commitColumnNames.add(CrucibleBundle.message("crucible.date"));

  //noinspection UseOfObsoleteCollectionType
  myCommitsModel = new DefaultTableModel(new Vector(), commitColumnNames) {
    @Override
    public boolean isCellEditable(int row, int column) {
      return false;
    }

    @Override
    public Class<?> getColumnClass(int columnIndex) {
      if (columnIndex == 0) return CommittedChangeList.class;
      if (columnIndex == 2) return Date.class;
      return String.class;
    }
  };

  myCommitsTable = new JBTable(myCommitsModel) {
    @Override
    public TableCellRenderer getCellRenderer(int row, int column) {
      if (column == myCommitsTable.getColumnModel().getColumnIndex(CrucibleBundle.message("crucible.commit"))) {
        return new MyCommitsCellRenderer();
      }
      return super.getCellRenderer(row, column);
    }
  };
  myCommitsTable.setStriped(true);
  myCommitsTable.setAutoCreateRowSorter(true);
  myCommitsTable.setExpandableItemsEnabled(false);
  setUpColumnWidths(myCommitsTable);

  final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myCommitsTable).setToolbarPosition(ActionToolbarPosition.LEFT);

  if (myReview.isReviewer(new User(myCrucibleSettings.USERNAME)) && "Review".equals(myReview.getState())) {
    decorator.addExtraAction(new CompleteReviewAction(myReview, CrucibleBundle.message("crucible.complete.review")));
  }
  decorator.addExtraAction(new ShowGeneralCommentsAction());
  decorator.addExtraAction(new OpenInBrowserAction());

  return decorator.createPanel();
}
 
开发者ID:ktisha,项目名称:Crucible4IDEA,代码行数:48,代码来源:DetailsPanel.java

示例11: CruciblePanel

import com.intellij.ui.table.JBTable; //导入方法依赖的package包/类
public CruciblePanel(@NotNull final Project project) {
  super(false);
  myProject = project;

  final JBSplitter splitter = new JBSplitter(false, 0.2f);

  myReviewModel = new CrucibleReviewModel(project);
  myReviewTable = new JBTable(myReviewModel);
  myReviewTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  myReviewTable.setStriped(true);
  myReviewTable.setExpandableItemsEnabled(false);

  final TableColumnModel columnModel = myReviewTable.getColumnModel();
  columnModel.getColumn(1).setCellRenderer(new DescriptionCellRenderer());

  setUpColumnWidths(myReviewTable);
  myReviewTable.addMouseListener(new MouseAdapter() {
    public void mouseClicked(MouseEvent e) {
      if (e.getClickCount() == 2) {
        final int viewRow = myReviewTable.getSelectedRow();
        if (viewRow >= 0 &&  viewRow < myReviewTable.getRowCount()) {
          ApplicationManager.getApplication().invokeLater(new Runnable() {
            @Override
            public void run() {
              final Review review =
                CrucibleManager.getInstance(myProject).getDetailsForReview((String)myReviewTable.
                  getValueAt(viewRow, myReviewTable.getColumnModel().getColumnIndex(CrucibleBundle.message("crucible.id"))));
              if (review != null) {
                openDetailsToolWindow(review);
                myReviewTable.clearSelection();
              }
            }
          }, ModalityState.stateForComponent(myReviewTable));

        }
      }
  }});

  final TableRowSorter<TableModel> rowSorter = new TableRowSorter<TableModel>(myReviewModel);
  rowSorter.setSortKeys(Collections.singletonList(new RowSorter.SortKey(4, SortOrder.ASCENDING)));
  rowSorter.sort();
  myReviewTable.setRowSorter(rowSorter);

  final JScrollPane detailsScrollPane = ScrollPaneFactory.createScrollPane(myReviewTable);

  final SimpleTreeStructure reviewTreeStructure = createTreeStructure();
  final DefaultTreeModel model = new CrucibleTreeModel();
  final SimpleTree reviewTree = new SimpleTree(model);

  new AbstractTreeBuilder(reviewTree, model, reviewTreeStructure, null);
  reviewTree.invalidate();

  final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(reviewTree);
  splitter.setFirstComponent(scrollPane);
  splitter.setSecondComponent(detailsScrollPane);
  setContent(splitter);
}
 
开发者ID:ktisha,项目名称:Crucible4IDEA,代码行数:58,代码来源:CruciblePanel.java


注:本文中的com.intellij.ui.table.JBTable.setStriped方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。