org.controlsfx.control.PopOver Java Examples

The following examples show how to use org.controlsfx.control.PopOver. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Main.java    From DashboardFx with GNU General Public License v3.0 6 votes vote down vote up
private void loadContentPopup(){
    try {
        popContent = FXMLLoader.load(getClass().getResource("/com/gn/module/main/Config.fxml"));
        popConfig.getRoot().getStylesheets().add(getClass().getResource("/com/gn/theme/css/poplight.css").toExternalForm());
        popConfig.setContentNode(popContent);
        popConfig.setArrowLocation(PopOver.ArrowLocation.TOP_RIGHT);
        popConfig.setArrowIndent(0);
        popConfig.setArrowSize(0);
        popConfig.setCornerRadius(0);
        popConfig.setAutoFix(true);
        popConfig.setAnimated(false);


    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
Example #2
Source File: PropertyCollectionView.java    From pmd-designer with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private PopOver rebindPopover(PropertyDescriptorSpec newSpec, PopOver pop) {
    if (pop == null) {
        // create it
        return detailsPopOver(newSpec);
    }

    pop.titleProperty().bind(newSpec.nameProperty()
                                    .filter(StringUtils::isNotBlank)
                                    .orElseConst("(no name)")
                                    .map(it -> "Property '" + it + "'"));

    EditPropertyDialogController wizard = (EditPropertyDialogController) pop.getUserData();
    Subscription sub = wizard.bindToDescriptor(newSpec, view.getItems()).and(pop.titleProperty()::unbind);
    pop.setOnHiding(we -> sub.unsubscribe());
    return pop;

}
 
Example #3
Source File: Pin.java    From BlockMap with MIT License 6 votes vote down vote up
@Override
protected PopOver initInfo() {
	PopOver info = super.initInfo();
	GridPane popContent = new GridPane();
	popContent.getStyleClass().add("grid");

	/* Image+Text for the popover */
	StreamUtils.zipWithIndex(pinCount.entrySet().stream()).forEach(e -> {
		ImageView img = new ImageView(e.getValue().getKey().image);
		img.setSmooth(false);
		img.setPreserveRatio(true);
		Label label1 = new Label(e.getValue().getKey().toString(), img);
		img.fitHeightProperty().bind(Bindings.createDoubleBinding(() -> label1.getFont().getSize() * 1.3, label1.fontProperty()));
		popContent.add(label1, 0, (int) e.getIndex());
		Label label2 = new Label(String.format("%dx", e.getValue().getValue()));
		popContent.add(label2, 1, (int) e.getIndex());
	});

	info.setContentNode(popContent);
	return info;
}
 
Example #4
Source File: Pin.java    From BlockMap with MIT License 6 votes vote down vote up
@Override
protected PopOver initInfo() {
	PopOver info = super.initInfo();
	GridPane content = new GridPane();
	content.getStyleClass().add("grid");

	content.add(new Label("Position: "), 0, 2, 1, 2);
	content.add(new Label(villageObjectPin.getPosition().toString()), 1, 2, 2, 2);

	content.add(new Label("Free tickets: "), 0, 4);
	content.add(new Label(String.valueOf(villageObjectPin.getFreeTickets())), 1, 4);

	content.add(new Label(type.name), 0, 5);

	info.setContentNode(content);
	return info;
}
 
Example #5
Source File: PopOverWrapper.java    From pmd-designer with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void preload(Supplier<PopOver> supplier) {
    if (supplier == null) {
        return;
    }
    PopOver popOver = supplier.get();
    if (popOver == null) {
        myPopover.setValue(null);
        return;
    }

    this.userOnHiding = popOver.getOnHiding();

    popOver.setOnHiding(we -> {
        this.identity = null;
        handleHiding(we);
    });

    popOver.getRoot().getStylesheets().addAll(DesignerUtil.getCss("popover").toString());
    popOver.getRoot().applyCss();
    myPopover.setValue(popOver);
}
 
Example #6
Source File: Pin.java    From BlockMap with MIT License 6 votes vote down vote up
@Override
protected PopOver initInfo() {
	PopOver info = super.initInfo();
	GridPane content = new GridPane();
	content.getStyleClass().add("grid");

	content.add(new Label("Player position:"), 0, 2);

	Vector3dc position = player.getPosition();
	Button jumpButton = new Button(position.toString());
	jumpButton.setTooltip(new Tooltip("Click to go there"));
	content.add(jumpButton, 1, 2);
	jumpButton.setOnAction(e -> {
		Vector2d spawnpoint = new Vector2d(position.x(), position.z());
		AABBd frustum = viewport.frustumProperty.get();
		viewport.translationProperty.set(spawnpoint.negate().add((frustum.maxX - frustum.minX) / 2, (frustum.maxY - frustum.minY) / 2));
		info.hide();
	});

	info.setContentNode(content);
	return info;
}
 
Example #7
Source File: SourceEditorController.java    From pmd-designer with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private PopOver rebindPopover(LiveTestCase testCase, PopOver existing) {
    if (testCase == null && existing != null) {
        existing.hide();
        return existing;
    }

    if (testCase != null) {
        if (existing == null) {
            return ViolationCollectionView.makePopOver(testCase, getDesignerRoot());
        } else {
            ViolationCollectionView view = (ViolationCollectionView) existing.getUserData();
            view.setItems(testCase.getExpectedViolations());
            return existing;
        }
    }
    return null;
}
 
Example #8
Source File: Pin.java    From BlockMap with MIT License 5 votes vote down vote up
@Override
protected PopOver initInfo() {
	PopOver info = super.initInfo();

	GridPane popContent = new GridPane();
	popContent.getStyleClass().add("grid");
	info.setContentNode(popContent);

	popContent.add(new Label("Found version(s):"), 0, 0);
	popContent.add(new Label(
			chunks.stream().map(c -> c.version).distinct().sorted().map(String::valueOf).collect(Collectors.joining(", ", "{", "}"))), 1, 0);
	popContent.add(new Label("Unsupported for reason(s):"), 0, 1);
	popContent.add(new Label(
			chunks.stream().map(c -> c.message).distinct().sorted().map(String::valueOf).collect(Collectors.joining(", ", "{", "}"))), 1, 1);
	popContent.add(new Separator(), 0, 2, 2, 1);
	popContent.add(new Label("Supported versions:"), 0, 3);
	popContent.add(new Label("Name:"), 1, 3);
	int row = 4;
	for (MinecraftVersion supported : MinecraftVersion.values()) {
		if (supported.maxVersion == Integer.MAX_VALUE)
			popContent.add(new Label(supported.minVersion + "+"), 0, row);
		else
			popContent.add(new Label(supported.minVersion + "-" + supported.maxVersion), 0, row);

		popContent.add(new Label(supported.versionName), 1, row++);
	}
	return info;
}
 
Example #9
Source File: MarsNode.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
public Label createPerson(Person person) {
	//Button b = new Button(person.getName());
	Label l = new Label(person.getName());

	l.setPadding(new Insets(20));
	l.setMaxWidth(Double.MAX_VALUE);
	l.setId("settlement-node");
	l.getStylesheets().add("/fxui/css/personnode.css");
	l.setOnMouseClicked(new EventHandler<MouseEvent>() {
     	PopOver popOver = null;
         @Override
         public void handle(MouseEvent evt) {
             	if (popOver == null ) {
                      popOver = createPopOver(l, person);
             	}
             	else if (evt.getClickCount() >= 1) {
                     popOver.hide(Duration.seconds(.5));
              	}
             	else if (popOver.isShowing()) {
               		popOver.hide(Duration.seconds(.5));
             	}
             	else if (!popOver.isShowing()) {
               		popOver = createPopOver(l, person);
             	}
         }
     });

	return l;
}
 
Example #10
Source File: MarsNode.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
public Label createEach(Settlement settlement) {
	Label l = new Label(settlement.getName());

	l.setPadding(new Insets(20));
	l.setAlignment(Pos.CENTER);
	l.setMaxWidth(Double.MAX_VALUE);

	l.setId("settlement-node");
	l.getStylesheets().add("/fxui/css/settlementnode.css");

	l.setOnMouseClicked(new EventHandler<MouseEvent>() {
     	PopOver popOver = null;
         @Override
         public void handle(MouseEvent evt) {
       	if (popOver == null ) {
                popOver = createPopOver(l, settlement);
         	}
       	else if (evt.getClickCount() >= 1) {
               popOver.hide(Duration.seconds(.5));
        	}
       	else if (popOver.isShowing()) {
         		popOver.hide(Duration.seconds(.5));
         	}
       	else if (!popOver.isShowing()) {
         		popOver = createPopOver(l, settlement);
         	}
         }
     });
	return l;
}
 
Example #11
Source File: UserDetail.java    From DashboardFx with GNU General Public License v3.0 5 votes vote down vote up
public UserDetail(String name, String text, String subtitle) {
    super(text, subtitle);
    this.headerProperty().set(name);
    UserDetail.root = popOver;
    popOver.setArrowLocation(PopOver.ArrowLocation.TOP_CENTER);
    popOver.setArrowIndent(0);
    popOver.setArrowSize(0);
    popOver.setCornerRadius(0);
    popOver.setContentNode(configLayout());
}
 
Example #12
Source File: UserDetail.java    From DashboardFx with GNU General Public License v3.0 5 votes vote down vote up
public UserDetail(){
    super("", "");
    UserDetail.root = popOver;
    popOver.setArrowLocation(PopOver.ArrowLocation.TOP_CENTER);
    popOver.setArrowIndent(0);
    popOver.setArrowSize(0);
    popOver.setCornerRadius(0);
    popOver.setContentNode(configLayout());
}
 
Example #13
Source File: Main.java    From DashboardFx with GNU General Public License v3.0 5 votes vote down vote up
private void addSubPop() throws Exception {
        popup.setContentNode(FXMLLoader.load(getClass().getResource("/com/gn/module/main/Popover.fxml")));

//        popup.getRoot().getStylesheets().add(getClass().getResource("/com/gn/theme/css/poplight.css").toExternalForm());

        popup.setArrowLocation(PopOver.ArrowLocation.LEFT_CENTER);
        popup.setArrowIndent(0);
        popup.setArrowSize(0);
        popup.setCornerRadius(0);
        popup.setAutoFix(true);
    }
 
Example #14
Source File: Pin.java    From BlockMap with MIT License 5 votes vote down vote up
@Override
protected PopOver initInfo() {
	PopOver info = super.initInfo();
	GridPane content = new GridPane();
	content.getStyleClass().add("grid");

	content.add(new Label("Position:"), 0, 2);
	content.add(new Label(spawn.toString()), 1, 2);

	info.setContentNode(content);
	return info;
}
 
Example #15
Source File: Pin.java    From BlockMap with MIT License 5 votes vote down vote up
@Override
protected PopOver initInfo() {
	PopOver info = super.initInfo();
	GridPane content = new GridPane();
	content.getStyleClass().add("grid");

	content.add(new Label("Name:"), 0, 2);
	Label playerName = new Label("loading...");
	playerName.textProperty().bind(this.playerName);
	content.add(playerName, 1, 2);

	player.getSpawnpoint().ifPresent(spawn -> {
		content.add(new Label("Spawnpoint: "), 0, 3);
		Button jumpButton = new Button(spawn.toString());
		jumpButton.setTooltip(new Tooltip("Click to go there"));
		content.add(jumpButton, 1, 3);
		jumpButton.setOnAction(e -> {
			Vector2d spawnpoint = new Vector2d(spawn.x(), spawn.z());
			AABBd frustum = viewport.frustumProperty.get();
			viewport.translationProperty.set(spawnpoint.negate().add((frustum.maxX - frustum.minX) / 2, (frustum.maxY - frustum.minY) / 2));
			info.hide();
		});
	});

	info.setContentNode(content);
	return info;
}
 
Example #16
Source File: Pin.java    From BlockMap with MIT License 5 votes vote down vote up
@Override
protected PopOver initInfo() {
	PopOver info = super.initInfo();
	GridPane content = new GridPane();
	content.getStyleClass().add("grid");

	int rowCount = 0;

	if (maps.size() > 1) {
		content.add(new Label("Map count:"), 0, rowCount);
		content.add(new Label(Integer.toString(maps.size())), 1, rowCount++);
	}

	for (de.piegames.blockmap.world.LevelMetadata.MapPin map : maps) {
		BorderPane mapPane = new BorderPane();
		mapPane.setLeft(new Label("Scale:"));
		mapPane.setRight(new Label("1:" + (1 << map.getScale())));

		if (map.getColors().isPresent()) {
			byte[] data = map.getColors().get();
			WritableImage image = new WritableImage(128, 128);
			for (int x = 0; x < 128; x++)
				for (int y = 0; y < 128; y++)
					image.getPixelWriter().setColor(x, y, COLOR_IDS[0xFF & data[y << 7 | x]]);
			mapPane.setBottom(new ImageView(image));
		}
		content.add(mapPane, 0, rowCount++, 1, 2);
	}
	info.setContentNode(content);
	return info;
}
 
Example #17
Source File: Pin.java    From BlockMap with MIT License 5 votes vote down vote up
@Override
protected PopOver initInfo() {
	PopOver info = super.initInfo();

	GridPane popContent = new GridPane();
	popContent.getStyleClass().add("grid");
	info.setContentNode(popContent);

	StreamUtils.zipWithIndex(chunkGeneration.stream().collect(Collectors.groupingBy(Function.identity(), Collectors.counting())).entrySet().stream())
			.forEach(index -> {
				popContent.add(new Label(index.getValue().getKey() + ":"), 0, (int) index.getIndex());
				popContent.add(new Label(index.getValue().getValue() + " chunks"), 1, (int) index.getIndex());
			});
	return info;
}
 
Example #18
Source File: Pin.java    From BlockMap with MIT License 5 votes vote down vote up
protected PopOver initInfo() {
	PopOver info = new PopOver();
	info.setArrowLocation(ArrowLocation.BOTTOM_CENTER);
	info.setAutoHide(true);
	info.setHeaderAlwaysVisible(true);
	/* Workaround: If the PopOver it too thin, it will be placed a bit off. Bug report: https://github.com/controlsfx/controlsfx/issues/1095 */
	Label content = new Label();
	content.setPrefWidth(130);
	info.setContentNode(content);
	info.setTitle(type.name);
	return info;
}
 
Example #19
Source File: PopOverWrapper.java    From pmd-designer with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void showOrFocus(Consumer<@NonNull PopOver> showMethod) {
    if (myPopover.isPresent() && myPopover.getValue().isShowing()) {
        myPopover.getValue().requestFocus();
    } else if (myPopover.isPresent()) {
        showMethod.accept(myPopover.getValue());
    } else {
        preload(() -> rebinder.apply(identity, null));
        if (myPopover.isEmpty()) {
            System.err.println("Wrong supplier, cannot rebind popover");
        } else {
            showMethod.accept(myPopover.getValue());
        }
    }
}
 
Example #20
Source File: PropertyCollectionView.java    From pmd-designer with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Makes the property popover for a rule.
 */
public static PopOver makePopOver(ObservableXPathRuleBuilder rule, Val<String> titleProperty, DesignerRoot designerRoot) {
    PropertyCollectionView view = new PropertyCollectionView(designerRoot);

    view.setItems(rule.getRuleProperties());

    PopOver popOver = new SmartPopover(view);
    popOver.titleProperty().bind(titleProperty.map(it -> "Properties of " + it));
    popOver.setHeaderAlwaysVisible(true);
    popOver.setPrefWidth(150);
    popOver.setUserData(view);

    return popOver;
}
 
Example #21
Source File: PopOverUtil.java    From pmd-designer with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Display a popover at an anchor node, but owned by an arbitrary other window.
 * In case of nested popovers, the inner ones should not be owned by the outer
 * one, otherwise their detached behavior is not independent.
 *
 * @see PopOver#show(Node, double)
 */
public static void showAt(PopOver popOver, Window owner, javafx.scene.Node anchor, double offset) {
    requireNonNull(owner);

    Bounds bounds = anchor.localToScreen(anchor.getBoundsInLocal());

    switch (popOver.getArrowLocation()) {
    case BOTTOM_CENTER:
    case BOTTOM_LEFT:
    case BOTTOM_RIGHT:
        popOver.show(owner, bounds.getMinX() + bounds.getWidth() / 2,
                     bounds.getMinY() + offset);
        break;
    case LEFT_BOTTOM:
    case LEFT_CENTER:
    case LEFT_TOP:
        popOver.show(owner, bounds.getMaxX() - offset,
                     bounds.getMinY() + bounds.getHeight() / 2);
        break;
    case RIGHT_BOTTOM:
    case RIGHT_CENTER:
    case RIGHT_TOP:
        popOver.show(owner, bounds.getMinX() + offset,
                     bounds.getMinY() + bounds.getHeight() / 2);
        break;
    case TOP_CENTER:
    case TOP_LEFT:
    case TOP_RIGHT:
        popOver.show(owner, bounds.getMinX() + bounds.getWidth() / 2,
                     bounds.getMinY() + bounds.getHeight() - offset);
        break;
    default:
        break;
    }
}
 
Example #22
Source File: ViolationCollectionView.java    From pmd-designer with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Makes the violation popover for a test case
 */
public static PopOver makePopOver(LiveTestCase rule, DesignerRoot designerRoot) {
    ViolationCollectionView view = new ViolationCollectionView(designerRoot);

    view.setItems(rule.getExpectedViolations());

    PopOver popOver = new SmartPopover(view);
    popOver.setUserData(view);
    popOver.getRoot().getStylesheets().add(DesignerUtil.getCss("popover").toString());
    popOver.titleProperty().setValue("Expected violations");
    popOver.setHeaderAlwaysVisible(true);

    //        popOver.setPrefWidth(150);
    return popOver;
}
 
Example #23
Source File: PropertyMapView.java    From pmd-designer with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Makes the property popover for a rule.
 */
public static PopOver makePopOver(LiveTreeRenderer renderer, DesignerRoot designerRoot) {
    PropertyMapView view = new PropertyMapView(designerRoot);

    view.bind(renderer);

    PopOver popOver = new SmartPopover(view);
    setHeader(view, popOver, "Options for this renderer");
    return popOver;
}
 
Example #24
Source File: PropertyMapView.java    From pmd-designer with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Makes the property popover for a rule.
 */
public static PopOver makePopOver(LiveTestCase testCase, DesignerRoot designerRoot) {
    PropertyMapView view = new PropertyMapView(designerRoot);

    view.bind(testCase);

    PopOver popOver = new SmartPopover(view);
    setHeader(view, popOver, "Properties for this test case");
    return popOver;
}
 
Example #25
Source File: Pin.java    From BlockMap with MIT License 4 votes vote down vote up
protected final PopOver getInfo() {
	if (info != null)
		return info;
	else
		return info = initInfo();
}
 
Example #26
Source File: PopOverWrapper.java    From pmd-designer with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void hide() {
    myPopover.getOpt().filter(Window::isShowing).ifPresent(PopOver::hide);
}
 
Example #27
Source File: PopOverWrapper.java    From pmd-designer with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public PopOverWrapper(BiFunction<T, @Nullable PopOver, @Nullable PopOver> rebinder) {
    this.identity = null;
    this.rebinder = rebinder;
}
 
Example #28
Source File: PopOverUtil.java    From pmd-designer with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public static void showAt(PopOver popOver, Window owner, javafx.scene.Node anchor) {
    //todo there's a bug with placement
    showAt(popOver, owner, anchor, 4);
}
 
Example #29
Source File: Main.java    From DashboardFx with GNU General Public License v3.0 4 votes vote down vote up
@FXML
private void openMessages(){
    if(!pop.isShowing()){
        GNAvatarView avatar1 = new GNAvatarView();
        GNAvatarView avatar2 = new GNAvatarView();
        GNAvatarView avatar3 = new GNAvatarView();
        GNAvatarView avatar4 = new GNAvatarView();

        avatar1.setImage(new Image(getClass().getResource("/com/gn/module/media/man.png").toExternalForm()));
        avatar2.setImage(new Image(getClass().getResource("/com/gn/module/media/woman.png").toExternalForm()));
        avatar3.setImage(new Image(getClass().getResource("/com/gn/module/media/man.png").toExternalForm()));

        ObservableList<AlertCell> list = FXCollections.observableArrayList(
                new AlertCell(avatar1, "Will Junior","Lorem ipsum dolor color", "24 minutes ago"),
                new AlertCell(avatar2, "Jad Gail","Lorem ipsum dolor color", "today"),
                new AlertCell(avatar3, "Bart","Lorem ipsum dolor color", "3 seconds ago")
        );

        Separator top = new Separator();
        Separator bottom = new Separator();

        Label message = new Label("Messages");
        Label count = new Label("4 News");
        count.getStyleClass().add("text-success");
        GridPane title = new GridPane();
        title.setMinHeight(40D);

        title.setAlignment(Pos.CENTER);
        title.add(message, 0, 0);
        title.add(count, 1,0);
        GridPane.setHalignment(count, HPos.RIGHT);

        ListView<AlertCell> listView = new ListView<>();

        listView.getItems().addAll(list);
        listView.getStyleClass().add("border-0");

        Button btn = new Button("Read all messages");
        btn.getStyleClass().add("btn-flat");

        VBox root = new VBox(title, top, listView, bottom, btn);
        root.setAlignment(Pos.CENTER);
        root.setPrefSize(300, 300);
        title.setPrefWidth(root.getPrefWidth());
        count.setPrefWidth(root.getPrefWidth());
        message.setPrefWidth(root.getPrefWidth());
        count.setAlignment(Pos.CENTER_RIGHT);
        title.setPadding(new Insets(0, 25, 0, 25));
        btn.setPrefWidth(root.getPrefWidth());

        listView.getStylesheets().add(getClass().getResource("/com/gn/theme/css/custom-scroll.css").toExternalForm());


        pop.getRoot().getStylesheets().add(getClass().getResource("/com/gn/theme/css/poplight.css").toExternalForm());
        pop.setContentNode(root);
        pop.setArrowLocation(PopOver.ArrowLocation.TOP_RIGHT);
        pop.setArrowIndent(0);
        pop.setArrowSize(0);
        pop.setCloseButtonEnabled(false);
        pop.setHeaderAlwaysVisible(false);
        pop.setCornerRadius(0);
        pop.setAutoFix(true);
        pop.show(messages);

    } else {
        pop.hide();
    }
}
 
Example #30
Source File: Main.java    From DashboardFx with GNU General Public License v3.0 4 votes vote down vote up
@FXML
private void openNotification(){
  if(!pop.isShowing()){
        GNAvatarView avatar1 = new GNAvatarView();
        GNAvatarView avatar2 = new GNAvatarView();
        GNAvatarView avatar3 = new GNAvatarView();

        avatar1.setImage(new Image(getClass().getResource("/com/gn/module/media/warning-35.png").toExternalForm()));
        avatar2.setImage(new Image(getClass().getResource("/com/gn/module/media/error-35.png").toExternalForm()));
        avatar3.setImage(new Image(getClass().getResource("/com/gn/module/media/notification-35.png").toExternalForm()));

        ObservableList<AlertCell> list = FXCollections.observableArrayList(
                new AlertCell(avatar1, "Warning","Lorem ipsum dolor color", "24 minutes ago"),
                new AlertCell(avatar2, "Error","Lorem ipsum dolor color", "today"),
                new AlertCell(avatar3, "Notification","Lorem ipsum dolor color", "3 seconds ago")
        );

        Separator top = new Separator();
        Separator bottom = new Separator();

        Label message = new Label("Messages");
        Label count = new Label("4 News");
        count.getStyleClass().add("text-success");
        GridPane title = new GridPane();
        title.setMinHeight(40D);

        title.setAlignment(Pos.CENTER);
        title.add(message, 0, 0);
        title.add(count, 1,0);
        GridPane.setHalignment(count, HPos.RIGHT);

        ListView<AlertCell> listView = new ListView<>();

        listView.getItems().addAll(list);
        listView.getStyleClass().add("border-0");

        Button btn = new Button("Read all messages");
        btn.getStyleClass().add("btn-flat");

        VBox root = new VBox(title, top, listView, bottom, btn);
        root.setAlignment(Pos.CENTER);
        root.setPrefSize(300, 300);
        title.setPrefWidth(root.getPrefWidth());
        count.setPrefWidth(root.getPrefWidth());
        message.setPrefWidth(root.getPrefWidth());
        count.setAlignment(Pos.CENTER_RIGHT);
        title.setPadding(new Insets(0, 25, 0, 25));
        btn.setPrefWidth(root.getPrefWidth());

        listView.getStylesheets().add(getClass().getResource("/com/gn/theme/css/custom-scroll.css").toExternalForm());


        pop.getRoot().getStylesheets().add(getClass().getResource("/com/gn/theme/css/poplight.css").toExternalForm());
        pop.setContentNode(root);
        pop.setArrowLocation(PopOver.ArrowLocation.TOP_RIGHT);
        pop.setArrowIndent(0);
        pop.setArrowSize(0);
        pop.setCloseButtonEnabled(false);
        pop.setHeaderAlwaysVisible(false);
        pop.setCornerRadius(0);
        pop.show(notifications);

    } else {
          pop.hide();
    }
}