/** Enable or disable the components in the compsThatNeedServer list */ private void enableComps() { synchronized (WIDGET_MUTEX) { boolean newEnabledState = (state == STATE_CONNECTED); for (int i = 0; i < compsThatNeedServer.size(); i++) { JComponent comp = (JComponent) compsThatNeedServer.get(i); if (comp.isEnabled() != newEnabledState) { GuiUtils.enableTree(comp, newEnabledState); } } } }
/** Enable or disable the GUI widgets based on what has been selected. */ protected void enableWidgets() { super.enableWidgets(); if (drivercbx != null) { drivercbx.setSelected(false); enableTimeWidgets(); } boolean connected = (getState() == STATE_CONNECTED); GuiUtils.enableTree(timesContainer, connected); // JDM absTimesPanel.setEnabled(getDoAbsoluteTimes() && connected); // getRelativeTimesChooser().setEnabled( !getDoAbsoluteTimes() // && connected); }
/** * Utility method to add components to dialog list * * @param comps list to add to * @param name name * @param cbx enable checkbox * @param comp the component */ private void addEditComponents( List comps, String name, final JCheckBox cbx, final JComponent comp) { cbx.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent e) { GuiUtils.enableTree(comp, cbx.isSelected()); } }); GuiUtils.enableTree(comp, cbx.isSelected()); comps.add(GuiUtils.top(GuiUtils.inset(cbx, 5))); comps.add(GuiUtils.top(GuiUtils.inset(GuiUtils.rLabel(name), new Insets(8, 0, 0, 0)))); JComponent right = GuiUtils.inset(comp, new Insets(3, 5, 0, 0)); // comps.add(GuiUtils.leftCenter(GuiUtils.top(GuiUtils.inset(cbx, // new Insets(2, 0, 0, 0))), GuiUtils.topLeft(right))); comps.add(GuiUtils.topLeft(right)); }
/** * enable/disable the components that can't be changed in autocompute * * @param enable true to enable */ private void enableAutoComps(boolean enable) { GuiUtils.enableTree(sizeComp, enable); // searchComp.setEnabled(enable); }
/** enable/disable the component based on the useDefaultCbx value */ public void checkEnable() { GuiUtils.enableTree(comp, !useDefaultCbx.isSelected()); if (!useDefaultCbx.isSelected()) { enableAutoComps(!useCompute); } }