1 package org.ozoneDB.adminGui.feature.server; 9 10 import org.ozoneDB.adminGui.widget.MessageBox; 11 import org.ozoneDB.adminGui.feature.FeaturePanel; 12 import org.ozoneDB.adminGui.res.Settings; 13 14 import java.awt.*; 15 import java.util.*; 16 import javax.swing.*; 17 18 21 public class ServerPanel extends FeaturePanel { 22 23 private Map components = new HashMap(); 24 private ServerInfoPanel serverInfoPanel; 25 26 public ServerPanel() { 27 this.setLayout(new FlowLayout()); 28 } 29 30 public void activateFeature() { 31 System.out.println("activating Server feature"); 32 try { 33 addComponents(); 34 } catch (Exception e) { 35 MessageBox.showError("Failed to find Admin object", e.toString()); 36 e.printStackTrace(); 37 } 38 } 39 40 protected void addComponents() { 41 42 this.removeAll(); 43 JSplitPane splitter = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); 44 splitter.setRightComponent(serverInfoPanel = new ServerInfoPanel()); 45 splitter.setLeftComponent(new ServerFeatureBar(serverInfoPanel)); 46 splitter.setOneTouchExpandable(false); 47 splitter.setDividerSize(3); 49 splitter.setEnabled(false); 50 splitter.setBackground(Settings.COLOR_COBALT); 51 add(splitter); 52 } 55 56 protected Properties getCriteria() { 57 Properties criteria = new Properties(); 58 59 Iterator it = components.keySet().iterator(); 60 while (it.hasNext()) { 61 String name = (String ) it.next(); 62 String value = ((JTextField) components.get(name)).getText(); 63 if (value.trim().length() > 0) { 64 criteria.setProperty(name, value); 65 } 66 } 67 return criteria; 68 } 69 } | Popular Tags |