Revision 36457

View differences:

trunk/extensions/extExpressionField/src/com/iver/cit/gvsig/project/documents/table/gui/EvalExpression.java
32 32
import com.iver.cit.gvsig.fmap.edition.VectorialEditableAdapter;
33 33
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
34 34
/**
35
 * This class implements the logic of a expression and fill a field of the table
36
 * 
35 37
 * @author Vicente Caballero Navarro
36 38
 */
37 39
public class EvalExpression {
......
61 63
	 public void setValue(Object obj,int i) {
62 64
	    	//VectorialEditableAdapter vea = (VectorialEditableAdapter) lv.getSource();
63 65
	    	 Value value = getValue(obj);
64
	    	 //System.out.println("num = "+i);
65 66
	    	 IRow feat=null;
66 67
			try {
67 68
				feat = ies.getRow(i).getLinkedRow().cloneRow();
trunk/extensions/extExpressionField/src/com/iver/cit/gvsig/project/documents/table/gui/EvalExpressionDialog.java
59 59

  
60 60

  
61 61
/**
62
 * DOCUMENT ME!
62
 * This dialog allows the user create expressions to fill a field of the table
63 63
 *
64 64
 * @author Vicente Caballero Navarro
65 65
 */
......
98 98
        initialize();
99 99

  
100 100
    }
101
    /**
102
     * This method initializes this
103
     */
101

  
104 102
    private void initialize() {
105 103
    	try {
106 104
	        evalExpressions();
......
126 124
        constr.ipady=5;
127 125
        constr.weightx=1;
128 126
        constr.weighty=0.3;
129
//        this.add(getTabPrincipal(), java.awt.BorderLayout.CENTER);
130
//        this.add(getPMessage(), java.awt.BorderLayout.NORTH);
131
//        this.add(getAcceptCancel(), java.awt.BorderLayout.SOUTH);
127

  
132 128
        this.add(getPMessage(), constr);
133 129
        constr.gridheight = 5;
134 130
        constr.weighty=1;
......
144 140
        this.add(getAcceptCancel(), constr2);
145 141

  
146 142
    }
147
    /**
148
     * This method initializes pCentral
149
     *
150
     * @return javax.swing.JPanel
151
     */
143

  
152 144
    private JPanel getPNorth() {
153 145
        if (pNorth == null) {
154 146
            pNorth = new JPanel();
......
173 165

  
174 166
            pNorth.add(getPNorthEast(), contr);
175 167

  
176

  
177

  
178
//            pNorth.add(getPNorthEast(), java.awt.BorderLayout.EAST);
179
//            pNorth.add(getPNorthCenter(), java.awt.BorderLayout.CENTER);
180
//            pNorth.add(getPNorthWest(), java.awt.BorderLayout.WEST);
181 168
        }
182 169

  
183 170
        return pNorth;
184 171
    }
185 172

  
186
    /**
187
     * This method initializes pNorth
188
     *
189
     * @return javax.swing.JPanel
190
     */
191 173
    private JPanel getPCentral() {
192 174
        if (pCentral == null) {
193 175
        	StringBuilder tit = new StringBuilder();
......
202 184
                    null, tit.toString(),
203 185
                    javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
204 186
                    javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
205
//            lblColumn = new JLabel();
206
//            pCentral.add(lblColumn, null);
207
//
187

  
208 188
            GridBagConstraints contr = new GridBagConstraints();
209 189
            contr.gridwidth = GridBagConstraints.REMAINDER;
210 190
            contr.gridheight = 1;
......
214 194
            contr.weightx=1;
215 195
            contr.weighty=1;
216 196
            pCentral.add(getJScrollPane(), contr);
217
//            lblColumn.setText(PluginServices.getText(this, "column") + " : " +
218
//                evalExpression.getFieldDescriptorSelected().getFieldAlias());
197

  
219 198
            GridBagConstraints contr1 = new GridBagConstraints();
220 199
            contr1.gridwidth = 1;
221 200
            contr1.gridheight = 1;
......
229 208
        return pCentral;
230 209
    }
231 210

  
232
    /**
233
     * This method initializes pSouth
234
     *
235
     * @return javax.swing.JPanel
236
     */
237 211
    private AcceptCancelPanel getAcceptCancel() {
238 212
		if (this.acceptCancel == null) {
239 213
			this.acceptCancel = new AcceptCancelPanel(
......
245 219
							int limit;
246 220
							limit = prefs.getInt("limit_rows_in_memory", -1);
247 221
							if (limit != -1) {
248
								int option = JOptionPane
249
										.showConfirmDialog(
250
												(Component) PluginServices
251
														.getMainFrame(),
252
												PluginServices
253
														.getText(
254
																this,
255
																"it_has_established_a_limit_of_rows_will_lose_the_possibility_to_undo_wants_to_continue"));
222
								int option = JOptionPane.showConfirmDialog(
223
												(Component) PluginServices.getMainFrame(),
224
												PluginServices.getText(
225
														this,
226
														"it_has_established_a_limit_of_rows_will_lose_the_possibility_to_undo_wants_to_continue"));
256 227
								if (option != JOptionPane.OK_OPTION) {
257 228
									return;
258 229
								}
......
379 350
			pMessage = new JPanel();
380 351
			pMessage.setLayout(new GridLayout());
381 352
			pMessage.setBorder(javax.swing.BorderFactory.createTitledBorder(null, PluginServices.getText(this,"information"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
382
//			pMessage.setPreferredSize(new java.awt.Dimension(550,120));
383 353
			pMessage.add(getJScrollPane3(), null);
384 354
		}
385 355
		return pMessage;
......
426 396
                igo.setLayer(lv);
427 397
            }
428 398
            if (operator.isEnable()) {
429
                   lom.addOperator(operator);
430
                   //System.out.println("Operator = "+operator.toString());
399
		lom.addOperator(operator);
431 400
            }
432 401
        }
433 402
        getListCommand().repaint();
......
436 405
        this.doLayout();
437 406

  
438 407
    }
439
    /**
440
     * This method initializes jScrollPane
441
     *
442
     * @return javax.swing.JScrollPane
443
     */
408
    
444 409
    private JScrollPane getJScrollPane() {
445 410
        if (jScrollPane == null) {
446 411
            jScrollPane = new JScrollPane();
......
451 416
        return jScrollPane;
452 417
    }
453 418

  
454
    /**
455
     * This method initializes txtExp
456
     *
457
     * @return javax.swing.JTextArea
458
     */
419
    
459 420
    private JTextArea getTxtExp() {
460 421
        if (txtExp == null) {
461 422
            txtExp = new JTextArea();
......
466 427
					else
467 428
						getAcceptCancel().setOkButtonEnabled(false);
468 429
				}
469

  
470

  
471

  
472

  
473 430
			});
474 431
        }
475 432

  
......
484 441
        return wi;
485 442
    }
486 443

  
487
    /**
488
     * This method initializes pNorthEast
489
     *
490
     * @return javax.swing.JPanel
491
     */
492 444
    private JPanel getPNorthEast() {
493 445
        if (pNorthEast == null) {
494 446
            pNorthEast = new JPanel(new GridLayout());
......
502 454
        return pNorthEast;
503 455
    }
504 456

  
505
    /**
506
     * This method initializes pNorthCenter
507
     *
508
     * @return javax.swing.JPanel
509
     */
510 457
    private JPanel getPNorthCenter() {
511 458
        if (pNorthCenter == null) {
512 459
            pNorthCenter = new JPanel();
......
524 471
        return pNorthCenter;
525 472
    }
526 473

  
527
    /**
528
     * This method initializes pNorthWest
529
     *
530
     * @return javax.swing.JPanel
531
     */
532 474
    private JPanel getPNorthWest() {
533 475
        if (pNorthWest == null) {
534 476
            pNorthWest = new JPanel(new GridLayout());
......
542 484
        return pNorthWest;
543 485
    }
544 486

  
545
    /**
546
     * This method initializes jScrollPane1
547
     *
548
     * @return javax.swing.JScrollPane
549
     */
550 487
    private JScrollPane getJScrollPane1() {
551 488
        if (jScrollPane1 == null) {
552 489
            jScrollPane1 = new JScrollPane();
......
557 494
        return jScrollPane1;
558 495
    }
559 496

  
560
    /**
561
     * This method initializes listFields
562
     *
563
     * @return javax.swing.JList
564
     */
565 497
    private JList getListFields() {
566 498
        if (listFields == null) {
567 499
            listFields = new JList();
......
623 555
        return listFields;
624 556
    }
625 557

  
626
    /**
627
     * This method initializes rbNumber
628
     *
629
     * @return javax.swing.JRadioButton
630
     */
631 558
    private JRadioButton getRbNumber() {
632 559
        if (rbNumber == null) {
633 560
            rbNumber = new JRadioButton();
......
644 571
        return rbNumber;
645 572
    }
646 573

  
647
    /**
648
     * This method initializes rbString
649
     *
650
     * @return javax.swing.JRadioButton
651
     */
652 574
    private JRadioButton getRbString() {
653 575
        if (rbString == null) {
654 576
            rbString = new JRadioButton();
......
664 586
        return rbString;
665 587
    }
666 588

  
667
    /**
668
     * This method initializes rbData
669
     *
670
     * @return javax.swing.JRadioButton
671
     */
672 589
    private JRadioButton getRbDate() {
673 590
        if (rbDate == null) {
674 591
            rbDate = new JRadioButton();
......
684 601
        return rbDate;
685 602
    }
686 603

  
687
    /**
688
     * This method initializes jScrollPane2
689
     *
690
     * @return javax.swing.JScrollPane
691
     */
692 604
    private JScrollPane getJScrollPane2() {
693 605
        if (jScrollPane2 == null) {
694 606
            jScrollPane2 = new JScrollPane();
......
699 611
        return jScrollPane2;
700 612
    }
701 613

  
702
    /**
703
     * Refresh the commands.
704
     */
705 614
    private void refreshCommands() {
706 615
        int type=IOperator.NUMBER;
707 616
        if (getRbNumber().isSelected()) {
......
715 624

  
716 625
    }
717 626

  
718
    /**
719
     * This method initializes ListCommand
720
     *
721
     * @return javax.swing.JList
722
     */
723 627
    private JList getListCommand() {
724 628
        if (listCommand == null) {
725 629
            listCommand = new JList();
......
732 636
                    		if (e.getClickCount() == 2) {
733 637
                    			if (listCommand.getSelectedValue()==null)
734 638
                    				return;
735
//                    			getTxtExp().setText(operator.addText(
736
//                    					getTxtExp().getText()));
737 639
                    		
738 640
                    		String text = getTxtExp().getText();
739 641
                    		int caretPos = getTxtExp().getCaretPosition();
......
773 675
        return listCommand;
774 676
    }
775 677

  
776
    /**
777
	 * This method initializes bClear
778
	 *
779
	 * @return javax.swing.JButton
780
	 */
781
	private JButton getBClear() {
678
    private JButton getBClear() {
782 679
		if (bClear == null) {
783 680
			bClear = new JButton();
784 681
			bClear.setText(PluginServices.getText(this,"clear_expression"));
......
790 687
		}
791 688
		return bClear;
792 689
	}
793
	/**
794
	 * This method initializes tabPrincipal
795
	 *
796
	 * @return javax.swing.JTabbedPane
797
	 */
690
	
798 691
	private JTabbedPane getTabPrincipal() {
799 692
		if (tabPrincipal == null) {
800 693
			tabPrincipal = new JTabbedPane();
......
803 696
		}
804 697
		return tabPrincipal;
805 698
	}
806
	/**
807
	 * This method initializes pPrincipal
808
	 *
809
	 * @return javax.swing.JPanel
810
	 */
699
	
811 700
	private JPanel getPPrincipal() {
812 701
		if (pPrincipal == null) {
813 702
			pPrincipal = new JPanel();
814 703
			pPrincipal.setLayout(new BorderLayout());
815
//			pPrincipal.setPreferredSize(new java.awt.Dimension(540,252));
816 704
			pPrincipal.add(getPNorth(), java.awt.BorderLayout.NORTH);
817 705
			pPrincipal.add(getPCentral(), java.awt.BorderLayout.CENTER);
818 706

  
819 707
		}
820 708
		return pPrincipal;
821 709
	}
822
	/**
823
	 * This method initializes pAdvanced
824
	 *
825
	 * @return javax.swing.JPanel
826
	 */
710

  
827 711
	private JPanel getPAdvanced() {
828 712
		if (pAdvanced == null) {
829 713
			pAdvanced = new JPanel();
......
833 717
		}
834 718
		return pAdvanced;
835 719
	}
836
	/**
837
	 * This method initializes pAdvancedNorth
838
	 *
839
	 * @return javax.swing.JPanel
840
	 */
720

  
841 721
	private JPanel getPAdvancedNorth() {
842 722
		if (pAdvancedNorth == null) {
843 723
			pAdvancedNorth = new JPanel(new GridBagLayout());
844
//			pAdvancedNorth.setPreferredSize(new java.awt.Dimension(873,100));
845 724
			pAdvancedNorth.setBorder(javax.swing.BorderFactory.createTitledBorder(null, PluginServices.getText(this,"expressions_from_file"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
846 725
			GridBagConstraints contr = new GridBagConstraints();
847 726
			contr.anchor = GridBagConstraints.FIRST_LINE_START;
......
861 740
		}
862 741
		return pAdvancedNorth;
863 742
	}
864
	/**
865
	 * This method initializes jTextField
866
	 *
867
	 * @return javax.swing.JTextField
868
	 */
743

  
869 744
	private JTextField getJTextField() {
870 745
		if (jTextField == null) {
871 746
			jTextField = new JTextField();
......
873 748
		}
874 749
		return jTextField;
875 750
	}
876
	/**
877
	 * This method initializes bFile
878
	 *
879
	 * @return javax.swing.JButton
880
	 */
751

  
881 752
	private JButton getBFile() {
882 753
		if (bFile == null) {
883 754
			bFile = new JButton();
......
908 779
		fileReader.close();
909 780
		return fileContents.toString();
910 781
	}
911
	/**
912
	 * This method initializes pAdvancedCenter
913
	 *
914
	 * @return javax.swing.JPanel
915
	 */
782

  
916 783
	private JPanel getPAdvancedCenter() {
917 784
		if (pAdvancedCenter == null) {
918 785
			lblLeng = new JLabel();
......
923 790
		return pAdvancedCenter;
924 791
	}
925 792

  
926
	/**
927
	 * This method initializes bEval
928
	 *
929
	 * @return javax.swing.JButton
930
	 */
931 793
	private JButton getBEval() {
932 794
		if (bEval == null) {
933 795
			bEval = new JButton();
......
951 813
		}
952 814
		return bEval;
953 815
	}
954
	/**
955
	 * This method initializes jScrollPane3
956
	 *
957
	 * @return javax.swing.JScrollPane
958
	 */
816

  
959 817
	private JScrollPane getJScrollPane3() {
960 818
		if (jScrollPane3 == null) {
961 819
			jScrollPane3 = new JScrollPane();
......
964 822
		}
965 823
		return jScrollPane3;
966 824
	}
967
	/**
968
	 * This method initializes txtMessage2
969
	 *
970
	 * @return javax.swing.JTextArea
971
	 */
825

  
972 826
	private JTextArea getTxtMessage2() {
973 827
		if (txtMessage2 == null) {
974 828
			txtMessage2 = new JTextArea();
975 829
			txtMessage2.setText(PluginServices.getText(this,"eval_expression_will_be_carried_out_right_now_with_current_values_in_table"));
976
			//txtMessage2.setSize(new java.awt.Dimension(550,100));
977 830
			txtMessage2.setEditable(false);
978 831
			txtMessage2.setBackground(UIManager.getColor(this));
979 832
		}
......
982 835
	public Object getWindowProfile() {
983 836
		return WindowInfo.DIALOG_PROFILE;
984 837
	}
985
} //  @jve:decl-index=0:visual-constraint="10,10"
838
}

Also available in: Unified diff