1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063
|
/*
*
* Copyright (C) 1999, Institute for MicroTherapy
*
* This software and supporting documentation were developed by
*
* University of Witten/Herdecke
* Department of Radiology and MicroTherapy
* Institute for MicroTherapy
* Medical computer science
*
* Universitaetsstrasse 142
* 44799 Bochum, Germany
*
* http://www.microtherapy.de/go/cs
* mailto:computer.science@microtherapy.de
*
* THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND THE INSTITUTE MAKES NO
* WARRANTY REGARDING THE SOFTWARE, ITS PERFORMANCE, ITS MERCHANTABILITY
* OR FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES
* OR ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY
* AND PERFORMANCE OF THE SOFTWARE IS WITH THE USER.
*
*
* Author : $Author: kleber $
* Last update : $Date: 2001/06/06 10:32:30 $
* Revision : $Revision: 1.1.1.1 $
* State: $State: Exp $
*/
package dicomPrint;
import java.awt.*;
import java.util.*;
import de.microtherapy.tools.text.document.general.*;
import javax.swing.*;
import javax.swing.border.*;
import J2Ci.*;
import jToolkit.gui.*;
import main.*;
/**
* This class contains the GUI and with the interactions
* for the Print - Panel of DICOMscope.
*
* @author Klaus Kleber
* @since 01.10.99
*/
public class PrintPanel extends JPanel implements CommandButtonListener, CommandTextListener, PrintListener, CommandToggleButtonListener
{
private boolean diplayStoredPrintObjectMode = false;
/**
* Contains the print Button
*/
private CommandJButton printButton;
/**
* Contains the remove-Button
*/
private CommandJButton removeButton;
/**
* Contains the ComboBox for changing the printer
*/
private CommandJComboBox printerCombo;
/**
* Contains the ComboBox for changing the printer
*/
private CommandJComboBox storedPrintPrinterCombo;
/**
* Contains the ComboBox for changing the medium
*/
private CommandJComboBox mediumCombo;;
/**
* Contains the ComboBox for changing the film size
*/
private CommandJComboBox filmSizeCombo;
/**
* Contains the ComboBox for changing the orientation
*/
private CommandJComboBox orientationCombo;
/**
* Contains the ComboBox for changing the priority
*/
private CommandJComboBox priorityCombo;
/**
* Contains the ComboBox for changing the priority
*/
private CommandJTextField copiesText;
/**
* Contains the ComboBox for changing the magnification type
*/
private CommandJComboBox magnificationCombo;
/**
* Contains the ComboBox for changing the smoothing type
*/
private CommandJComboBox smoothingCombo;
/**
* Contains the ComboBox for changing the configuration
*/
private CommandJComboBox configurationCombo;
/**
* Contains the ComboBox for changing the resolution
*/
private CommandJComboBox resolutionCombo;
/**
* Contains the ComboBox for changing the trim setting
*/
private CommandJComboBox trimCombo;
/**
* Contains the ComboBox for changing the cropping setting
*/
private CommandJComboBox croppingCombo;
/**
* Contains the ComboBox for changing the border setting
*/
private CommandJComboBox borderCombo;
/**
* Contains the ComboBox for changing the empty image setting
*/
private CommandJComboBox emptyImageCombo;
/**
* Contains the ComboBox for changing the min density setting
*/
private CommandJComboBox minDensityCombo;
/**
* Contains the ComboBox for changing the max density setting
*/
private CommandJComboBox maxDensityCombo;
/**
* Contains the TextField for illumination
*/
private CommandJTextField illuminationText;
/**
* Contains the TextField for reflection
*/
private CommandJTextField reflectionText;
/**
* Contains the TextField for annatation text
*/
private JTextField annotationText;
/**
* Contains the Checkbox for annatation date
*/
private JCheckBox annDateCheckBox;
/**
* Contains the Checkbox for annatation date
*/
private JCheckBox annPrinterNameCheckBox;
/**
* Contains the Checkbox for Illumination/Light date
*/
private JCheckBox annIllCheckBox;
private CommandJRadioButton annOnRadioButton;
private CommandJRadioButton annOffRadioButton;
/**
* Contains the ComboBox for rows/cols
*/
private CommandJComboBox layoutCombo;
/**
* Contains the ComboBox for presentation Lut
*/
private CommandJComboBox presentationLutCombo;
/**
* Contains the ComboBox for the rendering mode
*/
private CommandJComboBox renderingCombo;
private boolean activeListener = false;
//Ids for handling the action Events
static final int ID_PRINTER = 0;
static final int ID_MEDIUM = 1;
static final int ID_FILMSIZE = 2;
static final int ID_ORIENTATION = 3;
static final int ID_LAYOUT = 200;
static final int ID_MAGNIFICATION = 4;
static final int ID_SMOOTHING = 5;
static final int ID_CONFIGURATION = 6;
static final int ID_RESOLUTION = 7;
static final int ID_TRIM = 8;
static final int ID_CROPPING = 9;
static final int ID_BORDER = 10;
static final int ID_EMPTYIMAGE = 11;
static final int ID_MAXDENSITY = 12;
static final int ID_MINDENSITY = 13;
static final int ID_PRIORITY = 14;
static final int ID_COPIES = 15;
static final int ID_PRESENTATIONLUT = 50;
static final int ID_ILLUMINATION = 51;
static final int ID_REFLECTION = 52;
static final int ID_RENDERING = 53;
static final int ID_PRINT = 100;
static final int ID_REMOVE = 101;
static final int ID_ANNON = 200;
static final int ID_ANNOFF = 201;
static final int ID_STOREDPRINTER = 300;
static final int ID_SELECTSTOREDPRINTER = 301;
static final int ID_CLEARSTOREDPRINT = 302;
/**
* Default value for the max density
*/
private int defaultMaxDensityValue = 300;
/**
* Default value for the max density
*/
private int defaultMinDensityValue = 20;
/**
* Contains information about the number of images and pages in the current print job
*/
private JLabel imageLabel = new JLabel();
/**
* Contains the current rows settings.
*/
private long printerCurrentRows = 1;
/**
* Contains the current cols settings.
*/
private long printerCurrentCols = 1;
/**
* Contains the target printer of the print job
*/
private String target;
/**
* Contains current jDVPSStoredPrint object with informations about the print settings of the print job
*/
private jDVPSStoredPrint storedPrint;
/**
* Contains the DVInterface.
*/
private jDVInterface dvi ;
/**
* This object contains the GUI for the print preview
*/
private PreviewPanel previewPanel;
/**
* Contains the mouse handler for all objects of this PrintPanel
*/
private PreviewMouseHandler previewMouseHandler;
/**
* Contains the Color for the imageLabel
*/
private Color labelColor = Color.white;
/**
* Contains the current Presentation State
*/
private jDVPresentationState ps;
/**
* If true cols and rows will be changed if orientation will be changed.
*/
private boolean currentOrientationIsPortrait = true;
/**
*
*/
JTabbedPane tabpane = new JTabbedPane();
private JPanel mainPanel = new JPanel();
private JPanel additionalPanel = new JPanel();
private JPanel buttonPanel = new JPanel();
private JPanel annPanel = new JPanel();
private JPanel storedPrintPanel = new JPanel();
private JPanel pLutPanel = new JPanel();
private GridBagConstraints fGbc = new GridBagConstraints();
/**
* Constructor. Builds the GUI and initializes the widgets.
* @param dvi Contains the current jDVInterface.
* @param config Configuration.
*/
public PrintPanel(jDVInterface dvi, Hashtable config )
{
this.dvi = dvi;
this.ps = ps;
setLayout(new BorderLayout());
//init MouseHandler
previewMouseHandler = new PreviewMouseHandler(this);
Controller.instance().addPrintListener(this);
storedPrint = dvi.getPrintHandler();
//builds the GUI
build();
//Init printerCombo
initPrinterCombo();
init();
reset();
activeListener = true;
//reset max density
orientationCombo.setSelectedItem("Portrait");
storedPrint.setFilmOrientation(jDVPSFilmOrientation.DVPSF_portrait);
}
/**
* Initializes the printerCombo from the jDVInterface
*/
public void initPrinterCombo()
{
////////////////////////////////////////////////
//fill printerCombo
///////////////////////////////////////////////////
int sizeFor = dvi.getNumberOfTargets(jDVPSPeerType.DVPSE_printAny);
printerCombo.removeAllItems();
storedPrintPrinterCombo.removeAllItems();
for (int i = 0; i < sizeFor; i++)
{
target = dvi.getTargetID(i, jDVPSPeerType.DVPSE_printAny);
printerCombo.addItem(dvi.getTargetDescription(target));
storedPrintPrinterCombo.addItem(dvi.getTargetDescription(target));
}
//Hier mu normalerweise Targetfestgelegt werden.
if (dvi.getCurrentPrinter() == null )
{
target = dvi.getTargetID(0, jDVPSPeerType.DVPSE_printAny);
dvi.setCurrentPrinter(target);
}
else target = dvi.getCurrentPrinter();
}
/**
* Build the GUI of the PrintPanel.
*
*/
public void build()
{
//Contains the PreviewPanel.
JPanel centerPanel = new JPanel();
centerPanel.setLayout(new BorderLayout());
//Contains the buttonPanel and the labelPanel.
JPanel downPanel = new JPanel(new GridLayout(1,1));
//Contains information about the print job
JPanel labelPanel = new JPanel();
labelPanel.add(imageLabel);
//labelPanel.setBackground(Color.lightGray);
downPanel.add(labelPanel);
//Contains the button bar
printButton = new CommandJButton("Print", this, ID_PRINT);
removeButton = new CommandJButton("Clear", this, ID_REMOVE);
buttonPanel.add(printButton);
buttonPanel.add(removeButton);
centerPanel.add(downPanel, BorderLayout.SOUTH);
//Init previewPanel
previewPanel = new PreviewPanel(previewMouseHandler,1,1,storedPrint, dvi);
centerPanel.add(previewPanel,BorderLayout.CENTER);
add(centerPanel, BorderLayout.CENTER);
GridBagConstraints gbc = new GridBagConstraints();
gbc.anchor = GridBagConstraints.NORTHWEST;
/////////////////////////////////////////////////////////////
//Print job settings
////////////////////////////////////////////////////////////
//Contains the settings for the print job
JLabel sizeLabel = new JLabel("MMMMMMMMMMMMMMMMMMMM");
Dimension prefSize = new Dimension(sizeLabel.getPreferredSize().width, sizeLabel.getPreferredSize().height+sizeLabel.getPreferredSize().height/4) ;
//mainPanel.setPreferredSize(prefSize);
//
//Contains the layout settings
JPanel layoutPanel = new JPanel();
layoutPanel.setLayout(new GridBagLayout());
layoutPanel.setBorder(new TitledBorder("Options"));
//Printer
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 0.0;
gbc.gridwidth = 1;
layoutPanel.add(new JLabel("Printer"),gbc);
layoutPanel.add(Box.createHorizontalStrut(10),gbc);
gbc.fill = GridBagConstraints.BOTH;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.weightx = 1.0;
printerCombo = new CommandJComboBox(this, ID_PRINTER);
printerCombo.setPreferredSize(prefSize);
layoutPanel.add(printerCombo,gbc);
//Medium
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 0.0;
gbc.gridwidth = 1;
layoutPanel.add(new JLabel("Medium"),gbc);
layoutPanel.add(Box.createHorizontalStrut(10),gbc);
gbc.fill = GridBagConstraints.BOTH;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.weightx = 1.0;
mediumCombo = new CommandJComboBox(this, ID_MEDIUM);
mediumCombo.setPreferredSize(prefSize);
layoutPanel.add(mediumCombo,gbc);
//film Size
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 0.0;
gbc.gridwidth = 1;
layoutPanel.add(new JLabel("Film Size"),gbc);
layoutPanel.add(Box.createHorizontalStrut(10),gbc);
gbc.fill = GridBagConstraints.BOTH;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.weightx = 1.0;
filmSizeCombo = new CommandJComboBox(this, ID_FILMSIZE);
filmSizeCombo.setPreferredSize(prefSize);
layoutPanel.add(filmSizeCombo,gbc);
//Orientation
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 0.0;
gbc.gridwidth = 1;
layoutPanel.add(new JLabel("Orientation"),gbc);
layoutPanel.add(Box.createHorizontalStrut(10),gbc);
gbc.fill = GridBagConstraints.BOTH;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.weightx = 1.0;
orientationCombo = new CommandJComboBox(this, ID_ORIENTATION);
orientationCombo.setPreferredSize(prefSize);
layoutPanel.add(orientationCombo,gbc);
//Priority
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 0.0;
gbc.gridwidth = 1;
layoutPanel.add(new JLabel("Priority"),gbc);
layoutPanel.add(Box.createHorizontalStrut(10),gbc);
gbc.fill = GridBagConstraints.BOTH;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.weightx = 1.0;
priorityCombo = new CommandJComboBox(this, ID_PRIORITY);
priorityCombo.setPreferredSize(prefSize);
layoutPanel.add(priorityCombo,gbc);
//Layout
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 0.0;
gbc.gridwidth = 1;
layoutPanel.add(new JLabel("Layout"),gbc);
layoutPanel.add(Box.createHorizontalStrut(10),gbc);
gbc.fill = GridBagConstraints.BOTH;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.weightx = 1.0;
layoutCombo = new CommandJComboBox(this, ID_LAYOUT);
layoutCombo.setPreferredSize(prefSize);
layoutPanel.add(layoutCombo,gbc);
//Copies
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 0.0;
gbc.gridwidth = 1;
layoutPanel.add(new JLabel("Copies"),gbc);
layoutPanel.add(Box.createHorizontalStrut(10),gbc);
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.weightx = 1.0;
copiesText = new CommandJTextField(2,this, ID_COPIES);
copiesText.setDocument(new IntegerDocument(1));
layoutPanel.add(copiesText,gbc);
/////////////////////////////////
//Contains the additional layout settings
//////////////////////////////////
JPanel addPanel = new JPanel();
addPanel.setBorder(new TitledBorder("Additional Options"));
JPanel addLeftPanel = new JPanel(new GridBagLayout());
//Magnification
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 0.0;
gbc.gridwidth = 1;
addLeftPanel.add(new JLabel("Magnification"),gbc);
addLeftPanel.add(Box.createHorizontalStrut(10),gbc);
gbc.fill = GridBagConstraints.BOTH;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.weightx = 1.0;
magnificationCombo = new CommandJComboBox(this, ID_MAGNIFICATION);
magnificationCombo.setPreferredSize(prefSize);
addLeftPanel.add(magnificationCombo,gbc);
//Smoothing
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 0.0;
gbc.gridwidth = 1;
addLeftPanel.add(new JLabel("Smoothing"),gbc);
addLeftPanel.add(Box.createHorizontalStrut(10),gbc);
gbc.fill = GridBagConstraints.BOTH;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.weightx = 1.0;
smoothingCombo = new CommandJComboBox(this, ID_SMOOTHING);
smoothingCombo.setPreferredSize(prefSize);
addLeftPanel.add(smoothingCombo,gbc);
//Configuration
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 0.0;
gbc.gridwidth = 1;
addLeftPanel.add(new JLabel("Configuration"),gbc);
addLeftPanel.add(Box.createHorizontalStrut(10),gbc);
gbc.fill = GridBagConstraints.BOTH;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.weightx = 1.0;
configurationCombo = new CommandJComboBox(this, ID_CONFIGURATION);
configurationCombo.setPreferredSize(prefSize);
addLeftPanel.add(configurationCombo,gbc);
//Resolution
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 0.0;
gbc.gridwidth = 1;
addLeftPanel.add(new JLabel("Resolution"),gbc);
addLeftPanel.add(Box.createHorizontalStrut(10),gbc);
gbc.fill = GridBagConstraints.BOTH;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.weightx = 1.0;
resolutionCombo = new CommandJComboBox(this, ID_RESOLUTION);
resolutionCombo.setPreferredSize(prefSize);
addLeftPanel.add(resolutionCombo,gbc);
JPanel addRightPanel = new JPanel(new GridBagLayout());
//Trim
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 0.0;
gbc.gridwidth = 1;
addLeftPanel.add(new JLabel("Trim"),gbc);
addLeftPanel.add(Box.createHorizontalStrut(10),gbc);
gbc.fill = GridBagConstraints.BOTH;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.weightx = 1.0;
trimCombo = new CommandJComboBox(this, ID_TRIM);
trimCombo.setPreferredSize(prefSize);
addLeftPanel.add(trimCombo,gbc);
//Cropping
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 0.0;
gbc.gridwidth = 1;
addLeftPanel.add(new JLabel("Cropping"),gbc);
addLeftPanel.add(Box.createHorizontalStrut(10),gbc);
gbc.fill = GridBagConstraints.BOTH;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.weightx = 1.0;
croppingCombo = new CommandJComboBox(this, ID_CROPPING);
croppingCombo.setPreferredSize(prefSize);
addLeftPanel.add(croppingCombo,gbc);
//Border
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 0.0;
gbc.gridwidth = 1;
addLeftPanel.add(new JLabel("Border"),gbc);
addLeftPanel.add(Box.createHorizontalStrut(10),gbc);
gbc.fill = GridBagConstraints.BOTH;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.weightx = 1.0;
borderCombo = new CommandJComboBox(this, ID_BORDER);
borderCombo.setPreferredSize(prefSize);
addLeftPanel.add(borderCombo,gbc);
//Empty Image
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 0.0;
gbc.gridwidth = 1;
addLeftPanel.add(new JLabel("Empty Image"),gbc);
addLeftPanel.add(Box.createHorizontalStrut(10),gbc);
gbc.fill = GridBagConstraints.BOTH;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.weightx = 1.0;
emptyImageCombo = new CommandJComboBox(this, ID_EMPTYIMAGE);
emptyImageCombo.setPreferredSize(prefSize);
addLeftPanel.add(emptyImageCombo,gbc);
//MinDesity
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 0.0;
gbc.gridwidth = 1;
addLeftPanel.add(new JLabel("Min Density"),gbc);
addLeftPanel.add(Box.createHorizontalStrut(10),gbc);
gbc.fill = GridBagConstraints.BOTH;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.weightx = 1.0;
minDensityCombo = new CommandJComboBox(this, ID_MINDENSITY);
minDensityCombo.setPreferredSize(prefSize);
addLeftPanel.add(minDensityCombo,gbc);
//MaxDesity
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 0.0;
gbc.gridwidth = 1;
addLeftPanel.add(new JLabel("Max Density"),gbc);
addLeftPanel.add(Box.createHorizontalStrut(10),gbc);
gbc.fill = GridBagConstraints.BOTH;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.weightx = 1.0;
maxDensityCombo = new CommandJComboBox(this, ID_MAXDENSITY);
maxDensityCombo.setPreferredSize(prefSize);
addLeftPanel.add(maxDensityCombo,gbc);
addPanel.add(addLeftPanel);
//////////////////////////////////////////////
//Contains the presentation lut settings
////////////////////////////////////////
pLutPanel.setLayout(new GridBagLayout());
pLutPanel.setBorder(new TitledBorder("Presentation LUT Options"));
//Illumination
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 0.0;
gbc.gridwidth = 1;
pLutPanel.add(new JLabel("Illumination (cd/m^2)"),gbc);
pLutPanel.add(Box.createHorizontalStrut(10),gbc);
gbc.fill = GridBagConstraints.BOTH;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.weightx = 1.0;
illuminationText = new CommandJTextField(10,this, ID_ILLUMINATION);
illuminationText.setDocument(new IntegerDocument(10));
pLutPanel.add(illuminationText,gbc);
//Illumination
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 0.0;
gbc.gridwidth = 1;
pLutPanel.add(new JLabel("Reflection (cd/m^2)"),gbc);
pLutPanel.add(Box.createHorizontalStrut(10),gbc);
gbc.fill = GridBagConstraints.BOTH;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.weightx = 1.0;
reflectionText = new CommandJTextField(10,this, ID_REFLECTION);
reflectionText.setDocument(new IntegerDocument(10));
pLutPanel.add(reflectionText,gbc);
//Presentation LUT
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 0.0;
gbc.gridwidth = 1;
pLutPanel.add(new JLabel("Presentation LUT"),gbc);
pLutPanel.add(Box.createHorizontalStrut(10),gbc);
gbc.fill = GridBagConstraints.BOTH;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.weightx = 1.0;
presentationLutCombo = new CommandJComboBox(this, ID_PRESENTATIONLUT);
presentationLutCombo.setPreferredSize(prefSize);
pLutPanel.add(presentationLutCombo,gbc);
//Reendering as
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 0.0;
gbc.gridwidth = 1;
pLutPanel.add(new JLabel("Rendering as"),gbc);
pLutPanel.add(Box.createHorizontalStrut(10),gbc);
gbc.fill = GridBagConstraints.BOTH;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.weightx = 1.0;
renderingCombo = new CommandJComboBox(this, ID_RENDERING);
renderingCombo.setPreferredSize(prefSize);
pLutPanel.add(renderingCombo,gbc);
///////////////////////////////
//
/////////////////////////////////////////////////////
annPanel.setLayout(new GridBagLayout());
annPanel.setBorder(new TitledBorder("Annotation"));
annOnRadioButton = new CommandJRadioButton("on", false, this, ID_ANNON);
annOffRadioButton = new CommandJRadioButton("off", true, this, ID_ANNOFF);
ButtonGroup bg = new ButtonGroup();
bg.add(annOnRadioButton);
bg.add(annOffRadioButton);
gbc.fill = GridBagConstraints.BOTH;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.weightx = 1.0;
annPanel.add(annOffRadioButton,gbc);
gbc.fill = GridBagConstraints.BOTH;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.weightx = 1.0;
annPanel.add(annOnRadioButton,gbc);
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 0.0;
gbc.gridwidth = 1;
annPanel.add(new JLabel(" "),gbc);
annPanel.add(Box.createHorizontalStrut(10),gbc);
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 0.0;
gbc.gridwidth = 1;
annPanel.add(new JLabel("Text:"),gbc);
annPanel.add(Box.createHorizontalStrut(10),gbc);
gbc.fill = GridBagConstraints.BOTH;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.weightx = 1.0;
annotationText = new JTextField();
annPanel.add(annotationText,gbc);
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 0.0;
gbc.gridwidth = 1;
annPanel.add(new JLabel(" "),gbc);
annPanel.add(Box.createHorizontalStrut(10),gbc);
gbc.fill = GridBagConstraints.BOTH;
gbc.gridwidth = GridBagConstraints.REMAINDER;
annDateCheckBox = new JCheckBox("Date/Time");
annPanel.add(annDateCheckBox,gbc);
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 0.0;
gbc.gridwidth = 1;
annPanel.add(new JLabel(" "),gbc);
annPanel.add(Box.createHorizontalStrut(10),gbc);
gbc.fill = GridBagConstraints.BOTH;
gbc.gridwidth = GridBagConstraints.REMAINDER;
annPrinterNameCheckBox = new JCheckBox("Printer Name");
annPanel.add(annPrinterNameCheckBox,gbc);
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 0.0;
gbc.gridwidth = 1;
annPanel.add(new JLabel(" "),gbc);
annPanel.add(Box.createHorizontalStrut(10),gbc);
gbc.fill = GridBagConstraints.BOTH;
gbc.gridwidth = GridBagConstraints.REMAINDER;
annIllCheckBox = new JCheckBox("Illumination/Reflection");
annPanel.add(annIllCheckBox,gbc);
//Contains the layout settings
storedPrintPanel = new JPanel();
storedPrintPanel.setLayout(new GridBagLayout());
storedPrintPanel.setBorder(new TitledBorder("Select Printer"));
//Printer
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 0.0;
gbc.gridwidth = 1;
storedPrintPanel.add(new CommandJButton("Clear",this,ID_CLEARSTOREDPRINT),gbc);
storedPrintPanel.add(Box.createHorizontalStrut(10),gbc);
gbc.weightx = 1.0;
storedPrintPanel.add(new CommandJButton("Select",this,ID_SELECTSTOREDPRINTER),gbc);
storedPrintPanel.add(Box.createHorizontalStrut(10),gbc);
gbc.fill = GridBagConstraints.BOTH;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.weightx = 2.0;
storedPrintPrinterCombo = new CommandJComboBox(this, ID_STOREDPRINTER);
storedPrintPrinterCombo.setPreferredSize(prefSize);
storedPrintPanel.add(storedPrintPrinterCombo,gbc);
mainPanel.setLayout(new GridBagLayout());
fGbc.anchor = GridBagConstraints.NORTH;
// fGbc.gridwidth = 1;
//fGbc.gridheight = 1;
fGbc.gridx = GridBagConstraints.REMAINDER;
fGbc.fill = GridBagConstraints.HORIZONTAL;
mainPanel.add(layoutPanel,fGbc);
mainPanel.add(pLutPanel,fGbc);
mainPanel.add(buttonPanel,fGbc);
additionalPanel.setLayout(new GridBagLayout());
additionalPanel.add(addPanel,fGbc);
additionalPanel.add(annPanel,fGbc);
JPanel t1 = new JPanel();
t1.setLayout(new BorderLayout());
t1.add(mainPanel,BorderLayout.NORTH);
tabpane.add(t1, "Main");
JPanel t2 = new JPanel();
t2.setLayout(new BorderLayout());
t2.add(additionalPanel,BorderLayout.NORTH);
tabpane.add(t2, "Additional");
add(tabpane, BorderLayout.EAST);
}
private void initStoredPrint()
{
activeListener = false;
String value= null;
String name = storedPrint.getPrinterName();
if (name != null)value = dvi.getTargetDescription(storedPrint.getPrinterName());
if(value == null) value = name;
if(value == null) value = "";
printerCombo.removeAllItems();
printerCombo.addItem(value);
mediumCombo.removeAllItems();
mediumCombo.addItem("<Default>");
filmSizeCombo.removeAllItems();
value = storedPrint.getFilmSizeID();
if(value == null) value = "<Default>";
filmSizeCombo.addItem(value);
orientationCombo.removeAllItems();
int or = storedPrint.getFilmOrientation();
switch (or)
{
case jDVPSFilmOrientation.DVPSF_portrait: value = "PORTRAIT";
break;
case jDVPSFilmOrientation.DVPSF_landscape : value = "LANDSCAPE";
break;
case jDVPSFilmOrientation.DVPSF_default: value = "<Default>";
break;
}
orientationCombo.addItem(value);
priorityCombo.removeAllItems();
priorityCombo.addItem("<Default>");
layoutCombo.removeAllItems();
printerCurrentRows= storedPrint.getImageDisplayFormatRows();
printerCurrentCols= storedPrint.getImageDisplayFormatColumns();
value = "" + printerCurrentRows + "/" + printerCurrentCols;
layoutCombo.addItem(value);
copiesText.setText("1");
magnificationCombo.removeAllItems();
value = storedPrint.getMagnificationType();
if(value == null) value = "<Default>";
magnificationCombo.addItem(value);
smoothingCombo.removeAllItems();
value = storedPrint.getSmoothingType();
if(value == null) value = "<Default>";
smoothingCombo.addItem(value);
configurationCombo.removeAllItems();
value = storedPrint.getConfigurationInformation();
if(value == null) value = "<Default>";
configurationCombo.addItem(value);
resolutionCombo.removeAllItems();
value = storedPrint.getResolutionID();
if(value == null) value = "<Default>";
resolutionCombo.addItem(value);
trimCombo.removeAllItems();
int tr = storedPrint.getTrim();
switch (tr)
{
case jDVPSTrimMode.DVPSH_trim_on: value = "On";
break;
case jDVPSTrimMode.DVPSH_trim_off : value = "Off";
break;
case jDVPSTrimMode.DVPSH_default: value = "<Default>";
break;
}
trimCombo.addItem(value);
croppingCombo.removeAllItems();
int cr = storedPrint.getRequestedDecimateCropBehaviour();
switch (cr)
{
case jDVPSDecimateCropBehaviour.DVPSI_decimate: value = "DECIMATE";
break;
case jDVPSDecimateCropBehaviour.DVPSI_crop : value = "CROP";
break;
case jDVPSDecimateCropBehaviour.DVPSI_fail : value = "FAIL";
break;
case jDVPSDecimateCropBehaviour.DVPSI_default: value = "<Default>";
break;
}
croppingCombo.addItem(value);
borderCombo.removeAllItems();
value = storedPrint.getBorderDensity();
if(value == null) value = "<Default>";
borderCombo.addItem(value);
emptyImageCombo.removeAllItems();
value = storedPrint.getEmtpyImageDensity();
if(value == null) value = "<Default>";
emptyImageCombo.addItem(value);
minDensityCombo.removeAllItems();
value = storedPrint.getMinDensity();
if(value == null) value = "<Default>";
minDensityCombo.addItem(value);
maxDensityCombo.removeAllItems();
value = storedPrint.getMaxDensity();
if(value == null) value = "<Default>";
maxDensityCombo.addItem(value);
try
{
illuminationText.setText(new Integer(storedPrint.getPrintIllumination()).toString());
}
catch (Exception e)
{
illuminationText.setText(new String("-1"));
}
try
{
reflectionText.setText(new Integer(storedPrint.getPrintReflectedAmbientLight()).toString());
}
catch (Exception e)
{
reflectionText.setText(new String("-1"));
}
}
/**
* Initializes the widgets with values form the DVIInterface
*/
public void init()
{
///////////////////////////////
//Fill medium for current Printer
/////////////////////////////////
int forSize = dvi.getNumberOfLUTs();;
presentationLutCombo.removeAllItems();
for (int i = 0; i < forSize;i++)
{
//dvi.getTargetDescription(String)
presentationLutCombo.addItem( dvi.getLUTDescription(dvi.getLUTID(i)));
}
presentationLutCombo.addItem(new String("IDENTITY"));
presentationLutCombo.addItem(new String("LIN OD"));
presentationLutCombo.addItem(new String("<Default>"));
renderingCombo.removeAllItems();
renderingCombo.addItem("Hardcopy");
renderingCombo.addItem("Softcopy");
///////////////////////////////
//Fill medium for current Printer
/////////////////////////////////
mediumCombo.removeAllItems();
int s = dvi.getTargetPrinterNumberOfMediumTypes(target);
for (int i = 0; i < s;i++)
{
mediumCombo.addItem(dvi.getTargetPrinterMediumType(target, i ));
}
mediumCombo.addItem(new String("<Default>"));
///////////////////////////////
//Fill Film size for current Printer
/////////////////////////////////
filmSizeCombo.removeAllItems();
forSize = dvi.getTargetPrinterNumberOfFilmSizeIDs(target);
for (int i = 0; i < forSize;i++)
{
filmSizeCombo.addItem(dvi.getTargetPrinterFilmSizeID(target, i ));
}
filmSizeCombo.addItem(new String("<Default>"));
///////////////////////////////
//Orietation
/////////////////////////////////
orientationCombo.removeAllItems();
orientationCombo.addItem(new String("Portrait"));
orientationCombo.addItem(new String("Landscape"));
orientationCombo.addItem(new String("<Default>"));
priorityCombo.removeAllItems();
priorityCombo.addItem(new String("HIGH"));
priorityCombo.addItem(new String("MED"));
priorityCombo.addItem(new String("LOW"));
priorityCombo.addItem(new String("<Default>"));
///////////////////////////////
//Fill Magnification for current Printer
/////////////////////////////////
magnificationCombo.removeAllItems();
forSize = dvi.getTargetPrinterNumberOfMagnificationTypes(target);
for (int i = 0; i < forSize;i++)
{
magnificationCombo.addItem( dvi.getTargetPrinterMagnificationType(target, i ));
}
magnificationCombo.addItem(new String("<Default>"));
///////////////////////////////
//Fehler getTargetPrinterConfigurationSetting
/////////////////////////////////
configurationCombo.removeAllItems();
forSize = dvi.getTargetPrinterNumberOfConfigurationSettings(target);
for (int i = 0; i < forSize;i++)
{
configurationCombo.addItem(dvi.getTargetPrinterConfigurationSetting(target, i ));
}
configurationCombo.addItem(new String("<Default>"));
///////////////////////////////
//Resolution
/////////////////////////////////
resolutionCombo.removeAllItems();
forSize = dvi.getTargetPrinterNumberOfPrinterResolutionIDs(target);
for (int i = 0; i < forSize;i++)
{
resolutionCombo.addItem( dvi.getTargetPrinterResolutionID(target, i ));
}
resolutionCombo.addItem(new String("<Default>"));
///////////////////////////////
//Trim
/////////////////////////////////
trimCombo.removeAllItems();
if (dvi.getTargetPrinterSupportsTrim(target))
{
trimCombo.addItem(new String("On"));
trimCombo.addItem(new String("Off"));
}
trimCombo.addItem(new String("<Default>"));
///////////////////////////////
//crop
/////////////////////////////////
croppingCombo.removeAllItems();
if (dvi.getTargetPrinterSupportsDecimateCrop(target))
{
croppingCombo.addItem(new String("DECIMATE"));
croppingCombo.addItem(new String("CROP"));
croppingCombo.addItem(new String("FAIL"));
}
croppingCombo.addItem(new String("<Default>"));
///////////////////////////////
//Border Error
/////////////////////////////////
borderCombo.removeAllItems();
forSize = dvi.getTargetPrinterNumberOfBorderDensities(target);
for (int i = 0; i < forSize;i++)
{
borderCombo.addItem(dvi.getTargetPrinterBorderDensity(target, i ));
}
borderCombo.addItem(new String("<Default>"));
///////////////////////////////
//EmptyImages
/////////////////////////////////
emptyImageCombo.removeAllItems();
forSize = dvi.getTargetPrinterNumberOfEmptyImageDensities(target);
for (int i = 0; i < forSize;i++)
{
emptyImageCombo.addItem(dvi.getTargetPrinterEmptyImageDensity(target, i) );
}
emptyImageCombo.addItem(new String("<Default>"));
///////////////////////////////
//Min Density
/////////////////////////////////
minDensityCombo.removeAllItems();
forSize = dvi.getTargetPrinterNumberOfMinDensities(target);
for (int i = 0; i < forSize;i++)
{
minDensityCombo.addItem(dvi.getTargetPrinterMinDensity(target, i ));
}
minDensityCombo.addItem(new String("<Default>"));
///////////////////////////////
//Min Density
/////////////////////////////////
maxDensityCombo.removeAllItems();
forSize = dvi.getTargetPrinterNumberOfMaxDensities(target);
for (int i = 0; i < forSize;i++)
{
maxDensityCombo.addItem(dvi.getTargetPrinterMaxDensity(target, i ));
}
maxDensityCombo.addItem(new String("<Default>"));
///////////////////////////////
//Illumination/Reflection Light
/////////////////////////////////
illuminationText.setText(new Integer(storedPrint.getPrintIllumination()).toString());
reflectionText.setText(new Integer(storedPrint.getPrintReflectedAmbientLight()).toString());
}
/**
* Initialize the smoothingCombo.
*/
public void initSmoothing()
{
smoothingCombo.removeAllItems();
if ((storedPrint.getMagnificationType() != null) &&storedPrint.getMagnificationType().equals("CUBIC"))
{
int forSize = dvi.getTargetPrinterNumberOfSmoothingTypes(target);
for (int i = 0; i < forSize;i++)
{
smoothingCombo.addItem(dvi.getTargetPrinterSmoothingType(target, i ));
}
}
smoothingCombo.addItem(new String("<Default>"));
smoothingCombo.setSelectedIndex(smoothingCombo.getItemCount()-1);
storedPrint.setSmoothingType(new String(""));
}
/**
* Handles the action events from Buttons and ComboBoxes
*
* @param ID ID of the clicked widget
*/
public void buttonClicked (int ID)
{
if (activeListener)
{
activeListener = false;
switch (ID)
{
case ID_PRINT:
if (annOffRadioButton.isSelected())
{
dvi.setActiveAnnotation(false);
}
else
{
dvi.setActiveAnnotation(true);
dvi.setPrependDateTime(annDateCheckBox.isSelected());
dvi.setAnnotationText(annotationText.getText());
dvi.setPrependLighting(annIllCheckBox.isSelected());
dvi.setPrependPrinterName(annPrinterNameCheckBox.isSelected());
}
int status = dvi.spoolPrintJob(true);
previewPanel.updatePrintPreview();
setLabel();
break;
case ID_RENDERING:
if (renderingCombo.getSelectedIndex() == 0)
{
previewPanel.setPrintLUT(true);
previewPanel.updatePrintPreview();
}
else
{
previewPanel.setPrintLUT(false);
previewPanel.updatePrintPreview();
}
break;
case ID_PRESENTATIONLUT:
int num = presentationLutCombo.getItemCount();
if (presentationLutCombo.getSelectedIndex() == num-1)storedPrint.setDefaultPresentationLUT();
else if(presentationLutCombo.getSelectedIndex() == num-2) storedPrint.setPresentationLUTShape(jDVPSPresentationLUTType.DVPSP_lin_od);
else if(presentationLutCombo.getSelectedIndex() == num-3) storedPrint.setPresentationLUTShape(jDVPSPresentationLUTType.DVPSP_identity);
else
{
int i = presentationLutCombo.getSelectedIndex();
status = dvi.selectPrintPresentationLUT(dvi.getLUTID(i));
}
previewPanel.updatePrintPreview();
break;
case ID_PRINTER:
target = dvi.getTargetID(printerCombo.getSelectedIndex(), jDVPSPeerType.DVPSE_printAny);
dvi.setCurrentPrinter(target);
activeListener = false;
init();
reset();
activeListener = true;
//previewPanel.updatePrintPreview();
break;
case ID_REMOVE:
storedPrint.deleteMultipleImages(storedPrint.getNumberOfImages());
previewPanel.updatePrintPreview();
setLabel();
break;
case ID_MEDIUM:
if ( mediumCombo.getSelectedIndex() >= dvi.getTargetPrinterNumberOfMediumTypes(target)) dvi.setPrinterMediumType(new String(""));
else dvi.setPrinterMediumType((String)mediumCombo.getSelectedItem());
break;
case ID_FILMSIZE:
if ( filmSizeCombo.getSelectedIndex() >= dvi.getTargetPrinterNumberOfFilmSizeIDs(target))
{
previewPanel.setDefaultFilmSize();
storedPrint.setFilmSizeID(new String(""));
}
else
{
storedPrint.setFilmSizeID((String)filmSizeCombo.getSelectedItem());
String s = (String)filmSizeCombo.getSelectedItem();
try
{
int startFirstDigit = 0;
int endFirstDigit = 0;
int startSecondDigit = 0;
int endSecondDigit = 0;
for (;;startFirstDigit++)if (Character.isDigit(s.charAt(startFirstDigit)))break;
endFirstDigit = startFirstDigit;
for (;;endFirstDigit++)if (!Character.isDigit(s.charAt(endFirstDigit)))break;
startSecondDigit = endFirstDigit+1;
for (;;startSecondDigit++)if (Character.isDigit(s.charAt(startSecondDigit)))break;
endSecondDigit = startSecondDigit;
for (;;endSecondDigit++)if (!Character.isDigit(s.charAt(endSecondDigit)))break;
int scaleW = new Integer(s.substring(startFirstDigit,endFirstDigit)).intValue();
int scaleH = new Integer(s.substring(startSecondDigit,endSecondDigit)).intValue();
previewPanel.setFilmSize(scaleW,scaleH);
}
catch(Exception e)
{
dvi.writeLogMessage(jDVPSLogMessageLevel.DVPSM_warning,"GUI - PRINT","Unable to parse String for FILM SIZE: " + s + ", printer: " + storedPrint.getPrinterName());
previewPanel.setDefaultFilmSize();
}
}
break;
case ID_PRIORITY:
if ( priorityCombo.getSelectedItem().equals("<Default>")) dvi.setPrinterPriority(new String(""));
else dvi.setPrinterPriority((String)priorityCombo.getSelectedItem());
break;
case ID_ORIENTATION:
activeListener = false;
boolean hasChanged = false;
if ( orientationCombo.getSelectedItem().equals("<Default>"))
{
storedPrint.setFilmOrientation(jDVPSFilmOrientation.DVPSF_default);
if (!currentOrientationIsPortrait )
{
currentOrientationIsPortrait = true;
hasChanged = true;
}
}
else if ( orientationCombo.getSelectedItem().equals("Landscape"))
{
storedPrint.setFilmOrientation(jDVPSFilmOrientation.DVPSF_landscape);
if (currentOrientationIsPortrait )
{
currentOrientationIsPortrait = false;
hasChanged = true;
}
}
else if ( orientationCombo.getSelectedItem().equals("Portrait"))
{
storedPrint.setFilmOrientation(jDVPSFilmOrientation.DVPSF_portrait);
if (!currentOrientationIsPortrait )
{
currentOrientationIsPortrait = true;
hasChanged = true;
}
}
if (hasChanged)
{
if (orientationCombo.getSelectedIndex()== 1) previewPanel.setOrientation(false);
else previewPanel.setOrientation(true);
long help = printerCurrentRows;
printerCurrentRows= printerCurrentCols ;
printerCurrentCols = help;
setLayoutCombo();
}
break;
case ID_MAGNIFICATION:
if ( magnificationCombo.getSelectedIndex() >= dvi.getTargetPrinterNumberOfMagnificationTypes(target)) storedPrint.setMagnificationType(new String(""));
else storedPrint.setMagnificationType((String)magnificationCombo.getSelectedItem());
initSmoothing();
break;
case ID_SMOOTHING:
if ( smoothingCombo.getSelectedIndex() >= dvi.getTargetPrinterNumberOfSmoothingTypes(target)) storedPrint.setSmoothingType(new String(""));
else storedPrint.setSmoothingType((String)smoothingCombo.getSelectedItem());
break;
case ID_RESOLUTION:
if ( resolutionCombo.getSelectedIndex() >= dvi.getTargetPrinterNumberOfPrinterResolutionIDs(target)) storedPrint.setResolutionID(new String(""));
else storedPrint.setResolutionID((String)resolutionCombo.getSelectedItem());
break;
case ID_CONFIGURATION:
if ( configurationCombo.getSelectedIndex() >= dvi.getTargetPrinterNumberOfConfigurationSettings(target)) storedPrint.setConfigurationInformation(new String(""));
else storedPrint.setConfigurationInformation((String)configurationCombo.getSelectedItem());
break;
case ID_TRIM:
if (dvi.getTargetPrinterSupportsTrim(target))
{
if (trimCombo.getSelectedIndex() == 0) storedPrint.setTrim(jDVPSTrimMode.DVPSH_trim_on);
if (trimCombo.getSelectedIndex() == 1) storedPrint.setTrim(jDVPSTrimMode.DVPSH_trim_off);
if (trimCombo.getSelectedIndex() == 2) storedPrint.setTrim(jDVPSTrimMode.DVPSH_default);
}
break;
case ID_CROPPING:
if (dvi.getTargetPrinterSupportsDecimateCrop(target))
{
if (croppingCombo.getSelectedIndex() == 0) storedPrint.setRequestedDecimateCropBehaviour(jDVPSDecimateCropBehaviour.DVPSI_decimate);
if (croppingCombo.getSelectedIndex() == 1) storedPrint.setRequestedDecimateCropBehaviour(jDVPSDecimateCropBehaviour.DVPSI_crop);
if (croppingCombo.getSelectedIndex() == 2) storedPrint.setRequestedDecimateCropBehaviour(jDVPSDecimateCropBehaviour.DVPSI_fail);
if (croppingCombo.getSelectedIndex() == 3) storedPrint.setRequestedDecimateCropBehaviour(jDVPSDecimateCropBehaviour.DVPSI_default);
}
break;
case ID_BORDER:
if ( borderCombo.getSelectedIndex() >= dvi.getTargetPrinterNumberOfBorderDensities(target))
{
storedPrint.setBorderDensity(new String(""));
}
else storedPrint.setBorderDensity((String)borderCombo.getSelectedItem());
previewPanel.setFilmColor(getBorderColor());
break;
case ID_EMPTYIMAGE:
if ( emptyImageCombo.getSelectedIndex() >= dvi.getTargetPrinterNumberOfEmptyImageDensities(target))
{
storedPrint.setEmtpyImageDensity(new String(""));
previewPanel.setDefaultEmptyImageColor();
}
else storedPrint.setEmtpyImageDensity((String)emptyImageCombo.getSelectedItem());
previewPanel.setEmptyImageColor(getEmptyImageColor());
break;
case ID_MINDENSITY:
if ( minDensityCombo.getSelectedIndex() >= dvi.getTargetPrinterNumberOfMinDensities(target)) storedPrint.setMinDensity(new String(""));
else storedPrint.setMinDensity((String)minDensityCombo.getSelectedItem());
//previewPanel.setFilmAndEmptyImageColor(getBorderColor(),getEmptyImageColor());
break;
case ID_MAXDENSITY:
if ( maxDensityCombo.getSelectedIndex() >= dvi.getTargetPrinterNumberOfMaxDensities(target)) storedPrint.setMaxDensity(new String(""));
else storedPrint.setMaxDensity((String)maxDensityCombo.getSelectedItem());
//previewPanel.setFilmAndEmptyImageColor(getBorderColor(),getEmptyImageColor());
break;
case ID_LAYOUT:
int index = layoutCombo.getSelectedIndex();
printerCurrentRows = dvi.getTargetPrinterPortraitDisplayFormatRows(target, index );
printerCurrentCols = dvi.getTargetPrinterPortraitDisplayFormatColumns(target, index );
if (!currentOrientationIsPortrait)
{
long help = printerCurrentRows;
printerCurrentRows = printerCurrentCols;
printerCurrentCols = help;
}
//set value
storedPrint.setImageDisplayFormat(printerCurrentCols, printerCurrentRows);
//change previewPanel
previewPanel.setRowsCols((int) printerCurrentRows,(int)printerCurrentCols);
setLabel();
break;
}
activeListener = true;
}
if (ID == ID_SELECTSTOREDPRINTER)
{
activeListener = false;
String medium =(String) mediumCombo.getItemAt(0);
String filmSize =(String) filmSizeCombo.getItemAt(0);
String orientation =(String) orientationCombo.getItemAt(0);
String magnification =(String) magnificationCombo.getItemAt(0);
//Pririty Defualt
String smoothing =(String) smoothingCombo.getItemAt(0);
String configuration =(String) configurationCombo.getItemAt(0);
String resolution =(String) resolutionCombo.getItemAt(0);
String trim =(String) trimCombo.getItemAt(0);
String cropping =(String) croppingCombo.getItemAt(0);
String border =(String) borderCombo.getItemAt(0);
String emptyImage =(String) emptyImageCombo.getItemAt(0);
String minDensity =(String) minDensityCombo.getItemAt(0);
String maxDensity =(String) maxDensityCombo.getItemAt(0);
target = dvi.getTargetID(storedPrintPrinterCombo.getSelectedIndex(), jDVPSPeerType.DVPSE_printAny);
dvi.setCurrentPrinter(target);
initPrinterCombo();
init();
reset();
mainPanel.remove(storedPrintPanel);
additionalPanel.add(annPanel,fGbc);
mainPanel.add(buttonPanel,fGbc);
pLutPanel.setEnabled(true);
presentationLutCombo.setEnabled(true);
renderingCombo.setEnabled(true);
illuminationText.setEnabled(true);
reflectionText.setEnabled(true);
copiesText.setEnabled(true);
activeListener = true;
return;
}
if (ID == ID_CLEARSTOREDPRINT)
{
activeListener = false;
initPrinterCombo();
init();
reset();
storedPrint.deleteMultipleImages(storedPrint.getNumberOfImages());
previewPanel.updatePrintPreview();
setLabel();
mainPanel.remove(storedPrintPanel);
additionalPanel.add(annPanel,fGbc);
mainPanel.add(buttonPanel,fGbc);
presentationLutCombo.setEnabled(true);
renderingCombo.setEnabled(true);
illuminationText.setEnabled(true);
reflectionText.setEnabled(true);
copiesText.setEnabled(true);
activeListener = true;
}
}
public void buttonClicked (int ID, boolean selected)
{
if (activeListener)
{
switch (ID)
{
case ID_ANNOFF:
annotationText.setEnabled(false);
annDateCheckBox.setEnabled(false);
annPrinterNameCheckBox.setEnabled(false);
annIllCheckBox.setEnabled(false);
break;
case ID_ANNON:
annotationText.setEnabled(true);
annDateCheckBox.setEnabled(true);
annPrinterNameCheckBox.setEnabled(true);
annIllCheckBox.setEnabled(true);
break;
}
}
}
public int getBorderColor()
{
if ( borderCombo.getSelectedIndex() >= dvi.getTargetPrinterNumberOfBorderDensities(target))
{
return -1;
}
else
{
String s = (String)borderCombo.getSelectedItem();
if (s.equals("BLACK"))return 0;
else if (s.equals("WHITE"))return 255;
else
{
int minD = defaultMinDensityValue;
int maxD= defaultMaxDensityValue;
/*
if ( minDensityCombo.getSelectedIndex() >= dvi.getTargetPrinterNumberOfMinDensities(target))
{
minD = defaultMinDensityValue;
}
else
{
String sD = (String)minDensityCombo.getSelectedItem();
try
{
minD = new Integer(sD).intValue();
}
catch(Exception e)
{
minD = defaultMinDensityValue;
}
}
if ( maxDensityCombo.getSelectedIndex() >= dvi.getTargetPrinterNumberOfMaxDensities(target))
{
maxD = defaultMaxDensityValue;
}
else
{
String sD = (String)maxDensityCombo.getSelectedItem();
try
{
maxD = new Integer(sD).intValue();
}
catch(Exception e)
{
maxD = defaultMaxDensityValue;
}
}
*/
try
{
int density = new Integer(s).intValue();
int colorValue = storedPrint.convertODtoPValue(density, 8);
if (colorValue < 0) return -1;
else return colorValue;
}
catch(Exception e)
{
// System.err.println("Hallo Err: " + e);
return -1;
}
}
//dvi.convertODtoLum(int density, int min, int max, int bits);
}
}
public int getEmptyImageColor()
{
if ( emptyImageCombo.getSelectedIndex() >= dvi.getTargetPrinterNumberOfEmptyImageDensities(target))
{
return -1;
}
else
{
String s = (String)emptyImageCombo.getSelectedItem();
if (s.equals("BLACK"))return 0;
else if (s.equals("WHITE"))return 255;
else
{
int minD;
if ( minDensityCombo.getSelectedIndex() >= dvi.getTargetPrinterNumberOfMinDensities(target))
{
minD = defaultMinDensityValue;
}
else
{
String sD = (String)minDensityCombo.getSelectedItem();
try
{
minD = new Integer(sD).intValue();
}
catch(Exception e)
{
minD = defaultMinDensityValue;
}
}
int maxD;
if ( maxDensityCombo.getSelectedIndex() >= dvi.getTargetPrinterNumberOfMaxDensities(target))
{
maxD = defaultMaxDensityValue;
}
else
{
String sD = (String)maxDensityCombo.getSelectedItem();
try
{
maxD = new Integer(sD).intValue();
}
catch(Exception e)
{
maxD = defaultMaxDensityValue;
}
}
try
{
int density = new Integer(s).intValue();
int colorValue = storedPrint.convertODtoPValue(density, 8);
/*System.err.println("Color: " + colorValue);
System.err.println("minD: " + minD);
System.err.println("maxD: " + maxD);
System.err.println("density: " + density);*/
if (colorValue < 0) return -1;
else return colorValue;
}
catch(Exception e)
{
///System.err.println("Hallo Err: " + e);
return -1;
}
}
//dvi.convertODtoLum(int density, int min, int max, int bits);
}
}
/**
* Handles the ActionEvents and FocusLostEvents from TextFields
*
* @param ID ID of the fired widget
* @param text The new text
*/
public void setText(int ID, String text)
{
if (activeListener)
{
switch (ID)
{
case ID_ILLUMINATION:
if (text.trim().equals(""))
{
JOptionPane.showMessageDialog(null,"Value must be => 0");
illuminationText.setText("0");
}
storedPrint.setPrintIllumination(new Integer(text).intValue());
previewPanel.updatePrintPreview();
break;
case ID_REFLECTION:
if (text.trim().equals(""))
{
JOptionPane.showMessageDialog(null,"Value must be >= 0");
reflectionText.setText("0");
}
storedPrint.setPrintReflectedAmbientLight(new Integer(text).intValue());
previewPanel.updatePrintPreview();
break;
case ID_COPIES:
if (text.equals(""))dvi.setPrinterNumberOfCopies(0);
else
{
int copies = (new Integer(text)).intValue();
if (copies < 1)
{
JOptionPane.showMessageDialog(null,"Value must be > 1");
copiesText.setText("1");
dvi.setPrinterNumberOfCopies(1);
}
else
{
if (copies > 9)
{
JOptionPane.showMessageDialog(null,"Value must be <= 9");
copiesText.setText("9");
dvi.setPrinterNumberOfCopies(9);
}
else
{
dvi.setPrinterNumberOfCopies(copies);
}
}
}
break;
}
}
}
/**
* resets the settings for the print job.
* Necessary if changing the current printer.
*/
public void reset()
{
storedPrint = dvi.getPrintHandler();
previewPanel.setStoredPrint(storedPrint);
storedPrint.newPrinter();
renderingCombo.setSelectedIndex(0);
storedPrint.setDefaultPresentationLUT();
presentationLutCombo.setSelectedIndex(presentationLutCombo.getItemCount()-1);
if (!dvi.getTargetPrinterSupportsAnnotation(dvi.getCurrentPrinter()))
{
annOffRadioButton.setSelected(true);
annOnRadioButton.setEnabled(false);
annotationText.setEnabled(false);
annDateCheckBox.setEnabled(false);
annPrinterNameCheckBox.setEnabled(false);
annIllCheckBox.setEnabled(false);
}
else annOnRadioButton.setEnabled(true);
copiesText.setText("1");
dvi.setPrinterNumberOfCopies(new Integer(copiesText.getText()).intValue());
//reset medium type
dvi.setPrinterMediumType(new String(""));
mediumCombo.setSelectedIndex(mediumCombo.getItemCount()-1);
//reset filmSize
//storedPrint.setFilmSizeID(new String(""));
filmSizeCombo.setSelectedIndex(filmSizeCombo.getItemCount()-1);
//reset magnification type
//storedPrint.setMagnificationType(new String(""));
magnificationCombo.setSelectedIndex(magnificationCombo.getItemCount()-1);
//reset smoothing
initSmoothing();
//reset filmSize
//storedPrint.setFilmSizeID(new String(""));
priorityCombo.setSelectedIndex(priorityCombo.getItemCount()-1);
//reset configuration
//storedPrint.setConfigurationInformation(new String(""));
configurationCombo.setSelectedIndex(configurationCombo.getItemCount()-1);
//reset resolution
resolutionCombo.setSelectedIndex(resolutionCombo.getItemCount()-1);
storedPrint.setResolutionID(new String(""));
//reset trim
//storedPrint.setTrim(jDVPSTrimMode.DVPSH_default);
trimCombo.setSelectedIndex(trimCombo.getItemCount()-1);
//reset requested decimate crop behaviour
//storedPrint.setRequestedDecimateCropBehaviour(jDVPSDecimateCropBehaviour.DVPSI_default);
croppingCombo.setSelectedIndex(croppingCombo.getItemCount()-1);
//reset border
borderCombo.setSelectedIndex(borderCombo.getItemCount()-1);
storedPrint.setBorderDensity(new String(""));
//reset empty image
emptyImageCombo.setSelectedIndex(emptyImageCombo.getItemCount()-1);
storedPrint.setEmtpyImageDensity(new String(""));
//reset min density
minDensityCombo.setSelectedIndex(minDensityCombo.getItemCount()-1);
storedPrint.setMinDensity(new String(""));
//reset max density
maxDensityCombo.setSelectedIndex(maxDensityCombo.getItemCount()-1);
storedPrint.setMaxDensity(new String(""));
previewPanel.setFilmAndEmptyImageColorWithoutUpdate(getBorderColor(), getEmptyImageColor());
setLayoutCombo();
}
/**
* Handle DSEvents from other components.
*
* @param e
*/
public boolean processPrint(DSEvent e)
{
//Notification about receiveing and new print hardcopy.
if (e instanceof PrintEvent)
{
PrintEvent pe = (PrintEvent)e;
if (pe.type == pe.ID_HC)
{
activeListener = false;
previewPanel.instertPrint();
setLabel();
activeListener = true;
}
else
{
activeListener = false;
storedPrint = dvi.getPrintHandler();
diplayStoredPrintObjectMode = true;
//inset a new image preview into the PreviewPanel.
additionalPanel.remove(annPanel);
mainPanel.remove(buttonPanel);
mainPanel.add(storedPrintPanel,fGbc);
initStoredPrint();
boolean portrait = true;
if (storedPrint.getFilmOrientation()== jDVPSFilmOrientation.DVPSF_landscape) portrait = false;
previewPanel.updatePrintPreview(storedPrint,portrait, (int)storedPrint.getImageDisplayFormatRows(),(int)storedPrint.getImageDisplayFormatColumns());
setLabel();
presentationLutCombo.setEnabled(false);
renderingCombo.setEnabled(false);
illuminationText.setEnabled(false);
reflectionText.setEnabled(false);
copiesText.setEnabled(false);
activeListener = true;
}
//
}
return false;
}
/**
* Fills the imageLabel.
*/
public void setLabel()
{
int pagesInJob = Math.max(storedPrint.getNumberOfImages()/(int)(printerCurrentRows*printerCurrentCols),1);
//if (storedPrint.getNumberOfImages()%(int)(printerCurrentRows*printerCurrentCols)>0)pagesInJob++;
imageLabel.setText("Images in Queue: " + storedPrint.getNumberOfImages()+ ", Pages: " + 1 + " out of " + pagesInJob);
}
/**
* Gets the current jDVPSStoredPrint
*
* @return The current jDVPSStoredPrint
*/
public jDVPSStoredPrint getStored()
{
return storedPrint;
}
/**
* Gets the current jDVInterface
*
* @return The current jDVInterface
*/
public jDVInterface getDvi()
{
return dvi;
}
private void setLayoutCombo()
{
//target = dvi.getCurrentPrinter();
boolean portrait = true;
if (orientationCombo.getSelectedItem().equals("Landscape"))portrait = false;
///////////////////////////////
//Fill Film size for current Printer
/////////////////////////////////
layoutCombo.removeAllItems();
int forSize = dvi.getTargetPrinterNumberOfPortraitDisplayFormats(target);
String t = null;
if (forSize == 0 )
{
JOptionPane.showMessageDialog(null,"Missing Printer Layout in Configuration for Printer: " +dvi.getTargetDescription(target));
System.exit(0);
}
else
{
for (int i = 0; i < forSize;i++)
{
if (portrait) t = dvi.getTargetPrinterPortraitDisplayFormatRows(target, i )+ "/" + dvi.getTargetPrinterPortraitDisplayFormatColumns(target, i );
else t = dvi.getTargetPrinterPortraitDisplayFormatColumns(target, i )+ "/" + dvi.getTargetPrinterPortraitDisplayFormatRows(target, i );
layoutCombo.addItem(t);
}
}
int cols = 1;
int rows = 1;;
int bestIndex= 0;
int nextCols=1;
int nextRows=1;
for (int i = 0; i < forSize;i++)
{
nextCols = dvi.getTargetPrinterPortraitDisplayFormatColumns(target, i );
nextRows = dvi.getTargetPrinterPortraitDisplayFormatRows(target, i );
if (portrait)
{
if ((nextCols <= printerCurrentCols) &&(nextRows <= printerCurrentRows)
&&(nextCols >= cols)&&(nextRows >= rows))
{
bestIndex = i;
cols = nextCols;
rows = nextRows;
}
}
else
{
if ((nextCols <= printerCurrentRows) &&(nextRows <= printerCurrentCols)
&&(nextCols >= rows)&&(nextRows >= cols))
{
bestIndex = i;
cols = nextRows;
rows = nextCols;
}
}
}
printerCurrentCols = cols ;
printerCurrentRows = rows;
layoutCombo.setSelectedIndex(bestIndex);
storedPrint.setImageDisplayFormat(printerCurrentCols, printerCurrentRows);
//change previewPanel
previewPanel.setRowsCols((int) printerCurrentRows,(int)printerCurrentCols);
setLabel();
}
/**
* Deletes the image with the specified index form the print job
* @param index Index of the specified image
*/
public void deleteImage(int index)
{
storedPrint.deleteImage(index);
previewPanel.updatePrintPreview();
setLabel();
}
}
/*
* CVS Log
* $Log: PrintPanel.java,v $
* Revision 1.1.1.1 2001/06/06 10:32:30 kleber
* Init commit for DICOMscope 3.5
* Create new CVS
*
*/
|