Skip to content

Commit

Permalink
Minor improvements before release.
Browse files Browse the repository at this point in the history
  • Loading branch information
Exslims committed Mar 28, 2017
1 parent 9b03617 commit 6a3c632
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package com.mercury.platform.core.utils.error;

import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class ErrorHandler {
private Logger logger = LogManager.getLogger(ErrorHandler.class.getSimpleName());
public ErrorHandler(){
Thread.setDefaultUncaughtExceptionHandler((thread, throwable) -> {
logger.error(throwable.fillInStackTrace());
logger.error(ExceptionUtils.getStackTrace(throwable));
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class ComponentsFactory{

public ComponentsFactory() {
loadFonts();
this.scale = ConfigManager.INSTANCE.getScaleData().get("other");
this.scale = 1.0f;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public void mouseClicked(MouseEvent e) {
"app/scale-settings.png",
24,
AppThemeColor.FRAME_ALPHA,
TooltipConstants.SETUP_FRAMES_LOCATION);
TooltipConstants.SCALE_SETTINGS);
scaleButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.mercury.platform.ui.components.panel.HorizontalScrollContainer;
import com.mercury.platform.ui.components.panel.grid.*;
import com.mercury.platform.shared.pojo.ScaleData;
import com.mercury.platform.ui.frame.ComponentFrame;
import com.mercury.platform.ui.misc.event.*;
import com.mercury.platform.shared.pojo.ItemMessage;
import com.mercury.platform.shared.pojo.Message;
Expand Down Expand Up @@ -117,7 +118,7 @@ protected JPanel getPanelForPINSettings() {
}
}
quadGridPanel.setBackground(AppThemeColor.FRAME_ALPHA);
JPanel labelPanel = componentsFactory.getTransparentPanel(new FlowLayout(FlowLayout.LEFT));
JPanel labelPanel = componentsFactory.getTransparentPanel(new BorderLayout());
JComboBox tabType = componentsFactory.getComboBox(new String[]{"1x1", "4x4"});
tabType.addItemListener(e -> {
if(e.getStateChange() == ItemEvent.SELECTED){
Expand All @@ -135,11 +136,12 @@ protected JPanel getPanelForPINSettings() {
}
}
});
tabType.setPreferredSize(new Dimension((int)(componentsFactory.getScale() * 70),tabType.getHeight()));

labelPanel.add(tabType);
labelPanel.add(tabType,BorderLayout.LINE_START);
Color titleColor = configManager.isItemsGridEnable()?AppThemeColor.TEXT_NICKNAME:AppThemeColor.TEXT_DISABLE;
JLabel titleLabel = componentsFactory.getTextLabel(FontStyle.BOLD, titleColor, TextAlignment.LEFTOP, 20f, "Align this grid(approximately)");
labelPanel.add(titleLabel);
labelPanel.add(titleLabel,BorderLayout.CENTER);
headerPanel.add(labelPanel, BorderLayout.CENTER);

String title = (configManager.isItemsGridEnable())?"Disable" : "Enable";
Expand Down Expand Up @@ -293,7 +295,6 @@ public void mouseDragged(MouseEvent e) {
JPanel source = (JPanel) e.getSource();
Point frameLocation = getLocation();
setSize(new Dimension(e.getLocationOnScreen().x - frameLocation.x + source.getWidth(), getHeight()));
configManager.saveFrameSize(ItemsGridFrame.class.getSimpleName(),getSize());
}
}
private class ResizeByHeightMouseMotionListener extends MouseMotionAdapter {
Expand All @@ -303,7 +304,6 @@ public void mouseDragged(MouseEvent e) {
JPanel source = (JPanel) e.getSource();
Point frameLocation = getLocation();
setSize(new Dimension(getWidth(),e.getLocationOnScreen().y - frameLocation.y + source.getHeight()));
configManager.saveFrameSize(ItemsGridFrame.class.getSimpleName(),getSize());
}
}
private class ArrowMouseListener extends MouseAdapter {
Expand All @@ -317,12 +317,18 @@ private ArrowMouseListener(JPanel panel, Cursor cursor) {

@Override
public void mousePressed(MouseEvent e) {
Dimension size = configManager.getMinimumFrameSize(ItemsGridFrame.this.getClass().getSimpleName());
ItemsGridFrame.this.setMinimumSize(size);
panel.setBackground(AppThemeColor.TEXT_DISABLE);
}

@Override
public void mouseReleased(MouseEvent e) {
Dimension size = ItemsGridFrame.this.getSize();
ItemsGridFrame.this.setMaximumSize(size);
ItemsGridFrame.this.setMinimumSize(size);
panel.setBackground(AppThemeColor.FRAME);
configManager.saveFrameSize(ItemsGridFrame.class.getSimpleName(),getSize());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ public void setState(LocationState state){
@Override
public void onLocationChange(Point location) {
super.onLocationChange(location);
prevConstraints.location = location;
locationWasChanged = true;
if(inMoveMode) {
prevConstraints.location = location;
locationWasChanged = true;
}
}

private JPanel setUpMoveListeners(JPanel panel){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public TaskBarFrame() {
protected void initialize() {
super.initialize();
createUI();
this.setMaximumSize(taskBarPanel.getPreferredSize());
collapseListener = new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent e) {
Expand Down Expand Up @@ -126,7 +127,8 @@ protected JPanel getPanelForPINSettings() {
JPanel labelPanel = componentsFactory.getTransparentPanel(new FlowLayout(FlowLayout.CENTER));
labelPanel.add(componentsFactory.getTextLabel(FontStyle.BOLD,AppThemeColor.TEXT_MESSAGE, TextAlignment.LEFTOP,20f,"Task Bar"));
panel.add(labelPanel);
panel.setPreferredSize(this.getSize());
// panel.setPreferredSize(new Dimension(taskBarPanel.getWidthOf(4),taskBarPanel.getHeight()));
// System.out.println(panel.getPreferredSize());
panel.setBackground(AppThemeColor.FRAME);
return panel;
}
Expand All @@ -147,7 +149,7 @@ protected void performScaling(Map<String,Float> scaleData) {
@Override
public void createUI() {
JPanel panel = componentsFactory.getTransparentPanel(new BorderLayout());
TaskBarPanel taskBarPanel = new TaskBarPanel(new MercuryTaskBarController(),componentsFactory);
taskBarPanel = new TaskBarPanel(new MercuryTaskBarController(),componentsFactory);
panel.add(taskBarPanel, BorderLayout.CENTER);
panel.setBackground(AppThemeColor.FRAME);
mainContainer = panel;
Expand Down Expand Up @@ -190,6 +192,8 @@ public void exit() {}
this.MIN_WIDTH = taskBarPanel.getWidthOf(4);
this.MAX_WIDTH = taskBarPanel.getPreferredSize().width;
this.setSize(new Dimension(MIN_WIDTH,this.getHeight()));
this.setMinimumSize(new Dimension(MIN_WIDTH,taskBarPanel.getHeight()));
this.setMaximumSize(new Dimension(MAX_WIDTH,taskBarPanel.getHeight()));
return panel;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public TooltipFrame() {

@Override
protected void initialize() {
this.componentsFactory.setScale(1.1f);
}
@Override
public void initHandlers() {
Expand All @@ -43,12 +44,12 @@ public void initHandlers() {
tooltipArea.setText(tooltip);
if(tooltip.toCharArray().length < 120){
if(tooltip.toCharArray().length < 85){
this.setPreferredSize(new Dimension(320, 50));
this.setPreferredSize(new Dimension(320, 55));
}else {
this.setPreferredSize(new Dimension(320, 70));
this.setPreferredSize(new Dimension(320, 75));
}
}else {
this.setPreferredSize(new Dimension(320, 110));
this.setPreferredSize(new Dimension(320, 145));
}
}
this.pack();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private void initContainer() {
tabbedPane.addTab("General",generalSettings);
tabbedPane.addTab("Notification panel",cbSettings);
tabbedPane.addTab("Task panel",taskBarSettings);
tabbedPane.addTab("Help",new HelpPanel());
// tabbedPane.addTab("Help",new HelpPanel());
tabbedPane.addTab("Support",new SupportPanel());
tabbedPane.addTab("About",new AboutPanel());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,16 @@ public void restoreDefaultLocation(){
}
private void createTrayIcon(){
PopupMenu trayMenu = new PopupMenu();
MenuItem item = new MenuItem("Exit");
item.addActionListener(e -> {
MenuItem exit = new MenuItem("Exit");
exit.addActionListener(e -> {
exit();
});
trayMenu.add(item);
MenuItem restore = new MenuItem("Restore default location");
restore.addActionListener(e -> {
FramesManager.INSTANCE.restoreDefaultLocation();
});
trayMenu.add(restore);
trayMenu.add(exit);

BufferedImage icon = null;
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package com.mercury.platform.ui.misc;

/**
* Created by Константин on 19.01.2017.
*/
public class TooltipConstants {
//Shared
public static final String CLOSE_BUTTON = "Close";
Expand All @@ -16,6 +13,7 @@ public class TooltipConstants {
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 SCALE_SETTINGS = "Components scale settings";
public static final String EXIT = "Exit";

//Timer tooltips
Expand Down

0 comments on commit 6a3c632

Please sign in to comment.