-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #506 from dlsc-software-consulting-gmbh/features-a…
…dd-cssplayground
- Loading branch information
Showing
28 changed files
with
5,893 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
components/src/main/java/com/dlsc/jfxcentral2/utilities/cssplayground/CssPlaygroundView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package com.dlsc.jfxcentral2.utilities.cssplayground; | ||
|
||
import com.dlsc.jfxcentral2.components.FileHandlerView; | ||
import com.dlsc.jfxcentral2.components.PaneBase; | ||
import com.dlsc.jfxcentral2.utils.StringUtil; | ||
import javafx.concurrent.Service; | ||
import javafx.concurrent.Task; | ||
import javafx.scene.control.Label; | ||
import javafx.scene.layout.VBox; | ||
import org.kordamp.ikonli.antdesignicons.AntDesignIconsOutlined; | ||
import org.kordamp.ikonli.javafx.FontIcon; | ||
|
||
import java.util.List; | ||
|
||
|
||
public class CssPlaygroundView extends PaneBase { | ||
|
||
private final Label tipsLabel; | ||
private final VBox container ; | ||
|
||
public CssPlaygroundView() { | ||
getStyleClass().add("css-playground-view"); | ||
|
||
FileHandlerView fileHandlerView = new FileHandlerView(true, true, true); | ||
fileHandlerView.getSupportedExtensions().add(".css"); | ||
fileHandlerView.setText("Click or drop CSS files here"); | ||
fileHandlerView.managedProperty().bind(fileHandlerView.visibleProperty()); | ||
fileHandlerView.setVisible(false); | ||
|
||
tipsLabel = new Label(StringUtil.LOADING_TIPS); | ||
tipsLabel.getStyleClass().add("tips-label"); | ||
tipsLabel.setGraphic(new FontIcon(AntDesignIconsOutlined.CLOUD_DOWNLOAD)); | ||
|
||
container = new VBox(); | ||
container.getChildren().addAll(fileHandlerView, tipsLabel); | ||
container.getStyleClass().add("container"); | ||
|
||
getChildren().setAll(container); | ||
|
||
CssShowcaseService service = new CssShowcaseService(); | ||
service.setOnSucceeded(event -> { | ||
CssShowcaseView cssShowcaseView = service.getValue(); | ||
fileHandlerView.setOnUploadedFile(file -> cssShowcaseView.cssFileHandler(List.of(file))); | ||
fileHandlerView.setVisible(true); | ||
|
||
container.getChildren().remove(tipsLabel); | ||
container.getChildren().add(cssShowcaseView); | ||
}); | ||
|
||
service.start(); | ||
} | ||
|
||
private static class CssShowcaseService extends Service<CssShowcaseView> { | ||
@Override | ||
protected Task<CssShowcaseView> createTask() { | ||
return new Task<>() { | ||
@Override | ||
protected CssShowcaseView call() { | ||
return new CssShowcaseView(); | ||
} | ||
}; | ||
} | ||
} | ||
} | ||
|
Oops, something went wrong.