/** @param master */ public Renderer(JavaDesktopFrontend master) { this.plugin = master; this.I18n = plugin.getApi().getI18n(); environmentWidth = (int) getEnvironments().get(0).getPojo().getWidth(); environmentHeight = (int) getEnvironments().get(0).getPojo().getHeight(); CANVAS_WIDTH = environmentWidth + (BORDER_X * 2); CANVAS_HEIGHT = environmentHeight + (BORDER_Y * 2); backgroundColor = TopologyUtils.convertColorToAWT(getEnvironments().get(0).getPojo().getBackgroundColor()); calloutsUpdater = new CalloutsUpdater(this, 900); currEnv = getEnvironments().get(0); ResourcesManager.clear(); clear(); addCustomMouseListener(); addCustomMouseMotionListener(); setBackground(backgroundColor); addComponentListener( new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { backgroundChanged = true; findRescaleFactor(); } }); repaint(); }
/** * @param p * @return */ protected EnvObjectLogic mouseOnObject(Point p) { Point mousePointer = toRealCoords(p); for (EnvObjectLogic logic : plugin.getApi().things().findByEnvironment(currEnv)) { if (getCachedShape(logic).contains(mousePointer)) { return logic; } } return null; }
private void rebuildShapesCache() { for (EnvObjectLogic obj : plugin.getApi().things().findByEnvironment(getCurrEnv())) { rebuildShapeCache(obj); } }
private List<EnvironmentLogic> getEnvironments() { return plugin.getApi().environments().findAll(); }