Skip to content
Merged
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
2 changes: 1 addition & 1 deletion pom.xml
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.flowingcode.vaadin.addons</groupId>
<artifactId>orgchart-addon</artifactId>
<version>5.2.1-SNAPSHOT</version>
<version>5.3.0-SNAPSHOT</version>
<name>OrgChart Add-on</name>

<properties>
Expand Down
439 changes: 424 additions & 15 deletions src/main/java/com/flowingcode/vaadin/addons/orgchart/OrgChart.java

Large diffs are not rendered by default.

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
/*-
* #%L
* OrgChart Add-on
* %%
* Copyright (C) 2017 - 2025 Flowing Code S.A.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package com.flowingcode.vaadin.addons.orgchart.event;

import com.flowingcode.vaadin.addons.orgchart.OrgChart;
import com.flowingcode.vaadin.addons.orgchart.OrgChartItem;
import com.vaadin.flow.component.ComponentEvent;
import java.util.ArrayList;
import java.util.List;

/**
* Event fired when children are added to a node in the organization chart. Contains information
* about both the parent node and the newly added children.
*/
@SuppressWarnings("serial")
public class ChildrenAddedEvent extends ComponentEvent<OrgChart> {
private final OrgChartItem item;
private final List<OrgChartItem> newChildren;

/**
* Creates a new children added event.
*
* @param source the chart component that fired the event
* @param item the node that received new children
* @param newChildren list of the newly added children
* @param fromClient whether the event originated from the client side
*/
public ChildrenAddedEvent(OrgChart source, OrgChartItem item, List<OrgChartItem> newChildren,
boolean fromClient) {
super(source, fromClient);
this.item = item;
this.newChildren = new ArrayList<>(newChildren);
}

/**
* Gets the node that received new children.
*
* @return the node
*/
public OrgChartItem getItem() {
return item;
}

/**
* Gets the list of the newly added children.
*
* @return the list of new children
*/
public List<OrgChartItem> getNewChildren() {
return newChildren;
}
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
package com.flowingcode.vaadin.addons.orgchart.event;

import com.flowingcode.vaadin.addons.orgchart.OrgChart;
import com.flowingcode.vaadin.addons.orgchart.OrgChartItem;
import com.vaadin.flow.component.ComponentEvent;


/**
* Event thrown when a node is updated.
*/
@SuppressWarnings("serial")
public class NodeUpdatedEvent extends ComponentEvent<OrgChart> {
private final OrgChartItem updatedItem;

/**
* Creates a node updated event.
*
* @param source the chart component that fired the event
* @param updatedItem the node being updated
* @param fromClient whether the event originated from the client side
*/
public NodeUpdatedEvent(OrgChart source, OrgChartItem updatedItem, boolean fromClient) {
super(source, fromClient);
this.updatedItem = updatedItem;
}

/**
* Gets the updated node.
*
* @return the updated node item
*/
public OrgChartItem getUpdatedItem() {
return updatedItem;
}

}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
/*-
* #%L
* OrgChart Add-on
* %%
* Copyright (C) 2017 - 2025 Flowing Code S.A.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package com.flowingcode.vaadin.addons.orgchart.event;

import com.flowingcode.vaadin.addons.orgchart.OrgChart;
import com.vaadin.flow.component.ComponentEvent;

/**
* Event fired when a node and its descendants are removed from the organization chart. Contains
* information about the removed node.
*/
@SuppressWarnings("serial")
public class NodesRemovedEvent extends ComponentEvent<OrgChart> {
private final Integer nodeId;

/**
* Creates a new nodes removed event.
*
* @param source the chart component that fired the event
* @param nodeId the ID of the removed node
* @param fromClient whether the event originated from the client side
*/
public NodesRemovedEvent(OrgChart source, Integer nodeId, boolean fromClient) {
super(source, fromClient);
this.nodeId = nodeId;
}

/**
* Gets the ID of the removed node.
*
* @return the node ID
*/
public Integer getNodeId() {
return nodeId;
}

}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
/*-
* #%L
* OrgChart Add-on
* %%
* Copyright (C) 2017 - 2025 Flowing Code S.A.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package com.flowingcode.vaadin.addons.orgchart.event;

import com.flowingcode.vaadin.addons.orgchart.OrgChart;
import com.flowingcode.vaadin.addons.orgchart.OrgChartItem;
import com.vaadin.flow.component.ComponentEvent;

/**
* Event fired when a new parent is added to the chart.
*/
@SuppressWarnings("serial")
public class ParentAddedEvent extends ComponentEvent<OrgChart> {

private final OrgChartItem newParent;

/**
* Creates a new event.
*
* @param source the component that fired the event
* @param newParent the item that was added as the new parent
* @param fromClient true if the event originated from the client
*/
public ParentAddedEvent(OrgChart source, OrgChartItem newParent, boolean fromClient) {
super(source, fromClient);
this.newParent = newParent;
}

/**
* Gets the item that was added as the new parent/root.
*
* @return the new parent item
*/
public OrgChartItem getNewParent() {
return newParent;
}
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
/*-
* #%L
* OrgChart Add-on
* %%
* Copyright (C) 2017 - 2025 Flowing Code S.A.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package com.flowingcode.vaadin.addons.orgchart.event;

import java.util.ArrayList;
import java.util.List;

import com.flowingcode.vaadin.addons.orgchart.OrgChart;
import com.flowingcode.vaadin.addons.orgchart.OrgChartItem;
import com.vaadin.flow.component.ComponentEvent;

/**
* Event fired when siblings are added to a node in the organization chart. Contains information
* about both the target node and the newly added siblings.
*/
@SuppressWarnings("serial")
public class SiblingsAddedEvent extends ComponentEvent<OrgChart> {
private final OrgChartItem item;
private final List<OrgChartItem> newSiblings;

/**
* Creates a new siblings added event.
*
* @param source the chart component that fired the event
* @param item the node that received new siblings
* @param newSiblings list of the newly added siblings
* @param fromClient whether the event originated from the client side
*/
public SiblingsAddedEvent(OrgChart source, OrgChartItem item, List<OrgChartItem> newSiblings,
boolean fromClient) {
super(source, fromClient);
this.item = item;
this.newSiblings = new ArrayList<>(newSiblings);
}

/**
* Gets the node that received new siblings.
*
* @return the node
*/
public OrgChartItem getItem() {
return item;
}

/**
* Gets the list of the newly added siblings.
*
* @return the list of new sibling
*/
public List<OrgChartItem> getNewSiblings() {
return newSiblings;
}
}
Loading