SessionDropDown(IApplication app) { super(); _app = app; final SessionManager sessionManager = _app.getSessionManager(); final SessionDropDownModel model = new SessionDropDownModel( sessionManager); setModel(model); // Under JDK1.4 the first item in a JComboBox // is no longer automatically selected. if (getModel().getSize() > 0) { setSelectedIndex(0); } else { // Under JDK1.4 an empty JComboBox has an almost zero width. Dimension dm = getPreferredSize(); dm.width = 200; setPreferredSize(dm); // Dont enable the session drop down if it is empty setEnabled(false); } addActionListener(this); setMaximumSize(getPreferredSize()); sessionManager.addSessionListener(new MySessionListener(model, this)); }
/** * Add an <TT>ISession</TT> to this model. * * @param session <TT>ISession</TT> to be added. */ private void addSession(ISession session) { addElement(session); }
/** * Load from <TT>DataCache</TT>. */ private void load() { final ISession[] s = _sessionManager.getConnectedSessions(); if (s != null) { for (int i = 0; i < s.length; i++) { addSession(s[i]); } } }
SessionDropDown(IApplication app) { super(); _app = app; final SessionManager sessionManager = _app.getSessionManager(); final SessionDropDownModel model = new SessionDropDownModel( sessionManager); setModel(model); // Under JDK1.4 the first item in a JComboBox // is no longer automatically selected. if (getModel().getSize() > 0) { setSelectedIndex(0); } else { // Under JDK1.4 an empty JComboBox has an almost zero width. Dimension dm = getPreferredSize(); dm.width = 200; setPreferredSize(dm); // Dont enable the session drop down if it is empty setEnabled(false); } addActionListener(this); setMaximumSize(getPreferredSize()); sessionManager.addSessionListener(new MySessionListener(model, this)); }
/** * Load from <TT>DataCache</TT>. */ private void load() { final ISession[] s = _sessionManager.getConnectedSessions(); if (s != null) { for (int i = 0; i < s.length; i++) { addSession(s[i]); } } }
public void run() { _sessionDropDown._closing = true; _model.removeSession(session); if (_model.getSize() == 0) { _sessionDropDown.setEnabled(false); } _sessionDropDown._closing = false; } });
/** * Default ctor. Listen to the <TT>ISessioManager</TT> object for additions * and removals of aliases from the cache. */ public SessionDropDownModel(SessionManager sessionManager) { super(); _sessionManager = sessionManager; load(); }
/** * Remove an <TT>ISession</TT> from this model. * * @param session <TT>ISession</TT> to be removed. */ private void removeSession(ISession session) { removeElement(session); } }
/** * Remove an <TT>ISession</TT> from this model. * * @param session <TT>ISession</TT> to be removed. */ private void removeSession(ISession session) { removeElement(session); } }
/** * Add an <TT>ISession</TT> to this model. * * @param session <TT>ISession</TT> to be added. */ private void addSession(ISession session) { addElement(session); }
public void run() { _sessionDropDown._closing = true; _model.removeSession(session); if (_model.getSize() == 0) { _sessionDropDown.setEnabled(false); } _sessionDropDown._closing = false; } });
/** * Default ctor. Listen to the <TT>ISessioManager</TT> object for additions * and removals of aliases from the cache. */ public SessionDropDownModel(SessionManager sessionManager) { super(); _sessionManager = sessionManager; load(); }