gfx.translate(-x,-y);
}
};
private TabPanel buildPanel() throws IOException {
final TabPanel panel = new TabPanel();
panel.setPrefWidth(300);
panel.setPrefHeight(250);
setupColorTab(panel);
setupSwatchTab(panel);
setupRGBTab(panel);
setupGradientTab(panel);
setupPatternTab(panel);
//TODO: is this popup event really working?
EventBus.getSystem().addListener(panel, MouseEvent.MouseAll, new Callback<MouseEvent>() {
public void call(MouseEvent event) {
if(event.getType() == MouseEvent.MouseDragged) {
if(!popup.isVisible()) return;
Control control = panel.getSelected();
if(control instanceof ListView) {
ListView lv = (ListView) control;
Object item = lv.getItemAt(event.getPointInNodeCoords(lv));
if(item instanceof Paint) {
setSelectedFill((Paint) item);
}
}
}
if(event.getType() == MouseEvent.MouseReleased) {
Point2D pt = event.getPointInNodeCoords(panel);
pt = new Point2D.Double(pt.getX()+panel.getTranslateX(),pt.getY()+panel.getTranslateY());
if(panel.getVisualBounds().contains(pt)) {
popup.setVisible(false);
}
}
}
});