Search in sources :

Example 1 with AttributeEditor

use of au.gov.asd.tac.constellation.views.attributeeditor.editors.AttributeEditorFactory.AttributeEditor 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 AttributeEditor

use of au.gov.asd.tac.constellation.views.attributeeditor.editors.AttributeEditorFactory.AttributeEditor 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)

Aggregations

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