@Override public final void addBar(Bar myBar) { // before which bar should this bar be inserted? -1, if it is the lat index. myBar = setBarStandardSettings(myBar); int beforeWhich = -1; for (int i = 0; i < bars.size(); i++) { if (compareBarOrder(myBar, (Bar) bars.get(i)) && beforeWhich == -1) { beforeWhich = i; } } bars.setSize(bars.size() + 1); if (beforeWhich > -1) { for (int i = bars.size() - 1; i > beforeWhich; i--) { bars.set(i, bars.get(i - 1)); } bars.set(beforeWhich, myBar); } else { bars.set(bars.size() - 1, myBar); } if (myBar.getHeight() < lowestValue) { lowestValue = myBar.getHeight(); } }
@Override protected final Bar setBarStandardSettings(final Bar rawBar) { // set OVERLAY BAR Standards - they override standard bar settings (because theyre specialised // bars) if (rawBar instanceof OverlayBar || rawBar instanceof OverlayLabelBar) { if ((rawBar).getWidth() == -1.0) { (rawBar).setWidth(overlayBarWidth); } if ((rawBar).getColorMainBar() == null) { (rawBar).setColorMainBar(overlayBarColor); } } rawBar.setGC(gc); if (rawBar.getColorMainBar() == null) { rawBar.setColorMainBar(barColor); } if (rawBar.getWidth() == -1) { rawBar.setWidth(barWidth); } // Set Transparency if (rawBar instanceof OverlayBar) { if (((OverlayBar) rawBar).getTransparencyHighest() == -1) { ((OverlayBar) rawBar).setTransparencyHighest(overlayTranspHighest); } if (((OverlayBar) rawBar).getTransparencyLowest() == -1) { ((OverlayBar) rawBar).setTransparencyLowest(overlayTranspLowest); } } if (rawBar instanceof OverlayLabelBar) { if (((OverlayLabelBar) rawBar).getTransparencyHighest() == -1) { ((OverlayLabelBar) rawBar).setTransparencyHighest(overlayTranspHighest); } if (((OverlayLabelBar) rawBar).getTransparencyLowest() == -1) { ((OverlayLabelBar) rawBar).setTransparencyLowest(overlayTranspLowest); } } return rawBar; }