+ private void choosePdfWidth() {
+ final String s = ( String ) JOptionPane.showInputDialog( this,
+ "Please enter the default line width for PDF export.\n"
+ + "[current value: "
+ + getOptions().getPrintLineWidth() + "]\n",
+ "Line Width for PDF Export",
+ JOptionPane.QUESTION_MESSAGE,
+ null,
+ null,
+ getOptions().getPrintLineWidth() );
+ if ( !ForesterUtil.isEmpty( s ) ) {
+ boolean success = true;
+ float f = 0.0f;
+ final String m_str = s.trim();
+ if ( !ForesterUtil.isEmpty( m_str ) ) {
+ try {
+ f = Float.parseFloat( m_str );
+ }
+ catch ( final Exception ex ) {
+ success = false;
+ }
+ }
+ else {
+ success = false;
+ }
+ if ( success && ( f > 0.0 ) ) {
+ getOptions().setPrintLineWidth( f );
+ }
+ }
+ }
+
+ private void choosePrintSize() {
+ final String s = ( String ) JOptionPane.showInputDialog( this,
+ "Please enter values for width and height,\nseparated by a comma.\n"
+ + "[current values: "
+ + getOptions().getPrintSizeX() + ", "
+ + getOptions().getPrintSizeY() + "]\n"
+ + "[A4: " + Constants.A4_SIZE_X + ", "
+ + Constants.A4_SIZE_Y + "]\n" + "[US Letter: "
+ + Constants.US_LETTER_SIZE_X + ", "
+ + Constants.US_LETTER_SIZE_Y + "]",
+ "Default Size for Graphics Export",
+ JOptionPane.QUESTION_MESSAGE,
+ null,
+ null,
+ getOptions().getPrintSizeX() + ", "
+ + getOptions().getPrintSizeY() );
+ if ( !ForesterUtil.isEmpty( s ) && ( s.indexOf( ',' ) > 0 ) ) {
+ boolean success = true;
+ int x = 0;
+ int y = 0;
+ final String[] str_ary = s.split( "," );
+ if ( str_ary.length == 2 ) {
+ final String x_str = str_ary[ 0 ].trim();
+ final String y_str = str_ary[ 1 ].trim();
+ if ( !ForesterUtil.isEmpty( x_str ) && !ForesterUtil.isEmpty( y_str ) ) {
+ try {
+ x = Integer.parseInt( x_str );
+ y = Integer.parseInt( y_str );
+ }
+ catch ( final Exception ex ) {
+ success = false;
+ }
+ }
+ else {
+ success = false;
+ }
+ }
+ else {
+ success = false;
+ }
+ if ( success && ( x > 1 ) && ( y > 1 ) ) {
+ getOptions().setPrintSizeX( x );
+ getOptions().setPrintSizeY( y );
+ }
+ }
+ }
+