Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
kallimachos
Athen
Commits
53ed9a22
Commit
53ed9a22
authored
Feb 15, 2018
by
Markus Krug
Browse files
stylechanging dialog should now be able to change features accordingly
as well as the colors
parent
c4059af3
Pipeline
#7476
passed with stages
in 17 minutes and 47 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
de.uniwue.mk.athen/bundles/de.uniwue.mk.kall.athen.part.editor/src/de/uniwue/mk/kall/athen/part/editor/dialog/StyleChangingDialog.java
View file @
53ed9a22
...
...
@@ -21,6 +21,7 @@ import de.uniwue.mk.athen.textwidget.drawingstrategies.IAnnotationDrawingStrateg
import
de.uniwue.mk.athen.textwidget.struct.TypeStyleDataStructure
;
import
de.uniwue.mk.kall.athen.widget.editor.AnnotationEditorWidget
;
import
de.uniwue.mk.kall.drawingstrategies.generic.DrawingTypeStrategyFactory
;
import
de.uniwue.mk.kall.drawingstrategies.generic.GenericDrawingStrategy
;
import
de.uniwue.mk.kall.drawingstrategies.generic.struct.EDrawingType
;
public
class
StyleChangingDialog
extends
Dialog
{
...
...
@@ -104,8 +105,14 @@ public class StyleChangingDialog extends Dialog {
Color
color
=
new
Color
(
parent
.
getDisplay
(),
rgb
);
colorLabel
.
setBackground
(
color
);
// TODO this is never read!
// update TSDS
tsds
.
getStyle
().
getStyle
().
background
=
color
;
IAnnotationDrawingStrategy
drawingStrategy
=
tsds
.
getStyle
().
getDrawingStrategy
();
if
(
drawingStrategy
!=
null
&&
drawingStrategy
instanceof
GenericDrawingStrategy
)
{
GenericDrawingStrategy
gds
=
(
GenericDrawingStrategy
)
drawingStrategy
;
gds
.
changeColor
(
color
,
color
);
}
// inform listener
editor
.
styleChanged
(
tsds
);
...
...
@@ -144,9 +151,14 @@ public class StyleChangingDialog extends Dialog {
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
// BackgroundStyle
Color
foreGround
=
tsds
.
getStyle
().
getStyle
().
foreground
;
if
(
foreGround
==
null
)
{
// use the background
foreGround
=
tsds
.
getStyle
().
getStyle
().
background
;
}
if
(
e
.
getSource
().
toString
().
contains
(
String
.
valueOf
(
EPaintingStyles
.
BACKGROUND
)))
{
IAnnotationDrawingStrategy
strat
=
DrawingTypeStrategyFactory
.
getNaiveSpanDrawingStrategy
(
tsds
.
getAnnotationType
(),
tsds
.
getStyle
().
getStyle
().
fore
g
round
.
getRGBA
(),
tsds
.
getAnnotationType
(),
foreGround
!=
null
?
fore
G
round
.
getRGBA
()
:
null
,
tsds
.
getStyle
().
getStyle
().
background
.
getRGBA
(),
EDrawingType
.
RECTANGLE_FILLED
);
tsds
.
getStyle
().
setDrawingStrategy
(
strat
);
...
...
@@ -155,26 +167,28 @@ public class StyleChangingDialog extends Dialog {
else
if
(
e
.
getSource
().
toString
().
contains
(
String
.
valueOf
(
EPaintingStyles
.
UNDERLINE
)))
{
IAnnotationDrawingStrategy
drawingStrat
=
DrawingTypeStrategyFactory
.
getNaiveSpanDrawingStrategy
(
tsds
.
getAnnotationType
(),
tsds
.
getStyle
().
getStyle
().
fore
g
round
.
getRGBA
(),
tsds
.
getAnnotationType
(),
foreGround
!=
null
?
fore
G
round
.
getRGBA
()
:
null
,
tsds
.
getStyle
().
getStyle
().
background
.
getRGBA
(),
EDrawingType
.
UNDERLINED
);
tsds
.
getStyle
().
setDrawingStrategy
(
drawingStrat
);
}
else
if
(
e
.
getSource
().
toString
().
contains
(
String
.
valueOf
(
EPaintingStyles
.
BRACKET
)))
{
IAnnotationDrawingStrategy
strat
=
DrawingTypeStrategyFactory
.
getNaiveSpanDrawingStrategy
(
tsds
.
getAnnotationType
(),
tsds
.
getStyle
().
getStyle
().
fore
g
round
.
getRGBA
(),
tsds
.
getAnnotationType
(),
foreGround
!=
null
?
fore
G
round
.
getRGBA
()
:
null
,
tsds
.
getStyle
().
getStyle
().
background
.
getRGBA
(),
EDrawingType
.
BRACKET
);
tsds
.
getStyle
().
setDrawingStrategy
(
strat
);
}
else
if
(
e
.
getSource
().
toString
().
contains
(
String
.
valueOf
(
EPaintingStyles
.
BOX
)))
{
System
.
out
.
println
(
tsds
.
getAnnotationType
().
getName
());
System
.
out
.
println
(
tsds
.
getStyle
().
getStyle
().
background
);
System
.
out
.
println
(
tsds
.
getStyle
().
getStyle
().
foreground
);
IAnnotationDrawingStrategy
strat
=
DrawingTypeStrategyFactory
.
getNaiveSpanDrawingStrategy
(
tsds
.
getAnnotationType
(),
tsds
.
getStyle
().
getStyle
().
fore
g
round
.
getRGBA
(),
tsds
.
getAnnotationType
(),
foreGround
!=
null
?
fore
G
round
.
getRGBA
()
:
null
,
tsds
.
getStyle
().
getStyle
().
background
.
getRGBA
(),
EDrawingType
.
RECTANGLE_BORDER
);
tsds
.
getStyle
().
setDrawingStrategy
(
strat
);
}
// Inform listener
editor
.
styleChanged
(
tsds
);
}
...
...
de.uniwue.mk.athen/bundles/de.uniwue.mk.kall.athen.part.editor/src/de/uniwue/mk/kall/athen/widget/editor/AnnotationEditorWidget.java
View file @
53ed9a22
...
...
@@ -1124,8 +1124,8 @@ public class AnnotationEditorWidget extends Composite {
// default is backgroundDrawingStrategy
// TODO the anno browser labelprovider color seems off!!
AnnoStyle
style
=
new
AnnoStyle
(
DrawingTypeStrategyFactory
.
getNaiveSpanDrawingStrategy
(
next
,
null
,
actual
.
getRGBA
(),
EDrawingType
.
RECTANGLE_FILLED
),
styleRange
);
AnnoStyle
style
=
new
AnnoStyle
(
DrawingTypeStrategyFactory
.
getNaiveSpanDrawingStrategy
(
next
,
actual
.
getRGBA
(),
actual
.
getRGBA
(),
EDrawingType
.
RECTANGLE_FILLED
),
styleRange
);
// AnnoStyle style = new AnnoStyle(strat, styleRange);
TypeStyleDataStructure
asds
=
new
TypeStyleDataStructure
(
next
,
style
,
0
);
...
...
de.uniwue.mk.athen/bundles/de.uniwue.mk.kall.editorPainting/src/de/uniwue/kalimachos/coref/paintingStrategies/EPaintingStyles.java
View file @
53ed9a22
package
de.uniwue.kalimachos.coref.paintingStrategies
;
public
enum
EPaintingStyles
{
BACKGROUND
,
BOX
,
BRACKET
,
ONE_FEATURE
,
MULTI_FEATURE
,
NAMEDENTITY
,
UNDERLINE
;
BACKGROUND
,
BOX
,
BRACKET
,
UNDERLINE
;
...
...
de.uniwue.mk.athen/bundles/de.uniwue.mk.kall.editorPainting/src/de/uniwue/mk/kall/drawingstrategies/generic/BoxDrawingStrategy.java
View file @
53ed9a22
...
...
@@ -2,13 +2,10 @@ package de.uniwue.mk.kall.drawingstrategies.generic;
import
org.apache.uima.cas.Feature
;
import
org.apache.uima.cas.text.AnnotationFS
;
import
org.eclipse.swt.custom.StyleRange
;
import
org.eclipse.swt.graphics.Color
;
import
org.eclipse.swt.graphics.GC
;
import
org.eclipse.swt.widgets.Display
;
import
de.uniwue.mk.athen.textwidget.drawingstrategies.IAnnotationDrawingStrategy
;
import
de.uniwue.mk.athen.textwidget.struct.TypeStyleDataStructure
;
import
de.uniwue.mk.athen.textwidget.widget.ATHENEditorWidget
;
import
de.uniwue.mk.kall.drawingstrategies.generic.struct.DrawingStruct
;
import
de.uniwue.mk.kall.editorPainting.util.EditorDrawingUtil
;
...
...
de.uniwue.mk.athen/bundles/de.uniwue.mk.kall.editorPainting/src/de/uniwue/mk/kall/drawingstrategies/generic/GenericDrawingStrategy.java
View file @
53ed9a22
package
de.uniwue.mk.kall.drawingstrategies.generic
;
import
org.apache.uima.cas.text.AnnotationFS
;
import
org.eclipse.swt.graphics.Color
;
import
org.eclipse.swt.graphics.GC
;
import
de.uniwue.mk.athen.textwidget.drawingstrategies.IAnnotationDrawingStrategy
;
...
...
@@ -22,6 +23,12 @@ public class GenericDrawingStrategy implements IAnnotationDrawingStrategy{
}
public
void
changeColor
(
Color
bg
,
Color
fg
){
if
(
typeDrawingStruct
!=
null
){
typeDrawingStruct
.
changeColor
(
bg
,
fg
);
}
}
@Override
public
int
getPreferredLineHeight
(
AnnotationFS
anno
)
{
...
...
de.uniwue.mk.athen/bundles/de.uniwue.mk.kall.editorPainting/src/de/uniwue/mk/kall/drawingstrategies/generic/struct/FeatureDrawingStrategy.java
View file @
53ed9a22
...
...
@@ -7,6 +7,7 @@ import javax.sound.midi.Synthesizer;
import
org.apache.uima.cas.Feature
;
import
org.apache.uima.cas.text.AnnotationFS
;
import
org.eclipse.swt.graphics.Color
;
import
org.eclipse.swt.graphics.GC
;
import
de.uniwue.mk.athen.textwidget.widget.ATHENEditorWidget
;
...
...
@@ -86,6 +87,13 @@ public class FeatureDrawingStrategy {
}
public
void
changeColor
(
Color
bg
,
Color
fg
)
{
if
(
defaultDrawingStrategy
!=
null
){
defaultDrawingStrategy
.
changeColor
(
bg
,
fg
);
}
}
...
...
de.uniwue.mk.athen/bundles/de.uniwue.mk.kall.editorPainting/src/de/uniwue/mk/kall/drawingstrategies/generic/struct/FeatureValueDrawingStategy.java
View file @
53ed9a22
...
...
@@ -86,4 +86,17 @@ public class FeatureValueDrawingStategy {
}
public
void
changeColor
(
Color
bg
,
Color
fg
)
{
if
(
drawingStruct
!=
null
)
{
if
(
fg
!=
null
)
{
drawingStruct
.
setForeGroundColor
(
fg
.
getRGBA
());
}
if
(
bg
!=
null
)
{
drawingStruct
.
setBackGroundColor
(
bg
.
getRGBA
());
}
}
}
}
de.uniwue.mk.athen/bundles/de.uniwue.mk.kall.editorPainting/src/de/uniwue/mk/kall/drawingstrategies/generic/struct/TypeDrawingStrategy.java
View file @
53ed9a22
...
...
@@ -5,6 +5,7 @@ import java.util.List;
import
org.apache.uima.cas.Type
;
import
org.apache.uima.cas.text.AnnotationFS
;
import
org.eclipse.swt.graphics.Color
;
import
org.eclipse.swt.graphics.GC
;
import
de.uniwue.mk.athen.textwidget.widget.ATHENEditorWidget
;
...
...
@@ -75,4 +76,11 @@ public class TypeDrawingStrategy {
}
public
void
changeColor
(
Color
bg
,
Color
fg
)
{
if
(
spanDrawingStruct
!=
null
){
spanDrawingStruct
.
changeColor
(
bg
,
fg
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment