Skip to content

Commit f2da245

Browse files
committed
Updated readme
1 parent b858688 commit f2da245

10 files changed

Lines changed: 33 additions & 26 deletions

File tree

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
238 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,10 @@ To stop the progress:
9393
TaskbarProgressbar.stopProgress(primaryStage);
9494
```
9595
#### 2. Through instantiation *(the recommended way)*
96-
Firstly (after you imported the necessary class) create a `TaskbarProgressbar` instance:
96+
Firstly (after you imported the necessary class) create a `TaskbarProgressbar` instance with the help of
97+
`TaskbarProgressbarFactory`:
9798
```java
98-
TaskbarProgressbar progressbar = TaskbarProgressbar.createInstance(primaryStage);
99+
TaskbarProgressbar progressbar = TaskbarProgressbarFactory.getTaskbarProgressbar(primaryStage);
99100
```
100101
Before any operation you have to show the Stage:
101102
```java
@@ -123,13 +124,22 @@ progressbar.stopProgress();
123124
#### Bonus features
124125

125126
A simple method for showing a fully loaded error progressbar
126-
```
127+
```java
127128
progressbar.showFullErrorProgress();
128129
//equivalent to progressbar.showCustomProgress(100, 100, TaskbarProgressbar.Type.ERROR)
129130
```
130131
<b>Result:</b><br>
131132
![Full errror taskbar progress](images/full-error-progress.jpg)
132133

134+
<i>Also:</i>
135+
```java
136+
progressbar.showFullNormalProgress();
137+
```
138+
139+
```java
140+
progressbar.showFullPausedProgress();
141+
```
142+
133143
## More screenshots
134144
Some more screenshots about what can you do with this library
135145
* A paused progress example:<br>

src/main/java/com/nativejavafx/taskbar/TaskbarProgressbar.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -106,17 +106,6 @@ public void showFullNormalProgress() {
106106
public abstract void closeOperations();
107107

108108
/**
109-
* Creates a {@link TaskbarProgressbar} object.
110-
*
111-
* <p>
112-
* At first it checks that the taskbar progressbar functionality
113-
* is supported on the current system: if it is then it will
114-
* return a fully featured TaskbarProgressbar; otherwise
115-
* it will return a taskbar-progressbar object that actually
116-
* doesn't do anything.
117-
*
118-
* @param stage the stage to get the progressbar on the taskbar to
119-
* @return the taskbar-progressbar object
120109
* @deprecated use {@link TaskbarProgressbarFactory#getTaskbarProgressbar(Stage)} instead.
121110
*/
122111
@Deprecated
@@ -125,7 +114,7 @@ public static TaskbarProgressbar createInstance(Stage stage) {
125114
}
126115

127116
private synchronized static void createCache() {
128-
if (cache == null) cache = TaskbarProgressbarFactory.getTaskbarProgressbar(null, false);
117+
if (cache == null) cache = TaskbarProgressbarFactory.getTaskbarProgressbarImpl(null);
129118
}
130119

131120
/**

src/main/java/com/nativejavafx/taskbar/TaskbarProgressbarFactory.java

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import com.nativejavafx.taskbar.strategy.DefaultStageIndexer;
1919
import javafx.stage.Stage;
2020

21+
import static com.nativejavafx.taskbar.TaskbarProgressbar.isNotSupported;
2122
import static com.nativejavafx.taskbar.TaskbarProgressbar.isSupported;
2223

2324
/**
@@ -26,20 +27,27 @@
2627
*/
2728
public class TaskbarProgressbarFactory {
2829

29-
static TaskbarProgressbar getTaskbarProgressbar(Stage stage, boolean checkSupported) {
30-
if (checkSupported) {
31-
32-
if (!isSupported())
33-
return new NullTaskbarProgressbar();
34-
35-
}
36-
37-
return new TaskbarProgressbarImpl(stage,
38-
new GlassApiHWNDStrategy(new DefaultStageIndexer()));
30+
static TaskbarProgressbar getTaskbarProgressbarImpl(Stage stage) {
31+
return new TaskbarProgressbarImpl(stage, new GlassApiHWNDStrategy(new DefaultStageIndexer()));
3932
}
4033

34+
/**
35+
* Creates a {@link TaskbarProgressbar} object.
36+
*
37+
* <p>
38+
* At first it checks that the taskbar progressbar functionality
39+
* is supported on the current system: if it is then it will
40+
* return a fully featured TaskbarProgressbar; otherwise
41+
* it will return a taskbar-progressbar object that actually
42+
* doesn't do anything.
43+
*
44+
* @param stage the stage to get the progressbar on the taskbar to
45+
* @return the taskbar-progressbar object
46+
*/
4147
public static TaskbarProgressbar getTaskbarProgressbar(Stage stage) {
42-
return getTaskbarProgressbar(stage, true);
48+
if (TaskbarProgressbar.isNotSupported())
49+
return new NullTaskbarProgressbar();
50+
return getTaskbarProgressbarImpl(stage);
4351
}
4452

4553
}

0 commit comments

Comments
 (0)