ItEr38S05ValidacionEProbasFuncionaisItEr37S06: If OnlyOneVisible does not have the component it adds it dinamically.
This commit is contained in:
parent
111399bf1d
commit
cd92f623bd
1 changed files with 5 additions and 1 deletions
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
package org.navalplanner.web.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -34,11 +35,14 @@ public class OnlyOneVisible {
|
|||
private List<Component> components;
|
||||
|
||||
public OnlyOneVisible(Component... components) {
|
||||
this.components = Arrays.asList(components);
|
||||
this.components = new ArrayList<Component>(Arrays.asList(components));
|
||||
showOnly(null);
|
||||
}
|
||||
|
||||
public void showOnly(Component component) {
|
||||
if (!components.contains(component)) {
|
||||
components.add(component);
|
||||
}
|
||||
for (Component c : components) {
|
||||
if (c != null) {
|
||||
c.setVisible(component != null && c.equals(component));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue