Search in sources :

Example 21 with ListSelectionEvent

use of javax.swing.event.ListSelectionEvent in project intellij-community by JetBrains.

the class ToBeMergedDialog method initUI.

private void initUI() {
    final ListSelectionListener selectionListener = e -> {
        List<SvnChangeList> changeLists = myRevisionsList.getSelectedObjects();
        myAlreadyMerged.clear();
        for (SvnChangeList changeList : changeLists) {
            myAlreadyMerged.addAll(getAlreadyMergedPaths(changeList));
        }
        myRepositoryChangesBrowser.setChangesToDisplay(collectChanges(changeLists, false));
        mySplitter.doLayout();
        myRepositoryChangesBrowser.repaint();
    };
    final MyListCellRenderer listCellRenderer = new MyListCellRenderer();
    myRevisionsList = new TableView<SvnChangeList>() {

        @Override
        public TableCellRenderer getCellRenderer(int row, int column) {
            return listCellRenderer;
        }

        @Override
        public void valueChanged(ListSelectionEvent e) {
            super.valueChanged(e);
            selectionListener.valueChanged(e);
        }
    };
    myRevisionsList.setExpandableItemsEnabled(false);
    new TableViewSpeedSearch<SvnChangeList>(myRevisionsList) {

        @Override
        protected String getItemText(@NotNull SvnChangeList element) {
            return element.getComment();
        }
    };
    myRevisionsList.setModelAndUpdateColumns(myRevisionsModel);
    myRevisionsList.setTableHeader(null);
    myRevisionsList.setShowGrid(false);
    final AbstractBaseTagMouseListener mouseListener = new AbstractBaseTagMouseListener() {

        @Override
        public Object getTagAt(@NotNull MouseEvent e) {
            JTable table = (JTable) e.getSource();
            int row = table.rowAtPoint(e.getPoint());
            int column = table.columnAtPoint(e.getPoint());
            if (row == -1 || column == -1)
                return null;
            listCellRenderer.customizeCellRenderer(table, table.getValueAt(row, column), table.isRowSelected(row));
            return listCellRenderer.myRenderer.getFragmentTagAt(e.getPoint().x - table.getCellRect(row, column, false).x);
        }
    };
    mouseListener.installOn(myRevisionsList);
    myMore100Action = new MoreXAction(100);
    myMore500Action = new MoreXAction(500);
    BorderLayoutPanel panel = JBUI.Panels.simplePanel().addToCenter(ScrollPaneFactory.createScrollPane(myRevisionsList)).addToTop(createToolbar().getComponent());
    mySplitter = new Splitter(false, 0.7f);
    mySplitter.setFirstComponent(panel);
    myRepositoryChangesBrowser = new RepositoryChangesBrowser(myMergeContext.getProject(), Collections.<SvnChangeList>emptyList(), emptyList(), null);
    myRepositoryChangesBrowser.getDiffAction().registerCustomShortcutSet(myRepositoryChangesBrowser.getDiffAction().getShortcutSet(), myRevisionsList);
    setChangesDecorator();
    mySplitter.setSecondComponent(myRepositoryChangesBrowser);
    mySplitter.setDividerWidth(2);
    addRevisionListListeners();
    myPanel.add(mySplitter, BorderLayout.CENTER);
}
Also used : UIUtil(com.intellij.util.ui.UIUtil) AllIcons(com.intellij.icons.AllIcons) MessageType(com.intellij.openapi.ui.MessageType) CommittedChangesTreeBrowser.collectChanges(com.intellij.openapi.vcs.changes.committed.CommittedChangesTreeBrowser.collectChanges) Change(com.intellij.openapi.vcs.changes.Change) MergeChecker(org.jetbrains.idea.svn.mergeinfo.MergeChecker) ColumnInfo(com.intellij.util.ui.ColumnInfo) MergeCalculatorTask.getBunchSize(org.jetbrains.idea.svn.integrate.MergeCalculatorTask.getBunchSize) TableCellRenderer(javax.swing.table.TableCellRenderer) Collections.singletonList(java.util.Collections.singletonList) Task(com.intellij.openapi.progress.Task) BorderLayoutPanel(com.intellij.util.ui.components.BorderLayoutPanel) JBUI(com.intellij.util.ui.JBUI) Collections.synchronizedMap(java.util.Collections.synchronizedMap) CommittedChangeListRenderer(com.intellij.openapi.vcs.changes.committed.CommittedChangeListRenderer) VcsException(com.intellij.openapi.vcs.VcsException) ListSelectionEvent(javax.swing.event.ListSelectionEvent) ContainerUtilRt.newHashSet(com.intellij.util.containers.ContainerUtilRt.newHashSet) TableView(com.intellij.ui.table.TableView) KeyEvent(java.awt.event.KeyEvent) com.intellij.ui(com.intellij.ui) Collectors(java.util.stream.Collectors) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) SvnChangeList(org.jetbrains.idea.svn.history.SvnChangeList) List(java.util.List) ApplicationManager(com.intellij.openapi.application.ApplicationManager) NotNull(org.jetbrains.annotations.NotNull) AbstractBaseTagMouseListener(com.intellij.openapi.vcs.changes.issueLinks.AbstractBaseTagMouseListener) java.util(java.util) KeyAdapter(java.awt.event.KeyAdapter) ContainerUtil(com.intellij.util.containers.ContainerUtil) MergeCalculatorTask.loadChangeLists(org.jetbrains.idea.svn.integrate.MergeCalculatorTask.loadChangeLists) SvnMergeInfoCache(org.jetbrains.idea.svn.mergeinfo.SvnMergeInfoCache) DialogWrapper(com.intellij.openapi.ui.DialogWrapper) ListTableModel(com.intellij.util.ui.ListTableModel) ContainerUtilRt.emptyList(com.intellij.util.containers.ContainerUtilRt.emptyList) Splitter(com.intellij.openapi.ui.Splitter) ListMergeStatus(org.jetbrains.idea.svn.mergeinfo.ListMergeStatus) ChangeNodeDecorator(com.intellij.openapi.vcs.changes.ui.ChangeNodeDecorator) PopupUtil(com.intellij.openapi.ui.popup.util.PopupUtil) ActionEvent(java.awt.event.ActionEvent) MouseEvent(java.awt.event.MouseEvent) java.awt(java.awt) com.intellij.openapi.actionSystem(com.intellij.openapi.actionSystem) ChangesBrowserNodeRenderer(com.intellij.openapi.vcs.changes.ui.ChangesBrowserNodeRenderer) DumbAwareAction(com.intellij.openapi.project.DumbAwareAction) RepositoryChangesBrowser(com.intellij.openapi.vcs.changes.committed.RepositoryChangesBrowser) Pair(com.intellij.openapi.util.Pair) ObjectUtils(com.intellij.util.ObjectUtils) ListSelectionListener(javax.swing.event.ListSelectionListener) Condition(com.intellij.openapi.util.Condition) javax.swing(javax.swing) TableCellRenderer(javax.swing.table.TableCellRenderer) MouseEvent(java.awt.event.MouseEvent) Splitter(com.intellij.openapi.ui.Splitter) RepositoryChangesBrowser(com.intellij.openapi.vcs.changes.committed.RepositoryChangesBrowser) SvnChangeList(org.jetbrains.idea.svn.history.SvnChangeList) ListSelectionEvent(javax.swing.event.ListSelectionEvent) NotNull(org.jetbrains.annotations.NotNull) BorderLayoutPanel(com.intellij.util.ui.components.BorderLayoutPanel) ListSelectionListener(javax.swing.event.ListSelectionListener) AbstractBaseTagMouseListener(com.intellij.openapi.vcs.changes.issueLinks.AbstractBaseTagMouseListener) Collections.singletonList(java.util.Collections.singletonList) SvnChangeList(org.jetbrains.idea.svn.history.SvnChangeList) List(java.util.List) ContainerUtilRt.emptyList(com.intellij.util.containers.ContainerUtilRt.emptyList)

Example 22 with ListSelectionEvent

use of javax.swing.event.ListSelectionEvent in project zaproxy by zaproxy.

the class SearchPanel method initialize.

/**
	 * This method initializes this
	 */
private void initialize() {
    resultsModel = new SearchResultsTableModel();
    resultsTable = new SearchResultsTable(resultsModel);
    resultsTable.setName(HTTP_MESSAGE_CONTAINER_NAME);
    resultsTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent evt) {
            if (!evt.getValueIsAdjusting()) {
                SearchResult searchResult = resultsTable.getSelectedSearchResult();
                if (searchResult == null) {
                    return;
                }
                displayMessage(resultsTable.getSelectedSearchResult());
                // Get the focus back so that the arrow keys work
                resultsTable.requestFocusInWindow();
            }
        }
    });
    this.setLayout(new CardLayout());
    //this.setSize(474, 251);
    this.setName(Constant.messages.getString("search.panel.title"));
    // 'magnifying glass' icon
    this.setIcon(new ImageIcon(SearchPanel.class.getResource("/resource/icon/16/049.png")));
    this.add(getPanelCommand(), getPanelCommand().getName());
    this.setShowByDefault(true);
}
Also used : CardLayout(java.awt.CardLayout) ImageIcon(javax.swing.ImageIcon) ListSelectionEvent(javax.swing.event.ListSelectionEvent) ListSelectionListener(javax.swing.event.ListSelectionListener)

Example 23 with ListSelectionEvent

use of javax.swing.event.ListSelectionEvent in project otapij by FellowTraveler.

the class MainPage method initContractsTab.

private void initContractsTab() {
    Contract contract = new Contract();
    jTable_AssetList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        public void valueChanged(ListSelectionEvent e) {
            if (e.getValueIsAdjusting()) {
                return;
            }
            System.out.println("valueChanged:" + jTable_AssetList.getSelectedRow() + "e:" + e.getSource());
            if (jTable_AssetList.getSelectedRow() >= 0) {
                String assetID = (String) jTable_AssetList.getModel().getValueAt(jTable_AssetList.getSelectedRow(), 1);
                populateAssetContractDetails(assetID, new Contract().getRawAssetFileData(assetID));
            }
        }
    });
    jTable_ServerList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        public void valueChanged(ListSelectionEvent e) {
            if (e.getValueIsAdjusting()) {
                return;
            }
            System.out.println("valueChanged:" + jTable_ServerList.getSelectedRow() + "e:" + e.getSource());
            if (jTable_ServerList.getSelectedRow() >= 0) {
                String serverID = (String) jTable_ServerList.getModel().getValueAt(jTable_ServerList.getSelectedRow(), 1);
                populateServerContractDetails(serverID, new Contract().getRawServerFileData(serverID));
            }
        }
    });
    ((AssetContractTableModel) jTable_AssetList.getModel()).setValue(contract.loadAssetContract(), jTable_AssetList);
    ((ServerContractTableModel) jTable_ServerList.getModel()).setValue(contract.loadServerContract(), jTable_ServerList);
}
Also used : ListSelectionEvent(javax.swing.event.ListSelectionEvent) ServerContractTableModel(com.moneychanger.ui.model.ServerContractTableModel) Contract(com.moneychanger.core.Contract) AssetContractTableModel(com.moneychanger.ui.model.AssetContractTableModel) ListSelectionListener(javax.swing.event.ListSelectionListener)

Example 24 with ListSelectionEvent

use of javax.swing.event.ListSelectionEvent in project otapij by FellowTraveler.

the class MainPage method initNYMSTab.

private void initNYMSTab() {
    jTable_NymsList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        public void valueChanged(ListSelectionEvent e) {
            if (e.getValueIsAdjusting()) {
                return;
            }
            System.out.println("selectedRow:" + jTable_NymsList.getSelectedRow());
            if (jTable_NymsList.getSelectedRow() >= 0) {
                String nymID = (String) jTable_NymsList.getModel().getValueAt(jTable_NymsList.getSelectedRow(), 1);
                System.out.println("selected nymID:" + nymID);
                NYM nym = new NYM();
                nymBox = nym.loadNymBox(nymID);
                nymOutBox = nym.loadNymOutBox(nymID);
                System.out.println("loadNymBox loadNymOutBox data loaded");
                populateNYMDetails(nymID, nym.getRawFileData(nymID), nymBox, nymOutBox);
            }
        }
    });
    ((NYMTableModel) jTable_NymsList.getModel()).setValue(new NYM().loadNYM(), jTable_NymsList);
}
Also used : NYM(com.moneychanger.core.NYM) NYMTableModel(com.moneychanger.ui.model.NYMTableModel) ListSelectionEvent(javax.swing.event.ListSelectionEvent) ListSelectionListener(javax.swing.event.ListSelectionListener)

Example 25 with ListSelectionEvent

use of javax.swing.event.ListSelectionEvent in project otapij by FellowTraveler.

the class MainPage method initMarketsTab.

private void initMarketsTab() {
    jLabel25.setText("");
    jLabel46.setText("");
    jLabel30.setText("");
    jLabel27.setText("");
    jLabel39.setText("");
    jLabel32.setText("");
    jLabel40.setText("");
    jLabel41.setText("");
    jLabel59.setText("");
    jLabel60.setText("");
    jLabel61.setText("");
    MarketTableModel.removeCols(jTable13);
    MarketOffersTableModel.removeCols(jTable14);
    Helpers.populateComboWithoutAll(serverMap, jComboBox5);
    String serverID = "ALL";
    String nymID = "ALL";
    if (serverMap != null && serverMap.size() > 0 && jComboBox5.getSelectedIndex() > -1) {
        serverID = ((String[]) serverMap.get((Integer) jComboBox5.getSelectedIndex()))[1];
    }
    nymRegisteredMap = new NYM().loadRegisteredNYM(serverID);
    Helpers.populateComboWithoutAll(nymRegisteredMap, jComboBox6);
    jTable14.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        public void valueChanged(ListSelectionEvent e) {
            if (e.getValueIsAdjusting()) {
                return;
            }
            System.out.println("valueChanged Market List Action Listener :" + jTable14.getSelectedRow() + "e:" + e.getSource());
            // Get nym offer details
            nymOfferClick();
        }
    });
    jTable13.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        public void valueChanged(ListSelectionEvent e) {
            if (e.getValueIsAdjusting()) {
                return;
            }
            System.out.println("jTable13 valueChanged Market List Action Listener :" + jTable13.getSelectedRow() + "e:" + e.getSource());
            // Get market details
            marketListClick();
        }
    });
    if (nymRegisteredMap != null && nymRegisteredMap.size() > 0 && jComboBox6.getSelectedIndex() > -1) {
        nymID = ((String[]) nymRegisteredMap.get((Integer) jComboBox6.getSelectedIndex()))[1];
    }
    if (!"ALL".equalsIgnoreCase(nymID)) {
        Map nymTrades = Market.getNymTrades(serverID, nymID);
        if (nymTrades != null) {
            ((MarketTradesTableModel) jTable16.getModel()).setValue(nymTrades, jTable16);
        }
    }
}
Also used : NYM(com.moneychanger.core.NYM) ListSelectionEvent(javax.swing.event.ListSelectionEvent) MarketTradesTableModel(com.moneychanger.ui.model.MarketTradesTableModel) Map(java.util.Map) ListSelectionListener(javax.swing.event.ListSelectionListener)

Aggregations

ListSelectionEvent (javax.swing.event.ListSelectionEvent)110 ListSelectionListener (javax.swing.event.ListSelectionListener)101 ActionEvent (java.awt.event.ActionEvent)29 ActionListener (java.awt.event.ActionListener)23 JPanel (javax.swing.JPanel)22 JScrollPane (javax.swing.JScrollPane)22 MouseEvent (java.awt.event.MouseEvent)21 JButton (javax.swing.JButton)18 JBList (com.intellij.ui.components.JBList)16 BorderLayout (java.awt.BorderLayout)16 JLabel (javax.swing.JLabel)16 MouseAdapter (java.awt.event.MouseAdapter)11 NotNull (org.jetbrains.annotations.NotNull)11 FlowLayout (java.awt.FlowLayout)10 Insets (java.awt.Insets)10 ArrayList (java.util.ArrayList)9 List (java.util.List)9 Dimension (java.awt.Dimension)8 KeyAdapter (java.awt.event.KeyAdapter)8 KeyEvent (java.awt.event.KeyEvent)8