use of org.micromanager.internal.utils.PropertyNameCellRenderer in project micro-manager by micro-manager.
the class ConfigDialog method initializePropertyTable.
public void initializePropertyTable() {
JScrollPane scrollPane = new JScrollPane();
scrollPane.setFont(new Font("Arial", Font.PLAIN, 10));
scrollPane.setBorder(new BevelBorder(BevelBorder.LOWERED));
int extraWidth = scrollPane.getVerticalScrollBar().getPreferredSize().width;
add(scrollPane, "flowy, span, growx, growy, push, width pref+" + extraWidth + "px");
table_ = new DaytimeNighttime.Table();
table_.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
table_.setAutoCreateColumnsFromModel(false);
scrollPane.setViewportView(table_);
table_.setModel(data_);
if (numColumns_ == 3) {
table_.addColumn(new TableColumn(0, 200, new PropertyNameCellRenderer(studio_), null));
table_.addColumn(new TableColumn(1, 75, new PropertyUsageCellRenderer(studio_), new PropertyUsageCellEditor()));
table_.addColumn(new TableColumn(2, 200, new PropertyValueCellRenderer(studio_), new PropertyValueCellEditor(true)));
} else if (numColumns_ == 2) {
table_.addColumn(new TableColumn(0, 200, new PropertyNameCellRenderer(studio_), null));
table_.addColumn(new TableColumn(1, 200, new PropertyValueCellRenderer(studio_), new PropertyValueCellEditor(false)));
}
}
use of org.micromanager.internal.utils.PropertyNameCellRenderer in project micro-manager by micro-manager.
the class DeviceSetupDlg method rebuildComTable.
public void rebuildComTable(String portName) {
if (portName == null) {
return;
}
portDev_ = model_.findSerialPort(portName);
if (portDev_ == null) {
return;
}
// load port if necessary
StrVector loadedPorts = core_.getLoadedDevicesOfType(DeviceType.SerialDevice);
Iterator<String> lp = loadedPorts.iterator();
boolean loaded = false;
while (lp.hasNext()) {
lp.next().compareTo(portName);
loaded = true;
}
if (!loaded) {
try {
core_.loadDevice(portDev_.getName(), portDev_.getLibrary(), portDev_.getAdapterName());
portDev_.loadDataFromHardware(core_);
} catch (Exception e) {
ReportingUtils.logError(e);
}
}
try {
System.out.println("rebuild " + portDev_.getPropertyValue("BaudRate"));
} catch (MMConfigFileException e1) {
ReportingUtils.logMessage("Property BaudRate is not defined");
}
ComPropTableModel tm = new ComPropTableModel(model_, portDev_);
comTable_.setModel(tm);
PropertyValueCellEditor propValueEditor = new PropertyValueCellEditor();
PropertyValueCellRenderer propValueRenderer = new PropertyValueCellRenderer(studio_);
PropertyNameCellRenderer propNameRenderer = new PropertyNameCellRenderer(studio_);
if (comTable_.getColumnCount() == 0) {
TableColumn column;
column = new TableColumn(0, 200, propNameRenderer, null);
comTable_.addColumn(column);
column = new TableColumn(1, 200, propNameRenderer, null);
comTable_.addColumn(column);
column = new TableColumn(2, 200, propValueRenderer, propValueEditor);
comTable_.addColumn(column);
}
tm.fireTableStructureChanged();
tm.fireTableDataChanged();
comTable_.repaint();
}
use of org.micromanager.internal.utils.PropertyNameCellRenderer in project micro-manager by micro-manager.
the class PropertyEditor method createTable.
private void createTable() {
data_ = new PropertyEditorTableData(studio_, "", "", 1, 2, getContentPane());
data_.setFlags(flags_);
data_.setShowUnused(true);
data_.setColumnNames("Property", "Value", "");
table_ = new DaytimeNighttime.Table();
table_.setAutoCreateColumnsFromModel(false);
table_.setModel(data_);
table_.addColumn(new TableColumn(0, 200, new PropertyNameCellRenderer(studio_), null));
table_.addColumn(new TableColumn(1, 200, new PropertyValueCellRenderer(studio_), new PropertyValueCellEditor(false)));
}
use of org.micromanager.internal.utils.PropertyNameCellRenderer in project micro-manager by micro-manager.
the class DeviceSetupDlg method rebuildPropTable.
private void rebuildPropTable() {
PropertyTableModel tm = new PropertyTableModel(model_, core_, device_, this);
propTable_.setModel(tm);
PropertyValueCellEditor propValueEditor = new PropertyValueCellEditor();
PropertyValueCellRenderer propValueRenderer = new PropertyValueCellRenderer(studio_);
PropertyNameCellRenderer propNameRenderer = new PropertyNameCellRenderer(studio_);
if (propTable_.getColumnCount() == 0) {
TableColumn column;
column = new TableColumn(0, 200, propNameRenderer, null);
propTable_.addColumn(column);
column = new TableColumn(1, 200, propNameRenderer, null);
propTable_.addColumn(column);
column = new TableColumn(2, 200, propValueRenderer, propValueEditor);
propTable_.addColumn(column);
}
tm.fireTableStructureChanged();
tm.fireTableDataChanged();
boolean any = false;
Device[] devices = model_.getDevices();
// build list of devices to look for on the serial ports
for (Device device : devices) {
for (int j = 0; j < device.getNumberOfProperties(); j++) {
PropertyItem p = device.getProperty(j);
if (p.name.compareTo(MMCoreJ.getG_Keyword_Port()) == 0 && core_.supportsDeviceDetection(device.getName())) {
any = true;
break;
}
}
if (any) {
break;
}
}
detectButton_.setEnabled(any);
propTable_.repaint();
propTable_.putClientProperty("terminateEditOnFocusLost", true);
tm.addTableModelListener(new TableModelListener() {
@Override
public void tableChanged(TableModelEvent e) {
rebuildPropTable();
}
});
}
Aggregations