Skip to content

Commit

Permalink
Added tooltip support
Browse files Browse the repository at this point in the history
  • Loading branch information
aalmiray committed Mar 28, 2018
1 parent 3cbeb52 commit 2a1896d
Show file tree
Hide file tree
Showing 8 changed files with 131 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,14 @@ $ ./gradlew :sampler:run
* progress-bar-warning
* progress-bar-danger

=== Tooltips

* tooltip-primary
* tooltip-success
* tooltip-info
* tooltip-warning
* tooltip-danger

=== Miscellaneous

* badge
Expand All @@ -190,6 +198,7 @@ image::images/splitmenu-buttons.png[]
.0.2.3

* Added `progress-bar` variants
* Added `tooltip` variants
* Tweaked menu items and menus

.0.2.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
//@import "mixins/nav-divider";
//@import "mixins/forms";
@import "mixins/progress-bar";
@import "mixins/tooltip";
//@import "mixins/table-row";

// Skins
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// Tooltips
// --------------------------------------------------

// Variations
// -------------------------

.tooltip-primary {
@include tooltip-variant($brand-primary, $tooltip-border-color-primary);
}

.tooltip-success {
@include tooltip-variant($brand-success, $tooltip-border-color-success);
}

.tooltip-info {
@include tooltip-variant($brand-info, $tooltip-border-color-info);
}

.tooltip-warning {
@include tooltip-variant($brand-warning, $tooltip-border-color-warning);
}

.tooltip-danger {
@include tooltip-variant($brand-danger, $tooltip-border-color-danger);
}
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,11 @@ $tooltip-arrow-width: 5px !default;
//** Tooltip arrow color
$tooltip-arrow-color: $tooltip-bg !default;

$tooltip-border-color-primary: darken($brand-primary, 2%) !default;
$tooltip-border-color-success: darken($brand-success, 2%) !default;
$tooltip-border-color-info: darken($brand-info, 2%) !default;
$tooltip-border-color-warning: darken($brand-warning, 2%) !default;
$tooltip-border-color-danger: darken($brand-danger, 2%) !default;

//== Popovers
//
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Tooltips

@mixin tooltip-variant($color, $border-color) {
-fx-background: $color;
-fx-background-color: $color;
-fx-text-fill: $tooltip-color;
-fx-border-color: $border-color;
-fx-background-radius: $border-radius-base;
-fx-border-radius: $border-radius-base;
-fx-background-insets: 0;
-fx-padding: 0.667em 0.75em 0.667em 0.75em; /* 10px */
-fx-effect: dropshadow(three-pass-box, rgba(0, 0, 0, 0.5), 10, 0.0, 0, 3);
-fx-font-size: 0.85em;
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
//@import "bootstrap/thumbnails";
@import "bootstrap/alerts";
@import "bootstrap/progress-bars";
@import "bootstrap/tooltips";
//@import "bootstrap/media";
//@import "bootstrap/list-group";
@import "bootstrap/panels";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public void start(Stage primaryStage) throws Exception {
tabPane.getTabs().add(new DemoTab("Panels", "panels.fxml"));
tabPane.getTabs().add(new DemoTab("Headings", "text.fxml"));
tabPane.getTabs().add(new DemoTab("Progress Bars", "progressbars.fxml"));
tabPane.getTabs().add(new DemoTab("Tooltips ", "tooltips.fxml"));
tabPane.getTabs().add(new DemoTab("Text ", "text2.fxml"));
tabPane.getTabs().add(new DemoTab("Paragraph ", "paragraph.fxml"));
tabPane.getTabs().add(new DemoTab("Button Groups ", "button_groups.fxml"));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2015-2018 Andres Almiray
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Tooltip?>
<?import javafx.scene.layout.GridPane?>
<GridPane hgap="10" vgap="10" styleClass="page">
<padding>
<Insets top="20" left="20" bottom="20" right="20"/>
</padding>

<Label GridPane.columnIndex="0" GridPane.rowIndex="0" text="tooltip-primary"/>
<Button GridPane.columnIndex="1" GridPane.rowIndex="0" GridPane.hgrow="ALWAYS"
text="primary" styleClass="btn, btn-primary">
<tooltip>
<Tooltip styleClass="tooltip-primary" text="primary"/>
</tooltip>
</Button>

<Label GridPane.columnIndex="0" GridPane.rowIndex="1" text="tooltip-success"/>
<Button GridPane.columnIndex="1" GridPane.rowIndex="1" GridPane.hgrow="ALWAYS"
text="success" styleClass="btn, btn-success">
<tooltip>
<Tooltip styleClass="tooltip-success" text="success"/>
</tooltip>
</Button>

<Label GridPane.columnIndex="0" GridPane.rowIndex="2" text="tooltip-info"/>
<Button GridPane.columnIndex="1" GridPane.rowIndex="2" GridPane.hgrow="ALWAYS"
text="info" styleClass="btn, btn-info">
<tooltip>
<Tooltip styleClass="tooltip-info" text="info"/>
</tooltip>
</Button>

<Label GridPane.columnIndex="0" GridPane.rowIndex="3" text="tooltip-warning"/>
<Button GridPane.columnIndex="1" GridPane.rowIndex="3" GridPane.hgrow="ALWAYS"
text="warning" styleClass="btn, btn-warning">
<tooltip>
<Tooltip styleClass="tooltip-warning" text="warning"/>
</tooltip>
</Button>

<Label GridPane.columnIndex="0" GridPane.rowIndex="4" text="tooltip-danger"/>
<Button GridPane.columnIndex="1" GridPane.rowIndex="4" GridPane.hgrow="ALWAYS"
text="danger" styleClass="btn, btn-danger">
<tooltip>
<Tooltip styleClass="tooltip-danger" text="danger"/>
</tooltip>
</Button>
</GridPane>

0 comments on commit 2a1896d

Please sign in to comment.