source: release-kits/lirk3/bin/ant-installer/src/org/tp23/antinstaller/renderer/swing/TargetSelectInputRenderer.java@ 14982

Last change on this file since 14982 was 14982, checked in by oranfry, 16 years ago

initial import of LiRK3

File size: 1.6 KB
Line 
1/*
2 * Copyright 2005 Paul Hinds, Mark Anderson
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.tp23.antinstaller.renderer.swing;
17
18import java.util.Enumeration;
19
20import javax.swing.JRadioButton;
21
22import org.tp23.antinstaller.input.TargetSelectInput;
23/**
24 *
25 * @author Paul Hinds, Mark Anderson
26 * @version $Id: TargetSelectInputRenderer.java,v 1.3 2006/08/04 17:13:24 anothermwilson Exp $
27 */
28public class TargetSelectInputRenderer
29 extends SelectInputRenderer {
30
31 public TargetSelectInputRenderer() {
32 }
33
34 public void updateInputField(){
35 Enumeration enumeration = optionGroup.getElements();
36 int targetIdx = ((TargetSelectInput)inputField).getIdx();
37 int i = 0;
38 for(; enumeration.hasMoreElements(); i++){
39 JRadioButton o = (JRadioButton)enumeration.nextElement();
40 ctx.getCurrentPage().removeTarget(targetIdx);
41 if(o.isSelected()){
42 String target = inputField.getOptions()[i].value;
43 ctx.getCurrentPage().addTarget(targetIdx, target);
44 inputField.setValue(target);
45 break;
46 }
47 }
48 if(i > inputField.getOptions().length){
49 inputField.setValue(inputField.getDefaultValue());
50 }
51 }
52
53}
Note: See TracBrowser for help on using the repository browser.