use of javax.swing.event.ListSelectionEvent in project otapij by FellowTraveler.
the class AddressBookDialog method initValues.
private void initValues() {
ContactTableModel.removeCols(jTable5);
switch(mode) {
case 1:
{
jRadioButton1.setSelected(true);
((ContactDetailsTableModel) jTable6.getModel()).setColumnNames(new String[] { "Account List" });
System.out.println("In case1");
}
break;
case 2:
{
jRadioButton2.setSelected(true);
((ContactDetailsTableModel) jTable6.getModel()).setColumnNames(new String[] { "Nym List" });
}
break;
case 3:
break;
default:
break;
}
((ContactTableModel) jTable5.getModel()).setValue(AddressBookHelper.getContactList());
jPanel3.setLayout(new CardLayout());
jPanel3.add(new BlankPanel(), "BlankPanel");
jPanel3.add(new ContactNymPanel(), "ContactNymPanel");
jPanel3.add(new ContactAcctPanel(), "ContactAcctPanel");
jTable6.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting()) {
return;
}
if (jTable6.getSelectedRow() >= 0) {
CardLayout cardLayout = (CardLayout) jPanel3.getLayout();
if (mode == 1) {
cardLayout.show(jPanel3, "ContactAcctPanel");
contactDetails = AddressBookHelper.getContactDetails(contactID, mode);
if (contactDetails != null) {
ContactAcctPanel.setValues(jTable6.getSelectedRow(), contactID);
ContactAcctPanel.populateDetails(AddressBookHelper.getContactAccDetails(contactDetails.getContact(), jTable6.getSelectedRow()));
}
// Set details panel here
} else if (mode == 2) {
cardLayout.show(jPanel3, "ContactNymPanel");
contactDetails = AddressBookHelper.getContactDetails(contactID, mode);
if (contactDetails != null) {
ContactNymPanel.setValues(jTable6.getSelectedRow(), contactID);
ContactNymPanel.populateDetails(AddressBookHelper.getContactNymDetails(contactDetails.getContact(), jTable6.getSelectedRow()));
}
} else {
cardLayout.show(jPanel3, "BlankPanel");
}
}
}
});
jTable5.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting()) {
return;
}
if (jTable5.getSelectedRow() >= 0) {
if (!jRadioButton1.isSelected() && !jRadioButton2.isSelected()) {
JOptionPane.showMessageDialog(null, "Please select mode", "Mode Error", JOptionPane.ERROR_MESSAGE);
return;
}
if (jRadioButton2.isSelected()) {
jButton2.setEnabled(false);
jButton3.setEnabled(true);
((ContactDetailsTableModel) jTable6.getModel()).setColumnNames(new String[] { "Nym List" });
mode = 2;
} else if (jRadioButton1.isSelected()) {
jButton2.setEnabled(true);
jButton3.setEnabled(false);
((ContactDetailsTableModel) jTable6.getModel()).setColumnNames(new String[] { "Account List" });
mode = 1;
}
contactID = (String) jTable5.getModel().getValueAt(jTable5.getSelectedRow(), 1);
ContactDetails contactDetails = AddressBookHelper.getContactDetails(contactID, mode);
populateContactDetails(contactDetails, mode);
}
}
});
}
use of javax.swing.event.ListSelectionEvent in project otapij by FellowTraveler.
the class MainPage method initBasketsTab.
private void initBasketsTab() {
Helpers.populateComboWithoutAll(serverMap, jComboBox7);
BasketTableModel.removeCols(jTable19);
jLabel62.setText("");
String currentServerID = "ALL";
if (serverMap != null && serverMap.size() > 0 && jComboBox7.getSelectedIndex() > -1) {
currentServerID = ((String[]) serverMap.get((Integer) jComboBox7.getSelectedIndex()))[1];
}
List baskets = Basket.getBasketList(currentServerID, null);
System.out.println("baskets:" + baskets);
System.out.println("baskets.size():" + baskets.size());
if (baskets != null && baskets.size() > 0 && !"Popup Dialog".equalsIgnoreCase(((String[]) baskets.get(0))[0])) {
((BasketTableModel) jTable19.getModel()).setValue(baskets);
} else if (baskets != null && !baskets.isEmpty()) {
// Show dialog asking for register
new RegisterNymOnServerDialog(this, true, currentServerID).setVisible(true);
if (!Utility.VerifyStringVal(Helpers.getNymID())) {
return;
}
String nymID = Helpers.getNymID();
((BasketTableModel) jTable19.getModel()).setValue(Basket.getBasketList(currentServerID, nymID));
}
jTable19.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting()) {
return;
}
System.out.println("jTable19 valueChanged Basket List Action Listener :" + jTable19.getSelectedRow() + "e:" + e.getSource());
basketClick();
}
});
}
use of javax.swing.event.ListSelectionEvent in project otapij by FellowTraveler.
the class MainPage method initPaymentsInitTab.
private void initPaymentsInitTab() {
PaymentInboxTableModel.removeCols(jTable20);
PaymentOutboxTableModel.removeCols(jTable21);
PaymentRecordboxTableModel.removeCols(jTable22);
setCustomWidthPayments();
NYMTableModel.removeCols(jTable6);
Helpers.populateComboWithoutAll(serverMap, jComboSrvPay);
((NYMTableModel) jTable6.getModel()).setValue(new NYM().loadNYM(), jTable6);
jTable6.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting()) {
return;
}
System.out.println("jTable6 valueChanged Payment List Action Listener :" + jTable6.getSelectedRow() + "e:" + e.getSource());
try {
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
paymentClick();
} catch (InterruptedException ex) {
Logger.getLogger(MainPage.class.getName()).log(Level.SEVERE, null, ex);
} finally {
setCursor(Cursor.getDefaultCursor());
}
}
});
}
use of javax.swing.event.ListSelectionEvent in project android by JetBrains.
the class ConfigureAvdOptionsStep method bindComponents.
private void bindComponents() {
myBindings.bindTwoWay(new TextProperty(myAvdDisplayName), getModel().avdDisplayName());
myBindings.bind(new TextProperty(myAvdId), new StringExpression(getModel().avdDisplayName()) {
@NotNull
@Override
public String get() {
String displayName = getModel().avdDisplayName().get();
getModel().avdId().set(StringUtil.isNotEmpty(displayName) ? AvdWizardUtils.cleanAvdName(connection, displayName, !displayName.equals(myOriginalName)) : "");
return getModel().avdId().get();
}
});
myBindings.bindTwoWay(new TextProperty(mySystemImageName), getModel().systemImageName());
myBindings.bindTwoWay(new TextProperty(mySystemImageDetails), getModel().systemImageDetails());
myBindings.bindTwoWay(new SelectedProperty(myQemu2CheckBox), getModel().useQemu2());
myBindings.bindTwoWay(new SelectedItemProperty<Integer>(myCoreCount), getModel().cpuCoreCount());
myBindings.bindTwoWay(myRamStorage.storage(), getModel().getAvdDeviceData().ramStorage());
myBindings.bindTwoWay(myVmHeapStorage.storage(), getModel().vmHeapStorage());
myBindings.bindTwoWay(myInternalStorage.storage(), getModel().internalStorage());
myBindings.bindTwoWay(myBuiltInSdCardStorage.storage(), new OptionalToValuePropertyAdapter<Storage>(getModel().sdCardStorage()));
myBindings.bindTwoWay(new SelectedItemProperty<GpuMode>(myHostGraphics), getModel().hostGpuMode());
myBindings.bindTwoWay(new SelectedProperty(myDeviceFrameCheckbox), getModel().hasDeviceFrame());
myBindings.bindTwoWay(new SelectedItemProperty<File>(mySkinComboBox.getComboBox()), getModel().getAvdDeviceData().customSkinFile());
myOrientationToggle.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
ScreenOrientation orientation = myOrientationToggle.getSelectedElement();
if (orientation == null) {
getModel().selectedAvdOrientation().set(ScreenOrientation.PORTRAIT);
} else {
getModel().selectedAvdOrientation().set(orientation);
}
}
});
FileChooserDescriptor fileChooserDescriptor = new FileChooserDescriptor(true, false, false, false, false, false) {
@Override
public boolean isFileVisible(VirtualFile file, boolean showHiddenFiles) {
return super.isFileVisible(file, true);
}
};
fileChooserDescriptor.setHideIgnored(false);
myExternalSdCard.addBrowseFolderListener("Select SD Card", "Select an existing SD card image", myProject, fileChooserDescriptor);
myBindings.bindTwoWay(new TextProperty(myExternalSdCard.getTextField()), getModel().externalSdCardLocation());
myBindings.bindTwoWay(new OptionalToValuePropertyAdapter<AvdCamera>(new SelectedItemProperty<AvdCamera>(myFrontCameraCombo)), getModel().selectedFrontCamera());
myBindings.bindTwoWay(new OptionalToValuePropertyAdapter<AvdCamera>(new SelectedItemProperty<AvdCamera>(myBackCameraCombo)), getModel().selectedBackCamera());
myBindings.bindTwoWay(new OptionalToValuePropertyAdapter<AvdNetworkSpeed>(new SelectedItemProperty<AvdNetworkSpeed>(mySpeedCombo)), getModel().selectedNetworkSpeed());
myBindings.bindTwoWay(new OptionalToValuePropertyAdapter<AvdNetworkLatency>(new SelectedItemProperty<AvdNetworkLatency>(myLatencyCombo)), getModel().selectedNetworkLatency());
myBindings.bindTwoWay(new SelectedProperty(myEnableComputerKeyboard), getModel().enableHardwareKeyboard());
myBindings.bindTwoWay(new SelectedProperty(myExternalRadioButton), getModel().useExternalSdCard());
myBindings.bindTwoWay(new SelectedProperty(myBuiltInRadioButton), getModel().useBuiltInSdCard());
myCheckSdForChanges = true;
}
use of javax.swing.event.ListSelectionEvent in project intellij-community by JetBrains.
the class ShowFeatureUsageStatisticsDialog method createCenterPanel.
protected JComponent createCenterPanel() {
Splitter splitter = new Splitter(true);
splitter.setShowDividerControls(true);
ProductivityFeaturesRegistry registry = ProductivityFeaturesRegistry.getInstance();
ArrayList<FeatureDescriptor> features = new ArrayList<>();
for (String id : registry.getFeatureIds()) {
features.add(registry.getFeatureDescriptor(id));
}
final TableView table = new TableView<>(new ListTableModel<>(COLUMNS, features, 0));
new TableViewSpeedSearch<FeatureDescriptor>(table) {
@Override
protected String getItemText(@NotNull FeatureDescriptor element) {
return element.getDisplayName();
}
};
JPanel controlsPanel = new JPanel(new VerticalFlowLayout());
Application app = ApplicationManager.getApplication();
long uptime = System.currentTimeMillis() - app.getStartTime();
long idleTime = app.getIdleTime();
final String uptimeS = FeatureStatisticsBundle.message("feature.statistics.application.uptime", ApplicationNamesInfo.getInstance().getFullProductName(), DateFormatUtil.formatDuration(uptime));
final String idleTimeS = FeatureStatisticsBundle.message("feature.statistics.application.idle.time", DateFormatUtil.formatDuration(idleTime));
String labelText = uptimeS + ", " + idleTimeS;
CompletionStatistics stats = ((FeatureUsageTrackerImpl) FeatureUsageTracker.getInstance()).getCompletionStatistics();
if (stats.dayCount > 0 && stats.sparedCharacters > 0) {
String total = formatCharacterCount(stats.sparedCharacters, true);
String perDay = formatCharacterCount(stats.sparedCharacters / stats.dayCount, false);
labelText += "<br>Code completion has saved you from typing at least " + total + " since " + DateFormatUtil.formatDate(stats.startDate) + " (~" + perDay + " per working day)";
}
CumulativeStatistics fstats = ((FeatureUsageTrackerImpl) FeatureUsageTracker.getInstance()).getFixesStats();
if (fstats.dayCount > 0 && fstats.invocations > 0) {
labelText += "<br>Quick fixes have saved you from " + fstats.invocations + " possible bugs since " + DateFormatUtil.formatDate(fstats.startDate) + " (~" + fstats.invocations / fstats.dayCount + " per working day)";
}
controlsPanel.add(new JLabel(XmlStringUtil.wrapInHtml(labelText)), BorderLayout.NORTH);
JPanel topPanel = new JPanel(new BorderLayout());
topPanel.add(controlsPanel, BorderLayout.NORTH);
topPanel.add(ScrollPaneFactory.createScrollPane(table), BorderLayout.CENTER);
splitter.setFirstComponent(topPanel);
final JEditorPane browser = TipUIUtil.createTipBrowser();
splitter.setSecondComponent(ScrollPaneFactory.createScrollPane(browser));
table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
Collection selection = table.getSelection();
try {
if (selection.isEmpty()) {
browser.read(new StringReader(""), null);
} else {
FeatureDescriptor feature = (FeatureDescriptor) selection.iterator().next();
TipUIUtil.openTipInBrowser(feature.getTipFileName(), browser, feature.getProvider());
}
} catch (IOException ex) {
LOG.info(ex);
}
}
});
return splitter;
}
Aggregations