diff --git a/src/net/java/sip/communicator/impl/gui/main/call/conference/BasicConferenceParticipantPanel.java b/src/net/java/sip/communicator/impl/gui/main/call/conference/BasicConferenceParticipantPanel.java index ed891555e..daf96d965 100644 --- a/src/net/java/sip/communicator/impl/gui/main/call/conference/BasicConferenceParticipantPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/conference/BasicConferenceParticipantPanel.java @@ -63,7 +63,9 @@ public class BasicConferenceParticipantPanel private final GridBagConstraints constraints = new GridBagConstraints(); - private boolean isConferenceFocusUI; + private boolean isFocusUI; + + private boolean isSingleFocusUI; /** * Creates an instance of ConferenceParticipantPanel. @@ -155,17 +157,61 @@ public void setParticipantImage(ImageIcon icon) imageLabel.setIcon(icon); } + /** + * Enables or disables the single conference focus user interface. + * @param isSingleFocusUI indicates if we should enable or disable the + * conference focus user interface. + */ + public void setSingleFocusUI(boolean isSingleFocusUI) + { + this.isSingleFocusUI = isSingleFocusUI; + + if (isSingleFocusUI) + { + this.setBorder(BorderFactory.createEmptyBorder(0,0,0,0)); + + this.remove(titleBar); + this.remove(peerDetailsPanel); + } + else + { + this.setBorder(BorderFactory.createEmptyBorder(2,2,2,2)); + + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.gridx = 0; + constraints.gridy = 0; + constraints.weightx = 1; + constraints.weighty = 0; + constraints.insets = new Insets(0, 0, 0, 0); + + this.add(titleBar, constraints); + + constraints.fill = GridBagConstraints.BOTH; + constraints.gridx = 0; + constraints.gridy = 1; + constraints.weightx = 1; + constraints.weighty = 0; + constraints.insets = new Insets(0, 0, 0, 0); + + this.add(peerDetailsPanel, constraints); + } + this.revalidate(); + this.repaint(); + } + /** * Enables or disables the conference focus user interface. - * @param isConferenceFocusUI indicates if we should enable or disable the + * @param isFocusUI indicates if we should enable or disable the * conference focus user interface. */ - public void setConferenceFocusUI(boolean isConferenceFocusUI) + public void setFocusUI(boolean isFocusUI) { - this.isConferenceFocusUI = isConferenceFocusUI; + this.isFocusUI = isFocusUI; - if (isConferenceFocusUI) + if (isFocusUI) + { this.remove(peerDetailsPanel); + } else { constraints.fill = GridBagConstraints.BOTH; @@ -177,6 +223,19 @@ public void setConferenceFocusUI(boolean isConferenceFocusUI) this.add(peerDetailsPanel, constraints); } + this.revalidate(); + this.repaint(); + } + + /** + * Returns true if the current interface corresponds to a + * single conference focus interface, otherwise returns false. + * @return true if the current interface corresponds to a + * single conference focus interface, otherwise returns false. + */ + public boolean isSingleFocusUI() + { + return isSingleFocusUI; } /** @@ -185,9 +244,9 @@ public void setConferenceFocusUI(boolean isConferenceFocusUI) * @return true if the current interface corresponds to a * conference focus interface, otherwise returns false. */ - public boolean isConferenceFocusUI() + public boolean isFocusUI() { - return isConferenceFocusUI; + return isFocusUI; } /** @@ -241,18 +300,22 @@ private void initTitleBar() public void paintComponent(Graphics g) { super.paintComponent(g); - g = g.create(); - try - { - AntialiasingManager.activateAntialiasing(g); - - g.setColor(bgColor); - g.fillRoundRect(0, 0, this.getWidth(), this.getHeight(), 20, 20); - } - finally + if (!isSingleFocusUI) { - g.dispose(); + g = g.create(); + + try + { + AntialiasingManager.activateAntialiasing(g); + + g.setColor(bgColor); + g.fillRoundRect(0, 0, this.getWidth(), this.getHeight(), 20, 20); + } + finally + { + g.dispose(); + } } } diff --git a/src/net/java/sip/communicator/impl/gui/main/call/conference/ConferenceCallPanel.java b/src/net/java/sip/communicator/impl/gui/main/call/conference/ConferenceCallPanel.java index a2dc26c0a..b10220888 100644 --- a/src/net/java/sip/communicator/impl/gui/main/call/conference/ConferenceCallPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/conference/ConferenceCallPanel.java @@ -150,6 +150,12 @@ public void addCallPeerPanel(CallPeer peer) // Map the call peer to its renderer. callPeerPanels.put(peer, confPeerPanel); + // Depending on call peer count enables or disables the + if (call.getCallPeerCount() > 1) + setSingleConferenceFocusUI(false); + else + setSingleConferenceFocusUI(true); + // Add the renderer component to this container. constraints.fill = GridBagConstraints.BOTH; constraints.gridx = 0; @@ -182,6 +188,14 @@ public void removeCallPeerPanel(CallPeer peer) { ConferencePeerPanel confPeerPanel = callPeerPanels.get(peer); + // Remove the corresponding renderer. + callPeerPanels.remove(peer); + + if (call.getCallPeerCount() > 1) + setSingleConferenceFocusUI(false); + else + setSingleConferenceFocusUI(true); + // Remove the renderer component. mainPanel.remove(confPeerPanel); @@ -196,4 +210,25 @@ public void removeCallPeerPanel(CallPeer peer) peer.removePropertyChangeListener(adapter); peer.removeCallPeerSecurityListener(adapter); } + + /** + * Sets the single conference focus interface. + * @param isSingleConferenceFocusUI indicates if the single conference + * focus interface should be enabled or disabled + */ + private void setSingleConferenceFocusUI(boolean isSingleConferenceFocusUI) + { + Enumeration callPeers = callPeerPanels.keys(); + + while (callPeers.hasMoreElements()) + { + CallPeer callPeer = callPeers.nextElement(); + + if (callPeer.isConferenceFocus()) + { + callPeerPanels.get(callPeer) + .setSingleFocusUI(isSingleConferenceFocusUI); + } + } + } } diff --git a/src/net/java/sip/communicator/impl/gui/main/call/conference/ConferencePeerPanel.java b/src/net/java/sip/communicator/impl/gui/main/call/conference/ConferencePeerPanel.java index ca955c3a8..fe183c189 100644 --- a/src/net/java/sip/communicator/impl/gui/main/call/conference/ConferencePeerPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/conference/ConferencePeerPanel.java @@ -114,6 +114,9 @@ public ConferencePeerPanel(CallDialog callDialog, CallPeer callPeer) this.setPeerName(callPeer.getDisplayName()); + if (callPeer.isConferenceFocus()) + setFocusUI(true); + // We initialize the status bar for call peers only. this.initStatusBar(callPeer); @@ -354,10 +357,6 @@ private void addConferenceMemberPanel(ConferenceMember member) // Map the conference member to the created member panel. conferenceMembersPanels.put(member, memberPanel); - // If we have members turn to the conference focus UI. - if (conferenceMembersPanels.size() > 0) - this.setConferenceFocusUI(true); - GridBagConstraints constraints = new GridBagConstraints(); // Add the member panel to this container @@ -366,7 +365,7 @@ private void addConferenceMemberPanel(ConferenceMember member) constraints.gridy = getComponentCount(); constraints.weightx = 1; constraints.weighty = 0; - constraints.insets = new Insets(5, 10, 5, 10); + constraints.insets = new Insets(10, 0, 0, 0); this.add(memberPanel, constraints); @@ -394,10 +393,6 @@ private void removeConferenceMemberPanel(ConferenceMember member) member.removePropertyChangeListener(memberPanel); } - // If we don't have more members turn to the normal peer UI. - if (conferenceMembersPanels.size() == 0) - this.setConferenceFocusUI(false); - this.revalidate(); this.repaint(); } @@ -486,12 +481,16 @@ public void conferenceMemberRemoved(CallPeerConferenceEvent conferenceEvent) } /** - * We're adding the up-coming members on conferenceMemberAdded, so for - * now we have nothing to do here. + * Enables or disables the conference focus UI depending on the change. * @param conferenceEvent the conference event */ public void conferenceFocusChanged(CallPeerConferenceEvent conferenceEvent) - {} + { + if (conferenceEvent.getSourceCallPeer().equals(callPeer)) + { + this.setFocusUI(callPeer.isConferenceFocus()); + } + } /** * Paints a special background for conference focus peers. @@ -500,7 +499,7 @@ public void conferenceFocusChanged(CallPeerConferenceEvent conferenceEvent) public void paintComponent(Graphics g) { super.paintComponent(g); - if (isConferenceFocusUI()) + if (isFocusUI() && !isSingleFocusUI()) { Graphics2D g2 = (Graphics2D) g.create();