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);
}
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);
}
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);
}
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);
}
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);
}
}
}
Aggregations