Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BraillePlot
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Georg Graßnick
BraillePlot
Commits
b7a9f892
Commit
b7a9f892
authored
5 years ago
by
Andrey Ruzhanskiy
Browse files
Options
Downloads
Patches
Plain Diff
Added Nullchecks and better Exception Messages.
parent
3cbb0660
No related branches found
Branches containing commit
No related tags found
1 merge request
!14
Feat/braille print back end 4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/de/tudresden/inf/mci/brailleplot/exporter/PrintDirector.java
+17
-11
17 additions, 11 deletions
...tudresden/inf/mci/brailleplot/exporter/PrintDirector.java
with
17 additions
and
11 deletions
src/main/java/de/tudresden/inf/mci/brailleplot/exporter/PrintDirector.java
+
17
−
11
View file @
b7a9f892
...
@@ -19,7 +19,6 @@ public class PrintDirector {
...
@@ -19,7 +19,6 @@ public class PrintDirector {
private
PrintService
mService
;
private
PrintService
mService
;
private
String
mPrinterName
;
private
String
mPrinterName
;
private
DocFlavor
mDocflavor
;
private
DocFlavor
mDocflavor
;
private
AbstractBrailleTableParser
mParser
;
/**
/**
...
@@ -34,8 +33,12 @@ public class PrintDirector {
...
@@ -34,8 +33,12 @@ public class PrintDirector {
switch
(
mPrinter
)
{
switch
(
mPrinter
)
{
case
NORMALPRINTER:
mBuilder
=
new
NormalBuilder
();
break
;
case
NORMALPRINTER:
mBuilder
=
new
NormalBuilder
();
break
;
case
INDEX_EVEREST_D_V4_GRAPHIC_PRINTER:
mBuilder
=
new
GraphicPrintBuilder
();
break
;
case
INDEX_EVEREST_D_V4_GRAPHIC_PRINTER:
case
INDEX_EVEREST_D_V4_FLOATINGDOT_PRINTER:
mBuilder
=
new
FloatingDotAreaBuilder
();
break
;
mBuilder
=
new
GraphicPrintBuilder
();
break
;
case
INDEX_EVEREST_D_V4_FLOATINGDOT_PRINTER:
mBuilder
=
new
FloatingDotAreaBuilder
();
break
;
default
:
throw
new
IllegalArgumentException
();
default
:
throw
new
IllegalArgumentException
();
}
}
}
}
...
@@ -72,7 +75,7 @@ public class PrintDirector {
...
@@ -72,7 +75,7 @@ public class PrintDirector {
}
}
}
}
}
else
{
}
else
{
throw
new
IllegalArgumentException
();
throw
new
IllegalArgumentException
(
"The given Printer "
+
printerName
+
" was not found in the System."
);
}
}
}
}
...
@@ -86,14 +89,17 @@ public class PrintDirector {
...
@@ -86,14 +89,17 @@ public class PrintDirector {
if
(
printerName
==
null
||
data
==
null
)
{
if
(
printerName
==
null
||
data
==
null
)
{
throw
new
NullPointerException
();
throw
new
NullPointerException
();
}
}
setUpDoc
();
String
printerNameFromConfig
=
data
.
getPrinterConfig
().
getProperty
(
"name"
).
toString
();
setPrinter
(
printerName
);
if
(
printerName
.
equals
(
printerNameFromConfig
))
{
setUpDoc
();
byte
[]
result
=
mBuilder
.
assemble
(
data
);
setPrinter
(
printerName
);
byte
[]
result
=
mBuilder
.
assemble
(
data
);
// Printing the Document
print
(
result
);
}
else
{
throw
new
IllegalArgumentException
(
"The given Printername does not correspond with the Printername "
+
"in the printerConfig. Printerconfig: "
+
printerNameFromConfig
+
" Printer "
+
printerName
);
}
print
(
result
);
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment