Skip to content

Commit

Permalink
implement combined analysis view (#16, #17)
Browse files Browse the repository at this point in the history
* introduce view toggles for parts of the analysis

* introduce single AnalysisPanel instead of the completely separate two views

* fix bug in specific scenario with splitProposition
  • Loading branch information
CarstenWickner authored Sep 26, 2017
1 parent 13138b0 commit b1155df
Show file tree
Hide file tree
Showing 41 changed files with 2,604 additions and 3,020 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/target/
/.project
/.settings/
**/nbactions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void actionPerformed(final ActionEvent event) {
@Override
public List<Component> createToolBarItems() {
final List<Component> toolBarItems = new LinkedList<Component>();
final JButton addInterviewButton = new JButton(ScitosIcon.MODEL_ELEMENT_ADD.create());
final JButton addInterviewButton = new JButton(ScitosIcon.CLIPBOARD_ADD.create());
addInterviewButton.setToolTipText(AisMessage.INTERVIEW_NEW.get());
addInterviewButton.addActionListener(new ActionListener() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public ProjectOverView(final ScitosClient client, final AisViewProject project,
super(project, project.getModelObject(), options, new BorderLayout());
this.analysisPanel = new PatternAnalysisPanel(client, project);
this.add(this.analysisPanel);
final JButton addInterviewButton = new JButton(AisMessage.INTERVIEW_NEW.get(), ScitosIcon.MODEL_ELEMENT_ADD.create());
final JButton addInterviewButton = new JButton(AisMessage.INTERVIEW_NEW.get(), ScitosIcon.CLIPBOARD_ADD.create());
addInterviewButton.addActionListener(new ActionListener() {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -567,23 +567,11 @@ public void splitProposition(final Proposition target, final ClauseItem lastItem
secondPart.setLaterChildren(laterChildren);

// avoid gaps in super ordinated relations
AbstractConnectable currentFocus = target;
Relation superOrdinated;
while ((superOrdinated = currentFocus.getSuperOrdinatedRelation()) != null) {
final List<AbstractConnectable> associates = superOrdinated.getAssociates();
if (currentFocus != associates.get(associates.size() - 1)) {
/*
* target is not the last associate in one of its super ordinated relations; this relation will become invalid by splitting the
* targeted proposition; it needs to be removed
*/
superOrdinated.kill();
break;
}
currentFocus = superOrdinated;
}
this.handleRelationsWhenSplittingProposition(target, secondPart);
// transfer part after arrow
final Proposition partAfterArrow = target.getPartAfterArrow();
target.setPartAfterArrow(null);
secondPart.setPartAfterArrow(target.getPartAfterArrow());
secondPart.setPartAfterArrow(partAfterArrow);

// finish model changes
target.getParent().insertChildPropositionAfterPrior(secondPart, target);
Expand Down Expand Up @@ -622,6 +610,61 @@ public void splitProposition(final Proposition target, final ClauseItem lastItem
this.notifyListeners(this.getModel(), false);
}

/**
* When splitting a {@link Proposition} into two, super ordinated relations might no longer be valid and need to be removed to ensure model
* integrity. If the directly super ordinated {@link Relation} starts at the proposition being split, it should be moved to the new/second part.
*
* @param firstPart
* leading part of the proposition being split
* @param secondPart
* trailing part of the propostion being split
*/
private void handleRelationsWhenSplittingProposition(final Proposition firstPart, final Proposition secondPart) {
if (firstPart.getSuperOrdinatedRelation() == null) {
// nothing to handle
return;
}
AbstractConnectable currentFocus = firstPart;
Relation superOrdinated = firstPart.getSuperOrdinatedRelation();
if (firstPart == superOrdinated.getAssociates().get(0)) {
// move relation to the new proposition in order to preserve its validity
final List<AbstractConnectable> newAssociates = new ArrayList<AbstractConnectable>(superOrdinated.getAssociates());
newAssociates.set(0, secondPart);
superOrdinated.setAssociates(newAssociates);
final AssociateRole role = firstPart.getRole();
firstPart.setSuperOrdinatedRelation(null, null);
secondPart.setSuperOrdinatedRelation(superOrdinated, role);
// check whether super ordinated relations are still valid after this move
currentFocus = superOrdinated;
while ((superOrdinated = currentFocus.getSuperOrdinatedRelation()) != null) {
final List<AbstractConnectable> associates = superOrdinated.getAssociates();
if (currentFocus != associates.get(0)) {
/*
* moved relation is not the first associate in one of its super ordinated relations; this relation will in turn become
* invalid by splitting the targeted proposition; it needs to be removed
*/
superOrdinated.kill();
break;
}
currentFocus = superOrdinated;
}
return;
}
do {
final List<AbstractConnectable> associates = superOrdinated.getAssociates();
if (currentFocus != associates.get(associates.size() - 1)) {
/*
* target is not the last associate in one of its super ordinated relations; this relation will become invalid by
* splitting the targeted proposition; it needs to be removed
*/
superOrdinated.kill();
break;
}
currentFocus = superOrdinated;
superOrdinated = currentFocus.getSuperOrdinatedRelation();
} while (superOrdinated != null);
}

@Override
public void resetStandaloneStateOfPartAfterArrow(final Proposition partAfterArrow) throws HmxException {
final List<ClauseItem> items = partAfterArrow.getPartBeforeArrow().getItems();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,16 @@ public enum HmxMessage implements ILocalizableMessage {
MENUBAR_PROJECT_MERGE_BEHIND("Client.MenuBar.Edit.MergeProjects.Behind"),
/** menubar entry: View -&gt; Hide/Show Proposition Labels. */
MENUBAR_TOGGLE_PROPOSITION_LABELS("Client.MenuBar.View.TogglePropositionLabels"),
/** menubar entry: View -&gt; Hide/Show Proposition Translations. */
MENUBAR_TOGGLE_PROPOSITION_TRANSLATIONS("Client.MenuBar.View.TogglePropositionTranslations"),
/** menubar entry: View -&gt; Hide/Show Proposition Indentations. */
MENUBAR_TOGGLE_PROPOSITION_INDENTATIONS("Client.MenuBar.View.TogglePropositionIndentations"),
/** menubar entry: View -&gt; Hide/Show Relations. */
MENUBAR_TOGGLE_RELATIONS("Client.MenuBar.View.ToggleRelations"),
/** menubar entry: View -&gt; Hide/Show Clause Items. */
MENUBAR_TOGGLE_CLAUSE_ITEMS("Client.MenuBar.View.ToggleClauseItems"),
/** menubar entry: View -&gt; Hide/Show Syntactic Proposition Translations. */
MENUBAR_TOGGLE_SYNTACTIC_TRANSLATIONS("Client.MenuBar.View.ToggleSyntacticTranslations"),
/** menubar entry: View -&gt; Hide/Show Semantic Proposition Translations. */
MENUBAR_TOGGLE_SEMANTIC_TRANSLATIONS("Client.MenuBar.View.ToggleSemanticTranslations"),

/** in the new-project-setup: the hint label over the main text input. */
TEXTINPUT_TOPIC("TextInput.Topic"),
Expand Down Expand Up @@ -101,9 +109,13 @@ public enum HmxMessage implements ILocalizableMessage {

/** label over the comment area in the analysis mode. */
ANALYSIS_COMMENT_TOPIC("Analysis.CommentTopic"),
/** tool bar item for view preset: All Details. */
ANALYSIS_PRESET_SHOW_ALL("Client.ToolBar.ViewPreset.AllDetails"),
/** tool bar item for view preset: Syntactical Analysis. */
ANALYSIS_PRESET_SYNTACTICAL("Client.ToolBar.ViewPreset.SyntacticalAnalysis"),
/** tool bar item for view preset: Semantical Analysis. */
ANALYSIS_PRESET_SEMANTICAL("Client.ToolBar.ViewPreset.SemanticalAnalysis"),

/** button to switch to the syntactical analysis view. */
ANALYSIS_SYNTACTICAL_BUTTON("Analysis.Syntactical"),
/** syntactical context menu entry: change clause item function. */
MENU_CHANGE_ITEM_FUNCTION("Analysis.Syntactical.ChangeItemFunction"),
/** syntactical context menu entry: change indentation function. */
Expand Down Expand Up @@ -141,8 +153,6 @@ public enum HmxMessage implements ILocalizableMessage {
/** syntactical context menu entry: split part-after-arrow from other part. */
MENU_RESET_PROP_PART("Analysis.Syntactical.ResetStandaloneProposition"),

/** button to switch to the syntactical analysis view. */
ANALYSIS_SEMANTICAL_BUTTON("Analysis.Semantical"),
/** semantical context menu entry: create relation. */
MENU_CREATE_RELATION("Analysis.Semantical.CreateRelation"),
/** semantical context menu entry: rotate roles of relation parts. */
Expand All @@ -163,7 +173,6 @@ public enum HmxMessage implements ILocalizableMessage {
/** export related labels. */
EXPORT_TITLE("Export.Title"),
EXPORT_TITLE_AUTHOR("Export.Title.Author"),

EXPORT_HEIGHT("Export.Height"),
EXPORT_WIDTH("Export.Width"),

Expand Down Expand Up @@ -206,7 +215,6 @@ public enum HmxMessage implements ILocalizableMessage {
PREFERENCES_GENERAL_INDENTATION("Preferences.View.IndentationWidth"),
PREFERENCES_GENERAL_PROPOSITIONS("Preferences.View.Propositions"),
PREFERENCES_GENERAL_PROPOSITIONS_SHOW_LABELS("Preferences.View.Propositions.ShowLabels"),
PREFERENCES_GENERAL_PROPOSITIONS_SHOW_TRANSLATIONS("Preferences.View.Propositions.ShowTranslations"),
PREFERENCES_GENERAL_INPUT("Preferences.View.TextInput"),
PREFERENCES_GENERAL_INPUT_SHOW_SETTINGS("Preferences.View.TextInput.ShowSettings"),
PREFERENCES_GENERAL_AUTHOR("Preferences.Analysis.ProjectInfo.DefaultAuthor"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ public enum HmxGeneralOption implements IOptionSetting {
COMMENTED_BORDER_COLOR("Commented.BorderColor", ConversionUtil.toString(Color.GREEN)),
/** user setting: whether the labels on the analysis views should be visible by default. */
SHOW_PROPOSITION_LABELS("Analysis.Proposition.ShowLabels", String.valueOf(true)),
/** user setting: whether the translations on the analysis views should be visible by default. */
SHOW_PROPOSITION_TRANSLATIONS("Analysis.Proposition.ShowTranslations", String.valueOf(true)),
/** user setting: width of syntactical indentations. */
INDENTATION_WIDTH("SynAnalysis.IndentationWidth", "50"),
/** user setting: whether the setting area in the new-project-setup should be visible by default. */
Expand All @@ -57,10 +55,8 @@ public enum HmxGeneralOption implements IOptionSetting {
/**
* Constructor.
*
* @param attributeKey
* actual settings key
* @param defaultValue
* default value to return if no value was specified before
* @param attributeKey actual settings key
* @param defaultValue default value to return if no value was specified before
*/
private HmxGeneralOption(final String attributeKey, final String defaultValue) {
this.key = attributeKey;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<!--
<!--
Copyright (C) 2015 HermeneutiX.org
This file is part of SciToS.
SciToS is free software: you can redistribute it and/or modify
Expand All @@ -20,7 +20,6 @@
-->
<properties>
<entry key="Analysis.CommentTopic">Insert the Comment for the lowered Element here</entry>
<entry key="Analysis.Semantical">Go To Semantical</entry>
<entry key="Analysis.Semantical.AlterRelationType">Alter relation type</entry>
<entry key="Analysis.Semantical.CreateRelation">Create Relation with checked Elements</entry>
<entry key="Analysis.Semantical.RelationFolding.FoldAll">Hide all Roles</entry>
Expand All @@ -29,7 +28,6 @@
<entry key="Analysis.Semantical.RelationFolding.UnfoldLevel">Display Roles in this Column</entry>
<entry key="Analysis.Semantical.RemoveRelation">Remove Relation</entry>
<entry key="Analysis.Semantical.RotateAssociateRoles">Switch Roles</entry>
<entry key="Analysis.Syntactical">Go To Syntactical</entry>
<entry key="Analysis.Syntactical.ChangeItemFunction">Change Clause Item Function</entry>
<entry key="Analysis.Syntactical.ChangePropositionFunction">Change Indentation Function</entry>
<entry key="Analysis.Syntactical.HighlightItem">Highlight Clause Item</entry>
Expand Down Expand Up @@ -59,8 +57,15 @@ Continue?</entry>
are being removed from this project.
Continue?</entry>
<entry key="Client.MenuBar.Edit.ProjectInfo">Edit Project Info</entry>
<entry key="Client.MenuBar.View.ToggleClauseItems">Hide/Show Clause Items</entry>
<entry key="Client.MenuBar.View.TogglePropositionIndentations">Hide/Show Proposition Indentations</entry>
<entry key="Client.MenuBar.View.TogglePropositionLabels">Hide/Show Proposition Labels</entry>
<entry key="Client.MenuBar.View.TogglePropositionTranslations">Hide/Show Proposition Translations</entry>
<entry key="Client.MenuBar.View.ToggleRelations">Hide/Show Relations</entry>
<entry key="Client.MenuBar.View.ToggleSemanticTranslations">Hide/Show Semantic Translations</entry>
<entry key="Client.MenuBar.View.ToggleSyntacticTranslations">Hide/Show Syntactic Translations</entry>
<entry key="Client.ToolBar.ViewPreset.AllDetails">View: All Details</entry>
<entry key="Client.ToolBar.ViewPreset.SemanticalAnalysis">View: Semantical Analysis</entry>
<entry key="Client.ToolBar.ViewPreset.SyntacticalAnalysis">View: Syntactical Analysis</entry>
<entry key="Error.CreateRelation.AtLeastTwoChecked">At least one other element needs to be checked.</entry>
<entry key="Error.CreateRelation.MoreThenTwoChecked">The chosen relation cannot be created
with more then two associates.</entry>
Expand Down Expand Up @@ -198,7 +203,6 @@ It is being displayed as entry in the Syntactical Analysis' context menus.</entr
<entry key="Preferences.View.IndentationWidth">Indentation Width</entry>
<entry key="Preferences.View.Propositions">On Propositions in Analysis View</entry>
<entry key="Preferences.View.Propositions.ShowLabels">Show labels</entry>
<entry key="Preferences.View.Propositions.ShowTranslations">Show translations</entry>
<entry key="Preferences.View.TextInput">On Text Input View for new Analysis</entry>
<entry key="Preferences.View.TextInput.ShowSettings">Show settings</entry>
<entry key="ProjectInfo.Author">Author</entry>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<!--
<!--
Copyright (C) 2015 HermeneutiX.org
This file is part of SciToS.
SciToS is free software: you can redistribute it and/or modify
Expand All @@ -20,7 +20,6 @@
-->
<properties>
<entry key="Analysis.CommentTopic">Geben Sie hier den Kommentar für das eingedrückte Element ein</entry>
<entry key="Analysis.Semantical">Wechsel auf Semantische</entry>
<entry key="Analysis.Semantical.AlterRelationType">Ändere Beziehungsart</entry>
<entry key="Analysis.Semantical.CreateRelation">Setze ausgewählte Elemente in Beziehung</entry>
<entry key="Analysis.Semantical.RelationFolding.FoldAll">Alle Rollen ausblenden</entry>
Expand All @@ -29,7 +28,6 @@
<entry key="Analysis.Semantical.RelationFolding.UnfoldLevel">Rollen dieser Ebene einblenden</entry>
<entry key="Analysis.Semantical.RemoveRelation">Entferne Beziehung</entry>
<entry key="Analysis.Semantical.RotateAssociateRoles">Wechsle Rollen aus</entry>
<entry key="Analysis.Syntactical">Wechsel auf Syntaktische</entry>
<entry key="Analysis.Syntactical.ChangeItemFunction">Ändere Satzgliedfunktion</entry>
<entry key="Analysis.Syntactical.ChangePropositionFunction">Ändere Einrückungsfunktion</entry>
<entry key="Analysis.Syntactical.HighlightItem">Hebe Satzglied hervor</entry>
Expand Down Expand Up @@ -57,8 +55,15 @@ Wollen Sie wirklich fortfahren?</entry>
<entry key="Client.MenuBar.Edit.OriginText.Remove">Ausgewählte Propositionen Entfernen</entry>
<entry key="Client.MenuBar.Edit.OriginText.Remove.Confirm">Soll(en) die ausgewählte(n) Proposition(en) wirklich gelöscht werden?</entry>
<entry key="Client.MenuBar.Edit.ProjectInfo">Projektinformationen</entry>
<entry key="Client.MenuBar.View.ToggleClauseItems">Satzglieder: Aus-/Einblenden</entry>
<entry key="Client.MenuBar.View.TogglePropositionIndentations">Propositionseinrückungen: Aus-/Einblenden</entry>
<entry key="Client.MenuBar.View.TogglePropositionLabels">Propositionsbezeichner: Aus-/Einblenden</entry>
<entry key="Client.MenuBar.View.TogglePropositionTranslations">Propositionsübersetzungen: Aus-/Einblenden</entry>
<entry key="Client.MenuBar.View.ToggleRelations">Beziehungen: Aus-/Einblenden</entry>
<entry key="Client.MenuBar.View.ToggleSemanticTranslations">Semantische Übersetzungen: Aus-/Einblenden</entry>
<entry key="Client.MenuBar.View.ToggleSyntacticTranslations">Syntaktische Übersetzungen: Aus-/Einblenden</entry>
<entry key="Client.ToolBar.ViewPreset.AllDetails">Ansicht: Alles</entry>
<entry key="Client.ToolBar.ViewPreset.SemanticalAnalysis">Ansicht: Semantische Analyse</entry>
<entry key="Client.ToolBar.ViewPreset.SyntacticalAnalysis">Ansicht: Syntaktische Analyse</entry>
<entry key="Error.CreateRelation.AtLeastTwoChecked">Es müssen mindestens zwei Elemente
(über ihre CheckBoxen) ausgewählt sein.</entry>
<entry key="Error.CreateRelation.MoreThenTwoChecked">Die gewählte Beziehung kann
Expand Down Expand Up @@ -198,7 +203,6 @@ Er wird in the Syntaktischen Analyse im entsprechenden Auswahlmenü angezeigt.</
<entry key="Preferences.View.IndentationWidth">Breite der Einrückungen</entry>
<entry key="Preferences.View.Propositions">Auf Propositionen in Analyse-Ansicht</entry>
<entry key="Preferences.View.Propositions.ShowLabels">Kurzbezeichnerfelder einblenden</entry>
<entry key="Preferences.View.Propositions.ShowTranslations">Übersetzungsfelder einblenden</entry>
<entry key="Preferences.View.TextInput">Beim Start der Texteingabe</entry>
<entry key="Preferences.View.TextInput.ShowSettings">Einstellungen einblenden</entry>
<entry key="ProjectInfo.Author">Autor</entry>
Expand Down
Loading

0 comments on commit b1155df

Please sign in to comment.