Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[2514] Change RectangularNodeSyle#withHeader for InsideLabel#isHeader
Bug: #2514 Signed-off-by: Guillaume Coutable <guillaume.coutable@obeo.fr>
- Loading branch information
Showing
50 changed files
with
213 additions
and
280 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...eclipse/sirius/components/compatibility/diagrams/AbstractNodeMappingIsHeaderProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Obeo. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.sirius.components.compatibility.diagrams; | ||
|
||
import java.util.Objects; | ||
import java.util.function.Function; | ||
|
||
import org.eclipse.sirius.components.interpreter.AQLInterpreter; | ||
import org.eclipse.sirius.components.representations.VariableManager; | ||
import org.eclipse.sirius.diagram.business.api.query.ContainerMappingQuery; | ||
import org.eclipse.sirius.diagram.description.AbstractNodeMapping; | ||
import org.eclipse.sirius.diagram.description.ContainerMapping; | ||
import org.eclipse.sirius.diagram.description.style.FlatContainerStyleDescription; | ||
import org.eclipse.sirius.viewpoint.description.style.LabelStyleDescription; | ||
|
||
/** | ||
* Used to return if the node mapping has a header. | ||
* | ||
* @author gcoutable | ||
*/ | ||
public class AbstractNodeMappingIsHeaderProvider implements Function<VariableManager, Boolean> { | ||
|
||
private final AQLInterpreter interpreter; | ||
|
||
private final AbstractNodeMapping abstractNodeMapping; | ||
|
||
public AbstractNodeMappingIsHeaderProvider(AQLInterpreter interpreter, AbstractNodeMapping abstractNodeMapping) { | ||
this.interpreter = Objects.requireNonNull(interpreter); | ||
this.abstractNodeMapping = Objects.requireNonNull(abstractNodeMapping); | ||
} | ||
|
||
@Override | ||
public Boolean apply(VariableManager variableManager) { | ||
LabelStyleDescription labelStyleDescription = new LabelStyleDescriptionProvider(this.interpreter, this.abstractNodeMapping).apply(variableManager); | ||
return this.isHeader(variableManager, labelStyleDescription); | ||
} | ||
|
||
private Boolean isHeader(VariableManager variableManager, LabelStyleDescription labelStyleDescription) { | ||
if (labelStyleDescription instanceof FlatContainerStyleDescription flatContainerStyleDescription) { | ||
return this.abstractNodeMapping instanceof ContainerMapping && new ContainerMappingQuery((ContainerMapping) this.abstractNodeMapping).isListContainer(); | ||
} | ||
return false; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.