Search in sources :

Example 1 with AbstractEditor

use of au.gov.asd.tac.constellation.views.attributeeditor.editors.AbstractEditorFactory.AbstractEditor in project constellation by constellation-app.

the class AttributeEditorPanel method modifyAttributeAction.

private void modifyAttributeAction(final AttributeData attr) {
    final EditOperation editOperation = new ModifyAttributeEditOperation(attr);
    final List<String> extantAttributeNames = currentAttributeNames.get(attr.getElementType());
    final ValueValidator<AttributePrototype> validator = v -> extantAttributeNames.contains(v.getAttributeName()) && !attr.getAttributeName().equals(v.getAttributeName()) ? "An attribute with that name already exists." : null;
    final AbstractEditor<AttributePrototype> editor = ATTRIBUTE_EDITOR_FACTORY.createEditor(editOperation, validator, String.format("Modify %s attribute %s", attr.getElementType().getShortLabel(), attr.getAttributeName()), attr);
    ((AttributeEditor) editor).setGraphElementType(attr.getElementType());
    ((AttributeEditor) editor).setTypeModifiable(false);
    final AttributeEditorDialog dialog = new AttributeEditorDialog(false, editor);
    dialog.showDialog();
}
Also used : HPos(javafx.geometry.HPos) StackPane(javafx.scene.layout.StackPane) SchemaFactory(au.gov.asd.tac.constellation.graph.schema.SchemaFactory) ScrollPane(javafx.scene.control.ScrollPane) Map(java.util.Map) ZonedDateTimeAttributeDescription(au.gov.asd.tac.constellation.graph.attribute.ZonedDateTimeAttributeDescription) ZoneOffset(java.time.ZoneOffset) ValueValidator(au.gov.asd.tac.constellation.graph.attribute.interaction.ValueValidator) UserInterfaceIconProvider(au.gov.asd.tac.constellation.utilities.icon.UserInterfaceIconProvider) EditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.EditOperation) GraphManager(au.gov.asd.tac.constellation.graph.manager.GraphManager) Event(javafx.event.Event) Set(java.util.Set) Rectangle(javafx.scene.shape.Rectangle) KeyEvent(javafx.scene.input.KeyEvent) ZoneId(java.time.ZoneId) Platform(javafx.application.Platform) PluginInfo(au.gov.asd.tac.constellation.plugins.PluginInfo) AbstractEditorFactory(au.gov.asd.tac.constellation.views.attributeeditor.editors.AbstractEditorFactory) ModifyAttributeEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.ModifyAttributeEditOperation) ObservableList(javafx.collections.ObservableList) BorderPane(javafx.scene.layout.BorderPane) AttributeValueTranslator(au.gov.asd.tac.constellation.graph.attribute.interaction.AttributeValueTranslator) StringProperty(javafx.beans.property.StringProperty) NbPreferences(org.openide.util.NbPreferences) CreateAttributeEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.CreateAttributeEditOperation) GraphWriteMethods(au.gov.asd.tac.constellation.graph.GraphWriteMethods) MouseButton(javafx.scene.input.MouseButton) AttributeValueEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.AttributeValueEditOperation) ColumnConstraints(javafx.scene.layout.ColumnConstraints) ColorAttributeDescription(au.gov.asd.tac.constellation.graph.schema.visual.attribute.ColorAttributeDescription) AttributeValueEditorFactory(au.gov.asd.tac.constellation.views.attributeeditor.editors.AttributeValueEditorFactory) FXCollections(javafx.collections.FXCollections) TooltipPane(au.gov.asd.tac.constellation.utilities.tooltip.TooltipPane) TreeSet(java.util.TreeSet) TransferMode(javafx.scene.input.TransferMode) CollectionUtils(org.apache.commons.collections4.CollectionUtils) ArrayList(java.util.ArrayList) Graph(au.gov.asd.tac.constellation.graph.Graph) Dragboard(javafx.scene.input.Dragboard) DefaultGetter(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.DefaultGetter) PluginTags(au.gov.asd.tac.constellation.plugins.templates.PluginTags) TextAlignment(javafx.scene.text.TextAlignment) StringUtilities(au.gov.asd.tac.constellation.utilities.text.StringUtilities) GridPane(javafx.scene.layout.GridPane) Color(javafx.scene.paint.Color) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) TitledPane(javafx.scene.control.TitledPane) ConstellationColor(au.gov.asd.tac.constellation.utilities.color.ConstellationColor) Node(javafx.scene.Node) SchemaConcept(au.gov.asd.tac.constellation.graph.schema.concept.SchemaConcept) PluginException(au.gov.asd.tac.constellation.plugins.PluginException) Preferences(java.util.prefs.Preferences) Menu(javafx.scene.control.Menu) ContextMenuEvent(javafx.scene.input.ContextMenuEvent) KeyCodeCombination(javafx.scene.input.KeyCodeCombination) SelectionMode(javafx.scene.control.SelectionMode) TreeMap(java.util.TreeMap) ImageView(javafx.scene.image.ImageView) ObservableValue(javafx.beans.value.ObservableValue) Button(javafx.scene.control.Button) TimeZoneEditorFactory(au.gov.asd.tac.constellation.views.attributeeditor.editors.TimeZoneEditorFactory) Pos(javafx.geometry.Pos) ReadableGraph(au.gov.asd.tac.constellation.graph.ReadableGraph) ListCell(javafx.scene.control.ListCell) SimpleEditPlugin(au.gov.asd.tac.constellation.plugins.templates.SimpleEditPlugin) CheckMenuItem(javafx.scene.control.CheckMenuItem) PluginType(au.gov.asd.tac.constellation.plugins.PluginType) VBox(javafx.scene.layout.VBox) PrimaryKeyEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.PrimaryKeyEditOperation) KeyCombination(javafx.scene.input.KeyCombination) ContextMenu(javafx.scene.control.ContextMenu) AbstractAttributeInteraction(au.gov.asd.tac.constellation.graph.attribute.interaction.AbstractAttributeInteraction) PluginExecution(au.gov.asd.tac.constellation.plugins.PluginExecution) HBox(javafx.scene.layout.HBox) TextField(javafx.scene.control.TextField) MenuItem(javafx.scene.control.MenuItem) SeparatorConstants(au.gov.asd.tac.constellation.utilities.text.SeparatorConstants) TimeZone(java.util.TimeZone) Collection(java.util.Collection) Text(javafx.scene.text.Text) Priority(javafx.scene.layout.Priority) List(java.util.List) ToggleButton(javafx.scene.control.ToggleButton) DataFormat(javafx.scene.input.DataFormat) Entry(java.util.Map.Entry) ClipboardContent(javafx.scene.input.ClipboardContent) JavafxStyleManager(au.gov.asd.tac.constellation.utilities.javafx.JavafxStyleManager) ListSelectionEditor(au.gov.asd.tac.constellation.views.attributeeditor.editors.ListSelectionEditorFactory.ListSelectionEditor) UpdateTimeZonePlugin(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.UpdateTimeZonePlugin) ListView(javafx.scene.control.ListView) AttributeEditor(au.gov.asd.tac.constellation.views.attributeeditor.editors.AttributeEditorFactory.AttributeEditor) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) MouseEvent(javafx.scene.input.MouseEvent) HashMap(java.util.HashMap) ClipboardUtilities(au.gov.asd.tac.constellation.graph.interaction.plugins.clipboard.ClipboardUtilities) HashSet(java.util.HashSet) FontUtilities(au.gov.asd.tac.constellation.utilities.font.FontUtilities) Insets(javafx.geometry.Insets) PluginInteraction(au.gov.asd.tac.constellation.plugins.PluginInteraction) Tooltip(javafx.scene.control.Tooltip) SchemaAttribute(au.gov.asd.tac.constellation.graph.schema.attribute.SchemaAttribute) SchemaConceptUtilities(au.gov.asd.tac.constellation.graph.schema.concept.SchemaConceptUtilities) KeyCode(javafx.scene.input.KeyCode) PrimaryKeyDefaultGetter(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.PrimaryKeyDefaultGetter) MenuBar(javafx.scene.control.MenuBar) AbstractEditor(au.gov.asd.tac.constellation.views.attributeeditor.editors.AbstractEditorFactory.AbstractEditor) GraphElementType(au.gov.asd.tac.constellation.graph.GraphElementType) AttributeEditorFactory(au.gov.asd.tac.constellation.views.attributeeditor.editors.AttributeEditorFactory) ListSelectionEditorFactory(au.gov.asd.tac.constellation.views.attributeeditor.editors.ListSelectionEditorFactory) ActionEvent(javafx.event.ActionEvent) Collections(java.util.Collections) ModifyAttributeEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.ModifyAttributeEditOperation) AttributeEditor(au.gov.asd.tac.constellation.views.attributeeditor.editors.AttributeEditorFactory.AttributeEditor) EditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.EditOperation) ModifyAttributeEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.ModifyAttributeEditOperation) CreateAttributeEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.CreateAttributeEditOperation) AttributeValueEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.AttributeValueEditOperation) PrimaryKeyEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.PrimaryKeyEditOperation)

Example 2 with AbstractEditor

use of au.gov.asd.tac.constellation.views.attributeeditor.editors.AbstractEditorFactory.AbstractEditor in project constellation by constellation-app.

the class AttributeEditorPanel method createAttributeAction.

private void createAttributeAction(final GraphElementType elementType) {
    final EditOperation editOperation = new CreateAttributeEditOperation();
    final List<String> extantAttributeNames = currentAttributeNames.get(elementType);
    final ValueValidator<AttributePrototype> validator = v -> extantAttributeNames.contains(v.getAttributeName()) ? "An attribute with that name already exists." : null;
    final AbstractEditor<AttributePrototype> editor = ATTRIBUTE_EDITOR_FACTORY.createEditor(editOperation, validator, String.format("Create %s attribute", elementType.getShortLabel()), AttributePrototype.getBlankPrototype(elementType));
    ((AttributeEditor) editor).setGraphElementType(elementType);
    ((AttributeEditor) editor).setTypeModifiable(true);
    final AttributeEditorDialog dialog = new AttributeEditorDialog(false, editor);
    dialog.showDialog();
}
Also used : HPos(javafx.geometry.HPos) StackPane(javafx.scene.layout.StackPane) SchemaFactory(au.gov.asd.tac.constellation.graph.schema.SchemaFactory) ScrollPane(javafx.scene.control.ScrollPane) Map(java.util.Map) ZonedDateTimeAttributeDescription(au.gov.asd.tac.constellation.graph.attribute.ZonedDateTimeAttributeDescription) ZoneOffset(java.time.ZoneOffset) ValueValidator(au.gov.asd.tac.constellation.graph.attribute.interaction.ValueValidator) UserInterfaceIconProvider(au.gov.asd.tac.constellation.utilities.icon.UserInterfaceIconProvider) EditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.EditOperation) GraphManager(au.gov.asd.tac.constellation.graph.manager.GraphManager) Event(javafx.event.Event) Set(java.util.Set) Rectangle(javafx.scene.shape.Rectangle) KeyEvent(javafx.scene.input.KeyEvent) ZoneId(java.time.ZoneId) Platform(javafx.application.Platform) PluginInfo(au.gov.asd.tac.constellation.plugins.PluginInfo) AbstractEditorFactory(au.gov.asd.tac.constellation.views.attributeeditor.editors.AbstractEditorFactory) ModifyAttributeEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.ModifyAttributeEditOperation) ObservableList(javafx.collections.ObservableList) BorderPane(javafx.scene.layout.BorderPane) AttributeValueTranslator(au.gov.asd.tac.constellation.graph.attribute.interaction.AttributeValueTranslator) StringProperty(javafx.beans.property.StringProperty) NbPreferences(org.openide.util.NbPreferences) CreateAttributeEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.CreateAttributeEditOperation) GraphWriteMethods(au.gov.asd.tac.constellation.graph.GraphWriteMethods) MouseButton(javafx.scene.input.MouseButton) AttributeValueEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.AttributeValueEditOperation) ColumnConstraints(javafx.scene.layout.ColumnConstraints) ColorAttributeDescription(au.gov.asd.tac.constellation.graph.schema.visual.attribute.ColorAttributeDescription) AttributeValueEditorFactory(au.gov.asd.tac.constellation.views.attributeeditor.editors.AttributeValueEditorFactory) FXCollections(javafx.collections.FXCollections) TooltipPane(au.gov.asd.tac.constellation.utilities.tooltip.TooltipPane) TreeSet(java.util.TreeSet) TransferMode(javafx.scene.input.TransferMode) CollectionUtils(org.apache.commons.collections4.CollectionUtils) ArrayList(java.util.ArrayList) Graph(au.gov.asd.tac.constellation.graph.Graph) Dragboard(javafx.scene.input.Dragboard) DefaultGetter(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.DefaultGetter) PluginTags(au.gov.asd.tac.constellation.plugins.templates.PluginTags) TextAlignment(javafx.scene.text.TextAlignment) StringUtilities(au.gov.asd.tac.constellation.utilities.text.StringUtilities) GridPane(javafx.scene.layout.GridPane) Color(javafx.scene.paint.Color) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) TitledPane(javafx.scene.control.TitledPane) ConstellationColor(au.gov.asd.tac.constellation.utilities.color.ConstellationColor) Node(javafx.scene.Node) SchemaConcept(au.gov.asd.tac.constellation.graph.schema.concept.SchemaConcept) PluginException(au.gov.asd.tac.constellation.plugins.PluginException) Preferences(java.util.prefs.Preferences) Menu(javafx.scene.control.Menu) ContextMenuEvent(javafx.scene.input.ContextMenuEvent) KeyCodeCombination(javafx.scene.input.KeyCodeCombination) SelectionMode(javafx.scene.control.SelectionMode) TreeMap(java.util.TreeMap) ImageView(javafx.scene.image.ImageView) ObservableValue(javafx.beans.value.ObservableValue) Button(javafx.scene.control.Button) TimeZoneEditorFactory(au.gov.asd.tac.constellation.views.attributeeditor.editors.TimeZoneEditorFactory) Pos(javafx.geometry.Pos) ReadableGraph(au.gov.asd.tac.constellation.graph.ReadableGraph) ListCell(javafx.scene.control.ListCell) SimpleEditPlugin(au.gov.asd.tac.constellation.plugins.templates.SimpleEditPlugin) CheckMenuItem(javafx.scene.control.CheckMenuItem) PluginType(au.gov.asd.tac.constellation.plugins.PluginType) VBox(javafx.scene.layout.VBox) PrimaryKeyEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.PrimaryKeyEditOperation) KeyCombination(javafx.scene.input.KeyCombination) ContextMenu(javafx.scene.control.ContextMenu) AbstractAttributeInteraction(au.gov.asd.tac.constellation.graph.attribute.interaction.AbstractAttributeInteraction) PluginExecution(au.gov.asd.tac.constellation.plugins.PluginExecution) HBox(javafx.scene.layout.HBox) TextField(javafx.scene.control.TextField) MenuItem(javafx.scene.control.MenuItem) SeparatorConstants(au.gov.asd.tac.constellation.utilities.text.SeparatorConstants) TimeZone(java.util.TimeZone) Collection(java.util.Collection) Text(javafx.scene.text.Text) Priority(javafx.scene.layout.Priority) List(java.util.List) ToggleButton(javafx.scene.control.ToggleButton) DataFormat(javafx.scene.input.DataFormat) Entry(java.util.Map.Entry) ClipboardContent(javafx.scene.input.ClipboardContent) JavafxStyleManager(au.gov.asd.tac.constellation.utilities.javafx.JavafxStyleManager) ListSelectionEditor(au.gov.asd.tac.constellation.views.attributeeditor.editors.ListSelectionEditorFactory.ListSelectionEditor) UpdateTimeZonePlugin(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.UpdateTimeZonePlugin) ListView(javafx.scene.control.ListView) AttributeEditor(au.gov.asd.tac.constellation.views.attributeeditor.editors.AttributeEditorFactory.AttributeEditor) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) MouseEvent(javafx.scene.input.MouseEvent) HashMap(java.util.HashMap) ClipboardUtilities(au.gov.asd.tac.constellation.graph.interaction.plugins.clipboard.ClipboardUtilities) HashSet(java.util.HashSet) FontUtilities(au.gov.asd.tac.constellation.utilities.font.FontUtilities) Insets(javafx.geometry.Insets) PluginInteraction(au.gov.asd.tac.constellation.plugins.PluginInteraction) Tooltip(javafx.scene.control.Tooltip) SchemaAttribute(au.gov.asd.tac.constellation.graph.schema.attribute.SchemaAttribute) SchemaConceptUtilities(au.gov.asd.tac.constellation.graph.schema.concept.SchemaConceptUtilities) KeyCode(javafx.scene.input.KeyCode) PrimaryKeyDefaultGetter(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.PrimaryKeyDefaultGetter) MenuBar(javafx.scene.control.MenuBar) AbstractEditor(au.gov.asd.tac.constellation.views.attributeeditor.editors.AbstractEditorFactory.AbstractEditor) GraphElementType(au.gov.asd.tac.constellation.graph.GraphElementType) AttributeEditorFactory(au.gov.asd.tac.constellation.views.attributeeditor.editors.AttributeEditorFactory) ListSelectionEditorFactory(au.gov.asd.tac.constellation.views.attributeeditor.editors.ListSelectionEditorFactory) ActionEvent(javafx.event.ActionEvent) Collections(java.util.Collections) AttributeEditor(au.gov.asd.tac.constellation.views.attributeeditor.editors.AttributeEditorFactory.AttributeEditor) EditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.EditOperation) ModifyAttributeEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.ModifyAttributeEditOperation) CreateAttributeEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.CreateAttributeEditOperation) AttributeValueEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.AttributeValueEditOperation) PrimaryKeyEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.PrimaryKeyEditOperation) CreateAttributeEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.CreateAttributeEditOperation)

Example 3 with AbstractEditor

use of au.gov.asd.tac.constellation.views.attributeeditor.editors.AbstractEditorFactory.AbstractEditor in project constellation by constellation-app.

the class AttributeEditorPanel method updateTimeZoneAction.

private void updateTimeZoneAction(final AttributeData attr) {
    final EditOperation editOperation = zoneId -> PluginExecution.withPlugin(new UpdateTimeZonePlugin((ZoneId) zoneId, attr)).executeLater(GraphManager.getDefault().getActiveGraph());
    final AbstractEditor<ZoneId> editor = UPDATE_TIME_ZONE_EDITOR_FACTORY.createEditor(editOperation, String.format("Set time-zone for attribute %s", attr.getAttributeName()), TimeZone.getTimeZone(ZoneOffset.UTC).toZoneId());
    final AttributeEditorDialog dialog = new AttributeEditorDialog(true, editor);
    dialog.showDialog();
}
Also used : HPos(javafx.geometry.HPos) StackPane(javafx.scene.layout.StackPane) SchemaFactory(au.gov.asd.tac.constellation.graph.schema.SchemaFactory) ScrollPane(javafx.scene.control.ScrollPane) Map(java.util.Map) ZonedDateTimeAttributeDescription(au.gov.asd.tac.constellation.graph.attribute.ZonedDateTimeAttributeDescription) ZoneOffset(java.time.ZoneOffset) ValueValidator(au.gov.asd.tac.constellation.graph.attribute.interaction.ValueValidator) UserInterfaceIconProvider(au.gov.asd.tac.constellation.utilities.icon.UserInterfaceIconProvider) EditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.EditOperation) GraphManager(au.gov.asd.tac.constellation.graph.manager.GraphManager) Event(javafx.event.Event) Set(java.util.Set) Rectangle(javafx.scene.shape.Rectangle) KeyEvent(javafx.scene.input.KeyEvent) ZoneId(java.time.ZoneId) Platform(javafx.application.Platform) PluginInfo(au.gov.asd.tac.constellation.plugins.PluginInfo) AbstractEditorFactory(au.gov.asd.tac.constellation.views.attributeeditor.editors.AbstractEditorFactory) ModifyAttributeEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.ModifyAttributeEditOperation) ObservableList(javafx.collections.ObservableList) BorderPane(javafx.scene.layout.BorderPane) AttributeValueTranslator(au.gov.asd.tac.constellation.graph.attribute.interaction.AttributeValueTranslator) StringProperty(javafx.beans.property.StringProperty) NbPreferences(org.openide.util.NbPreferences) CreateAttributeEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.CreateAttributeEditOperation) GraphWriteMethods(au.gov.asd.tac.constellation.graph.GraphWriteMethods) MouseButton(javafx.scene.input.MouseButton) AttributeValueEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.AttributeValueEditOperation) ColumnConstraints(javafx.scene.layout.ColumnConstraints) ColorAttributeDescription(au.gov.asd.tac.constellation.graph.schema.visual.attribute.ColorAttributeDescription) AttributeValueEditorFactory(au.gov.asd.tac.constellation.views.attributeeditor.editors.AttributeValueEditorFactory) FXCollections(javafx.collections.FXCollections) TooltipPane(au.gov.asd.tac.constellation.utilities.tooltip.TooltipPane) TreeSet(java.util.TreeSet) TransferMode(javafx.scene.input.TransferMode) CollectionUtils(org.apache.commons.collections4.CollectionUtils) ArrayList(java.util.ArrayList) Graph(au.gov.asd.tac.constellation.graph.Graph) Dragboard(javafx.scene.input.Dragboard) DefaultGetter(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.DefaultGetter) PluginTags(au.gov.asd.tac.constellation.plugins.templates.PluginTags) TextAlignment(javafx.scene.text.TextAlignment) StringUtilities(au.gov.asd.tac.constellation.utilities.text.StringUtilities) GridPane(javafx.scene.layout.GridPane) Color(javafx.scene.paint.Color) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) TitledPane(javafx.scene.control.TitledPane) ConstellationColor(au.gov.asd.tac.constellation.utilities.color.ConstellationColor) Node(javafx.scene.Node) SchemaConcept(au.gov.asd.tac.constellation.graph.schema.concept.SchemaConcept) PluginException(au.gov.asd.tac.constellation.plugins.PluginException) Preferences(java.util.prefs.Preferences) Menu(javafx.scene.control.Menu) ContextMenuEvent(javafx.scene.input.ContextMenuEvent) KeyCodeCombination(javafx.scene.input.KeyCodeCombination) SelectionMode(javafx.scene.control.SelectionMode) TreeMap(java.util.TreeMap) ImageView(javafx.scene.image.ImageView) ObservableValue(javafx.beans.value.ObservableValue) Button(javafx.scene.control.Button) TimeZoneEditorFactory(au.gov.asd.tac.constellation.views.attributeeditor.editors.TimeZoneEditorFactory) Pos(javafx.geometry.Pos) ReadableGraph(au.gov.asd.tac.constellation.graph.ReadableGraph) ListCell(javafx.scene.control.ListCell) SimpleEditPlugin(au.gov.asd.tac.constellation.plugins.templates.SimpleEditPlugin) CheckMenuItem(javafx.scene.control.CheckMenuItem) PluginType(au.gov.asd.tac.constellation.plugins.PluginType) VBox(javafx.scene.layout.VBox) PrimaryKeyEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.PrimaryKeyEditOperation) KeyCombination(javafx.scene.input.KeyCombination) ContextMenu(javafx.scene.control.ContextMenu) AbstractAttributeInteraction(au.gov.asd.tac.constellation.graph.attribute.interaction.AbstractAttributeInteraction) PluginExecution(au.gov.asd.tac.constellation.plugins.PluginExecution) HBox(javafx.scene.layout.HBox) TextField(javafx.scene.control.TextField) MenuItem(javafx.scene.control.MenuItem) SeparatorConstants(au.gov.asd.tac.constellation.utilities.text.SeparatorConstants) TimeZone(java.util.TimeZone) Collection(java.util.Collection) Text(javafx.scene.text.Text) Priority(javafx.scene.layout.Priority) List(java.util.List) ToggleButton(javafx.scene.control.ToggleButton) DataFormat(javafx.scene.input.DataFormat) Entry(java.util.Map.Entry) ClipboardContent(javafx.scene.input.ClipboardContent) JavafxStyleManager(au.gov.asd.tac.constellation.utilities.javafx.JavafxStyleManager) ListSelectionEditor(au.gov.asd.tac.constellation.views.attributeeditor.editors.ListSelectionEditorFactory.ListSelectionEditor) UpdateTimeZonePlugin(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.UpdateTimeZonePlugin) ListView(javafx.scene.control.ListView) AttributeEditor(au.gov.asd.tac.constellation.views.attributeeditor.editors.AttributeEditorFactory.AttributeEditor) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) MouseEvent(javafx.scene.input.MouseEvent) HashMap(java.util.HashMap) ClipboardUtilities(au.gov.asd.tac.constellation.graph.interaction.plugins.clipboard.ClipboardUtilities) HashSet(java.util.HashSet) FontUtilities(au.gov.asd.tac.constellation.utilities.font.FontUtilities) Insets(javafx.geometry.Insets) PluginInteraction(au.gov.asd.tac.constellation.plugins.PluginInteraction) Tooltip(javafx.scene.control.Tooltip) SchemaAttribute(au.gov.asd.tac.constellation.graph.schema.attribute.SchemaAttribute) SchemaConceptUtilities(au.gov.asd.tac.constellation.graph.schema.concept.SchemaConceptUtilities) KeyCode(javafx.scene.input.KeyCode) PrimaryKeyDefaultGetter(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.PrimaryKeyDefaultGetter) MenuBar(javafx.scene.control.MenuBar) AbstractEditor(au.gov.asd.tac.constellation.views.attributeeditor.editors.AbstractEditorFactory.AbstractEditor) GraphElementType(au.gov.asd.tac.constellation.graph.GraphElementType) AttributeEditorFactory(au.gov.asd.tac.constellation.views.attributeeditor.editors.AttributeEditorFactory) ListSelectionEditorFactory(au.gov.asd.tac.constellation.views.attributeeditor.editors.ListSelectionEditorFactory) ActionEvent(javafx.event.ActionEvent) Collections(java.util.Collections) ZoneId(java.time.ZoneId) UpdateTimeZonePlugin(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.UpdateTimeZonePlugin) EditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.EditOperation) ModifyAttributeEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.ModifyAttributeEditOperation) CreateAttributeEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.CreateAttributeEditOperation) AttributeValueEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.AttributeValueEditOperation) PrimaryKeyEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.PrimaryKeyEditOperation)

Example 4 with AbstractEditor

use of au.gov.asd.tac.constellation.views.attributeeditor.editors.AbstractEditorFactory.AbstractEditor in project constellation by constellation-app.

the class AttributeEditorPanel method createColourMenuItem.

private MenuItem createColourMenuItem(final String itemName, final String correspondingPreference, final Color color) {
    final HBox schemaMenuNode = new HBox(CELL_ITEM_SPACING);
    final MenuItem schemaMenuItem = new MenuItem(null, schemaMenuNode);
    final Rectangle schemaMenuRect = new Rectangle(20, 20);
    final Text schemaMenuText = new Text(itemName);
    schemaMenuText.setStyle("-fx-fill: white; -fx-font-smoothing-type:lcd;");
    schemaMenuNode.getChildren().addAll(schemaMenuRect, schemaMenuText);
    schemaMenuRect.setFill(color);
    schemaMenuRect.setStroke(Color.LIGHTGREY);
    schemaMenuItem.setOnAction(e -> {
        final EditOperation editOperation = value -> prefs.put(correspondingPreference, ((ConstellationColor) value).getHtmlColor());
        // return type of createEditor will actually be AbstractEditor<ConstellationColor>
        @SuppressWarnings("unchecked") final AbstractEditor<ConstellationColor> editor = ((AbstractEditorFactory<ConstellationColor>) AttributeValueEditorFactory.getEditFactory(ColorAttributeDescription.ATTRIBUTE_NAME)).createEditor(editOperation, String.format("for %s", itemName), ConstellationColor.fromFXColor(color));
        final AttributeEditorDialog dialog = new AttributeEditorDialog(false, editor);
        dialog.showDialog();
    });
    return schemaMenuItem;
}
Also used : HPos(javafx.geometry.HPos) StackPane(javafx.scene.layout.StackPane) SchemaFactory(au.gov.asd.tac.constellation.graph.schema.SchemaFactory) ScrollPane(javafx.scene.control.ScrollPane) Map(java.util.Map) ZonedDateTimeAttributeDescription(au.gov.asd.tac.constellation.graph.attribute.ZonedDateTimeAttributeDescription) ZoneOffset(java.time.ZoneOffset) ValueValidator(au.gov.asd.tac.constellation.graph.attribute.interaction.ValueValidator) UserInterfaceIconProvider(au.gov.asd.tac.constellation.utilities.icon.UserInterfaceIconProvider) EditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.EditOperation) GraphManager(au.gov.asd.tac.constellation.graph.manager.GraphManager) Event(javafx.event.Event) Set(java.util.Set) Rectangle(javafx.scene.shape.Rectangle) KeyEvent(javafx.scene.input.KeyEvent) ZoneId(java.time.ZoneId) Platform(javafx.application.Platform) PluginInfo(au.gov.asd.tac.constellation.plugins.PluginInfo) AbstractEditorFactory(au.gov.asd.tac.constellation.views.attributeeditor.editors.AbstractEditorFactory) ModifyAttributeEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.ModifyAttributeEditOperation) ObservableList(javafx.collections.ObservableList) BorderPane(javafx.scene.layout.BorderPane) AttributeValueTranslator(au.gov.asd.tac.constellation.graph.attribute.interaction.AttributeValueTranslator) StringProperty(javafx.beans.property.StringProperty) NbPreferences(org.openide.util.NbPreferences) CreateAttributeEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.CreateAttributeEditOperation) GraphWriteMethods(au.gov.asd.tac.constellation.graph.GraphWriteMethods) MouseButton(javafx.scene.input.MouseButton) AttributeValueEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.AttributeValueEditOperation) ColumnConstraints(javafx.scene.layout.ColumnConstraints) ColorAttributeDescription(au.gov.asd.tac.constellation.graph.schema.visual.attribute.ColorAttributeDescription) AttributeValueEditorFactory(au.gov.asd.tac.constellation.views.attributeeditor.editors.AttributeValueEditorFactory) FXCollections(javafx.collections.FXCollections) TooltipPane(au.gov.asd.tac.constellation.utilities.tooltip.TooltipPane) TreeSet(java.util.TreeSet) TransferMode(javafx.scene.input.TransferMode) CollectionUtils(org.apache.commons.collections4.CollectionUtils) ArrayList(java.util.ArrayList) Graph(au.gov.asd.tac.constellation.graph.Graph) Dragboard(javafx.scene.input.Dragboard) DefaultGetter(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.DefaultGetter) PluginTags(au.gov.asd.tac.constellation.plugins.templates.PluginTags) TextAlignment(javafx.scene.text.TextAlignment) StringUtilities(au.gov.asd.tac.constellation.utilities.text.StringUtilities) GridPane(javafx.scene.layout.GridPane) Color(javafx.scene.paint.Color) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) TitledPane(javafx.scene.control.TitledPane) ConstellationColor(au.gov.asd.tac.constellation.utilities.color.ConstellationColor) Node(javafx.scene.Node) SchemaConcept(au.gov.asd.tac.constellation.graph.schema.concept.SchemaConcept) PluginException(au.gov.asd.tac.constellation.plugins.PluginException) Preferences(java.util.prefs.Preferences) Menu(javafx.scene.control.Menu) ContextMenuEvent(javafx.scene.input.ContextMenuEvent) KeyCodeCombination(javafx.scene.input.KeyCodeCombination) SelectionMode(javafx.scene.control.SelectionMode) TreeMap(java.util.TreeMap) ImageView(javafx.scene.image.ImageView) ObservableValue(javafx.beans.value.ObservableValue) Button(javafx.scene.control.Button) TimeZoneEditorFactory(au.gov.asd.tac.constellation.views.attributeeditor.editors.TimeZoneEditorFactory) Pos(javafx.geometry.Pos) ReadableGraph(au.gov.asd.tac.constellation.graph.ReadableGraph) ListCell(javafx.scene.control.ListCell) SimpleEditPlugin(au.gov.asd.tac.constellation.plugins.templates.SimpleEditPlugin) CheckMenuItem(javafx.scene.control.CheckMenuItem) PluginType(au.gov.asd.tac.constellation.plugins.PluginType) VBox(javafx.scene.layout.VBox) PrimaryKeyEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.PrimaryKeyEditOperation) KeyCombination(javafx.scene.input.KeyCombination) ContextMenu(javafx.scene.control.ContextMenu) AbstractAttributeInteraction(au.gov.asd.tac.constellation.graph.attribute.interaction.AbstractAttributeInteraction) PluginExecution(au.gov.asd.tac.constellation.plugins.PluginExecution) HBox(javafx.scene.layout.HBox) TextField(javafx.scene.control.TextField) MenuItem(javafx.scene.control.MenuItem) SeparatorConstants(au.gov.asd.tac.constellation.utilities.text.SeparatorConstants) TimeZone(java.util.TimeZone) Collection(java.util.Collection) Text(javafx.scene.text.Text) Priority(javafx.scene.layout.Priority) List(java.util.List) ToggleButton(javafx.scene.control.ToggleButton) DataFormat(javafx.scene.input.DataFormat) Entry(java.util.Map.Entry) ClipboardContent(javafx.scene.input.ClipboardContent) JavafxStyleManager(au.gov.asd.tac.constellation.utilities.javafx.JavafxStyleManager) ListSelectionEditor(au.gov.asd.tac.constellation.views.attributeeditor.editors.ListSelectionEditorFactory.ListSelectionEditor) UpdateTimeZonePlugin(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.UpdateTimeZonePlugin) ListView(javafx.scene.control.ListView) AttributeEditor(au.gov.asd.tac.constellation.views.attributeeditor.editors.AttributeEditorFactory.AttributeEditor) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) MouseEvent(javafx.scene.input.MouseEvent) HashMap(java.util.HashMap) ClipboardUtilities(au.gov.asd.tac.constellation.graph.interaction.plugins.clipboard.ClipboardUtilities) HashSet(java.util.HashSet) FontUtilities(au.gov.asd.tac.constellation.utilities.font.FontUtilities) Insets(javafx.geometry.Insets) PluginInteraction(au.gov.asd.tac.constellation.plugins.PluginInteraction) Tooltip(javafx.scene.control.Tooltip) SchemaAttribute(au.gov.asd.tac.constellation.graph.schema.attribute.SchemaAttribute) SchemaConceptUtilities(au.gov.asd.tac.constellation.graph.schema.concept.SchemaConceptUtilities) KeyCode(javafx.scene.input.KeyCode) PrimaryKeyDefaultGetter(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.PrimaryKeyDefaultGetter) MenuBar(javafx.scene.control.MenuBar) AbstractEditor(au.gov.asd.tac.constellation.views.attributeeditor.editors.AbstractEditorFactory.AbstractEditor) GraphElementType(au.gov.asd.tac.constellation.graph.GraphElementType) AttributeEditorFactory(au.gov.asd.tac.constellation.views.attributeeditor.editors.AttributeEditorFactory) ListSelectionEditorFactory(au.gov.asd.tac.constellation.views.attributeeditor.editors.ListSelectionEditorFactory) ActionEvent(javafx.event.ActionEvent) Collections(java.util.Collections) ConstellationColor(au.gov.asd.tac.constellation.utilities.color.ConstellationColor) HBox(javafx.scene.layout.HBox) Rectangle(javafx.scene.shape.Rectangle) CheckMenuItem(javafx.scene.control.CheckMenuItem) MenuItem(javafx.scene.control.MenuItem) Text(javafx.scene.text.Text) AbstractEditorFactory(au.gov.asd.tac.constellation.views.attributeeditor.editors.AbstractEditorFactory) EditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.EditOperation) ModifyAttributeEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.ModifyAttributeEditOperation) CreateAttributeEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.CreateAttributeEditOperation) AttributeValueEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.AttributeValueEditOperation) PrimaryKeyEditOperation(au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.PrimaryKeyEditOperation)

Aggregations

Graph (au.gov.asd.tac.constellation.graph.Graph)4 GraphElementType (au.gov.asd.tac.constellation.graph.GraphElementType)4 GraphWriteMethods (au.gov.asd.tac.constellation.graph.GraphWriteMethods)4 ReadableGraph (au.gov.asd.tac.constellation.graph.ReadableGraph)4 ZonedDateTimeAttributeDescription (au.gov.asd.tac.constellation.graph.attribute.ZonedDateTimeAttributeDescription)4 AbstractAttributeInteraction (au.gov.asd.tac.constellation.graph.attribute.interaction.AbstractAttributeInteraction)4 AttributeValueTranslator (au.gov.asd.tac.constellation.graph.attribute.interaction.AttributeValueTranslator)4 ValueValidator (au.gov.asd.tac.constellation.graph.attribute.interaction.ValueValidator)4 ClipboardUtilities (au.gov.asd.tac.constellation.graph.interaction.plugins.clipboard.ClipboardUtilities)4 GraphManager (au.gov.asd.tac.constellation.graph.manager.GraphManager)4 SchemaFactory (au.gov.asd.tac.constellation.graph.schema.SchemaFactory)4 SchemaAttribute (au.gov.asd.tac.constellation.graph.schema.attribute.SchemaAttribute)4 SchemaConcept (au.gov.asd.tac.constellation.graph.schema.concept.SchemaConcept)4 SchemaConceptUtilities (au.gov.asd.tac.constellation.graph.schema.concept.SchemaConceptUtilities)4 ColorAttributeDescription (au.gov.asd.tac.constellation.graph.schema.visual.attribute.ColorAttributeDescription)4 PluginException (au.gov.asd.tac.constellation.plugins.PluginException)4 PluginExecution (au.gov.asd.tac.constellation.plugins.PluginExecution)4 PluginInfo (au.gov.asd.tac.constellation.plugins.PluginInfo)4 PluginInteraction (au.gov.asd.tac.constellation.plugins.PluginInteraction)4 PluginType (au.gov.asd.tac.constellation.plugins.PluginType)4