Fix issue #606 (Moving contact to group, closes group).

cusax-fix
Damian Minkov 17 years ago
parent 51b7db768c
commit d526603597

@ -451,7 +451,8 @@ public void joinChatRoom( ChatRoomWrapper chatRoomWrapper,
GuiActivator.getUIService().getMainFrame(),
GuiActivator.getResources().getI18NString("service.gui.WARNING"),
GuiActivator.getResources().getI18NString(
"haveToBeConnectedToJoin"))
"service.gui.CHAT_ROOM_NOT_CONNECTED",
new String[]{chatRoomWrapper.getChatRoomName()}))
.showDialog();
return;

@ -81,6 +81,11 @@ public class ContactList
private final java.util.List<MetaContact> activeContacts
= new Vector<MetaContact>();
/**
* If set to true prevents groups to be closed or opened using the mouse.
*/
private boolean disableOpenClose = false;
/**
* Creates an instance of the <tt>ContactList</tt>.
*
@ -545,40 +550,46 @@ public void mouseClicked(MouseEvent e)
}
else if ((e.getModifiers() & InputEvent.BUTTON1_MASK) != 0)
{
if (listModel.isGroupClosed(group))
listModel.openGroup(group);
else
listModel.closeGroup(group);
if(!disableOpenClose)
{
if (listModel.isGroupClosed(group))
listModel.openGroup(group);
else
listModel.closeGroup(group);
}
fireContactListEvent( group,
ContactListEvent.GROUP_SELECTED,
e.getClickCount());
// get the component under the mouse
Component component = this.getHorizontalComponent(renderer,
translatedX);
if (component instanceof JPanel)
if(!disableOpenClose)
{
if (component.getName() != null
&& component.getName().equals("buttonsPanel"))
// get the component under the mouse
Component component = this.getHorizontalComponent(renderer,
translatedX);
if (component instanceof JPanel)
{
JPanel panel = (JPanel) component;
if (component.getName() != null
&& component.getName().equals("buttonsPanel"))
{
JPanel panel = (JPanel) component;
int internalX = translatedX
- (renderer.getWidth() - panel.getWidth() - 2);
int internalX = translatedX
- (renderer.getWidth() - panel.getWidth() - 2);
Component c = getHorizontalComponent(panel, internalX);
Component c = getHorizontalComponent(panel, internalX);
if (c instanceof JLabel)
{
if (listModel.isGroupClosed(group))
{
listModel.openGroup(group);
}
else
if (c instanceof JLabel)
{
listModel.closeGroup(group);
if (listModel.isGroupClosed(group))
{
listModel.openGroup(group);
}
else
{
listModel.closeGroup(group);
}
}
}
}
@ -900,6 +911,15 @@ private Component getHorizontalComponent(Container c, int x)
return null;
}
/**
* If set to true prevents groups to be closed or opened using the mouse.
* @param disableOpenClose the disableOpenClose to set
*/
public void setDisableOpenClose(boolean disableOpenClose)
{
this.disableOpenClose = disableOpenClose;
}
/**
* Runs the info window for the specified contact at the appropriate
* position.

@ -606,6 +606,7 @@ else if(itemName.startsWith(moveSubcontactPrefix))
itemName.substring(moveSubcontactPrefix.length()));
guiContactList.addExcContactListListener(this);
guiContactList.setDisableOpenClose(true);
// FIXME: set the special cursor while moving a subcontact
//guiContactList.setCursor(
@ -613,6 +614,15 @@ else if(itemName.startsWith(moveSubcontactPrefix))
this.moveDialog = new MoveSubcontactMessageDialog(mainFrame, this);
// Be sure we allow open/close groups in the contactlist if
// user cancels the action
this.moveDialog.addWindowListener(new WindowAdapter()
{
public void windowClosed(WindowEvent e)
{
guiContactList.setDisableOpenClose(false);
}
});
this.moveDialog.setVisible(true);
if(contact != null)
@ -798,6 +808,8 @@ else if(contactToMove != null)
{
new MoveSubcontactThread(sourceGroup).start();
}
guiContactList.setDisableOpenClose(false);
}
/**

Loading…
Cancel
Save