Skip to content

Commit

Permalink
Merge pull request #514 from dlsc-software-consulting-gmbh/enhancemen…
Browse files Browse the repository at this point in the history
…t-update-shadow-designer-view

Update ShadowDesignerView
  • Loading branch information
dlemmermann authored Oct 19, 2023
2 parents 5ac4969 + d5b584c commit 60eb382
Show file tree
Hide file tree
Showing 47 changed files with 1,144 additions and 353 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.dlsc.jfxcentral2.utilities.cssplayground.CssPlaygroundView;
import com.dlsc.jfxcentral2.utilities.paintpicker.GradientDesignerView;
import com.dlsc.jfxcentral2.utilities.pathextractor.SVGPathExtractorView;
import com.dlsc.jfxcentral2.utilities.shadowdesigner.ShadowDesignerView;
import com.dlsc.jfxcentral2.utilities.effectdesigner.EffectDesignerView;
import com.dlsc.jfxcentral2.utils.ModelObjectTool;
import javafx.scene.Node;
import javafx.scene.control.Label;
Expand Down Expand Up @@ -65,13 +65,13 @@ private Node createToolPane(Utility model) {
setIcon(Material2OutlinedAL.COLOR_LENS);
getStyleClass().add("gradient-designer-overview-box");
return new GradientDesignerView(sizeProperty());
} else if (StringUtils.equalsIgnoreCase(model.getId(), "shadowdesigner")){
setTitle("Shadow Designer");
} else if (StringUtils.equalsIgnoreCase(model.getId(), "effectdesigner")){
setTitle("Effect Designer");
setIcon(SimpleLineIcons.MAGIC_WAND);
getStyleClass().add("shadow-designer-overview-box");
ShadowDesignerView shadowDesignerView = new ShadowDesignerView();
shadowDesignerView.sizeProperty().bind(sizeProperty());
return shadowDesignerView;
getStyleClass().add("effect-designer-overview-box");
EffectDesignerView effectDesignerView = new EffectDesignerView();
effectDesignerView.sizeProperty().bind(sizeProperty());
return effectDesignerView;
}

return createComingSoonPane();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package com.dlsc.jfxcentral2.utilities.effectdesigner;

import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.scene.control.Button;
import javafx.scene.layout.HBox;
import one.jpro.platform.routing.CopyUtil;
import org.apache.commons.lang3.StringUtils;
import org.kordamp.ikonli.boxicons.BoxiconsLogos;
import org.kordamp.ikonli.carbonicons.CarbonIcons;
import org.kordamp.ikonli.javafx.FontIcon;

public class CopyEffectCodeView extends HBox {

public CopyEffectCodeView(Runnable onCopyCompleted) {
getStyleClass().add("copy-effect-code-view");

FontIcon javaIcon = new FontIcon(CarbonIcons.CODE);
Button copyJavaCode = new Button("Java Code", javaIcon);
copyJavaCode.getStyleClass().addAll("fill-button","java-button");
copyJavaCode.setOnAction(event -> onCopyCompleted.run());
copyJavaCode.disableProperty().bind(javaCode.isEmpty());
javaCodeProperty().addListener((observable, oldValue, newValue) -> {
if (!StringUtils.isEmpty(newValue)) {
CopyUtil.setCopyOnClick(copyJavaCode, newValue);
}
});

FontIcon cssIcon = new FontIcon(BoxiconsLogos.CSS3);
Button copyCssCode = new Button("CSS Code", cssIcon);
copyCssCode.getStyleClass().addAll("fill-button","css-button");
copyCssCode.setOnAction(event -> onCopyCompleted.run());
copyCssCode.disableProperty().bind(cssCode.isEmpty());
cssCodeProperty().addListener((observable, oldValue, newValue) -> {
if (!StringUtils.isEmpty(newValue)) {
CopyUtil.setCopyOnClick(copyCssCode, newValue);
}
});

getChildren().setAll(copyJavaCode, copyCssCode);
}


private final StringProperty javaCode = new SimpleStringProperty(this, "javaCode");

public String getJavaCode() {
return javaCode.get();
}

public StringProperty javaCodeProperty() {
return javaCode;
}

public void setJavaCode(String javaCode) {
this.javaCode.set(javaCode);
}

private final StringProperty cssCode = new SimpleStringProperty(this, "cssCode");

public String getCssCode() {
return cssCode.get();
}

public StringProperty cssCodeProperty() {
return cssCode;
}

public void setCssCode(String cssCode) {
this.cssCode.set(cssCode);
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
package com.dlsc.jfxcentral2.utilities.shadowdesigner;
package com.dlsc.jfxcentral2.utilities.effectdesigner;

import com.dlsc.jfxcentral2.components.PaneBase;
import com.dlsc.jfxcentral2.utilities.shadowdesigner.editor.BlendBottomInputEditor;
import com.dlsc.jfxcentral2.utilities.shadowdesigner.editor.BlendTopInputEditor;
import com.dlsc.jfxcentral2.utilities.shadowdesigner.editor.BloomEditor;
import com.dlsc.jfxcentral2.utilities.shadowdesigner.editor.BoxBlurEditor;
import com.dlsc.jfxcentral2.utilities.shadowdesigner.editor.ColorAdjustEditor;
import com.dlsc.jfxcentral2.utilities.shadowdesigner.editor.ColorInputEditor;
import com.dlsc.jfxcentral2.utilities.shadowdesigner.editor.DisplacementMapEditor;
import com.dlsc.jfxcentral2.utilities.shadowdesigner.editor.DropShadowEditor;
import com.dlsc.jfxcentral2.utilities.shadowdesigner.editor.GaussianBlurEditor;
import com.dlsc.jfxcentral2.utilities.shadowdesigner.editor.GlowEditor;
import com.dlsc.jfxcentral2.utilities.shadowdesigner.editor.ImageInputEditor;
import com.dlsc.jfxcentral2.utilities.shadowdesigner.editor.InnerShadowEditor;
import com.dlsc.jfxcentral2.utilities.shadowdesigner.editor.MotionBlurEditor;
import com.dlsc.jfxcentral2.utilities.shadowdesigner.editor.PerspectiveTransformEditor;
import com.dlsc.jfxcentral2.utilities.shadowdesigner.editor.ReflectionEditor;
import com.dlsc.jfxcentral2.utilities.shadowdesigner.editor.SepiaToneEditor;
import com.dlsc.jfxcentral2.utilities.shadowdesigner.editor.ShadowEditor;
import com.dlsc.jfxcentral2.utilities.shadowdesigner.effect.BlendBottomInput;
import com.dlsc.jfxcentral2.utilities.shadowdesigner.effect.BlendTopInput;
import com.dlsc.jfxcentral2.utilities.effectdesigner.editor.BlendBottomInputEditor;
import com.dlsc.jfxcentral2.utilities.effectdesigner.editor.BlendTopInputEditor;
import com.dlsc.jfxcentral2.utilities.effectdesigner.editor.BloomEditor;
import com.dlsc.jfxcentral2.utilities.effectdesigner.editor.BoxBlurEditor;
import com.dlsc.jfxcentral2.utilities.effectdesigner.editor.ColorAdjustEditor;
import com.dlsc.jfxcentral2.utilities.effectdesigner.editor.ColorInputEditor;
import com.dlsc.jfxcentral2.utilities.effectdesigner.editor.DisplacementMapEditor;
import com.dlsc.jfxcentral2.utilities.effectdesigner.editor.DropShadowEditor;
import com.dlsc.jfxcentral2.utilities.effectdesigner.editor.GaussianBlurEditor;
import com.dlsc.jfxcentral2.utilities.effectdesigner.editor.GlowEditor;
import com.dlsc.jfxcentral2.utilities.effectdesigner.editor.ImageInputEditor;
import com.dlsc.jfxcentral2.utilities.effectdesigner.editor.InnerShadowEditor;
import com.dlsc.jfxcentral2.utilities.effectdesigner.editor.LightingBumpInputEditor;
import com.dlsc.jfxcentral2.utilities.effectdesigner.editor.LightingContentInputEditor;
import com.dlsc.jfxcentral2.utilities.effectdesigner.editor.MotionBlurEditor;
import com.dlsc.jfxcentral2.utilities.effectdesigner.editor.PerspectiveTransformEditor;
import com.dlsc.jfxcentral2.utilities.effectdesigner.editor.ReflectionEditor;
import com.dlsc.jfxcentral2.utilities.effectdesigner.editor.SepiaToneEditor;
import com.dlsc.jfxcentral2.utilities.effectdesigner.editor.ShadowEditor;
import com.dlsc.jfxcentral2.utilities.effectdesigner.effect.BlendBottomInput;
import com.dlsc.jfxcentral2.utilities.effectdesigner.effect.BlendTopInput;
import com.dlsc.jfxcentral2.utilities.effectdesigner.effect.LightingBumpInput;
import com.dlsc.jfxcentral2.utilities.effectdesigner.effect.LightingContentInput;
import javafx.beans.InvalidationListener;
import javafx.beans.binding.Bindings;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.control.Label;
Expand All @@ -45,10 +48,10 @@
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;

public class ShadowDesignerView extends PaneBase {
public class EffectDesignerView extends PaneBase {

public ShadowDesignerView() {
getStyleClass().add("shadow-designer-view");
public EffectDesignerView() {
getStyleClass().add("effect-designer-view");
setAlignment(Pos.TOP_LEFT);

StackPane previewPane = new StackPane();
Expand All @@ -67,7 +70,10 @@ public ShadowDesignerView() {
if (newEffect == null) {
effectPaneWrapper.getChildren().clear();
}
Node node = createOptionPane(newEffect, () -> effectFlowPane.getEffects().remove(newEffect));
Node node = createOptionPane(newEffect, () -> {
effectFlowPane.requestFocus();
effectFlowPane.getEffects().remove(newEffect);
});
if (node == null) {
effectPaneWrapper.getChildren().clear();
} else {
Expand All @@ -80,8 +86,6 @@ public ShadowDesignerView() {

VBox rightBox = new VBox(effectFlowPane, effectPaneWrapper);
rightBox.getStyleClass().addAll("right-box", "with-non-effect");
rightBox.alignmentProperty().bind(Bindings.createObjectBinding(() ->
effectPaneWrapper.isVisible() && !effectFlowPane.getEffects().isEmpty() ? Pos.TOP_LEFT : Pos.CENTER, effectPaneWrapper.visibleProperty()));

effectFlowPane.getEffects().addListener((InvalidationListener) observable -> {
if (effectFlowPane.getEffects().isEmpty()) {
Expand Down Expand Up @@ -125,6 +129,10 @@ private Node createOptionPane(Effect newEffect, Runnable deleteAction) {
node = new ImageInputEditor(effect, deleteAction);
} else if (newEffect instanceof InnerShadow effect) {
node = new InnerShadowEditor(effect, deleteAction);
} else if (newEffect instanceof LightingBumpInput effect){
node = new LightingBumpInputEditor(effect, deleteAction);
} else if (newEffect instanceof LightingContentInput effect){
node = new LightingContentInputEditor(effect, deleteAction);
} else if (newEffect instanceof MotionBlur effect) {
node = new MotionBlurEditor(effect, deleteAction);
} else if (newEffect instanceof PerspectiveTransform effect) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.dlsc.jfxcentral2.utilities.shadowdesigner;
package com.dlsc.jfxcentral2.utilities.effectdesigner;

import com.dlsc.jfxcentral2.utilities.shadowdesigner.effect.BlendBottomInput;
import com.dlsc.jfxcentral2.utilities.shadowdesigner.effect.BlendTopInput;
import com.dlsc.jfxcentral2.utilities.effectdesigner.effect.BlendBottomInput;
import com.dlsc.jfxcentral2.utilities.effectdesigner.effect.BlendTopInput;
import com.dlsc.jfxcentral2.utilities.effectdesigner.effect.LightingBumpInput;
import com.dlsc.jfxcentral2.utilities.effectdesigner.effect.LightingContentInput;
import javafx.scene.effect.Bloom;
import javafx.scene.effect.BoxBlur;
import javafx.scene.effect.ColorAdjust;
Expand All @@ -24,8 +26,8 @@

public enum EffectEnum {
//BLEND("Blend", Blend.class),
BLEND_TOP_INPUT("Blend (TopInPut)", BlendTopInput.class),
BLEND_BOTTOM_INPUT("Blend (BottomInput)", BlendBottomInput.class),
BLEND_TOP_INPUT("Blend (Top)", BlendTopInput.class),
BLEND_BOTTOM_INPUT("Blend (Bottom)", BlendBottomInput.class),
BLOOM("Bloom", Bloom.class),
BOX_BLUR("BoxBlur", BoxBlur.class),
COLOR_ADJUST("ColorAdjust", ColorAdjust.class),
Expand All @@ -37,8 +39,8 @@ public enum EffectEnum {
IMAGE_INPUT("ImageInput", ImageInput.class),
INNER_SHADOW("InnerShadow", InnerShadow.class),
//LIGHTING("Lighting", Lighting.class),
//LIGHTING_BUMP_INPUT("Lighting (BumpInput)", LightingBumpInput.class),
//LIGHTING_CONTENT_INPUT("Lighting (ContentInput)", LightingContentInput.class),
LIGHTING_BUMP_INPUT("Lighting (Bump)", LightingBumpInput.class),
LIGHTING_CONTENT_INPUT("Lighting (Content)", LightingContentInput.class),
MOTION_BLUR("MotionBlur", MotionBlur.class),
PERSPECTIVE_TRANSFORM("PerspectiveTransform", PerspectiveTransform.class),
REFLECTION("Reflection", Reflection.class),
Expand Down
Loading

0 comments on commit 60eb382

Please sign in to comment.