Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRAFT: MigPane integration & support improved for custom components. #229

Open
wants to merge 1 commit into
base: 8u-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ subprojects {
}

dependencies {
// MigPane integration.
compile 'com.miglayout:miglayout-core:5.2'
compile 'com.miglayout:miglayout-javafx:5.2'

// maven dependencies
compile 'org.eclipse.aether:aether-api:1.1.0'
compile 'org.eclipse.aether:aether-impl:1.1.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,8 @@ private boolean isStaticPropertyRelevant(PropertyName propName) {
else {
// Check if the static property class is the common parent of the selection
if (getCommonParent() == null) return false;
isRelevant = getCommonParent() == propName.getResidenceClass();
// Superclass properties are valid for extended classes! Example: Pane1 extends AnchorPane => Pane1 childs must have AnchorPane layout props.
isRelevant = propName.getResidenceClass().isAssignableFrom(getCommonParent());
}
return isRelevant;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import java.net.URL;
import java.util.Comparator;
import javafx.scene.layout.Region;
import org.tbee.javafx.scene.layout.fxml.MigPane;

/**
*
Expand Down Expand Up @@ -187,6 +188,7 @@ private BuiltinLibrary() {
addRegionItem200x200(javafx.scene.control.TitledPane.class, TAG_CONTAINERS, EMPTY_QUALIFIER);
addCustomizedItem(javafx.scene.control.ToolBar.class, TAG_CONTAINERS);
addRegionItem100x200(javafx.scene.layout.VBox.class, TAG_CONTAINERS);
addRegionItem200x200(org.tbee.javafx.scene.layout.fxml.MigPane.class, TAG_CONTAINERS); // MigPane integration.

// Controls
addCustomizedItem(javafx.scene.control.Button.class, TAG_CONTROLS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4885,6 +4885,44 @@ public boolean isPropertyTrimmingNeeded(PropertyName name) {
new InspectorPath("Properties", "Include FXML file", 2));


// MigPane integration.
private final ComponentClassMetadata MigPaneMetadata =
new ComponentClassMetadata(org.tbee.javafx.scene.layout.fxml.MigPane.class, PaneMetadata);

private final PropertyName MigPane_layoutName =
new PropertyName("layout");
private final PropertyName MigPane_colsName =
new PropertyName("cols");
private final PropertyName MigPane_rowsName =
new PropertyName("rows");
private final PropertyName MigPane_ccName =
new PropertyName("cc", org.tbee.javafx.scene.layout.fxml.MigPane.class);

private final ValuePropertyMetadata MigPane_layoutPropertyMetadata =
new StringPropertyMetadata(
MigPane_layoutName,
true, /* readWrite */
null, /* defaultValue */
new InspectorPath("Properties", "Layout", 0));
private final ValuePropertyMetadata MigPane_colsPropertyMetadata =
new StringPropertyMetadata(
MigPane_colsName,
true, /* readWrite */
null, /* defaultValue */
new InspectorPath("Properties", "Layout", 1));
private final ValuePropertyMetadata MigPane_rowsPropertyMetadata =
new StringPropertyMetadata(
MigPane_rowsName,
true, /* readWrite */
null, /* defaultValue */
new InspectorPath("Properties", "Layout", 2));
private final ValuePropertyMetadata MigPane_ccPropertyMetadata =
new StringPropertyMetadata(
MigPane_ccName,
true, /* readWrite */
null, /* defaultValue */
new InspectorPath("Layout", "Mig Pane Constraints", 0));


private Metadata() {

Expand Down Expand Up @@ -6301,6 +6339,14 @@ private Metadata() {
sectionNames.add("Layout");
sectionNames.add("Code");

// MigPane integration.
MigPaneMetadata.getProperties().add(MigPane_layoutPropertyMetadata);
MigPaneMetadata.getProperties().add(MigPane_colsPropertyMetadata);
MigPaneMetadata.getProperties().add(MigPane_rowsPropertyMetadata);
componentClassMap.put(MigPaneMetadata.getKlass(), MigPaneMetadata);
NodeMetadata.getProperties().add(MigPane_ccPropertyMetadata);
IncludeElementMetadata.getProperties().add(MigPane_ccPropertyMetadata);

// Populates subSectionMap
final List<String> ss0 = new ArrayList<>();
ss0.add("Custom");
Expand All @@ -6325,6 +6371,7 @@ private Metadata() {
ss1.add("Stack Pane Constraints");
ss1.add("Tile Pane Constraints");
ss1.add("VBox Constraints");
ss1.add("Mig Pane Constraints"); // MigPane integration.
ss1.add("Internal");
ss1.add("Specific");
ss1.add("Size");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import com.oracle.javafx.scenebuilder.kit.editor.panel.inspector.editors.util.SBDuration;
import com.oracle.javafx.scenebuilder.kit.metadata.klass.ComponentClassMetadata;
import com.oracle.javafx.scenebuilder.kit.metadata.klass.CustomComponentClassMetadata;
import com.oracle.javafx.scenebuilder.kit.metadata.property.ComponentPropertyMetadata;
import com.oracle.javafx.scenebuilder.kit.metadata.property.PropertyMetadata;
import com.oracle.javafx.scenebuilder.kit.metadata.property.value.BooleanPropertyMetadata;
import com.oracle.javafx.scenebuilder.kit.metadata.property.value.DurationPropertyMetadata;
Expand Down Expand Up @@ -298,6 +299,12 @@ private PropertyMetadata makePropertyMetadata(PropertyName name,
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
} else if (javafx.scene.Node.class.isAssignableFrom(propertyType)) {
// Add a Node based properies (ex: context on Region extended component)!
result = new ComponentPropertyMetadata(
name,
Metadata.getMetadata().queryComponentMetadata(javafx.scene.Node.class),
false);
} else {
result = null;
}
Expand Down