Farming plugin panel redesign
Farming Plugin: - Redid the layout, coloring and positioning on the FarmingTrackerPanel to include my new MaterialTabs. - Added section divider labels in the special and tree tabs. - Hid the patch type indicator for some patches (explained in docs). - Added patch names for all instances of FarmingPatch (previously only a portion of them were written for a hack that is no longer necessary). - Created getName() method in PatchImplementation that returns the patch type's name in a formatted style (SPIRIT_TREE -> Spirit Tree). - Created a new tab for bushes. MaterialTabs: - Added onSelectEvent runnable to MaterialTab. - Added horizontal gap to the tabs. - Added getTab() method that returns a tab on a given index. CustomScrollBarUI: - Added functionality to allow the ui colors to be changed from an external call. (setters) ColorScheme: - Created color constants in the ColorScheme file for the progresss bar backgrounds and used them in the CropState enum.
This commit is contained in:
committed by
Tomas Slusny
parent
497d421737
commit
6d331ae5a1
@@ -27,15 +27,16 @@ package net.runelite.client.plugins.farmingtracker;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import net.runelite.client.ui.ColorScheme;
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Getter
|
@Getter
|
||||||
public enum CropState
|
public enum CropState
|
||||||
{
|
{
|
||||||
HARVESTABLE(Color.GREEN),
|
HARVESTABLE(ColorScheme.PROGRESS_COMPLETE_COLOR),
|
||||||
GROWING(Color.GREEN),
|
GROWING(ColorScheme.PROGRESS_COMPLETE_COLOR),
|
||||||
DISEASED(Color.ORANGE),
|
DISEASED(ColorScheme.PROGRESS_INPROGRESS_COLOR),
|
||||||
DEAD(Color.RED);
|
DEAD(ColorScheme.PROGRESS_ERROR_COLOR);
|
||||||
|
|
||||||
private final Color color;
|
private final Color color;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018 Abex
|
* Copyright (c) 2018 Abex
|
||||||
|
* Copyright (c) 2018, Psikoi <https://github.com/psikoi>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -24,13 +25,18 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.farmingtracker;
|
package net.runelite.client.plugins.farmingtracker;
|
||||||
|
|
||||||
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import javax.swing.GroupLayout;
|
import java.awt.GridLayout;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JProgressBar;
|
import javax.swing.border.EmptyBorder;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import net.runelite.client.ui.ColorScheme;
|
||||||
import net.runelite.client.ui.FontManager;
|
import net.runelite.client.ui.FontManager;
|
||||||
|
import net.runelite.client.ui.components.ThinProgressBar;
|
||||||
|
import net.runelite.client.ui.components.shadowlabel.JShadowedLabel;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
class FarmingPatchPanel extends JPanel
|
class FarmingPatchPanel extends JPanel
|
||||||
@@ -38,42 +44,69 @@ class FarmingPatchPanel extends JPanel
|
|||||||
private final FarmingPatch patch;
|
private final FarmingPatch patch;
|
||||||
private final JLabel icon = new JLabel();
|
private final JLabel icon = new JLabel();
|
||||||
private final JLabel estimate = new JLabel();
|
private final JLabel estimate = new JLabel();
|
||||||
private final JProgressBar progress = new JProgressBar();
|
private final ThinProgressBar progress = new ThinProgressBar();
|
||||||
|
|
||||||
FarmingPatchPanel(FarmingPatch patch)
|
FarmingPatchPanel(FarmingPatch patch)
|
||||||
{
|
{
|
||||||
this.patch = patch;
|
this.patch = patch;
|
||||||
|
|
||||||
GroupLayout layout = new GroupLayout(this);
|
setLayout(new BorderLayout());
|
||||||
this.setLayout(layout);
|
setOpaque(false);
|
||||||
|
setBorder(new EmptyBorder(7, 0, 0, 0));
|
||||||
|
|
||||||
|
JPanel topContainer = new JPanel();
|
||||||
|
topContainer.setBorder(new EmptyBorder(7, 7, 6, 0));
|
||||||
|
topContainer.setLayout(new BorderLayout());
|
||||||
|
topContainer.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||||
|
|
||||||
final JLabel location = new JLabel(patch.getRegion().getName() + " " + patch.getName());
|
|
||||||
location.setFont(FontManager.getRunescapeSmallFont());
|
|
||||||
icon.setMinimumSize(new Dimension(36, 32));
|
icon.setMinimumSize(new Dimension(36, 32));
|
||||||
|
|
||||||
layout.setVerticalGroup(layout.createSequentialGroup()
|
JPanel infoPanel = new JPanel();
|
||||||
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER)
|
infoPanel.setOpaque(false);
|
||||||
.addComponent(icon)
|
infoPanel.setLayout(new GridLayout(2, 1));
|
||||||
.addGroup(layout.createSequentialGroup()
|
infoPanel.setBorder(new EmptyBorder(4, 4, 4, 0));
|
||||||
.addGap(1)
|
|
||||||
.addComponent(location)
|
|
||||||
.addGap(1)
|
|
||||||
.addComponent(estimate)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.addComponent(progress, 8, 8, 8)
|
|
||||||
.addGap(4)
|
|
||||||
);
|
|
||||||
|
|
||||||
layout.setHorizontalGroup(layout.createParallelGroup()
|
final JLabel location = new JShadowedLabel(patch.getRegion().getName()
|
||||||
.addGroup(layout.createSequentialGroup()
|
+ (showFullTitle() ? " (" + patch.getName() + ")" : ""));
|
||||||
.addComponent(icon)
|
location.setFont(FontManager.getRunescapeSmallFont());
|
||||||
.addGroup(layout.createParallelGroup()
|
location.setForeground(Color.WHITE);
|
||||||
.addComponent(location)
|
|
||||||
.addComponent(estimate)
|
estimate.setFont(FontManager.getRunescapeSmallFont());
|
||||||
)
|
estimate.setForeground(Color.GRAY);
|
||||||
)
|
|
||||||
.addComponent(progress)
|
infoPanel.add(location);
|
||||||
);
|
infoPanel.add(estimate);
|
||||||
|
|
||||||
|
topContainer.add(icon, BorderLayout.WEST);
|
||||||
|
topContainer.add(infoPanel, BorderLayout.CENTER);
|
||||||
|
|
||||||
|
add(topContainer, BorderLayout.NORTH);
|
||||||
|
add(progress, BorderLayout.SOUTH);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This determines if the label should display location and type, ex:
|
||||||
|
* It makes sense to display:
|
||||||
|
* Catherby (North) <-- for allotment
|
||||||
|
* but not so much for herbs:
|
||||||
|
* Troll Stronghold
|
||||||
|
* as there are no other herb patches in that region.
|
||||||
|
*/
|
||||||
|
private boolean showFullTitle()
|
||||||
|
{
|
||||||
|
switch (patch.getImplementation())
|
||||||
|
{
|
||||||
|
case FLOWER:
|
||||||
|
case HOPS:
|
||||||
|
case BUSH:
|
||||||
|
case FRUIT_TREE:
|
||||||
|
case CALQUAT:
|
||||||
|
case SPIRIT_TREE:
|
||||||
|
case TREE:
|
||||||
|
case HERB:
|
||||||
|
return false;
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018 Abex
|
* Copyright (c) 2018 Abex
|
||||||
|
* Copyright (c) 2018, Psikoi <https://github.com/psikoi>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -29,6 +30,7 @@ import java.awt.Dimension;
|
|||||||
import java.awt.GridBagConstraints;
|
import java.awt.GridBagConstraints;
|
||||||
import java.awt.GridBagLayout;
|
import java.awt.GridBagLayout;
|
||||||
import java.awt.Image;
|
import java.awt.Image;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.OffsetDateTime;
|
import java.time.OffsetDateTime;
|
||||||
@@ -37,9 +39,10 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
import javax.swing.JTabbedPane;
|
import javax.swing.SwingConstants;
|
||||||
import javax.swing.border.EmptyBorder;
|
import javax.swing.border.EmptyBorder;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
@@ -47,7 +50,11 @@ import net.runelite.api.vars.Autoweed;
|
|||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.game.AsyncBufferedImage;
|
import net.runelite.client.game.AsyncBufferedImage;
|
||||||
import net.runelite.client.game.ItemManager;
|
import net.runelite.client.game.ItemManager;
|
||||||
|
import net.runelite.client.ui.ColorScheme;
|
||||||
|
import net.runelite.client.ui.FontManager;
|
||||||
import net.runelite.client.ui.PluginPanel;
|
import net.runelite.client.ui.PluginPanel;
|
||||||
|
import net.runelite.client.ui.components.materialtabs.MaterialTab;
|
||||||
|
import net.runelite.client.ui.components.materialtabs.MaterialTabGroup;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
class FarmingTrackerPanel extends PluginPanel
|
class FarmingTrackerPanel extends PluginPanel
|
||||||
@@ -61,6 +68,10 @@ class FarmingTrackerPanel extends PluginPanel
|
|||||||
|
|
||||||
private List<FarmingPatchPanel> patchPanels = new ArrayList<>();
|
private List<FarmingPatchPanel> patchPanels = new ArrayList<>();
|
||||||
|
|
||||||
|
/* This is the panel the tabs' respective panels will be displayed on. */
|
||||||
|
private final JPanel display = new JPanel();
|
||||||
|
private final MaterialTabGroup tabGroup = new MaterialTabGroup(display);
|
||||||
|
|
||||||
FarmingTrackerPanel(
|
FarmingTrackerPanel(
|
||||||
Client client,
|
Client client,
|
||||||
ItemManager itemManager,
|
ItemManager itemManager,
|
||||||
@@ -77,11 +88,19 @@ class FarmingTrackerPanel extends PluginPanel
|
|||||||
this.config = config;
|
this.config = config;
|
||||||
|
|
||||||
setLayout(new BorderLayout());
|
setLayout(new BorderLayout());
|
||||||
|
setBackground(ColorScheme.DARK_GRAY_COLOR);
|
||||||
|
|
||||||
|
display.setOpaque(false);
|
||||||
|
display.setBorder(new EmptyBorder(10, 10, 8, 10));
|
||||||
|
|
||||||
|
tabGroup.setBorder(new EmptyBorder(10, 1, 0, 0));
|
||||||
|
|
||||||
|
add(tabGroup, BorderLayout.NORTH);
|
||||||
|
add(display, BorderLayout.CENTER);
|
||||||
|
|
||||||
JTabbedPane tabs = new JTabbedPane();
|
|
||||||
farmingWorld.getTabs().forEach((tab, patches) ->
|
farmingWorld.getTabs().forEach((tab, patches) ->
|
||||||
{
|
{
|
||||||
JPanel panel = new JPanel(new GridBagLayout())
|
JPanel container = new JPanel(new GridBagLayout())
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public Dimension getPreferredSize()
|
public Dimension getPreferredSize()
|
||||||
@@ -89,7 +108,7 @@ class FarmingTrackerPanel extends PluginPanel
|
|||||||
return new Dimension(PluginPanel.PANEL_WIDTH, super.getPreferredSize().height);
|
return new Dimension(PluginPanel.PANEL_WIDTH, super.getPreferredSize().height);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
panel.setBorder(new EmptyBorder(2, 6, 6, 6));
|
container.setBackground(ColorScheme.DARK_GRAY_COLOR);
|
||||||
|
|
||||||
GridBagConstraints c = new GridBagConstraints();
|
GridBagConstraints c = new GridBagConstraints();
|
||||||
c.fill = GridBagConstraints.HORIZONTAL;
|
c.fill = GridBagConstraints.HORIZONTAL;
|
||||||
@@ -97,43 +116,77 @@ class FarmingTrackerPanel extends PluginPanel
|
|||||||
c.gridx = 0;
|
c.gridx = 0;
|
||||||
c.gridy = 0;
|
c.gridy = 0;
|
||||||
|
|
||||||
|
PatchImplementation lastImpl = null;
|
||||||
|
|
||||||
|
boolean first = true;
|
||||||
for (FarmingPatch patch : patches)
|
for (FarmingPatch patch : patches)
|
||||||
{
|
{
|
||||||
FarmingPatchPanel p = new FarmingPatchPanel(patch);
|
FarmingPatchPanel p = new FarmingPatchPanel(patch);
|
||||||
|
|
||||||
|
/* Show labels to subdivide tabs into sections */
|
||||||
|
if ((tab == Tab.SPECIAL
|
||||||
|
&& patch.getImplementation().ordinal() > 2
|
||||||
|
&& patch.getImplementation() != lastImpl)
|
||||||
|
|| (tab == Tab.TREE
|
||||||
|
&& patch.getImplementation().ordinal() > 9
|
||||||
|
&& patch.getImplementation() != lastImpl))
|
||||||
|
{
|
||||||
|
JLabel groupLabel = new JLabel(patch.getImplementation().getName());
|
||||||
|
groupLabel.setBorder(new EmptyBorder(15, 0, 0, 0));
|
||||||
|
groupLabel.setFont(FontManager.getRunescapeSmallFont());
|
||||||
|
|
||||||
|
container.add(groupLabel, c);
|
||||||
|
c.gridy++;
|
||||||
|
lastImpl = patch.getImplementation();
|
||||||
|
}
|
||||||
|
|
||||||
patchPanels.add(p);
|
patchPanels.add(p);
|
||||||
panel.add(p, c);
|
container.add(p, c);
|
||||||
c.gridy++;
|
c.gridy++;
|
||||||
|
|
||||||
|
/* This is a weird hack to remove the top border on the first tracker of every tab */
|
||||||
|
if (first)
|
||||||
|
{
|
||||||
|
p.setBorder(null);
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JPanel wrapped = new JPanel(new BorderLayout());
|
JPanel wrapped = new JPanel(new BorderLayout());
|
||||||
wrapped.add(panel, BorderLayout.NORTH);
|
wrapped.add(container, BorderLayout.NORTH);
|
||||||
|
wrapped.setBackground(ColorScheme.DARK_GRAY_COLOR);
|
||||||
|
|
||||||
JScrollPane scroller = new JScrollPane(wrapped);
|
JScrollPane scroller = new JScrollPane(wrapped);
|
||||||
scroller.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
|
scroller.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
|
||||||
scroller.getVerticalScrollBar().setUnitIncrement(16);
|
scroller.getVerticalScrollBar().setPreferredSize(new Dimension(16, 0));
|
||||||
|
scroller.getVerticalScrollBar().setBorder(new EmptyBorder(0, 9, 0, 0));
|
||||||
|
scroller.setBackground(ColorScheme.DARK_GRAY_COLOR);
|
||||||
|
|
||||||
|
MaterialTab materialTab = new MaterialTab("", tabGroup, scroller);
|
||||||
|
materialTab.setName(tab.getName());
|
||||||
|
|
||||||
AsyncBufferedImage icon = itemManager.getImage(tab.getItemID());
|
AsyncBufferedImage icon = itemManager.getImage(tab.getItemID());
|
||||||
tabs.addTab(null, null, scroller, tab.getName());
|
|
||||||
int idx = tabs.getTabCount() - 1;
|
|
||||||
Runnable resize = () ->
|
Runnable resize = () ->
|
||||||
{
|
{
|
||||||
tabs.setIconAt(idx, new ImageIcon(icon.getScaledInstance(24, 21, Image.SCALE_SMOOTH)));
|
BufferedImage subIcon = icon.getSubimage(0, 0, 32, 32);
|
||||||
|
materialTab.setIcon(new ImageIcon(subIcon.getScaledInstance(24, 24, Image.SCALE_SMOOTH)));
|
||||||
|
materialTab.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
|
materialTab.setVerticalAlignment(SwingConstants.CENTER);
|
||||||
|
materialTab.setOpaque(true);
|
||||||
|
materialTab.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||||
|
materialTab.setPreferredSize(new Dimension(30, 27));
|
||||||
};
|
};
|
||||||
icon.onChanged(resize);
|
icon.onChanged(resize);
|
||||||
resize.run();
|
resize.run();
|
||||||
|
|
||||||
|
materialTab.setOnSelectEvent(() -> config.setPatch(tab));
|
||||||
|
|
||||||
|
tabGroup.addTab(materialTab);
|
||||||
if (config.patch() == tab)
|
if (config.patch() == tab)
|
||||||
{
|
{
|
||||||
tabs.setSelectedComponent(scroller);
|
tabGroup.select(materialTab);
|
||||||
}
|
}
|
||||||
tabs.addChangeListener(e ->
|
|
||||||
{
|
|
||||||
if (tabs.getSelectedComponent() == scroller)
|
|
||||||
{
|
|
||||||
config.setPatch(tab);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
add(tabs, BorderLayout.CENTER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void update()
|
void update()
|
||||||
@@ -178,10 +231,11 @@ class FarmingTrackerPanel extends PluginPanel
|
|||||||
PatchState state = unixTime <= 0 ? null : patch.getImplementation().forVarbitValue(value);
|
PatchState state = unixTime <= 0 ? null : patch.getImplementation().forVarbitValue(value);
|
||||||
if (state == null)
|
if (state == null)
|
||||||
{
|
{
|
||||||
panel.getIcon().setIcon(null);
|
itemManager.getImage(Produce.WEEDS.getItemID()).addTo(panel.getIcon());
|
||||||
panel.getIcon().setToolTipText("Unknown state");
|
panel.getIcon().setToolTipText("Unknown state");
|
||||||
panel.getProgress().setMaximum(0);
|
panel.getProgress().setMaximumValue(0);
|
||||||
panel.getProgress().setValue(0);
|
panel.getProgress().setValue(0);
|
||||||
|
panel.getProgress().setVisible(false);
|
||||||
panel.getEstimate().setText("Unknown");
|
panel.getEstimate().setText("Unknown");
|
||||||
panel.getProgress().setBackground(null);
|
panel.getProgress().setBackground(null);
|
||||||
}
|
}
|
||||||
@@ -298,9 +352,20 @@ class FarmingTrackerPanel extends PluginPanel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
panel.getProgress().setBackground(state.getCropState().getColor().darker());
|
/* Hide any fully grown weeds' progress bar. */
|
||||||
panel.getProgress().setMaximum(stages - 1);
|
if (state.getProduce() != Produce.WEEDS
|
||||||
panel.getProgress().setValue(stage);
|
|| (state.getProduce() == Produce.WEEDS && !autoweed && stage < stages - 1))
|
||||||
|
{
|
||||||
|
panel.getProgress().setVisible(true);
|
||||||
|
panel.getProgress().setForeground(state.getCropState().getColor().darker());
|
||||||
|
panel.getProgress().setMaximumValue(stages - 1);
|
||||||
|
panel.getProgress().setValue(stage);
|
||||||
|
panel.getProgress().update();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
panel.getProgress().setVisible(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,11 +66,11 @@ public class FarmingWorld
|
|||||||
new FarmingPatch("North", Varbits.FARMING_4771, PatchImplementation.ALLOTMENT),
|
new FarmingPatch("North", Varbits.FARMING_4771, PatchImplementation.ALLOTMENT),
|
||||||
new FarmingPatch("South", Varbits.FARMING_4772, PatchImplementation.ALLOTMENT),
|
new FarmingPatch("South", Varbits.FARMING_4772, PatchImplementation.ALLOTMENT),
|
||||||
new FarmingPatch("Flower", Varbits.FARMING_4773, PatchImplementation.FLOWER),
|
new FarmingPatch("Flower", Varbits.FARMING_4773, PatchImplementation.FLOWER),
|
||||||
new FarmingPatch("", Varbits.FARMING_4774, PatchImplementation.HERB)
|
new FarmingPatch("Herb", Varbits.FARMING_4774, PatchImplementation.HERB)
|
||||||
));
|
));
|
||||||
|
|
||||||
add(new FarmingRegion("Brimhaven", 11058,
|
add(new FarmingRegion("Brimhaven", 11058,
|
||||||
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.FRUIT_TREE),
|
new FarmingPatch("Fruit Tree", Varbits.FARMING_4771, PatchImplementation.FRUIT_TREE),
|
||||||
new FarmingPatch("Spirit Tree", Varbits.FARMING_4772, PatchImplementation.SPIRIT_TREE)
|
new FarmingPatch("Spirit Tree", Varbits.FARMING_4772, PatchImplementation.SPIRIT_TREE)
|
||||||
));
|
));
|
||||||
|
|
||||||
@@ -78,10 +78,10 @@ public class FarmingWorld
|
|||||||
new FarmingPatch("North", Varbits.FARMING_4771, PatchImplementation.ALLOTMENT),
|
new FarmingPatch("North", Varbits.FARMING_4771, PatchImplementation.ALLOTMENT),
|
||||||
new FarmingPatch("South", Varbits.FARMING_4772, PatchImplementation.ALLOTMENT),
|
new FarmingPatch("South", Varbits.FARMING_4772, PatchImplementation.ALLOTMENT),
|
||||||
new FarmingPatch("Flower", Varbits.FARMING_4773, PatchImplementation.FLOWER),
|
new FarmingPatch("Flower", Varbits.FARMING_4773, PatchImplementation.FLOWER),
|
||||||
new FarmingPatch("", Varbits.FARMING_4774, PatchImplementation.HERB)
|
new FarmingPatch("Herb", Varbits.FARMING_4774, PatchImplementation.HERB)
|
||||||
));
|
));
|
||||||
add(new FarmingRegion("Catherby", 11317,
|
add(new FarmingRegion("Catherby", 11317,
|
||||||
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.FRUIT_TREE)
|
new FarmingPatch("Fruit Tree", Varbits.FARMING_4771, PatchImplementation.FRUIT_TREE)
|
||||||
));
|
));
|
||||||
|
|
||||||
add(new FarmingRegion("Champion's Guild", 12596,
|
add(new FarmingRegion("Champion's Guild", 12596,
|
||||||
@@ -89,7 +89,7 @@ public class FarmingWorld
|
|||||||
));
|
));
|
||||||
|
|
||||||
add(new FarmingRegion("Draynor Manor", 12340,
|
add(new FarmingRegion("Draynor Manor", 12340,
|
||||||
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.BELLADONNA)
|
new FarmingPatch("Belladonna", Varbits.FARMING_4771, PatchImplementation.BELLADONNA)
|
||||||
));
|
));
|
||||||
|
|
||||||
add(new FarmingRegion("Entrana", 11060,
|
add(new FarmingRegion("Entrana", 11060,
|
||||||
@@ -102,13 +102,13 @@ public class FarmingWorld
|
|||||||
));
|
));
|
||||||
|
|
||||||
add(new FarmingRegion("Falador", 11828,
|
add(new FarmingRegion("Falador", 11828,
|
||||||
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.TREE)
|
new FarmingPatch("Tree", Varbits.FARMING_4771, PatchImplementation.TREE)
|
||||||
));
|
));
|
||||||
add(new FarmingRegion("Falador", 12083,
|
add(new FarmingRegion("Falador", 12083,
|
||||||
new FarmingPatch("North West", Varbits.FARMING_4771, PatchImplementation.ALLOTMENT),
|
new FarmingPatch("North West", Varbits.FARMING_4771, PatchImplementation.ALLOTMENT),
|
||||||
new FarmingPatch("South East", Varbits.FARMING_4772, PatchImplementation.ALLOTMENT),
|
new FarmingPatch("South East", Varbits.FARMING_4772, PatchImplementation.ALLOTMENT),
|
||||||
new FarmingPatch("Flower", Varbits.FARMING_4773, PatchImplementation.FLOWER),
|
new FarmingPatch("Flower", Varbits.FARMING_4773, PatchImplementation.FLOWER),
|
||||||
new FarmingPatch("", Varbits.FARMING_4774, PatchImplementation.HERB)
|
new FarmingPatch("Herb", Varbits.FARMING_4774, PatchImplementation.HERB)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@@ -129,20 +129,20 @@ public class FarmingWorld
|
|||||||
));
|
));
|
||||||
|
|
||||||
add(new FarmingRegion("Gnome Stronghold", 9781,
|
add(new FarmingRegion("Gnome Stronghold", 9781,
|
||||||
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.TREE),
|
new FarmingPatch("Tree", Varbits.FARMING_4771, PatchImplementation.TREE),
|
||||||
new FarmingPatch("", Varbits.FARMING_4772, PatchImplementation.FRUIT_TREE)
|
new FarmingPatch("Fruit Tree", Varbits.FARMING_4772, PatchImplementation.FRUIT_TREE)
|
||||||
));
|
));
|
||||||
|
|
||||||
add(new FarmingRegion("Harmony", 15148,
|
add(new FarmingRegion("Harmony", 15148,
|
||||||
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.ALLOTMENT),
|
new FarmingPatch("Allotment", Varbits.FARMING_4771, PatchImplementation.ALLOTMENT),
|
||||||
new FarmingPatch("", Varbits.FARMING_4772, PatchImplementation.HERB)
|
new FarmingPatch("Herb", Varbits.FARMING_4772, PatchImplementation.HERB)
|
||||||
));
|
));
|
||||||
|
|
||||||
add(new FarmingRegion("Kourend", 7222,
|
add(new FarmingRegion("Kourend", 7222,
|
||||||
new FarmingPatch("North East", Varbits.FARMING_4771, PatchImplementation.ALLOTMENT),
|
new FarmingPatch("North East", Varbits.FARMING_4771, PatchImplementation.ALLOTMENT),
|
||||||
new FarmingPatch("South West", Varbits.FARMING_4772, PatchImplementation.ALLOTMENT),
|
new FarmingPatch("South West", Varbits.FARMING_4772, PatchImplementation.ALLOTMENT),
|
||||||
new FarmingPatch("Flower", Varbits.FARMING_4773, PatchImplementation.FLOWER),
|
new FarmingPatch("Flower", Varbits.FARMING_4773, PatchImplementation.FLOWER),
|
||||||
new FarmingPatch("", Varbits.FARMING_4774, PatchImplementation.HERB)
|
new FarmingPatch("Herb", Varbits.FARMING_4774, PatchImplementation.HERB)
|
||||||
));
|
));
|
||||||
add(new FarmingRegion("Kourend", 6711,
|
add(new FarmingRegion("Kourend", 6711,
|
||||||
new FarmingPatch("Spirit Tree", Varbits.FARMING_4771, PatchImplementation.SPIRIT_TREE)
|
new FarmingPatch("Spirit Tree", Varbits.FARMING_4771, PatchImplementation.SPIRIT_TREE)
|
||||||
@@ -163,14 +163,14 @@ public class FarmingWorld
|
|||||||
));
|
));
|
||||||
|
|
||||||
add(new FarmingRegion("Lletya", 9265,
|
add(new FarmingRegion("Lletya", 9265,
|
||||||
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.FRUIT_TREE)
|
new FarmingPatch("Fruit Tree", Varbits.FARMING_4771, PatchImplementation.FRUIT_TREE)
|
||||||
));
|
));
|
||||||
|
|
||||||
add(new FarmingRegion("Lumbridge", 12851,
|
add(new FarmingRegion("Lumbridge", 12851,
|
||||||
new FarmingPatch("Hops", Varbits.FARMING_4771, PatchImplementation.HOPS)
|
new FarmingPatch("Hops", Varbits.FARMING_4771, PatchImplementation.HOPS)
|
||||||
));
|
));
|
||||||
add(new FarmingRegion("Lumbridge", 12594,
|
add(new FarmingRegion("Lumbridge", 12594,
|
||||||
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.TREE)
|
new FarmingPatch("Tree", Varbits.FARMING_4771, PatchImplementation.TREE)
|
||||||
));
|
));
|
||||||
|
|
||||||
add(new FarmingRegion("Morytania", 13622,
|
add(new FarmingRegion("Morytania", 13622,
|
||||||
@@ -180,7 +180,7 @@ public class FarmingWorld
|
|||||||
new FarmingPatch("North West", Varbits.FARMING_4771, PatchImplementation.ALLOTMENT),
|
new FarmingPatch("North West", Varbits.FARMING_4771, PatchImplementation.ALLOTMENT),
|
||||||
new FarmingPatch("South East", Varbits.FARMING_4772, PatchImplementation.ALLOTMENT),
|
new FarmingPatch("South East", Varbits.FARMING_4772, PatchImplementation.ALLOTMENT),
|
||||||
new FarmingPatch("Flower", Varbits.FARMING_4773, PatchImplementation.FLOWER),
|
new FarmingPatch("Flower", Varbits.FARMING_4773, PatchImplementation.FLOWER),
|
||||||
new FarmingPatch("", Varbits.FARMING_4774, PatchImplementation.HERB)
|
new FarmingPatch("Herb", Varbits.FARMING_4774, PatchImplementation.HERB)
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
||||||
@@ -193,31 +193,31 @@ public class FarmingWorld
|
|||||||
), 11826);
|
), 11826);
|
||||||
|
|
||||||
add(new FarmingRegion("Seers' Village", 10551,
|
add(new FarmingRegion("Seers' Village", 10551,
|
||||||
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.HOPS)
|
new FarmingPatch("Hops", Varbits.FARMING_4771, PatchImplementation.HOPS)
|
||||||
));
|
));
|
||||||
|
|
||||||
add(new FarmingRegion("Tai Bwo Wannai", 11056,
|
add(new FarmingRegion("Tai Bwo Wannai", 11056,
|
||||||
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.CALQUAT)
|
new FarmingPatch("Calquat", Varbits.FARMING_4771, PatchImplementation.CALQUAT)
|
||||||
));
|
));
|
||||||
|
|
||||||
add(new FarmingRegion("Taverly", 11573,
|
add(new FarmingRegion("Taverly", 11573,
|
||||||
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.TREE)
|
new FarmingPatch("Tree", Varbits.FARMING_4771, PatchImplementation.TREE)
|
||||||
));
|
));
|
||||||
|
|
||||||
add(new FarmingRegion("Tree Gnome Village", 9777,
|
add(new FarmingRegion("Tree Gnome Village", 9777,
|
||||||
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.FRUIT_TREE)
|
new FarmingPatch("Fruit Tree", Varbits.FARMING_4771, PatchImplementation.FRUIT_TREE)
|
||||||
));
|
));
|
||||||
|
|
||||||
add(new FarmingRegion("Troll Stronghold", 11321,
|
add(new FarmingRegion("Troll Stronghold", 11321,
|
||||||
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.HERB)
|
new FarmingPatch("Herb", Varbits.FARMING_4771, PatchImplementation.HERB)
|
||||||
));
|
));
|
||||||
|
|
||||||
add(new FarmingRegion("Varrock", 12854,
|
add(new FarmingRegion("Varrock", 12854,
|
||||||
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.TREE)
|
new FarmingPatch("Tree", Varbits.FARMING_4771, PatchImplementation.TREE)
|
||||||
), 12853);
|
), 12853);
|
||||||
|
|
||||||
add(new FarmingRegion("Yanille", 10288,
|
add(new FarmingRegion("Yanille", 10288,
|
||||||
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.HOPS)
|
new FarmingPatch("Hops", Varbits.FARMING_4771, PatchImplementation.HOPS)
|
||||||
));
|
));
|
||||||
|
|
||||||
// Finalize
|
// Finalize
|
||||||
|
|||||||
@@ -970,7 +970,7 @@ public enum PatchImplementation
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
BUSH(Tab.SPECIAL)
|
BUSH(Tab.BUSH)
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
PatchState forVarbitValue(int value)
|
PatchState forVarbitValue(int value)
|
||||||
@@ -2271,7 +2271,7 @@ public enum PatchImplementation
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
GRAPES(Tab.SPECIAL)
|
GRAPES(Tab.SPECIAL)
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
PatchState forVarbitValue(int value)
|
PatchState forVarbitValue(int value)
|
||||||
@@ -2299,5 +2299,16 @@ public enum PatchImplementation
|
|||||||
|
|
||||||
abstract PatchState forVarbitValue(int value);
|
abstract PatchState forVarbitValue(int value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a formatted name based on the enum's name.
|
||||||
|
* Ex:
|
||||||
|
* SPIRIT_TREE into Spirit Tree
|
||||||
|
* HERB into Herb
|
||||||
|
*/
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return (name().substring(0, 1).toUpperCase() + name().toLowerCase().substring(1)).replaceAll("_", " ");
|
||||||
|
}
|
||||||
|
|
||||||
private final Tab tab;
|
private final Tab tab;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ public enum Tab
|
|||||||
HERB("Herbs", ItemID.GRIMY_RANARR_WEED),
|
HERB("Herbs", ItemID.GRIMY_RANARR_WEED),
|
||||||
TREE("Trees", ItemID.MAHOGANY_LOGS),
|
TREE("Trees", ItemID.MAHOGANY_LOGS),
|
||||||
FRUIT_TREE("Fruit Trees", ItemID.PINEAPPLE),
|
FRUIT_TREE("Fruit Trees", ItemID.PINEAPPLE),
|
||||||
|
BUSH("Bushes", ItemID.WHITE_BERRIES),
|
||||||
SPECIAL("Special", ItemID.MUSHROOM);
|
SPECIAL("Special", ItemID.MUSHROOM);
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.client.ui.components;
|
package net.runelite.client.ui.components;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
@@ -32,6 +33,7 @@ import javax.swing.JComponent;
|
|||||||
import javax.swing.JScrollBar;
|
import javax.swing.JScrollBar;
|
||||||
import javax.swing.plaf.ComponentUI;
|
import javax.swing.plaf.ComponentUI;
|
||||||
import javax.swing.plaf.basic.BasicScrollBarUI;
|
import javax.swing.plaf.basic.BasicScrollBarUI;
|
||||||
|
import lombok.Setter;
|
||||||
import net.runelite.client.ui.ColorScheme;
|
import net.runelite.client.ui.ColorScheme;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,6 +42,15 @@ import net.runelite.client.ui.ColorScheme;
|
|||||||
*/
|
*/
|
||||||
public class CustomScrollBarUI extends BasicScrollBarUI
|
public class CustomScrollBarUI extends BasicScrollBarUI
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/* The background color of the bar's thumb */
|
||||||
|
@Setter
|
||||||
|
private Color thumbColor = ColorScheme.MEDIUM_GRAY_COLOR;
|
||||||
|
|
||||||
|
/* The background color of the bar's track */
|
||||||
|
@Setter
|
||||||
|
private Color trackColor = ColorScheme.SCROLL_TRACK_COLOR;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overrides the painting of the bar's track (the darker part underneath that extends
|
* Overrides the painting of the bar's track (the darker part underneath that extends
|
||||||
* the full page length).
|
* the full page length).
|
||||||
@@ -47,7 +58,7 @@ public class CustomScrollBarUI extends BasicScrollBarUI
|
|||||||
@Override
|
@Override
|
||||||
protected void paintTrack(Graphics graphics, JComponent jComponent, Rectangle rectangle)
|
protected void paintTrack(Graphics graphics, JComponent jComponent, Rectangle rectangle)
|
||||||
{
|
{
|
||||||
graphics.setColor(ColorScheme.SCROLL_TRACK_COLOR);
|
graphics.setColor(trackColor);
|
||||||
graphics.fillRect(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
|
graphics.fillRect(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,7 +69,7 @@ public class CustomScrollBarUI extends BasicScrollBarUI
|
|||||||
@Override
|
@Override
|
||||||
protected void paintThumb(Graphics graphics, JComponent jComponent, Rectangle rectangle)
|
protected void paintThumb(Graphics graphics, JComponent jComponent, Rectangle rectangle)
|
||||||
{
|
{
|
||||||
graphics.setColor(ColorScheme.MEDIUM_GRAY_COLOR);
|
graphics.setColor(thumbColor);
|
||||||
graphics.fillRect(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
|
graphics.fillRect(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import javax.swing.JLabel;
|
|||||||
import javax.swing.border.Border;
|
import javax.swing.border.Border;
|
||||||
import javax.swing.border.CompoundBorder;
|
import javax.swing.border.CompoundBorder;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
import net.runelite.client.ui.ColorScheme;
|
import net.runelite.client.ui.ColorScheme;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -59,6 +60,10 @@ public class MaterialTab extends JLabel
|
|||||||
@Getter
|
@Getter
|
||||||
private final JComponent content;
|
private final JComponent content;
|
||||||
|
|
||||||
|
/* To be execuded when the tab is selected */
|
||||||
|
@Setter
|
||||||
|
private Runnable onSelectEvent;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private boolean selected;
|
private boolean selected;
|
||||||
|
|
||||||
@@ -93,6 +98,10 @@ public class MaterialTab extends JLabel
|
|||||||
setBorder(SELECTED_BORDER);
|
setBorder(SELECTED_BORDER);
|
||||||
setForeground(Color.WHITE);
|
setForeground(Color.WHITE);
|
||||||
selected = true;
|
selected = true;
|
||||||
|
if (onSelectEvent != null)
|
||||||
|
{
|
||||||
|
onSelectEvent.run();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unselect()
|
public void unselect()
|
||||||
|
|||||||
@@ -59,10 +59,22 @@ public class MaterialTabGroup extends JPanel
|
|||||||
{
|
{
|
||||||
this.display = display;
|
this.display = display;
|
||||||
this.display.setLayout(new BorderLayout());
|
this.display.setLayout(new BorderLayout());
|
||||||
setLayout(new FlowLayout());
|
setLayout(new FlowLayout(FlowLayout.CENTER, 8, 0));
|
||||||
setOpaque(false);
|
setOpaque(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Returns the tab on a certain index. */
|
||||||
|
public MaterialTab getTab(int index)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (tabs == null || tabs.isEmpty())
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return tabs.get(index);
|
||||||
|
}
|
||||||
|
|
||||||
public void addTab(MaterialTab tab)
|
public void addTab(MaterialTab tab)
|
||||||
{
|
{
|
||||||
tabs.add(tab);
|
tabs.add(tab);
|
||||||
@@ -89,6 +101,7 @@ public class MaterialTabGroup extends JPanel
|
|||||||
{
|
{
|
||||||
tab.select();
|
tab.select();
|
||||||
display.add(tab.getContent());
|
display.add(tab.getContent());
|
||||||
|
display.revalidate();
|
||||||
display.repaint();
|
display.repaint();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user