/** * Handle the event * * @param ae The event */ public void actionPerformed(ActionEvent ae) { String cmd = ae.getActionCommand(); if (cmd.equals(CMD_CONNECT)) { doConnect(); } else { super.actionPerformed(ae); } }
/** 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); }
/** * Disable/enable any components that depend on the server. Try to update the status labelwith * what we know here. */ protected void updateStatus() { super.updateStatus(); // Put this in a thread to fix the enabled but shown // as disabled bug Misc.run( new Runnable() { public void run() { enableComps(); } }); if (state != STATE_CONNECTED) { clearTimesList(); } if (state == STATE_UNCONNECTED) { setStatus("Please connect to the server", "connect"); } else if (state == STATE_CONNECTING) { setStatus("Connecting to server: " + getServer()); } else if (getGoodToGo()) { setStatus( "Press \"" + CMD_LOAD + "\" to load the selected " + getDataName().toLowerCase(), "buttons"); } else if (getState() == STATE_CONNECTED) { if (usingStations() && (stationMap.getStations().size() > 0) && (getSelectedStations().size() == 0)) { if (stationMap.getMultipleSelect()) { setStatus("Please select one or more stations", "stations"); } else { setStatus("Please select a station", "stations"); } if (stationMap.getDeclutter()) { // setStatus( // getStatusLabel().getText(), "stations"); } } else if (!haveTimeSelected()) { setStatus(MSG_TIMES); } } setHaveData(getGoodToGo()); }