@Nullable
 private TableColumn getRootColumnOrNull(@NotNull MouseEvent e) {
   if (!myLogDataHolder.isMultiRoot()) return null;
   int column = convertColumnIndexToModel(columnAtPoint(e.getPoint()));
   if (column == GraphTableModel.ROOT_COLUMN) {
     return getColumnModel().getColumn(column);
   }
   return null;
 }
  DetailsPanel(
      @NotNull VcsLogDataHolder logDataHolder,
      @NotNull VcsLogGraphTable graphTable,
      @NotNull VcsLogColorManager colorManager,
      @NotNull VisiblePack initialDataPack) {
    myLogDataHolder = logDataHolder;
    myGraphTable = graphTable;
    myColorManager = colorManager;
    myDataPack = initialDataPack;

    myReferencesPanel = new ReferencesPanel(myColorManager);
    myCommitDetailsPanel =
        new DataPanel(logDataHolder.getProject(), logDataHolder.isMultiRoot(), logDataHolder);

    myScrollPane =
        new JBScrollPane(
            ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    myMainContentPanel =
        new JPanel(new MigLayout("flowy, ins 0, hidemode 3, gapy 0")) {
          @Override
          public Dimension getPreferredSize() {
            Dimension size = super.getPreferredSize();
            size.width = myScrollPane.getViewport().getWidth() - 5;
            return size;
          }
        };
    myMainContentPanel.setOpaque(false);
    myScrollPane.setOpaque(false);
    myScrollPane.getViewport().setOpaque(false);
    myScrollPane.setViewportView(myMainContentPanel);
    myMainContentPanel.add(myReferencesPanel, "");
    myMainContentPanel.add(myCommitDetailsPanel, "");

    myLoadingPanel =
        new JBLoadingPanel(
            new BorderLayout(),
            logDataHolder,
            ProgressWindow.DEFAULT_PROGRESS_DIALOG_POSTPONE_TIME_MILLIS) {
          @Override
          public Color getBackground() {
            return getDetailsBackground();
          }
        };
    myLoadingPanel.add(myScrollPane);

    myMessagePanel = new MessagePanel();

    setLayout(new CardLayout());
    add(myLoadingPanel, STANDARD_LAYER);
    add(myMessagePanel, MESSAGE_LAYER);

    showMessage("No commits selected");
  }
Esempio n. 3
0
  public VcsLogGraphTable(
      @NotNull VcsLogUiImpl UI,
      @NotNull final VcsLogDataHolder logDataHolder,
      @NotNull DataPack initialDataPack) {
    super();
    myUI = UI;
    myLogDataHolder = logDataHolder;
    myDataPack = initialDataPack;
    myGraphCommitCellRender =
        new GraphCommitCellRender(
            myUI.getColorManager(), logDataHolder, myDataPack.getGraphFacade(), this);

    setDefaultRenderer(
        VirtualFile.class, new RootCellRenderer(myUI, myLogDataHolder.isMultiRoot()));
    setDefaultRenderer(GraphCommitCell.class, myGraphCommitCellRender);
    setDefaultRenderer(String.class, new StringCellRenderer());

    setRowHeight(HEIGHT_CELL);
    setShowHorizontalLines(false);
    setIntercellSpacing(new Dimension(0, 0));

    getSelectionModel()
        .addListSelectionListener(
            new ListSelectionListener() {
              @Override
              public void valueChanged(ListSelectionEvent e) {
                int selectedRow = getSelectedRow();
                if (selectedRow >= 0) {
                  myUI.click(selectedRow);
                }
              }
            });

    MouseAdapter mouseAdapter = new MyMouseAdapter();
    addMouseMotionListener(mouseAdapter);
    addMouseListener(mouseAdapter);

    PopupHandler.installPopupHandler(
        this, VcsLogUiImpl.POPUP_ACTION_GROUP, VcsLogUiImpl.VCS_LOG_TABLE_PLACE);
    TableScrollingUtil.installActions(this, false);
  }
Esempio n. 4
0
 private int getXOffset() {
   TableColumn rootColumn = getColumnModel().getColumn(AbstractVcsLogTableModel.ROOT_COLUMN);
   return myLogDataHolder.isMultiRoot() ? rootColumn.getWidth() : 0;
 }
  public VcsLogGraphTable(@NotNull VcsLogUI UI, final VcsLogDataHolder logDataHolder) {
    super();
    myUI = UI;

    myGraphPainter = new SimpleGraphCellPainter(logDataHolder.isMultiRoot());

    setDefaultRenderer(VirtualFile.class, new RootCellRenderer(myUI));
    setDefaultRenderer(
        GraphCommitCell.class,
        new GraphCommitCellRender(myGraphPainter, logDataHolder, myUI.getColorManager()));
    setDefaultRenderer(
        CommitCell.class, new CommitCellRender(myUI.getColorManager(), logDataHolder.getProject()));
    setDefaultRenderer(String.class, new StringCellRenderer());

    setRowHeight(HEIGHT_CELL);
    setShowHorizontalLines(false);
    setIntercellSpacing(new Dimension(0, 0));

    getSelectionModel()
        .addListSelectionListener(
            new ListSelectionListener() {
              @Override
              public void valueChanged(ListSelectionEvent e) {
                int selectedRow = getSelectedRow();
                if (selectedRow >= 0) {
                  myUI.click(selectedRow);
                }
              }
            });

    MouseAdapter mouseAdapter = new MyMouseAdapter();
    addMouseMotionListener(mouseAdapter);
    addMouseListener(mouseAdapter);

    PopupHandler.installPopupHandler(
        this, VcsLogUI.POPUP_ACTION_GROUP, VcsLogUI.VCS_LOG_TABLE_PLACE);

    getColumnModel()
        .addColumnModelListener(
            new TableColumnModelListener() {
              @Override
              public void columnAdded(TableColumnModelEvent e) {
                if (e.getToIndex() == AbstractVcsLogTableModel.ROOT_COLUMN) {
                  myGraphPainter.setRootColumn(
                      getColumnModel().getColumn(AbstractVcsLogTableModel.ROOT_COLUMN));
                }
              }

              @Override
              public void columnRemoved(TableColumnModelEvent e) {}

              @Override
              public void columnMoved(TableColumnModelEvent e) {}

              @Override
              public void columnMarginChanged(ChangeEvent e) {}

              @Override
              public void columnSelectionChanged(ListSelectionEvent e) {}
            });
  }