public static void main(String args[]) { ReplicatedHashMapDemo client=new ReplicatedHashMapDemo(); JChannel channel; String props="udp.xml"; try { for(int i=0; i < args.length; i++) { String arg=args[i]; if("-props".equals(arg)) { props=args[++i]; continue; } help(); return; } } catch(Exception e) { help(); return; } try { channel=new JChannel(props); channel.connect("ReplicatedHashMapDemo-Cluster"); client.start(channel); } catch(Throwable t) { t.printStackTrace(); } }
public ReplicatedHashMapDemo() { super(); addWindowListener(this); }
String stock_name=stock_field.getText(); if(stock_name == null || stock_name.isEmpty()) { showMsg("Key is empty !"); return; showMsg("Looking up value for " + stock_name + ':'); Float val=map.get(stock_name); if(val != null) { value_field.setText(val.toString()); clearMsg(); showMsg("Value for " + stock_name + " not found"); if(stock_name == null || stock_val == null || stock_name.isEmpty() || stock_val.isEmpty()) { showMsg("Both key and value have to be present to create a new entry"); return; showMsg("Key " + stock_name + " set to " + val); break; case "All": showAll(); break; case "Quit": setVisible(false); System.exit(0); case "Delete": removeItem(); break;
public void viewChange(View view, java.util.List<Address> new_mbrs, java.util.List<Address> old_mbrs) { System.out.println("** view: " + view); _setTitle(); }
private void showAll() { if(listbox.getItemCount() > 0) listbox.removeAll(); if(map.isEmpty()) return; clearMsg(); String key; Float val; for(Map.Entry<String,Float> entry: map.entrySet()) { key=entry.getKey(); val=entry.getValue(); if(val == null) continue; listbox.add(key + ": " + val.toString()); } }
String stock_name=stock_field.getText(); if(stock_name == null || stock_name.isEmpty()) { showMsg("Key is empty !"); return; showMsg("Looking up value for " + stock_name + ':'); Float val=map.get(stock_name); if(val != null) { value_field.setText(val.toString()); clearMsg(); showMsg("Value for " + stock_name + " not found"); if(stock_name == null || stock_val == null || stock_name.isEmpty() || stock_val.isEmpty()) { showMsg("Both key and value have to be present to create a new entry"); return; showMsg("Key " + stock_name + " set to " + val); break; case "All": showAll(); break; case "Quit": setVisible(false); System.exit(0); case "Delete": removeItem(); break;
public void viewChange(View view, java.util.List<Address> new_mbrs, java.util.List<Address> old_mbrs) { System.out.println("** view: " + view); _setTitle(); }
private void showAll() { if(listbox.getItemCount() > 0) listbox.removeAll(); if(map.isEmpty()) return; clearMsg(); String key; Float val; for(Map.Entry<String,Float> entry: map.entrySet()) { key=entry.getKey(); val=entry.getValue(); if(val == null) continue; listbox.add(key + ": " + val.toString()); } }
public static void main(String args[]) { ReplicatedHashMapDemo client=new ReplicatedHashMapDemo(); JChannel channel; String props="udp.xml"; try { for(int i=0; i < args.length; i++) { String arg=args[i]; if("-props".equals(arg)) { props=args[++i]; continue; } help(); return; } } catch(Exception e) { help(); return; } try { channel=new JChannel(props); channel.connect("ReplicatedHashMapDemo-Cluster"); client.start(channel); } catch(Throwable t) { t.printStackTrace(); } }
public ReplicatedHashMapDemo() { super(); addWindowListener(this); }