diff --git a/app-core/src/main/java/com/mercury/platform/shared/ConfigManager.java b/app-core/src/main/java/com/mercury/platform/shared/ConfigManager.java index 7ebc1ed5..30cb846f 100644 --- a/app-core/src/main/java/com/mercury/platform/shared/ConfigManager.java +++ b/app-core/src/main/java/com/mercury/platform/shared/ConfigManager.java @@ -83,7 +83,7 @@ public ConfigManager() { defaultAppSettings.put("flowDirection","DOWNWARDS"); defaultAppSettings.put("tradeMode","DEFAULT"); defaultAppSettings.put("limitMsgCount",3); - defaultAppSettings.put("expandedMsgCount",0); + defaultAppSettings.put("expandedMsgCount",2); defaultAppSettings.put("itemsGridEnable",true); defaultAppSettings.put("checkUpdateOnStartUp",true); defaultAppSettings.put("dismissAfterKick",false); diff --git a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/MessagePanel.java b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/MessagePanel.java index 4ce42ca4..ef2852bc 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/MessagePanel.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/MessagePanel.java @@ -71,7 +71,7 @@ public MessagePanel(Message message, ComponentFrame owner, MessagePanelStyle sty BorderFactory.createLineBorder(AppThemeColor.BORDER, 1))); this.messagePanel = getFormattedMessagePanel(); - this.customButtonsPanel = getButtonsPanel(whisper); + this.customButtonsPanel = getButtonsPanel(); init(); initHandlers(); setMaximumSize(new Dimension(Integer.MAX_VALUE,getPreferredSize().height)); @@ -124,10 +124,47 @@ private JPanel getFormattedMessagePanel(){ JPanel tradePanel = new JPanel(new BorderLayout()); tradePanel.setBackground(AppThemeColor.TRANSPARENT); - tradePanel.setBorder(BorderFactory.createEmptyBorder(-11,0,-11,0)); + tradePanel.setBorder(BorderFactory.createEmptyBorder(-11,2,-11,0)); if(message instanceof ItemMessage) { - JLabel itemLabel = componentsFactory.getTextLabel(FontStyle.BOLD, AppThemeColor.TEXT_IMPORTANT, TextAlignment.CENTER, 16f, ((ItemMessage)message).getItemName()); - tradePanel.add(itemLabel,BorderLayout.CENTER); + JButton itemButton = componentsFactory.getButton(((ItemMessage) message).getItemName()); + itemButton.setForeground(AppThemeColor.TEXT_IMPORTANT); + itemButton.setFont(componentsFactory.getFont(FontStyle.BOLD).deriveFont(16f)); + itemButton.setBackground(AppThemeColor.TRANSPARENT); + itemButton.setBorder(BorderFactory.createEmptyBorder(0,4,0,2)); + itemButton.setHorizontalAlignment(SwingConstants.LEFT); + itemButton.setContentAreaFilled(false); + itemButton.setRolloverEnabled(false); + itemButton.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + if(message instanceof ItemMessage) { + copyItemNameToClipboard(((ItemMessage) message).getItemName()); + if (((ItemMessage) message).getTabInfo() != null) { + EventRouter.INSTANCE.fireEvent(new ShowItemMeshEvent(message.getWhisperNickname(), ((ItemMessage) message).getTabInfo())); + } + } + } + + @Override + public void mouseReleased(MouseEvent e) { + owner.repaint(); + } + + @Override + public void mouseEntered(MouseEvent e) { + itemButton.setBorder(new CompoundBorder( + BorderFactory.createMatteBorder(0,1,0,1,AppThemeColor.BORDER), + BorderFactory.createEmptyBorder(0,3,0,1))); + owner.repaint(); + } + + @Override + public void mouseExited(MouseEvent e) { + itemButton.setBorder(BorderFactory.createEmptyBorder(0,4,0,2)); + owner.repaint(); + } + }); + tradePanel.add(itemButton,BorderLayout.CENTER); }else if(message instanceof CurrencyMessage){ CurrencyMessage message = (CurrencyMessage) this.message; JPanel curCountPanel = new JPanel(); @@ -214,13 +251,7 @@ private JPanel getWhisperPanel(){ inviteButton.addActionListener(e -> { EventRouter.INSTANCE.fireEvent(new ChatCommandEvent("/invite " + whisper)); if(message instanceof ItemMessage) { - Timer timer = new Timer(30, action -> { - StringSelection selection = new StringSelection(((ItemMessage) message).getItemName()); - Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); - clipboard.setContents(selection, null); - }); - timer.setRepeats(false); - timer.start(); + copyItemNameToClipboard(((ItemMessage) message).getItemName()); if (((ItemMessage) message).getTabInfo() != null) { EventRouter.INSTANCE.fireEvent(new ShowItemMeshEvent(message.getWhisperNickname(), ((ItemMessage) message).getTabInfo())); } @@ -379,7 +410,7 @@ public void setStyle(MessagePanelStyle style) { public MessagePanelStyle getStyle() { return style; } - private JPanel getButtonsPanel(String whisper){ + private JPanel getButtonsPanel(){ JPanel panel = new JPanel(new FlowLayout()); panel.setBackground(AppThemeColor.TRANSPARENT); initResponseButtons(panel); @@ -423,15 +454,23 @@ private void initResponseButtons(JPanel panel){ button.addActionListener(e -> { EventRouter.INSTANCE.fireEvent(new ChatCommandEvent("@" + whisper + " " + buttonConfig.getResponseText())); if(buttonConfig.isClose() && !style.equals(MessagePanelStyle.SP_MODE)){ - try{ - Thread.sleep(50); + Timer timer = new Timer(30, action -> { EventRouter.INSTANCE.fireEvent(new CloseMessagePanelEvent(MessagePanel.this, message)); - }catch (InterruptedException ex){ - - } + }); + timer.setRepeats(false); + timer.start(); } }); panel.add(button); }); } + private void copyItemNameToClipboard(String itemName){ + Timer timer = new Timer(30, action -> { + StringSelection selection = new StringSelection(itemName); + Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); + clipboard.setContents(selection, null); + }); + timer.setRepeats(false); + timer.start(); + } } diff --git a/app-ui/src/main/java/com/mercury/platform/ui/frame/impl/ItemsGridFrame.java b/app-ui/src/main/java/com/mercury/platform/ui/frame/impl/ItemsGridFrame.java index 0a94209f..451f5da9 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/frame/impl/ItemsGridFrame.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/frame/impl/ItemsGridFrame.java @@ -213,8 +213,8 @@ protected JPanel panelWhenMove() { configManager.setItemsGridEnable(true); repaint(); },configManager.isItemsGridEnable()); - JButton hideButton = componentsFactory.getIconButton("app/close.png", 12, AppThemeColor.FRAME_ALPHA, ""); - hideButton.setBorder(BorderFactory.createEmptyBorder(2,0,0,2)); + JButton hideButton = componentsFactory.getBorderedButton("Save"); + hideButton.setPreferredSize(new Dimension(90,24)); hideButton.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { @@ -249,7 +249,6 @@ public void mousePressed(MouseEvent e) { itemsMesh.setBackground(AppThemeColor.FRAME_ALPHA); panel.add(itemsMesh,BorderLayout.CENTER); setUpResizePanels(panel); -// panel.setSize(this.getSize()); return panel; } @@ -259,36 +258,15 @@ private void setUpResizePanels(JPanel root){ rightPanel.setBackground(AppThemeColor.FRAME); rightPanel.add(rightArrow,BorderLayout.CENTER); - rightPanel.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent e) { - rightPanel.setBackground(AppThemeColor.TEXT_DISABLE); - } - - @Override - public void mouseReleased(MouseEvent e) { - rightPanel.setBackground(AppThemeColor.FRAME); - } - }); + rightPanel.addMouseListener(new ArrowMouseListener(rightPanel,new Cursor(Cursor.E_RESIZE_CURSOR))); rightPanel.addMouseMotionListener(new ResizeByWidthMouseMotionListener()); - JLabel downArrow = componentsFactory.getIconLabel("app/expand-mp.png",16); //todo JPanel downPanel = componentsFactory.getTransparentPanel(new FlowLayout(FlowLayout.CENTER)); downPanel.setBorder(BorderFactory.createEmptyBorder(-10,0,0,0)); downPanel.setBackground(AppThemeColor.FRAME); downPanel.add(downArrow); - downPanel.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent e) { - downPanel.setBackground(AppThemeColor.TEXT_DISABLE); - } - - @Override - public void mouseReleased(MouseEvent e) { - downPanel.setBackground(AppThemeColor.FRAME); - } - }); + downPanel.addMouseListener(new ArrowMouseListener(downPanel, new Cursor(Cursor.N_RESIZE_CURSOR))); downPanel.addMouseMotionListener(new ResizeByHeightMouseMotionListener()); root.add(rightPanel,BorderLayout.LINE_END); @@ -320,4 +298,33 @@ public void mouseDragged(MouseEvent e) { configManager.saveFrameSize(ItemsGridFrame.class.getSimpleName(),getSize()); } } + private class ArrowMouseListener extends MouseAdapter { + private JPanel panel; + private Cursor cursor; + + private ArrowMouseListener(JPanel panel, Cursor cursor) { + this.panel = panel; + this.cursor = cursor; + } + + @Override + public void mousePressed(MouseEvent e) { + panel.setBackground(AppThemeColor.TEXT_DISABLE); + } + + @Override + public void mouseReleased(MouseEvent e) { + panel.setBackground(AppThemeColor.FRAME); + } + + @Override + public void mouseEntered(MouseEvent e) { + setCursor(cursor); + } + + @Override + public void mouseExited(MouseEvent e) { + setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); + } + } } diff --git a/app-ui/src/main/java/com/mercury/platform/ui/frame/impl/TaskBarFrame.java b/app-ui/src/main/java/com/mercury/platform/ui/frame/impl/TaskBarFrame.java index 78c4767d..adb5f808 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/frame/impl/TaskBarFrame.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/frame/impl/TaskBarFrame.java @@ -98,7 +98,7 @@ private JPanel getTaskBarPanel(){ true ); - JButton itemGrid = componentsFactory.getIconButton("app/item-grid-enable.png",24,AppThemeColor.FRAME_ALPHA, TooltipConstants.VISIBLE_MODE); + JButton itemGrid = componentsFactory.getIconButton("app/item-grid-enable.png",24,AppThemeColor.FRAME_ALPHA, TooltipConstants.ITEM_GRID); itemGrid.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { @@ -107,19 +107,6 @@ public void mousePressed(MouseEvent e) { } } }); -// componentsFactory.setUpToggleCallbacks(itemGrid, -// () -> { -// itemGrid.setIcon(componentsFactory.getIcon("app/item-grid-enable.png", 24)); -// TaskBarFrame.this.repaint(); -// FramesManager.INSTANCE.enableMovementDirect("ItemsGridFrame"); -// }, -// () -> { -// itemGrid.setIcon(componentsFactory.getIcon("app/item-grid-disable.png", 24)); -// TaskBarFrame.this.repaint(); -// FramesManager.INSTANCE.disableMovement("ItemsGridFrame"); -// }, -// true -// ); JButton toHideOut = componentsFactory.getIconButton("app/hideout.png",24,AppThemeColor.FRAME_ALPHA,TooltipConstants.HIDEOUT); toHideOut.addActionListener(action -> { diff --git a/app-ui/src/main/java/com/mercury/platform/ui/misc/TooltipConstants.java b/app-ui/src/main/java/com/mercury/platform/ui/misc/TooltipConstants.java index 8b711722..d62eee6d 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/misc/TooltipConstants.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/misc/TooltipConstants.java @@ -15,6 +15,7 @@ public class TooltipConstants { public static final String HISTORY = "History. Browse through all notifications you received previously."; public static final String SETUP_FRAMES_LOCATION = "Panel unlock. Unlock panels to reposition."; public static final String SETTINGS = "Settings"; + public static final String ITEM_GRID = "Items Grid settings"; public static final String EXIT = "Exit"; //Timer tooltips