Search in sources :

Example 1 with PropertyNameCellRenderer

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)));
    }
}
Also used : JScrollPane(javax.swing.JScrollPane) PropertyValueCellRenderer(org.micromanager.internal.utils.PropertyValueCellRenderer) BevelBorder(javax.swing.border.BevelBorder) DaytimeNighttime(org.micromanager.internal.utils.DaytimeNighttime) PropertyValueCellEditor(org.micromanager.internal.utils.PropertyValueCellEditor) TableColumn(javax.swing.table.TableColumn) PropertyUsageCellRenderer(org.micromanager.internal.utils.PropertyUsageCellRenderer) Font(java.awt.Font) PropertyNameCellRenderer(org.micromanager.internal.utils.PropertyNameCellRenderer) PropertyUsageCellEditor(org.micromanager.internal.utils.PropertyUsageCellEditor)

Example 2 with PropertyNameCellRenderer

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();
}
Also used : PropertyValueCellRenderer(org.micromanager.internal.utils.PropertyValueCellRenderer) StrVector(mmcorej.StrVector) PropertyValueCellEditor(org.micromanager.internal.utils.PropertyValueCellEditor) TableColumn(javax.swing.table.TableColumn) IOException(java.io.IOException) PropertyNameCellRenderer(org.micromanager.internal.utils.PropertyNameCellRenderer)

Example 3 with PropertyNameCellRenderer

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)));
}
Also used : PropertyValueCellRenderer(org.micromanager.internal.utils.PropertyValueCellRenderer) DaytimeNighttime(org.micromanager.internal.utils.DaytimeNighttime) PropertyValueCellEditor(org.micromanager.internal.utils.PropertyValueCellEditor) TableColumn(javax.swing.table.TableColumn) PropertyNameCellRenderer(org.micromanager.internal.utils.PropertyNameCellRenderer)

Example 4 with PropertyNameCellRenderer

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();
        }
    });
}
Also used : PropertyValueCellRenderer(org.micromanager.internal.utils.PropertyValueCellRenderer) TableModelEvent(javax.swing.event.TableModelEvent) PropertyValueCellEditor(org.micromanager.internal.utils.PropertyValueCellEditor) TableColumn(javax.swing.table.TableColumn) PropertyItem(org.micromanager.internal.utils.PropertyItem) TableModelListener(javax.swing.event.TableModelListener) PropertyNameCellRenderer(org.micromanager.internal.utils.PropertyNameCellRenderer)

Aggregations

TableColumn (javax.swing.table.TableColumn)4 PropertyNameCellRenderer (org.micromanager.internal.utils.PropertyNameCellRenderer)4 PropertyValueCellEditor (org.micromanager.internal.utils.PropertyValueCellEditor)4 PropertyValueCellRenderer (org.micromanager.internal.utils.PropertyValueCellRenderer)4 DaytimeNighttime (org.micromanager.internal.utils.DaytimeNighttime)2 Font (java.awt.Font)1 IOException (java.io.IOException)1 JScrollPane (javax.swing.JScrollPane)1 BevelBorder (javax.swing.border.BevelBorder)1 TableModelEvent (javax.swing.event.TableModelEvent)1 TableModelListener (javax.swing.event.TableModelListener)1 StrVector (mmcorej.StrVector)1 PropertyItem (org.micromanager.internal.utils.PropertyItem)1 PropertyUsageCellEditor (org.micromanager.internal.utils.PropertyUsageCellEditor)1 PropertyUsageCellRenderer (org.micromanager.internal.utils.PropertyUsageCellRenderer)1