Revision 37961 trunk/extensions/extWMS/src/com/iver/cit/gvsig/gui/panels/WMSParamsPanel.java
WMSParamsPanel.java | ||
---|---|---|
447 | 447 |
} |
448 | 448 |
|
449 | 449 |
} |
450 |
getBtnAdd().setEnabled(isGetMapable); |
|
450 |
// Podemos a?adir una rama entera |
|
451 |
getBtnAdd().setEnabled(true); //isGetMapable); |
|
451 | 452 |
fireWizardComplete(isCorrectlyConfigured()); |
452 | 453 |
} |
453 | 454 |
}); |
... | ... | |
629 | 630 |
WMSLayerNode[] layers = selectedLayersToArray(); |
630 | 631 |
int length = layers.length; |
631 | 632 |
for (int i = 0; i < length; i++) { |
632 |
String styleName = (String) styles.get(i);
|
|
633 |
String styleName = styles.get(i).toString();
|
|
633 | 634 |
layers[length - i - 1].setSelectedStyleByName(styleName); |
634 | 635 |
} |
635 | 636 |
} |
... | ... | |
657 | 658 |
selectedPaths.add(selecciones[i]); |
658 | 659 |
WMSLayerNode nodo = (WMSLayerNode) selecciones[i] |
659 | 660 |
.getLastPathComponent(); |
660 |
if (nodo.getName() == null || nodo.getName().equals(""))
|
|
661 |
if (nodo.getChildren().size() > 0) {
|
|
661 | 662 |
// no es un node que es puga demanar |
663 |
// continue; |
|
664 |
// Nuevo: Iteramos por todos los subnodos para a?adir todos ellos. |
|
665 |
for (int j=0; j < nodo.getChildren().size(); j++) { |
|
666 |
if (addRecursiveNode((WMSLayerNode) nodo.getChildren().get(j))) { |
|
667 |
alguno=true; |
|
668 |
} |
|
669 |
} |
|
662 | 670 |
continue; |
671 |
} |
|
663 | 672 |
if (nodo.isSizeFixed()) { |
664 | 673 |
if (sizeFixed == null) |
665 | 674 |
sizeFixed = nodo.getFixedSize(); |
... | ... | |
676 | 685 |
// s'afegeix a la llista de capes seleccionades |
677 | 686 |
JDnDListModel modelo = (JDnDListModel) lstSelectedLayers.getModel(); |
678 | 687 |
|
679 |
if (modelo.addElement(0, nodo.clone())) { |
|
688 |
// TODO: AQU? QUIZ?S DEBER?AMOS COMPROBAR SI YA EST? EN LA LISTA PARA EVITAR DUPLICADOS. |
|
689 |
// Lo dejamos as? por si el usuario quiere montarse el servicio a su gusto. |
|
690 |
if (modelo.addElement(nodo.clone())) { |
|
680 | 691 |
alguno = true; |
681 | 692 |
} |
682 | 693 |
} |
... | ... | |
687 | 698 |
refreshInfo(); |
688 | 699 |
} |
689 | 700 |
|
701 |
private boolean addRecursiveNode(WMSLayerNode nodo) { |
|
702 |
boolean alguno = false; |
|
703 |
if (nodo.getChildren().size() > 0) { |
|
704 |
for (int j=0; j < nodo.getChildren().size(); j++) { |
|
705 |
if (addRecursiveNode((WMSLayerNode) nodo.getChildren().get(j))) { |
|
706 |
alguno=true; |
|
707 |
} |
|
708 |
} |
|
709 |
return alguno; |
|
710 |
} |
|
711 |
if (nodo.isSizeFixed()) { |
|
712 |
if (sizeFixed == null) |
|
713 |
sizeFixed = nodo.getFixedSize(); |
|
714 |
else if ((sizeFixed.getHeight() != nodo.getFixedSize() |
|
715 |
.getHeight()) |
|
716 |
|| (sizeFixed.getWidth() != nodo.getFixedSize() |
|
717 |
.getWidth())) { |
|
718 |
JOptionPane.showMessageDialog((Component) PluginServices |
|
719 |
.getMainFrame(), PluginServices.getText(this, |
|
720 |
"server_cant_render_layers")); |
|
721 |
return false; |
|
722 |
} |
|
723 |
} |
|
724 |
// s'afegeix a la llista de capes seleccionades |
|
725 |
JDnDListModel modelo = (JDnDListModel) lstSelectedLayers.getModel(); |
|
726 |
|
|
727 |
if (modelo.addElement(nodo.clone())) { |
|
728 |
alguno = true; |
|
729 |
} |
|
730 |
return alguno; |
|
731 |
} |
|
732 |
|
|
690 | 733 |
/** |
691 | 734 |
* This method initializes lstSelectedLayers |
692 | 735 |
* |
... | ... | |
1429 | 1472 |
protected boolean nodeSelected(TreePath[] selection, WMSLayerNode node) { |
1430 | 1473 |
for (int i = 0; i < selection.length; i++) { |
1431 | 1474 |
Object[] components = selection[i].getPath(); |
1432 |
for (int j = 0; j < components.length; j++) { |
|
1433 |
if (components[j] instanceof WMSLayerNode) { |
|
1434 |
if (((WMSLayerNode) components[j]).getTitle().compareTo( |
|
1475 |
if (components.length > 0) { |
|
1476 |
if (components[components.length-1] instanceof WMSLayerNode) { |
|
1477 |
WMSLayerNode aux = (WMSLayerNode) components[components.length-1]; |
|
1478 |
if (aux.getTitle().compareTo( |
|
1435 | 1479 |
node.getTitle()) == 0) { |
1436 | 1480 |
return true; |
1437 | 1481 |
} |
1482 |
else { |
|
1483 |
WMSLayerNode parent = node.getParent(); |
|
1484 |
while (parent !=null) { |
|
1485 |
// if root layer, stop checking |
|
1486 |
if ((parent.getParent() == null) && (components.length > 1)) |
|
1487 |
break; |
|
1488 |
|
|
1489 |
if (parent.getTitle().equalsIgnoreCase(aux.getTitle())) { |
|
1490 |
return true; |
|
1491 |
} |
|
1492 |
else |
|
1493 |
parent = parent.getParent(); |
|
1494 |
} |
|
1495 |
} |
|
1438 | 1496 |
} |
1439 | 1497 |
} |
1440 | 1498 |
} |
... | ... | |
1456 | 1514 |
|
1457 | 1515 |
l.setName(node.getTitle()); |
1458 | 1516 |
for (int i = 0; i < node.getChildren().size(); i++) { |
1459 |
if (nodeSelected(selection, (WMSLayerNode) (node.getChildren() |
|
1460 |
.get(i)))) { |
|
1517 |
WMSLayerNode auxNode = (WMSLayerNode) (node.getChildren().get(i)); |
|
1518 |
if (auxNode.getChildren().size() > 0) { |
|
1519 |
FLayer lyr = getSubTree(auxNode, selection); |
|
1520 |
if (lyr != null) { |
|
1521 |
l.addLayer(lyr); |
|
1522 |
} |
|
1523 |
} |
|
1524 |
else if (nodeSelected(selection, auxNode)) { |
|
1461 | 1525 |
FLayer lyr = getSubTree((WMSLayerNode) node.getChildren() |
1462 | 1526 |
.get(i), selection); |
1463 | 1527 |
if (lyr != null) { |
... | ... | |
1465 | 1529 |
} |
1466 | 1530 |
} |
1467 | 1531 |
} |
1532 |
if (l.getLayersCount() == 0) |
|
1533 |
return null; |
|
1468 | 1534 |
return l; |
1469 | 1535 |
} else { |
1470 | 1536 |
if (nodeSelected(selection, node)) { |
Also available in: Unified diff