Skip to content

Commit

Permalink
Cleanup FarmingTracker panels
Browse files Browse the repository at this point in the history
  • Loading branch information
abextm authored and deathbeam committed May 19, 2018
1 parent 3526b25 commit 64610ae
Show file tree
Hide file tree
Showing 5 changed files with 302 additions and 330 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*/
package net.runelite.client.plugins.farmingtracker;

import com.google.common.base.Strings;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
Expand Down Expand Up @@ -67,7 +68,7 @@ class FarmingPatchPanel extends JPanel
infoPanel.setBorder(new EmptyBorder(4, 4, 4, 0));

final JLabel location = new JShadowedLabel(patch.getRegion().getName()
+ (showFullTitle() ? " (" + patch.getName() + ")" : ""));
+ (Strings.isNullOrEmpty(patch.getName()) ? "" : " (" + patch.getName() + ")"));
location.setFont(FontManager.getRunescapeSmallFont());
location.setForeground(Color.WHITE);

Expand All @@ -83,30 +84,4 @@ class FarmingPatchPanel extends JPanel
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;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*/
package net.runelite.client.plugins.farmingtracker;

import com.google.common.base.Strings;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
Expand Down Expand Up @@ -124,15 +125,20 @@ public Dimension getPreferredSize()
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))
if (patch.getImplementation() != lastImpl && !Strings.isNullOrEmpty(patch.getImplementation().getName()))
{
JLabel groupLabel = new JLabel(patch.getImplementation().getName());
groupLabel.setBorder(new EmptyBorder(15, 0, 0, 0));

if (first)
{
first = false;
groupLabel.setBorder(new EmptyBorder(4, 0, 0, 0));
}
else
{
groupLabel.setBorder(new EmptyBorder(15, 0, 0, 0));
}

groupLabel.setFont(FontManager.getRunescapeSmallFont());

container.add(groupLabel, c);
Expand All @@ -147,8 +153,8 @@ public Dimension getPreferredSize()
/* This is a weird hack to remove the top border on the first tracker of every tab */
if (first)
{
p.setBorder(null);
first = false;
p.setBorder(null);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,55 +60,55 @@ public FarmingWorld()
));

add(new FarmingRegion("Ardougne", 10290,
new FarmingPatch("Bush", Varbits.FARMING_4771, PatchImplementation.BUSH)
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.BUSH)
));
add(new FarmingRegion("Ardougne", 10548,
new FarmingPatch("North", Varbits.FARMING_4771, PatchImplementation.ALLOTMENT),
new FarmingPatch("South", Varbits.FARMING_4772, PatchImplementation.ALLOTMENT),
new FarmingPatch("Flower", Varbits.FARMING_4773, PatchImplementation.FLOWER),
new FarmingPatch("Herb", Varbits.FARMING_4774, PatchImplementation.HERB)
new FarmingPatch("", Varbits.FARMING_4773, PatchImplementation.FLOWER),
new FarmingPatch("", Varbits.FARMING_4774, PatchImplementation.HERB)
));

add(new FarmingRegion("Brimhaven", 11058,
new FarmingPatch("Fruit Tree", Varbits.FARMING_4771, PatchImplementation.FRUIT_TREE),
new FarmingPatch("Spirit Tree", Varbits.FARMING_4772, PatchImplementation.SPIRIT_TREE)
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.FRUIT_TREE),
new FarmingPatch("", Varbits.FARMING_4772, PatchImplementation.SPIRIT_TREE)
));

add(new FarmingRegion("Catherby", 11062,
new FarmingPatch("North", Varbits.FARMING_4771, PatchImplementation.ALLOTMENT),
new FarmingPatch("South", Varbits.FARMING_4772, PatchImplementation.ALLOTMENT),
new FarmingPatch("Flower", Varbits.FARMING_4773, PatchImplementation.FLOWER),
new FarmingPatch("Herb", Varbits.FARMING_4774, PatchImplementation.HERB)
new FarmingPatch("", Varbits.FARMING_4773, PatchImplementation.FLOWER),
new FarmingPatch("", Varbits.FARMING_4774, PatchImplementation.HERB)
));
add(new FarmingRegion("Catherby", 11317,
new FarmingPatch("Fruit Tree", Varbits.FARMING_4771, PatchImplementation.FRUIT_TREE)
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.FRUIT_TREE)
));

add(new FarmingRegion("Champion's Guild", 12596,
new FarmingPatch("Bush", Varbits.FARMING_4771, PatchImplementation.BUSH)
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.BUSH)
));

add(new FarmingRegion("Draynor Manor", 12340,
new FarmingPatch("Belladonna", Varbits.FARMING_4771, PatchImplementation.BELLADONNA)
));

add(new FarmingRegion("Entrana", 11060,
new FarmingPatch("Hops", Varbits.FARMING_4771, PatchImplementation.HOPS)
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.HOPS)
));

add(new FarmingRegion("Etceteria", 10300,
new FarmingPatch("Bush", Varbits.FARMING_4771, PatchImplementation.BUSH),
new FarmingPatch("Spirit Tree", Varbits.FARMING_4772, PatchImplementation.SPIRIT_TREE)
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.BUSH),
new FarmingPatch("", Varbits.FARMING_4772, PatchImplementation.SPIRIT_TREE)
));

add(new FarmingRegion("Falador", 11828,
new FarmingPatch("Tree", Varbits.FARMING_4771, PatchImplementation.TREE)
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.TREE)
));
add(new FarmingRegion("Falador", 12083,
new FarmingPatch("North West", Varbits.FARMING_4771, PatchImplementation.ALLOTMENT),
new FarmingPatch("South East", Varbits.FARMING_4772, PatchImplementation.ALLOTMENT),
new FarmingPatch("Flower", Varbits.FARMING_4773, PatchImplementation.FLOWER),
new FarmingPatch("Herb", Varbits.FARMING_4774, PatchImplementation.HERB)
new FarmingPatch("", Varbits.FARMING_4773, PatchImplementation.FLOWER),
new FarmingPatch("", Varbits.FARMING_4774, PatchImplementation.HERB)
)
{
@Override
Expand All @@ -129,23 +129,23 @@ public boolean isInBounds(WorldPoint loc)
));

add(new FarmingRegion("Gnome Stronghold", 9781,
new FarmingPatch("Tree", Varbits.FARMING_4771, PatchImplementation.TREE),
new FarmingPatch("Fruit Tree", Varbits.FARMING_4772, PatchImplementation.FRUIT_TREE)
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.TREE),
new FarmingPatch("", Varbits.FARMING_4772, PatchImplementation.FRUIT_TREE)
));

add(new FarmingRegion("Harmony", 15148,
new FarmingPatch("Allotment", Varbits.FARMING_4771, PatchImplementation.ALLOTMENT),
new FarmingPatch("Herb", Varbits.FARMING_4772, PatchImplementation.HERB)
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.ALLOTMENT),
new FarmingPatch("", Varbits.FARMING_4772, PatchImplementation.HERB)
));

add(new FarmingRegion("Kourend", 7222,
new FarmingPatch("North East", Varbits.FARMING_4771, PatchImplementation.ALLOTMENT),
new FarmingPatch("South West", Varbits.FARMING_4772, PatchImplementation.ALLOTMENT),
new FarmingPatch("Flower", Varbits.FARMING_4773, PatchImplementation.FLOWER),
new FarmingPatch("Herb", Varbits.FARMING_4774, PatchImplementation.HERB)
new FarmingPatch("", Varbits.FARMING_4773, PatchImplementation.FLOWER),
new FarmingPatch("", Varbits.FARMING_4774, PatchImplementation.HERB)
));
add(new FarmingRegion("Kourend", 6711,
new FarmingPatch("Spirit Tree", Varbits.FARMING_4771, PatchImplementation.SPIRIT_TREE)
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.SPIRIT_TREE)
));
add(new FarmingRegion("Kourend", 7223,
new FarmingPatch("West 1", Varbits.GRAPES_4953, PatchImplementation.GRAPES),
Expand All @@ -163,14 +163,14 @@ public boolean isInBounds(WorldPoint loc)
));

add(new FarmingRegion("Lletya", 9265,
new FarmingPatch("Fruit Tree", Varbits.FARMING_4771, PatchImplementation.FRUIT_TREE)
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.FRUIT_TREE)
));

add(new FarmingRegion("Lumbridge", 12851,
new FarmingPatch("Hops", Varbits.FARMING_4771, PatchImplementation.HOPS)
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.HOPS)
));
add(new FarmingRegion("Lumbridge", 12594,
new FarmingPatch("Tree", Varbits.FARMING_4771, PatchImplementation.TREE)
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.TREE)
));

add(new FarmingRegion("Morytania", 13622,
Expand All @@ -179,45 +179,45 @@ public boolean isInBounds(WorldPoint loc)
add(new FarmingRegion("Morytania", 14391,
new FarmingPatch("North West", Varbits.FARMING_4771, PatchImplementation.ALLOTMENT),
new FarmingPatch("South East", Varbits.FARMING_4772, PatchImplementation.ALLOTMENT),
new FarmingPatch("Flower", Varbits.FARMING_4773, PatchImplementation.FLOWER),
new FarmingPatch("Herb", Varbits.FARMING_4774, PatchImplementation.HERB)
new FarmingPatch("", Varbits.FARMING_4773, PatchImplementation.FLOWER),
new FarmingPatch("", Varbits.FARMING_4774, PatchImplementation.HERB)
));


add(new FarmingRegion("Port Sarim", 12082,
new FarmingPatch("Spirit tree", Varbits.FARMING_4771, PatchImplementation.SPIRIT_TREE)
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.SPIRIT_TREE)
));

add(new FarmingRegion("Rimmington", 11570,
new FarmingPatch("Bush", Varbits.FARMING_4771, PatchImplementation.BUSH)
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.BUSH)
), 11826);

add(new FarmingRegion("Seers' Village", 10551,
new FarmingPatch("Hops", Varbits.FARMING_4771, PatchImplementation.HOPS)
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.HOPS)
));

add(new FarmingRegion("Tai Bwo Wannai", 11056,
new FarmingPatch("Calquat", Varbits.FARMING_4771, PatchImplementation.CALQUAT)
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.CALQUAT)
));

add(new FarmingRegion("Taverly", 11573,
new FarmingPatch("Tree", Varbits.FARMING_4771, PatchImplementation.TREE)
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.TREE)
));

add(new FarmingRegion("Tree Gnome Village", 9777,
new FarmingPatch("Fruit Tree", Varbits.FARMING_4771, PatchImplementation.FRUIT_TREE)
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.FRUIT_TREE)
));

add(new FarmingRegion("Troll Stronghold", 11321,
new FarmingPatch("Herb", Varbits.FARMING_4771, PatchImplementation.HERB)
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.HERB)
));

add(new FarmingRegion("Varrock", 12854,
new FarmingPatch("Tree", Varbits.FARMING_4771, PatchImplementation.TREE)
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.TREE)
), 12853);

add(new FarmingRegion("Yanille", 10288,
new FarmingPatch("Hops", Varbits.FARMING_4771, PatchImplementation.HOPS)
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.HOPS)
));

// Finalize
Expand Down
Loading

0 comments on commit 64610ae

Please sign in to comment.