private void deleteAllShipLoads() { if (_track != null) { for (String loadName : _track.getShipLoadNames()) { _track.deleteShipLoadName(loadName); } } }
private void updateShipLoadNames() { log.debug("Update ship load names"); panelShipLoads.removeAll(); if (_track != null) { // set radio button shipLoadNameAll.setSelected(_track.getShipLoadOption().equals(Track.ALL_LOADS)); shipLoadNameInclude.setSelected(_track.getShipLoadOption().equals(Track.INCLUDE_LOADS)); shipLoadNameExclude.setSelected(_track.getShipLoadOption().equals(Track.EXCLUDE_LOADS)); pShipLoadControls.setVisible(!shipLoadNameAll.isSelected()); if (!shipLoadNameAll.isSelected()) { int x = 0; int y = 0; // vertical position in panel int numberOfLoads = getNumberOfCheckboxesPerLine() / 2 + 1; for (String loadName : _track.getShipLoadNames()) { JLabel load = new JLabel(); load.setText(loadName); addItemTop(panelShipLoads, load, x++, y); // limit the number of loads per line if (x > numberOfLoads) { y++; x = 0; } } revalidate(); } } else { shipLoadNameAll.setSelected(true); } panelShipLoads.repaint(); panelShipLoads.revalidate(); }
private void checkForErrors() { if (_track.getLoadOption().equals(Track.INCLUDE_LOADS) && _track.getLoadNames().length == 0 || _track.getShipLoadOption().equals(Track.INCLUDE_LOADS) && _track.getShipLoadNames().length == 0) { JOptionPane.showMessageDialog( this, Bundle.getMessage("ErrorNeedLoads"), Bundle.getMessage("ErrorNoLoads"), JOptionPane.ERROR_MESSAGE); } }