Search in sources :

Example 1 with ProcessorConfigCheckbox

use of com.willwinder.universalgcodesender.uielements.components.ProcessorConfigCheckbox in project Universal-G-Code-Sender by winder.

the class ControllerProcessorSettingsPanel method updateComponentsInternal.

/**
 *  ------------------------------
 *  |  [      controller      ]  |
 *  | [ ] front processor 1      |
 *  | [ ] front processor 2      |
 *  | [ ] end processor 1        |
 *  | [ ] end processor 2        |
 *
 *  | [+]                   [-]  |
 *  |  ________________________  |
 *  | | Enabled | Pattern      | |
 *  | |  [y]    | T\d+         | |
 *  | |  [n]    | M30          | |
 *  |  ------------------------  |
 *  |____________________________|
 */
@Override
protected void updateComponentsInternal(Settings s) {
    this.removeAll();
    initCustomRemoverTable(customRemoverTable);
    setLayout(new MigLayout("wrap 1, inset 5, fillx", "fill"));
    super.addIgnoreChanges(controllerConfigs);
    ConfigTuple ct = configFiles.get(controllerConfigs.getSelectedItem());
    ProcessorConfigGroups pcg = ct.loader.getProcessorConfigs();
    System.out.println(ct.file);
    for (ProcessorConfig pc : pcg.Front) {
        add(new ProcessorConfigCheckbox(pc, CommandProcessorLoader.getHelpForConfig(pc)));
    }
    for (ProcessorConfig pc : pcg.End) {
        add(new ProcessorConfigCheckbox(pc, CommandProcessorLoader.getHelpForConfig(pc)));
    }
    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new MigLayout("wrap 3", "grow, fill", ""));
    add(buttonPanel, add);
    add(buttonPanel, new JLabel());
    add(buttonPanel, remove);
    addIgnoreChanges(buttonPanel);
    DefaultTableModel model = (DefaultTableModel) this.customRemoverTable.getModel();
    for (ProcessorConfig pc : pcg.Custom) {
        Boolean enabled = pc.enabled;
        String pattern = "";
        if (pc.args != null && !pc.args.get("pattern").isJsonNull()) {
            pattern = pc.args.get("pattern").getAsString();
        }
        model.addRow(new Object[] { enabled, pattern });
    }
    addIgnoreChanges(new JScrollPane(customRemoverTable), "height 100");
    SwingUtilities.updateComponentTreeUI(this);
}
Also used : ProcessorConfigCheckbox(com.willwinder.universalgcodesender.uielements.components.ProcessorConfigCheckbox) MigLayout(net.miginfocom.swing.MigLayout) DefaultTableModel(javax.swing.table.DefaultTableModel) ProcessorConfigGroups(com.willwinder.universalgcodesender.utils.ControllerSettings.ProcessorConfigGroups) ConfigTuple(com.willwinder.universalgcodesender.utils.FirmwareUtils.ConfigTuple) ProcessorConfig(com.willwinder.universalgcodesender.utils.ControllerSettings.ProcessorConfig)

Aggregations

ProcessorConfigCheckbox (com.willwinder.universalgcodesender.uielements.components.ProcessorConfigCheckbox)1 ProcessorConfig (com.willwinder.universalgcodesender.utils.ControllerSettings.ProcessorConfig)1 ProcessorConfigGroups (com.willwinder.universalgcodesender.utils.ControllerSettings.ProcessorConfigGroups)1 ConfigTuple (com.willwinder.universalgcodesender.utils.FirmwareUtils.ConfigTuple)1 DefaultTableModel (javax.swing.table.DefaultTableModel)1 MigLayout (net.miginfocom.swing.MigLayout)1