Skip to content

Commit

Permalink
Changed currency ratio order
Browse files Browse the repository at this point in the history
  • Loading branch information
Morph21 committed Oct 26, 2020
1 parent b178528 commit e29b714
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private JPanel getFromPanel() {
this.data.getItems().forEach((item) -> {
JButton itemBtn = this.componentsFactory.getButton(item);
itemBtn.setBackground(AppThemeColor.FRAME);
itemBtn.setBorder(new EmptyBorder(4,4,4,4));
itemBtn.setBorder(new EmptyBorder(4, 4, 4, 4));
itemBtn.addActionListener(action -> {
MercuryStoreCore.findInStashTab.onNext(item);
});
Expand All @@ -74,7 +74,7 @@ private JPanel getFromPanel() {
itemsPanel.setLayout(new BoxLayout(itemsPanel, BoxLayout.Y_AXIS));
JButton itemBtn = this.componentsFactory.getButton(this.data.getCurrForSaleCount().intValue() + " " + this.data.getCurrForSaleTitle());
itemBtn.setBackground(AppThemeColor.FRAME);
itemBtn.setBorder(new EmptyBorder(4,4,4,4));
itemBtn.setBorder(new EmptyBorder(4, 4, 4, 4));
itemBtn.addActionListener(action -> {
MercuryStoreCore.findInStashTab.onNext(this.data.getCurrForSaleTitle());
});
Expand All @@ -92,15 +92,19 @@ private JPanel getFromPanel() {
private JPanel getCurrencyRatePanel() {
Double currForSaleCount = this.data.getCurrForSaleCount();
Double curCount = this.data.getCurCount();
double rate = curCount / currForSaleCount;
DecimalFormat decimalFormat = new DecimalFormat("#.####");
JPanel ratePanel = componentsFactory.getJPanel(new BorderLayout(), AppThemeColor.FRAME);
ratePanel.add(componentsFactory.
getTextLabel(FontStyle.BOLD, AppThemeColor.TEXT_DEFAULT, TextAlignment.CENTER, 18f, null, "("), BorderLayout.LINE_START);
ratePanel.add(componentsFactory.getTextLabel(FontStyle.BOLD,
AppThemeColor.TEXT_DEFAULT,
TextAlignment.CENTER,
18f,
null,
"(" + Ratio.getRatio(currForSaleCount, curCount)),
BorderLayout.LINE_START);

JLabel currencyLabel = componentsFactory.getIconLabel("currency/" + this.data.getCurrency() + ".png", 26);
currencyLabel.setFont(this.componentsFactory.getFont(FontStyle.BOLD, 18f));
currencyLabel.setForeground(AppThemeColor.TEXT_DEFAULT);
currencyLabel.setText(Ratio.getRatio(curCount, currForSaleCount) + ")");
currencyLabel.setText(")");
currencyLabel.setBorder(null);
ratePanel.add(currencyLabel, BorderLayout.CENTER);
return ratePanel;
Expand All @@ -114,7 +118,7 @@ protected JButton getStillInterestedButton() {
String responseText = "Hi, are you still interested in ";
String curForSaleCount = this.data.getCurrForSaleCount().toString();
responseText += curForSaleCount + " " + this.data.getCurrForSaleTitle() + " for " +
curCount + " " + this.data.getCurrency() + "?";
curCount + " " + this.data.getCurrency() + "?";
this.controller.performResponse(responseText);
});
return stillIntButton;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,19 @@ private JPanel getFromPanel() {
private JPanel getCurrencyRatePanel() {
Double currForSaleCount = this.data.getCurrForSaleCount();
Double curCount = this.data.getCurCount();
double rate = curCount / currForSaleCount;
DecimalFormat decimalFormat = new DecimalFormat("#.####");

JPanel ratePanel = componentsFactory.getJPanel(new BorderLayout(), AppThemeColor.FRAME);
ratePanel.add(componentsFactory.
getTextLabel(FontStyle.BOLD, AppThemeColor.TEXT_DEFAULT, TextAlignment.CENTER, 18f, null, "("), BorderLayout.LINE_START);
ratePanel.add(componentsFactory.getTextLabel(FontStyle.BOLD,
AppThemeColor.TEXT_DEFAULT,
TextAlignment.CENTER,
18f,
null,
"( " + Ratio.getRatio(currForSaleCount, curCount)),
BorderLayout.LINE_START);
JLabel currencyLabel = componentsFactory.getIconLabel("currency/" + this.data.getCurrency() + ".png", 26);
currencyLabel.setFont(this.componentsFactory.getFont(FontStyle.BOLD, 18f));
currencyLabel.setForeground(AppThemeColor.TEXT_DEFAULT);
currencyLabel.setText(Ratio.getRatio(currForSaleCount, currForSaleCount) + ")");
currencyLabel.setText(")");
currencyLabel.setBorder(null);
ratePanel.add(currencyLabel, BorderLayout.CENTER);
return ratePanel;
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e29b714

Please sign in to comment.