From c3d0ccb5a1ddfcebf693a594199b991cad4e2af9 Mon Sep 17 00:00:00 2001 From: Carsten Wickner Date: Wed, 13 Sep 2017 23:19:29 +0200 Subject: [PATCH] Issue #9 introduce visibility toggle for proposition labels and translations --- .../hmx/scitos/hmx/core/i18n/HmxMessage.java | 9 +- .../hmx/core/option/HmxGeneralOption.java | 6 +- .../hmx/scitos/hmx/core/i18n/HmxMessage.xml | 9 +- .../scitos/hmx/core/i18n/HmxMessage_de.xml | 7 +- .../hmx/scitos/hmx/view/IPericopeView.java | 14 +++ .../components/CombinedAnalysesPanel.java | 39 ++++++++ .../swing/components/SingleProjectView.java | 55 ++++++++--- .../swing/elements/AbstractProposition.java | 92 +++++++++++------- .../view/swing/elements/SemProposition.java | 3 +- .../hmx/view/swing/elements/SemRelation.java | 33 +++++-- .../view/swing/elements/SynProposition.java | 3 +- .../hmx/view/swing/option/FontChooser.java | 4 +- .../swing/option/HmxGeneralOptionPanel.java | 22 ++++- .../java/org/hmx/scitos/view/ScitosIcon.java | 6 +- .../icons/fatcow/attributes_display.png | Bin 0 -> 455 bytes .../icons/fatcow/horizontal_rule.png | Bin 0 -> 448 bytes 16 files changed, 230 insertions(+), 72 deletions(-) create mode 100644 scitos.view/src/main/resources/icons/fatcow/attributes_display.png create mode 100644 scitos.view/src/main/resources/icons/fatcow/horizontal_rule.png diff --git a/scitos.hmx/scitos.hmx.core/src/main/java/org/hmx/scitos/hmx/core/i18n/HmxMessage.java b/scitos.hmx/scitos.hmx.core/src/main/java/org/hmx/scitos/hmx/core/i18n/HmxMessage.java index 6a1ec78..0a78b7a 100644 --- a/scitos.hmx/scitos.hmx.core/src/main/java/org/hmx/scitos/hmx/core/i18n/HmxMessage.java +++ b/scitos.hmx/scitos.hmx.core/src/main/java/org/hmx/scitos/hmx/core/i18n/HmxMessage.java @@ -56,6 +56,10 @@ public enum HmxMessage implements ILocalizableMessage { MENUBAR_PROJECT_MERGE_INFRONT("Client.MenuBar.Edit.MergeProjects.InFront"), /** answer: insert content of project to merge with behind current text. */ MENUBAR_PROJECT_MERGE_BEHIND("Client.MenuBar.Edit.MergeProjects.Behind"), + /** menubar entry: View -> Hide/Show Proposition Labels. */ + MENUBAR_TOGGLE_PROPOSITION_LABELS("Client.MenuBar.View.TogglePropositionLabels"), + /** menubar entry: View -> Hide/Show Proposition Translations. */ + MENUBAR_TOGGLE_PROPOSITION_TRANSLATIONS("Client.MenuBar.View.TogglePropositionTranslations"), /** in the new-project-setup: the hint label over the main text input. */ TEXTINPUT_TOPIC("TextInput.Topic"), @@ -200,6 +204,9 @@ public enum HmxMessage implements ILocalizableMessage { PREFERENCES_GENERAL_RELATION_COLOR("Preferences.View.Color.Relation"), PREFERENCES_GENERAL_COMMENTED_BORDER_COLOR("Preferences.View.Color.CommentedBorder"), 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"), @@ -243,7 +250,7 @@ public enum HmxMessage implements ILocalizableMessage { PREFERENCES_RELATION_LOW_WEIGHT_ROLE("Preferences.Relation.LowWeightRole"), PREFERENCES_RELATION_LOW_WEIGHT_REPEAT("Preferences.Relation.LowWeightRepeatable"), PREFERENCES_RELATION_TOOLTIP("Preferences.Relation.Description"), - + PREFERENCES_LANGUAGE("Preferences.OriginLanguage"), PREFERENCES_LANGUAGE_EDIT("Preferences.OriginLanguage.EditEntry"), PREFERENCES_LANGUAGE_APPLY("Preferences.OriginLanguage.ApplyChanges"), diff --git a/scitos.hmx/scitos.hmx.core/src/main/java/org/hmx/scitos/hmx/core/option/HmxGeneralOption.java b/scitos.hmx/scitos.hmx.core/src/main/java/org/hmx/scitos/hmx/core/option/HmxGeneralOption.java index fb6c68f..6c56001 100644 --- a/scitos.hmx/scitos.hmx.core/src/main/java/org/hmx/scitos/hmx/core/option/HmxGeneralOption.java +++ b/scitos.hmx/scitos.hmx.core/src/main/java/org/hmx/scitos/hmx/core/option/HmxGeneralOption.java @@ -35,9 +35,13 @@ public enum HmxGeneralOption implements IOptionSetting { RELATION_COLOR("Relation.Color", ConversionUtil.toString(Color.RED)), /** user setting: color of semantical relations. */ 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: if the setting area in the new-project-setup should be visible by default. */ + /** user setting: whether the setting area in the new-project-setup should be visible by default. */ SHOW_SETTINGS("TextInput.ShowInputSettings", String.valueOf(true)), /** user setting: default author name when setting up new projects. */ AUTHOR("ProjectInfo.DefaultAuthor", null); diff --git a/scitos.hmx/scitos.hmx.core/src/main/resources/org/hmx/scitos/hmx/core/i18n/HmxMessage.xml b/scitos.hmx/scitos.hmx.core/src/main/resources/org/hmx/scitos/hmx/core/i18n/HmxMessage.xml index 836544a..6662f99 100644 --- a/scitos.hmx/scitos.hmx.core/src/main/resources/org/hmx/scitos/hmx/core/i18n/HmxMessage.xml +++ b/scitos.hmx/scitos.hmx.core/src/main/resources/org/hmx/scitos/hmx/core/i18n/HmxMessage.xml @@ -59,6 +59,8 @@ Continue? are being removed from this project. Continue? Edit Project Info + Hide/Show Proposition Labels + Hide/Show Proposition Translations At least one other element needs to be checked. The chosen relation cannot be created with more then two associates. @@ -194,7 +196,10 @@ It is being displayed as entry in the Syntactical Analysis' context menus.Relation Color Invisible Indentation Width - On Start of new Analysis + On Propositions in Analysis View + Show labels + Show translations + On Text Input View for new Analysis Show settings Author Comment @@ -221,4 +226,4 @@ Only clause item functions deposited for the chosen language will be available i Add some more text to your current project WARNING: After clicking on "Start Analysis" it will be impossible to change the language of the origin text. - \ No newline at end of file + diff --git a/scitos.hmx/scitos.hmx.core/src/main/resources/org/hmx/scitos/hmx/core/i18n/HmxMessage_de.xml b/scitos.hmx/scitos.hmx.core/src/main/resources/org/hmx/scitos/hmx/core/i18n/HmxMessage_de.xml index 76ad22a..a4d61e4 100644 --- a/scitos.hmx/scitos.hmx.core/src/main/resources/org/hmx/scitos/hmx/core/i18n/HmxMessage_de.xml +++ b/scitos.hmx/scitos.hmx.core/src/main/resources/org/hmx/scitos/hmx/core/i18n/HmxMessage_de.xml @@ -57,6 +57,8 @@ Wollen Sie wirklich fortfahren? Ausgewählte Propositionen Entfernen Soll(en) die ausgewählte(n) Proposition(en) wirklich gelöscht werden? Projektinformationen + Propositionsbezeichner: Aus-/Einblenden + Propositionsübersetzungen: Aus-/Einblenden Es müssen mindestens zwei Elemente (über ihre CheckBoxen) ausgewählt sein. Die gewählte Beziehung kann @@ -194,6 +196,9 @@ Er wird in the Syntaktischen Analyse im entsprechenden Auswahlmenü angezeigt.Farbe der Beziehungen Ausblenden Breite der Einrückungen + Auf Propositionen in Analyse-Ansicht + Kurzbezeichnerfelder einblenden + Übersetzungsfelder einblenden Beim Start der Texteingabe Einstellungen einblenden Autor @@ -221,4 +226,4 @@ In der syntaktischen Analyse können nur Satzgliedfunktionen ausgewählt werden, Fügen Sie zusätzlichen Text zum aktuellen Projekt hinzu WARNUNG: Die Sprache des Ausgangstextes kann nach dem Betätigen der "Beginne Analyse"-Schaltfläche nicht mehr nachträglich geändert werden! - \ No newline at end of file + diff --git a/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/IPericopeView.java b/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/IPericopeView.java index 7063389..fbfc42f 100644 --- a/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/IPericopeView.java +++ b/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/IPericopeView.java @@ -38,6 +38,20 @@ public interface IPericopeView extends ISemanticalRelationProvider, IUndoManaged */ HmxModelHandler getModelHandler(); + /** + * Getter for the view preference whether the label fields of propositions should be displayed or not. + * + * @return whether to displayed proposition label fields + */ + boolean isShowingPropositionLabels(); + + /** + * Getter for the view preference whether the translation fields of propositions should be displayed or not. + * + * @return whether to displayed proposition translation fields + */ + boolean isShowingPropositionTranslations(); + /** * Collect the list of selected {@link Proposition}s in the syntactical analysis, if it is currently active (i.e. displayed). * diff --git a/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/swing/components/CombinedAnalysesPanel.java b/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/swing/components/CombinedAnalysesPanel.java index dce17d0..a62d217 100644 --- a/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/swing/components/CombinedAnalysesPanel.java +++ b/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/swing/components/CombinedAnalysesPanel.java @@ -45,6 +45,7 @@ import org.hmx.scitos.domain.util.ComparisonUtil; import org.hmx.scitos.hmx.core.HmxModelHandler; import org.hmx.scitos.hmx.core.i18n.HmxMessage; +import org.hmx.scitos.hmx.core.option.HmxGeneralOption; import org.hmx.scitos.hmx.domain.ICommentable; import org.hmx.scitos.hmx.domain.ISemanticalRelationProvider; import org.hmx.scitos.hmx.domain.model.AbstractConnectable; @@ -92,6 +93,14 @@ public final class CombinedAnalysesPanel extends JPanel implements IPericopeView */ private final JTextPane commentArea; + /** + * Flag indicating whether the label fields of propositions should be displayed or not. + */ + private boolean showingPropositionLabels = HmxGeneralOption.SHOW_PROPOSITION_LABELS.getValueAsBoolean(); + /** + * Flag indicating whether the translation fields of propositions should be displayed or not. + */ + private boolean showingPropositionTranslations = HmxGeneralOption.SHOW_PROPOSITION_TRANSLATIONS.getValueAsBoolean(); /** * The most recently selected commentable model element currently associated with the {@link #commentArea}. */ @@ -312,6 +321,36 @@ public void refresh() { } } + @Override + public boolean isShowingPropositionLabels() { + return this.showingPropositionLabels; + } + + @Override + public boolean isShowingPropositionTranslations() { + return this.showingPropositionTranslations; + } + + /** + * Toggle the visibility of the label fields for all propositions. This causes a full rebuild of the displayed Pericope. + * + * @see #refresh() + */ + public void togglePropositionLabelVisibility() { + this.showingPropositionLabels = !this.showingPropositionLabels; + this.refresh(); + } + + /** + * Toggle the visibility of the translation fields for all propositions. This causes a full rebuild of the displayed Pericope. + * + * @see #refresh() + */ + public void togglePropositionTranslationVisibility() { + this.showingPropositionTranslations = !this.showingPropositionTranslations; + this.refresh(); + } + /** * Determine the currently active analysis view (either {@link #synAnalysisView} or {@link #semAnalysisView}). * diff --git a/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/swing/components/SingleProjectView.java b/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/swing/components/SingleProjectView.java index a620baf..34216ee 100644 --- a/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/swing/components/SingleProjectView.java +++ b/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/swing/components/SingleProjectView.java @@ -20,6 +20,7 @@ package org.hmx.scitos.hmx.view.swing.components; import java.awt.BorderLayout; +import java.awt.Component; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -29,7 +30,6 @@ import java.util.Map.Entry; import javax.swing.JMenuItem; -import javax.swing.JPanel; import org.hmx.scitos.core.HmxException; import org.hmx.scitos.core.i18n.Message; @@ -80,6 +80,14 @@ public class SingleProjectView extends AbstractProjectView createViewMenuItems() { - // TODO add menu item to hide/show translation input fields - // } - - // @Override - // public List createToolBarItems() { - // TODO add tool bar item to hide/show translation input fields - // } + @Override + public List createViewMenuItems() { + this.toggleLabelsItem = new JMenuItem(HmxMessage.MENUBAR_TOGGLE_PROPOSITION_LABELS.get(), ScitosIcon.ATTRIBUTES_DISPLAY.create()); + this.toggleLabelsItem.addActionListener(new ActionListener() { + @Override + public void actionPerformed(final ActionEvent event) { + ((CombinedAnalysesPanel) SingleProjectView.this.activeView).togglePropositionLabelVisibility(); + } + }); + this.toggleTranslationsItem = new JMenuItem(HmxMessage.MENUBAR_TOGGLE_PROPOSITION_TRANSLATIONS.get(), ScitosIcon.HORIZONTAL_RULE.create()); + this.toggleTranslationsItem.addActionListener(new ActionListener() { + @Override + public void actionPerformed(final ActionEvent event) { + ((CombinedAnalysesPanel) SingleProjectView.this.activeView).togglePropositionTranslationVisibility(); + } + }); + return Arrays.asList(this.toggleLabelsItem, this.toggleTranslationsItem); + } } diff --git a/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/swing/elements/AbstractProposition.java b/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/swing/elements/AbstractProposition.java index 09e4672..7a4fbde 100755 --- a/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/swing/elements/AbstractProposition.java +++ b/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/swing/elements/AbstractProposition.java @@ -103,14 +103,19 @@ abstract class AbstractProposition extends AbstractCommentable impl * the responsible model handler implementation realizing any model changes * @param represented * represented {@link Proposition} to set + * @param showLabel + * whether the label field should be shown + * @param showTranslation + * whether the translation field should be shown */ - protected AbstractProposition(final HmxModelHandler modelHandler, final Proposition represented) { + protected AbstractProposition(final HmxModelHandler modelHandler, final Proposition represented, final boolean showLabel, + final boolean showTranslation) { super(new GridBagLayout()); this.modelHandler = modelHandler; this.represented = represented; final boolean leftAligned = modelHandler.getModel().isLeftToRightOriented(); - this.defaultBorderCommented = - BorderFactory.createCompoundBorder(BorderFactory.createRaisedBevelBorder(), BorderFactory.createCompoundBorder( + this.defaultBorderCommented = BorderFactory.createCompoundBorder(BorderFactory.createRaisedBevelBorder(), + BorderFactory.createCompoundBorder( BorderFactory.createMatteBorder(2, leftAligned ? 1 : 0, 2, leftAligned ? 0 : 1, HmxGeneralOption.COMMENTED_BORDER_COLOR.getValueAsColor()), BorderFactory.createEmptyBorder(0, leftAligned ? 1 : 2, 4, leftAligned ? 2 : 1))); @@ -120,9 +125,13 @@ protected AbstractProposition(final HmxModelHandler modelHandler, final Proposit this.itemArea.setComponentOrientation(orientation); this.leftArrows = new ArrowStack(true, 0); this.rightArrows = new ArrowStack(false, 0); - this.initCheckboxAndLabel(); + this.initCheckboxAndLabel(showLabel); this.initOriginTextArea(); - this.initTranslationArea(); + if (showTranslation) { + this.initTranslationArea(); + } else { + this.translationField.setVisible(false); + } this.add(this.contentPane); this.setDefaultBorder(); } @@ -130,8 +139,11 @@ protected AbstractProposition(final HmxModelHandler modelHandler, final Proposit /** * Initialize the left part of the {@link AbstractProposition} containing the {@link JCheckBox}, the label {@link JTextField} and an expanding * {@link JPanel} for the indentations in the syntactical analysis view. + * + * @param showLabel + * whether the label field should be shown */ - private void initCheckboxAndLabel() { + private void initCheckboxAndLabel(final boolean showLabel) { // checkBox this.checkBoxDummy.setPreferredSize(this.checkBox.getPreferredSize()); this.setCheckBoxVisible(this.represented.getPartBeforeArrow() == null); @@ -142,19 +154,23 @@ private void initCheckboxAndLabel() { this.contentPane.add(this.checkBox, constraints); this.contentPane.add(this.checkBoxDummy, constraints); // labelField - this.labelField.setName("Label Input"); - this.labelField.setColumns(Proposition.MAX_LABEL_LENGTH - 1); - this.labelField.setDocument(new Validation(Proposition.MAX_LABEL_LENGTH)); - this.labelField.addFocusListener(new FocusAdapter() { - - @Override - public void focusLost(final FocusEvent event) { - AbstractProposition.this.submitLabelChanges(); - } - }); - this.refreshLabelText(); - constraints.gridx = 1; - this.contentPane.add(this.labelField, constraints); + if (showLabel) { + this.labelField.setName("Label Input"); + this.labelField.setColumns(Proposition.MAX_LABEL_LENGTH - 1); + this.labelField.setDocument(new Validation(Proposition.MAX_LABEL_LENGTH)); + this.labelField.addFocusListener(new FocusAdapter() { + + @Override + public void focusLost(final FocusEvent event) { + AbstractProposition.this.submitLabelChanges(); + } + }); + this.refreshLabelText(); + constraints.gridx = 1; + this.contentPane.add(this.labelField, constraints); + } else { + this.labelField.setVisible(false); + } // indentationArea constraints.fill = GridBagConstraints.VERTICAL; constraints.weighty = 1; @@ -168,8 +184,12 @@ public void focusLost(final FocusEvent event) { * Ensure that any pending changes (e.g. in the label or translation field) are being submitted to the model handler. */ public void submitChangesToModel() { - this.submitLabelChanges(); - this.submitTranslationChanges(); + if (this.labelField.isVisible()) { + this.submitLabelChanges(); + } + if (this.translationField.isVisible()) { + this.submitTranslationChanges(); + } } /** @@ -339,7 +359,9 @@ public final Proposition getRepresented() { * Update the displayed identifier text to match the value in the represented {@link Proposition}. */ public final void refreshLabelText() { - this.labelField.setText(this.represented.getLabel()); + if (this.labelField.isVisible()) { + this.labelField.setText(this.represented.getLabel()); + } } /** @@ -347,19 +369,21 @@ public final void refreshLabelText() { * Override and use this method in extending class to refresh and fit the changed translation text. */ protected void refreshTranslation() { - // if the translation text wants more space, it gets more - final Dimension preferred = this.translationField.getPreferredSize(); - final int itemAreaWidth = this.itemArea.getSize().width; - if (preferred.width > itemAreaWidth) { - // enlarge the translation field - this.translationField.setSize(preferred); - } else { - this.translationField.setSize(new Dimension(itemAreaWidth, preferred.height)); + if (this.translationField.isVisible()) { + // if the translation text wants more space, it gets more + final Dimension preferred = this.translationField.getPreferredSize(); + final int itemAreaWidth = this.itemArea.getSize().width; + if (preferred.width > itemAreaWidth) { + // enlarge the translation field + this.translationField.setSize(preferred); + } else { + this.translationField.setSize(new Dimension(itemAreaWidth, preferred.height)); + } + // enlarge the containing proposition + this.contentPane.setSize(this.contentPane.getPreferredSize()); + // make sure it is still displayed + this.itemArea.validate(); } - // enlarge the containing proposition - this.contentPane.setSize(this.contentPane.getPreferredSize()); - // make sure it is still displayed - this.itemArea.validate(); } /** diff --git a/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/swing/elements/SemProposition.java b/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/swing/elements/SemProposition.java index 8161302..06c9418 100755 --- a/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/swing/elements/SemProposition.java +++ b/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/swing/elements/SemProposition.java @@ -60,7 +60,8 @@ public final class SemProposition extends AbstractProposition implements IConnec * model {@link Proposition} to represent/display */ public SemProposition(final IPericopeView viewReference, final SemAnalysisPanel semPanel, final Proposition represented) { - super(viewReference.getModelHandler(), represented); + super(viewReference.getModelHandler(), represented, viewReference.isShowingPropositionLabels(), + viewReference.isShowingPropositionTranslations()); this.semArea = semPanel; this.originText.setFont(this.getModelHandler().getModel().getFont()); diff --git a/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/swing/elements/SemRelation.java b/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/swing/elements/SemRelation.java index 3a38698..def5469 100755 --- a/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/swing/elements/SemRelation.java +++ b/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/swing/elements/SemRelation.java @@ -75,13 +75,15 @@ public final class SemRelation extends AbstractCommentable implements /** The text fields displaying the respective roles of the sub ordinated associates. */ private final List roleFields; /** The color of the relation lines. */ - private final Color color; + private final Color color = HmxGeneralOption.RELATION_COLOR.getValueAsColor(); /** * The represented model {@link Relation}. */ private final Relation represented; /** The origin language of the current analysis is aligned from left to right. */ private final boolean leftAligned; + /** Whether the role labels should be shown above the relation lines. Otherwise, they will be shown on top of the lines (i.e. hiding them). */ + private final boolean showRoleAboveLine; /** * check box to select this {@link SemRelation}. */ @@ -103,7 +105,7 @@ public final class SemRelation extends AbstractCommentable implements /** * Constructor. - * + * * @param viewReference * the view providing access to the project's model handler and handling the comments on model elements * @param semArea @@ -120,6 +122,7 @@ public SemRelation(final IPericopeView viewReference, final SemAnalysisPanel sem this.represented = represented; this.leftAligned = viewReference.getModelHandler().getModel().isLeftToRightOriented(); final List modelAssociates = represented.getAssociates(); + this.showRoleAboveLine = viewReference.isShowingPropositionTranslations(); this.viewAssociates = new ArrayList>(modelAssociates.size()); for (final AbstractConnectable singleAssociate : modelAssociates) { this.viewAssociates.add(SemControl.getRepresentative(semArea, singleAssociate)); @@ -133,11 +136,17 @@ public SemRelation(final IPericopeView viewReference, final SemAnalysisPanel sem } else { final int associateCount = modelAssociates.size(); this.roleFields = new ArrayList(associateCount); + final Border outsideBorder; + if (this.showRoleAboveLine) { + outsideBorder = BorderFactory.createLoweredBevelBorder(); + } else { + outsideBorder = BorderFactory.createLineBorder(this.color, 1); + } + final Border fieldBorder = BorderFactory.createCompoundBorder(outsideBorder, BorderFactory.createEmptyBorder(2, 2, 2, 2)); for (int i = 0; i < associateCount; i++) { final JTextField roleField = new ScaledTextField(); roleField.setEditable(false); - roleField.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLoweredBevelBorder(), - BorderFactory.createEmptyBorder(2, 2, 2, 2))); + roleField.setBorder(fieldBorder); this.roleFields.add(roleField); this.add(roleField); } @@ -173,7 +182,6 @@ public void mouseReleased(final MouseEvent event) { } } }); - this.color = HmxGeneralOption.RELATION_COLOR.getValueAsColor(); this.setPreferredSize(new Dimension(this.calculateWidth(), this.getPreferredSize().height)); } @@ -261,7 +269,14 @@ protected void paintComponent(final Graphics graphics) { if (!this.leftAligned) { fieldX = startX - (2 + (3 * SemRelation.HALF_LINE_THICKNESS) + fieldWidth); } - final int fieldY = horizontalLines.get(i) - fieldHeight - 2 - SemRelation.HALF_LINE_THICKNESS; + int fieldY = horizontalLines.get(i); + if (this.showRoleAboveLine) { + // ensure the field is shown above the line with spacing of 2px + fieldY -= fieldHeight + SemRelation.HALF_LINE_THICKNESS + 2; + } else { + // display the field directly over the line (half above/half below) + fieldY -= fieldHeight / 2; + } roleField.setBounds(fieldX, fieldY, fieldWidth, fieldHeight); } } @@ -311,7 +326,7 @@ public void setNotChecked() { /** * Check if the semantical roles are currently hidden/invisible. - * + * * @return if the semantical roles are hidden */ public boolean isFolded() { @@ -342,7 +357,7 @@ public double getConnectY() { /** * Getter for top most vertical position contained in the represented {@link Relation} subtree. This is the index of the first contained * {@link Proposition} in the {@link Pericope} {@code + 0.5} (e.g. {@code 0.5}, {@code 1.5}, {@code 2.5}, ...). - * + * * @return point to connect of the first contained {@link SemProposition} */ public double getFirstGridY() { @@ -352,7 +367,7 @@ public double getFirstGridY() { /** * Getter for bottom most vertical position contained in the represented {@link Relation} subtree. This is the index of the last contained * {@link Proposition} in the {@link Pericope} {@code + 0.5} (e.g. {@code 1.5}, {@code 2.5}, {@code 3.5}, ...). - * + * * @return point to connect of the last contained {@link SemProposition} */ public double getLastGridY() { diff --git a/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/swing/elements/SynProposition.java b/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/swing/elements/SynProposition.java index fe7a95c..7e5f469 100755 --- a/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/swing/elements/SynProposition.java +++ b/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/swing/elements/SynProposition.java @@ -64,7 +64,8 @@ public final class SynProposition extends AbstractProposition { * represented {@link Proposition} to set */ private SynProposition(final IPericopeView viewReference, final Proposition represented) { - super(viewReference.getModelHandler(), represented); + super(viewReference.getModelHandler(), represented, viewReference.isShowingPropositionLabels(), + viewReference.isShowingPropositionTranslations()); this.viewReference = viewReference; this.init(); this.addMouseListener(new MouseAdapter() { diff --git a/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/swing/option/FontChooser.java b/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/swing/option/FontChooser.java index 076423d..d6c70d5 100644 --- a/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/swing/option/FontChooser.java +++ b/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/swing/option/FontChooser.java @@ -48,7 +48,7 @@ public final class FontChooser extends JPanel { /** The drop down component to select the font family from. */ - private final JComboBox fontTypeBox; + private final JComboBox fontTypeBox; /** The slider component to adjust the font size with. */ final JSlider fontSizeSlider = new JSlider(8, 64); /** The (editable) sample text area to show case the current font selection on. */ @@ -60,7 +60,7 @@ public final class FontChooser extends JPanel { public FontChooser() { final String[] fontFamilyNames = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); Arrays.sort(fontFamilyNames); - this.fontTypeBox = new JComboBox(fontFamilyNames); + this.fontTypeBox = new JComboBox(fontFamilyNames); AutoCompleteDecorator.decorate(this.fontTypeBox); this.fontTypeBox.addActionListener(new ActionListener() { diff --git a/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/swing/option/HmxGeneralOptionPanel.java b/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/swing/option/HmxGeneralOptionPanel.java index 9f6dd5a..65e3ac0 100644 --- a/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/swing/option/HmxGeneralOptionPanel.java +++ b/scitos.hmx/scitos.hmx.view/src/main/java/org/hmx/scitos/hmx/view/swing/option/HmxGeneralOptionPanel.java @@ -65,9 +65,15 @@ public final class HmxGeneralOptionPanel extends AbstractSimpleOptionPanel4e-97o@Oc8yqwf|XWU+1c3&rV-9dPD!Fwh{}SWA!=nb=yzBSjuasw7b2WTz{1{C zUZaA&5RoW0;qG>R4#QyT)jNTMEY?n~PKDjiCiezv0%5NlI_)EVCkxOg7+2ViEj znmIQYGl~MFYQdE=Ff2qABu+mbuXZjR_6JDDrE}5C`?Z{LTz-@RBSHH~eR^i4^YPuv zT|WE*4}59o)WRX}DT4qL42X~tq2~pC;8PeJLAN=+;9ig$Mp|-5!PPq%=HT;o&Ri%E zpz1F$1VCkh5z}{$3fdD28bOZzQ&0%5&1H~4Z!>2x6nLsQ;6TR}81zbSur{Hf_AmoV z1%{A^>-RHou(zJG6bi<%UsMa?+S@oPXiYA_$_1%2rVMU9$k51#s35=rr!CHu1d07# xTJ4@4dVv7rcm%{@i!*-(Tg$Z@K*Ik~`~mBw%E&sNyKw*j002ovPDHLkV1fcb!AbxC literal 0 HcmV?d00001 diff --git a/scitos.view/src/main/resources/icons/fatcow/horizontal_rule.png b/scitos.view/src/main/resources/icons/fatcow/horizontal_rule.png new file mode 100644 index 0000000000000000000000000000000000000000..3e70c651c8dfc38f97aa7eb9ef931408f3667e1b GIT binary patch literal 448 zcmV;x0YCnUP)# zDbkSiknEOZ=arY;u+)VR>W>-bWtiug=N%Zj-R`*EZfmR6(q^-{*0i&xF)dbH7SlTK zJ;u*pzX?QG2d~Ploo!6(DA?GDakUyCs4B*C&3y&20%eh96qE+fp1z>bXi%@$xe`T0 zaYP)&1c8ty=cMV3BuPoqgvofqp#S-zL9h3TFbt96W{X)Skmbaf&*#+y`}>doNe~l9 z5nu_@B0<6|O*tD+_%b-WXfWv8MiuKfD|%kOL6-Syf(H*Dv9)!BYnz)m=NOGf{231U zcyNHv7N`d#Z%;9>x-{q?_AshsxX_WK`N$MQ04IgttM|uz_