Revision 3855 branches/v05/extensions/extWMS/src/com/iver/cit/gvsig/gui/panels/WMSParamsPanel.java
WMSParamsPanel.java | ||
---|---|---|
44 | 44 |
import java.awt.event.FocusEvent; |
45 | 45 |
import java.awt.event.FocusListener; |
46 | 46 |
import java.awt.geom.Rectangle2D; |
47 |
import java.util.AbstractCollection; |
|
47 | 48 |
import java.util.ArrayList; |
48 | 49 |
import java.util.ConcurrentModificationException; |
49 | 50 |
import java.util.HashSet; |
... | ... | |
67 | 68 |
import com.iver.cit.gvsig.gui.WizardPanel; |
68 | 69 |
import com.iver.cit.gvsig.gui.beans.controls.dnd.JDnDList; |
69 | 70 |
import com.iver.cit.gvsig.gui.beans.controls.dnd.JDnDListModel; |
71 |
import com.iver.cit.gvsig.gui.beans.listeners.BeanListener; |
|
70 | 72 |
import com.iver.cit.gvsig.gui.wizards.FormatListModel; |
71 | 73 |
import com.iver.cit.gvsig.gui.wizards.LayerTreeModel; |
72 | 74 |
import com.iver.cit.gvsig.gui.wizards.SRSListModel; |
... | ... | |
126 | 128 |
private DimensionPanel tabDimensions = null; |
127 | 129 |
private int dimensionTabIndex; |
128 | 130 |
private int stylesTabIndex; |
129 |
|
|
131 |
private String oldSRS = null; |
|
132 |
protected Vector oldStyles = null; |
|
133 |
protected AbstractCollection oldDimensions = null; |
|
130 | 134 |
|
131 | 135 |
public WMSParamsPanel(){ |
132 | 136 |
super(); |
... | ... | |
410 | 414 |
lstSelectedLayers.clearSelection(); |
411 | 415 |
fireWizardComplete(isCorrectlyConfigured()); |
412 | 416 |
|
413 |
refresh(); |
|
417 |
refreshData(); |
|
418 |
refreshInfo(); |
|
414 | 419 |
|
415 | 420 |
} |
416 | 421 |
|
... | ... | |
427 | 432 |
/** |
428 | 433 |
* Refreshes the content shown by this. |
429 | 434 |
*/ |
430 |
public void refresh() { |
|
435 |
public void refreshData() {
|
|
431 | 436 |
refreshSRS(); |
432 | 437 |
getLstSelectedLayers().repaint(); |
433 | 438 |
refreshStyleTree(); |
434 | 439 |
refreshDimensions(); |
435 |
refreshInfo(); |
|
440 |
//refreshInfo();
|
|
436 | 441 |
} |
437 | 442 |
|
438 | 443 |
/** |
... | ... | |
504 | 509 |
WMSLayerNode styleRoot = new WMSLayerNode(); |
505 | 510 |
styleRoot.setTitle(PluginServices.getText(this, "selected_themes")); |
506 | 511 |
|
507 |
StylesTreeModel model = new StylesTreeModel(styleRoot); |
|
512 |
StyleTreeModel model = new StyleTreeModel(styleRoot); |
|
513 |
//model.setLayerNames(getLayersQuery()); |
|
508 | 514 |
jTabbedPane.setEnabledAt(stylesTabIndex, false); |
509 | 515 |
for (int i=0; i<size; i++){ |
510 | 516 |
WMSLayerNode node = (WMSLayerNode)getLstSelectedLayers().getModel().getElementAt(i); |
... | ... | |
512 | 518 |
myNode.setName(node.getName()); |
513 | 519 |
myNode.setTitle(node.getTitle()); |
514 | 520 |
|
515 |
if (node.getStyles()==null) |
|
516 |
continue; |
|
517 |
|
|
518 |
for (int j = 0; j < node.getStyles().size(); j++) { |
|
519 |
FMapWMSStyle sty = (FMapWMSStyle) node.getStyles().get(j); |
|
520 |
myNode.addStyle(sty.name, sty.title, sty.styleAbstract); |
|
521 |
// if (node.getStyles()==null) |
|
522 |
// continue; |
|
523 |
// |
|
524 |
// for (int j = 0; j < node.getStyles().size(); j++) { |
|
525 |
// FMapWMSStyle sty = (FMapWMSStyle) node.getStyles().get(j); |
|
526 |
// myNode.addStyle(sty.name, sty.title, sty.styleAbstract); |
|
527 |
// } |
|
528 |
// |
|
529 |
// // If any of the layers defines styles, the tab will be enabled. |
|
530 |
// if (model.addLayerBranch(myNode)){ |
|
531 |
// jTabbedPane.setEnabledAt(stylesTabIndex, true); |
|
532 |
// } |
|
533 |
if (node.getStyles()!=null){ |
|
534 |
|
|
535 |
for (int j = 0; j < node.getStyles().size(); j++) { |
|
536 |
FMapWMSStyle sty = (FMapWMSStyle) node.getStyles().get(j); |
|
537 |
myNode.addStyle(sty.name, sty.title, sty.styleAbstract); |
|
538 |
} |
|
521 | 539 |
} |
522 |
|
|
523 | 540 |
// If any of the layers defines styles, the tab will be enabled. |
524 | 541 |
if (model.addLayerBranch(myNode)){ |
525 | 542 |
jTabbedPane.setEnabledAt(stylesTabIndex, true); |
526 | 543 |
} |
544 |
|
|
527 | 545 |
} |
528 | 546 |
getStyleTree().setModel(model); |
529 | 547 |
getStyleTree().expandAll(); |
530 | 548 |
getStyleTree().repaint(); |
531 | 549 |
} |
532 | 550 |
|
533 |
public void setStyleSelections(Vector styles) { |
|
534 |
getStyleTree().setSelections(styles); |
|
551 |
public void setStyleSelections(WMSLayerNode[] selectedLayers, Vector styles) {
|
|
552 |
getStyleTree().setSelections(selectedLayers, styles);
|
|
535 | 553 |
} |
536 | 554 |
/** |
537 | 555 |
* Gets the currently shown style tree. |
... | ... | |
566 | 584 |
} |
567 | 585 |
|
568 | 586 |
if (alguno) { |
569 |
refresh(); |
|
587 |
refreshData();
|
|
570 | 588 |
} |
571 |
|
|
589 |
refreshInfo(); |
|
572 | 590 |
} |
573 | 591 |
|
574 | 592 |
/** |
... | ... | |
604 | 622 |
lstSRSs.addListSelectionListener(new javax.swing.event.ListSelectionListener() { |
605 | 623 |
public void valueChanged( |
606 | 624 |
javax.swing.event.ListSelectionEvent e) { |
625 |
int i = lstSRSs.getSelectedIndex(); |
|
626 |
if (i!=-1) |
|
627 |
oldSRS = (String) lstSRSs.getModel().getElementAt(i); |
|
607 | 628 |
fireWizardComplete(isCorrectlyConfigured()); |
608 | 629 |
} |
609 | 630 |
}); |
... | ... | |
635 | 656 |
* DOCUMENT ME! |
636 | 657 |
*/ |
637 | 658 |
private void refreshSRS() { |
638 |
String oldSrs = (String) getLstSRSs().getSelectedValue(); |
|
659 |
//String oldSrs = (String) getLstSRSs().getSelectedValue();
|
|
639 | 660 |
ArrayList elements = ((JDnDListModel) lstSelectedLayers.getModel()).getElements(); |
640 | 661 |
WMSLayerNode[] layers = (WMSLayerNode[]) elements.toArray(new WMSLayerNode[0]); |
641 | 662 |
|
... | ... | |
675 | 696 |
|
676 | 697 |
lstSRSs.setModel(model); |
677 | 698 |
} |
678 |
int srsIndex = getSRSIndex( oldSrs ); |
|
699 |
//int srsIndex = getSRSIndex( oldSrs ); |
|
700 |
int srsIndex = getSRSIndex( oldSRS ); |
|
679 | 701 |
if (srsIndex!=-1) |
680 | 702 |
getLstSRSs().setSelectedIndex(srsIndex); |
681 | 703 |
|
... | ... | |
740 | 762 |
return getJTxtNomCapa().getText(); |
741 | 763 |
} |
742 | 764 |
|
765 |
public void setLayerName(String name) { |
|
766 |
getJTxtNomCapa().setText(name); |
|
767 |
} |
|
768 |
|
|
743 | 769 |
public Rectangle2D getLayersRectangle(){ |
744 | 770 |
ArrayList elements = ((JDnDListModel) getLstSelectedLayers().getModel()).getElements(); |
745 | 771 |
WMSLayerNode[] layers = (WMSLayerNode[]) elements.toArray(new WMSLayerNode[0]); |
... | ... | |
945 | 971 |
if (tabStyle == null) { |
946 | 972 |
tabStyle = new StylesPanel(); |
947 | 973 |
tabStyle.setEnabled(false); |
974 |
tabStyle.addListener(new BeanListener(){ |
|
975 |
public void beanValueChanged(Object value) { |
|
976 |
Vector myStyles = (Vector) value; |
|
977 |
if (oldStyles == null || !(oldStyles.size() == myStyles.size() && oldStyles.containsAll(myStyles))){ |
|
978 |
oldStyles = myStyles; |
|
979 |
callStateChanged(isCorrectlyConfigured()); |
|
980 |
} |
|
981 |
}; |
|
982 |
}); |
|
948 | 983 |
} |
949 | 984 |
return tabStyle; |
950 | 985 |
} |
... | ... | |
1109 | 1144 |
if (tabDimensions == null) { |
1110 | 1145 |
tabDimensions = new DimensionPanel(); |
1111 | 1146 |
tabDimensions.setEnabled(false); |
1147 |
tabDimensions.addListener(new BeanListener(){ |
|
1148 |
public void beanValueChanged(Object value) { |
|
1149 |
Vector myDimensions = (Vector) value; |
|
1150 |
if (oldDimensions == null || !(oldDimensions.size() == myDimensions.size() && oldDimensions.containsAll(myDimensions))){ |
|
1151 |
oldDimensions = myDimensions; |
|
1152 |
callStateChanged(isCorrectlyConfigured()); |
|
1153 |
} |
|
1154 |
} |
|
1155 |
}); |
|
1112 | 1156 |
|
1113 | 1157 |
} |
1114 | 1158 |
return tabDimensions; |
Also available in: Unified diff