Example #1
0
  /**
   * Implements CallListener.incomingCallReceived. When a call is received creates a call panel and
   * adds it to the main tabbed pane and plays the ring phone sound to the user.
   */
  public void incomingCallReceived(CallEvent event) {
    Call sourceCall = event.getSourceCall();

    CallPanel callPanel = new CallPanel(this, sourceCall, GuiCallParticipantRecord.INCOMING_CALL);

    mainFrame.addCallPanel(callPanel);

    if (mainFrame.getState() == JFrame.ICONIFIED) mainFrame.setState(JFrame.NORMAL);

    if (!mainFrame.isVisible()) mainFrame.setVisible(true);

    mainFrame.toFront();

    this.callButton.setEnabled(true);
    this.hangupButton.setEnabled(true);

    NotificationManager.fireNotification(
        NotificationManager.INCOMING_CALL,
        null,
        "Incoming call recived from: " + sourceCall.getCallParticipants().next());

    activeCalls.put(sourceCall, callPanel);

    this.setCallPanelVisible(true);
  }
  private View(ViewControl control) {
    mControl = control;

    WebLookAndFeel.install();

    ToolTipManager.sharedInstance().setInitialDelay(200);

    mContactListView = new ContactListView(this, ContactList.getInstance());
    ContactList.getInstance().addObserver(mContactListView);
    mChatListView = new ChatListView(this, ChatList.getInstance());
    ChatList.getInstance().addObserver(mChatListView);

    // chat view
    mChatView = new ChatView(this);
    ChatList.getInstance().addObserver(mChatView);

    // content area
    mContent = new Content(this, mChatView);

    // search panel
    mSearchPanel = new SearchPanel(new Table[] {mContactListView, mChatListView}, mChatView);

    // status bar
    WebStatusBar statusBar = new WebStatusBar();
    mStatusBarLabel = new WebStatusLabel(" ");
    statusBar.add(mStatusBarLabel);

    // main frame
    mMainFrame =
        new MainFrame(this, mContactListView, mChatListView, mContent, mSearchPanel, statusBar);
    mMainFrame.setVisible(true);

    // tray
    mTrayManager = new TrayManager(this, mMainFrame);
    ChatList.getInstance().addObserver(mTrayManager);

    // hotkeys
    this.setHotkeys();

    // notifier
    mNotifier = new Notifier(this);

    this.statusChanged();
  }
  private void statusChanged() {
    Control.Status status = mControl.getCurrentStatus();
    switch (status) {
      case CONNECTING:
        mStatusBarLabel.setText(Tr.tr("Connecting..."));
        break;
      case CONNECTED:
        mChatView.setColor(Color.WHITE);
        mStatusBarLabel.setText(Tr.tr("Connected"));
        NotificationManager.hideAllNotifications();
        break;
      case DISCONNECTING:
        mStatusBarLabel.setText(Tr.tr("Disconnecting..."));
        break;
      case DISCONNECTED:
        mChatView.setColor(Color.LIGHT_GRAY);
        mStatusBarLabel.setText(Tr.tr("Not connected"));
        // if (mTrayIcon != null)
        //    trayIcon.setImage(updatedImage);
        break;
      case SHUTTING_DOWN:
        mMainFrame.save();
        mChatListView.save();
        mTrayManager.removeTray();
        mMainFrame.setVisible(false);
        mMainFrame.dispose();
        break;
      case FAILED:
        mStatusBarLabel.setText(Tr.tr("Connecting failed"));
        break;
      case ERROR:
        mChatView.setColor(Color.lightGray);
        mStatusBarLabel.setText(Tr.tr("Connection error"));
        break;
    }

    mMainFrame.onStatusChanged(status);
  }
 public static void main(String[] args) {
   MainFrame dialog = new MainFrame();
   dialog.pack();
   dialog.setVisible(true);
 }
Example #5
0
 /** @param args */
 public static void main(String[] args) {
   // TODO Auto-generated method stub
   MainFrame mFrm = new MainFrame();
   mFrm.setVisible(true);
 }
 public static void main(String[] arg) {
   final MainFrame frame = new MainFrame();
   frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
   frame.setVisible(true);
 }