private void updateButtons() { int index = list.getSelectedIndex(); remove.setEnabled(index != -1 && listModel.getSize() != 0); moveUp.setEnabled(index > 0); moveDown.setEnabled(index != -1 && index != listModel.getSize() - 1); edit.setEnabled(index != -1); }
private UniProfile isSameProfile(String name) { int size = model.getSize(); for (int i = 0; i < size; i++) { UniProfile aProfile = (UniProfile) model.getElementAt(i); if (aProfile.toString().equals(name)) return aProfile; } return null; }
/** * Returns the rowCount attribute of the BPMsList object * * @return The rowCount value */ public int getRowCount() { return listModel.getSize(); }
public void clientJoined(Message.ClientJoinMsg m) { Iterator i = clients.iterator(); while (i.hasNext()) { EditorClient ec = (EditorClient) i.next(); if (ec.isPresent()) { if (m.getName().equals(ec.getName())) { sendClientReject(m.getKeyValue(), Message.ClientRejectMsg.REASON_NAME); return; } if (m.getColorCode() == ec.getColorCode()) { sendClientReject(m.getKeyValue(), Message.ClientRejectMsg.REASON_COLOR); return; } } } // clientAccepted // mach... added ClientIPaddress + added server to EditorClient const EditorClient newClient = new EditorClient( this, nextClientId, m.getName(), m.getColorCode(), m.getKeyValue(), m.getClientIPaddress()); if (EditorServer_Debug) System.out.println( ">>> In EditorServer.clientJoined : client NAME is : *" + m.getName() + "* IPAddress : is : *" + m.getClientIPaddress() + "*"); clients.add(newClient); nextClientId++; clientsPanel.updateClientList(); // here... match Audio & Text client // iterate through list of audio client String audioClientIP = ""; int offset = -1; if (isAudioOptionSelected) { if (EditorServer_Debug) System.out.println("\n>>>In Client Accepted !!!"); for (int n = 0; n < plistModel.getSize(); n++) { audioClientIP = (plistModel.getElementAt(n)).toString(); offset = audioClientIP.indexOf('@'); audioClientIP = audioClientIP.substring(offset + 1); if (audioClientIP.equals(m.getClientIPaddress())) { System.out.println("MATCH found!!!" + m.getName() + "<>" + audioClientIP); // change ... plistModel.set(n, m.getName()); } } } // endif isAudioOptionSelected try { clientChannel.sendToOthers(client, new Data(newClient.getMessage())); sendDocumentState(nextClientId - 1); sendHighlightTypes(); sendHighlights(); } catch (Exception e) { System.err.println("EditorServer: clientJoined: error sending msg"); if (EditorServer_Debug) e.printStackTrace(); } }