Skip to content

Commit 59efafa

Browse files
committed
Merge branch 'release/2.1'
2 parents 84b044c + 5c3916f commit 59efafa

File tree

177 files changed

+12764
-1362
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

177 files changed

+12764
-1362
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
target
22
*/target/*
3+
.idea
4+
*.iml
5+
nbactions.xml

iris-common/pom.xml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
<!--
2+
3+
Copyright (C) 2012, 2013, 2015 Smithsonian Astrophysical Observatory
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
17+
-->
118

219
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
320
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
@@ -9,21 +26,21 @@
926
<parent>
1027
<groupId>cfa.vo</groupId>
1128
<artifactId>iris2</artifactId>
12-
<version>2.0.1</version>
29+
<version>2.1</version>
1330
</parent>
1431

1532
<dependencies>
1633
<dependency>
1734
<groupId>stil</groupId>
1835
<artifactId>stil</artifactId>
19-
<version>3.0.2</version>
36+
<version>3.0</version>
37+
<classifier>2</classifier>
2038
<type>jar</type>
2139
</dependency>
2240
<dependency>
2341
<groupId>cfa.vao.sed</groupId>
2442
<artifactId>sedlib</artifactId>
2543
<version>1.2</version>
26-
<type>jar</type>
2744
</dependency>
2845
<dependency>
2946
<groupId>${project.groupId}</groupId>
@@ -69,6 +86,11 @@
6986
<artifactId>swingx</artifactId>
7087
<version>0.9.7</version>
7188
</dependency>
89+
<dependency>
90+
<groupId>specview</groupId>
91+
<artifactId>specview</artifactId>
92+
<version>20141209b1</version>
93+
</dependency>
7294
</dependencies>
7395

7496
<profiles>

iris-common/src/main/java/cfa/vo/iris/events/PluginJarEvent.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/**
2+
* Copyright (C) 2012, 2015 Smithsonian Astrophysical Observatory
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+
*/
16+
117
/*
218
* To change this template, choose Tools | Templates
319
* and open the template in the editor.

iris-common/src/main/java/cfa/vo/iris/events/PluginListener.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/**
2+
* Copyright (C) 2012, 2015 Smithsonian Astrophysical Observatory
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+
*/
16+
117
/*
218
* To change this template, choose Tools | Templates
319
* and open the template in the editor.

iris-common/src/main/java/cfa/vo/iris/gui/GUIUtils.java

Lines changed: 205 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
*/
1919
package cfa.vo.iris.gui;
2020

21+
import javax.swing.*;
22+
import java.awt.*;
2123
import java.beans.PropertyVetoException;
22-
import javax.swing.JInternalFrame;
23-
import javax.swing.SwingUtilities;
2424

2525
/**
2626
* Common GUI utilities accessed via static methods.
@@ -78,4 +78,207 @@ public static void processOnSwingEventThread(Runnable todo, boolean wait) {
7878
}
7979
}
8080
}
81+
82+
// The following code is taken from Oracle
83+
/*
84+
* Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
85+
*
86+
* Redistribution and use in source and binary forms, with or without
87+
* modification, are permitted provided that the following conditions
88+
* are met:
89+
*
90+
* - Redistributions of source code must retain the above copyright
91+
* notice, this list of conditions and the following disclaimer.
92+
*
93+
* - Redistributions in binary form must reproduce the above copyright
94+
* notice, this list of conditions and the following disclaimer in the
95+
* documentation and/or other materials provided with the distribution.
96+
*
97+
* - Neither the name of Oracle or the names of its
98+
* contributors may be used to endorse or promote products derived
99+
* from this software without specific prior written permission.
100+
*
101+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
102+
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
103+
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
104+
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
105+
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
106+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
107+
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
108+
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
109+
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
110+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
111+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
112+
*/
113+
114+
/**
115+
* Aligns the first <code>rows</code> * <code>cols</code>
116+
* components of <code>parent</code> in
117+
* a grid. Each component in a column is as wide as the maximum
118+
* preferred width of the components in that column;
119+
* height is similarly determined for each row.
120+
* The parent is made just big enough to fit them all.
121+
*
122+
* @param rows number of rows
123+
* @param cols number of columns
124+
* @param initialX x location to start the grid at
125+
* @param initialY y location to start the grid at
126+
* @param xPad x padding between cells
127+
* @param yPad y padding between cells
128+
*/
129+
public static void makeCompactGrid(Container parent,
130+
int rows, int cols,
131+
int initialX, int initialY,
132+
int xPad, int yPad) {
133+
SpringLayout layout;
134+
try {
135+
layout = (SpringLayout)parent.getLayout();
136+
} catch (ClassCastException exc) {
137+
System.err.println("The first argument to makeCompactGrid must use SpringLayout.");
138+
return;
139+
}
140+
141+
//Align all cells in each column and make them the same width.
142+
Spring x = Spring.constant(initialX);
143+
for (int c = 0; c < cols; c++) {
144+
Spring width = Spring.constant(0);
145+
for (int r = 0; r < rows; r++) {
146+
width = Spring.max(width,
147+
getConstraintsForCell(r, c, parent, cols).
148+
getWidth());
149+
}
150+
for (int r = 0; r < rows; r++) {
151+
SpringLayout.Constraints constraints =
152+
getConstraintsForCell(r, c, parent, cols);
153+
constraints.setX(x);
154+
constraints.setWidth(width);
155+
}
156+
x = Spring.sum(x, Spring.sum(width, Spring.constant(xPad)));
157+
}
158+
159+
//Align all cells in each row and make them the same height.
160+
Spring y = Spring.constant(initialY);
161+
for (int r = 0; r < rows; r++) {
162+
Spring height = Spring.constant(0);
163+
for (int c = 0; c < cols; c++) {
164+
height = Spring.max(height,
165+
getConstraintsForCell(r, c, parent, cols).
166+
getHeight());
167+
}
168+
for (int c = 0; c < cols; c++) {
169+
SpringLayout.Constraints constraints =
170+
getConstraintsForCell(r, c, parent, cols);
171+
constraints.setY(y);
172+
constraints.setHeight(height);
173+
}
174+
y = Spring.sum(y, Spring.sum(height, Spring.constant(yPad)));
175+
}
176+
177+
//Set the parent's size.
178+
SpringLayout.Constraints pCons = layout.getConstraints(parent);
179+
pCons.setConstraint(SpringLayout.SOUTH, y);
180+
pCons.setConstraint(SpringLayout.EAST, x);
181+
}
182+
183+
/* Used by makeCompactGrid. */
184+
private static SpringLayout.Constraints getConstraintsForCell(
185+
int row, int col,
186+
Container parent,
187+
int cols) {
188+
SpringLayout layout = (SpringLayout) parent.getLayout();
189+
Component c = parent.getComponent(row * cols + col);
190+
return layout.getConstraints(c);
191+
}
192+
193+
/**
194+
* Aligns the first <code>rows</code> * <code>cols</code>
195+
* components of <code>parent</code> in
196+
* a grid. Each component is as big as the maximum
197+
* preferred width and height of the components.
198+
* The parent is made just big enough to fit them all.
199+
*
200+
* @param rows number of rows
201+
* @param cols number of columns
202+
* @param initialX x location to start the grid at
203+
* @param initialY y location to start the grid at
204+
* @param xPad x padding between cells
205+
* @param yPad y padding between cells
206+
*/
207+
public static void makeGrid(Container parent,
208+
int rows, int cols,
209+
int initialX, int initialY,
210+
int xPad, int yPad) {
211+
SpringLayout layout;
212+
try {
213+
layout = (SpringLayout)parent.getLayout();
214+
} catch (ClassCastException exc) {
215+
System.err.println("The first argument to makeGrid must use SpringLayout.");
216+
return;
217+
}
218+
219+
Spring xPadSpring = Spring.constant(xPad);
220+
Spring yPadSpring = Spring.constant(yPad);
221+
Spring initialXSpring = Spring.constant(initialX);
222+
Spring initialYSpring = Spring.constant(initialY);
223+
int max = rows * cols;
224+
225+
//Calculate Springs that are the max of the width/height so that all
226+
//cells have the same size.
227+
Spring maxWidthSpring = layout.getConstraints(parent.getComponent(0)).
228+
getWidth();
229+
Spring maxHeightSpring = layout.getConstraints(parent.getComponent(0)).
230+
getHeight();
231+
for (int i = 1; i < max; i++) {
232+
SpringLayout.Constraints cons = layout.getConstraints(
233+
parent.getComponent(i));
234+
235+
maxWidthSpring = Spring.max(maxWidthSpring, cons.getWidth());
236+
maxHeightSpring = Spring.max(maxHeightSpring, cons.getHeight());
237+
}
238+
239+
//Apply the new width/height Spring. This forces all the
240+
//components to have the same size.
241+
for (int i = 0; i < max; i++) {
242+
SpringLayout.Constraints cons = layout.getConstraints(
243+
parent.getComponent(i));
244+
245+
cons.setWidth(maxWidthSpring);
246+
cons.setHeight(maxHeightSpring);
247+
}
248+
249+
//Then adjust the x/y constraints of all the cells so that they
250+
//are aligned in a grid.
251+
SpringLayout.Constraints lastCons = null;
252+
SpringLayout.Constraints lastRowCons = null;
253+
for (int i = 0; i < max; i++) {
254+
SpringLayout.Constraints cons = layout.getConstraints(
255+
parent.getComponent(i));
256+
if (i % cols == 0) { //start of new row
257+
lastRowCons = lastCons;
258+
cons.setX(initialXSpring);
259+
} else { //x position depends on previous component
260+
cons.setX(Spring.sum(lastCons.getConstraint(SpringLayout.EAST),
261+
xPadSpring));
262+
}
263+
264+
if (i / cols == 0) { //first row
265+
cons.setY(initialYSpring);
266+
} else { //y position depends on previous row
267+
cons.setY(Spring.sum(lastRowCons.getConstraint(SpringLayout.SOUTH),
268+
yPadSpring));
269+
}
270+
lastCons = cons;
271+
}
272+
273+
//Set the parent's size.
274+
SpringLayout.Constraints pCons = layout.getConstraints(parent);
275+
pCons.setConstraint(SpringLayout.SOUTH,
276+
Spring.sum(
277+
Spring.constant(yPad),
278+
lastCons.getConstraint(SpringLayout.SOUTH)));
279+
pCons.setConstraint(SpringLayout.EAST,
280+
Spring.sum(
281+
Spring.constant(xPad),
282+
lastCons.getConstraint(SpringLayout.EAST)));
283+
}
81284
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/**
2+
* Copyright (C) 2015 Smithsonian Astrophysical Observatory
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+
*/
16+
17+
/*
18+
* To change this license header, choose License Headers in Project Properties.
19+
* To change this template file, choose Tools | Templates
20+
* and open the template in the editor.
21+
*/
22+
package cfa.vo.iris.gui;
23+
24+
import java.awt.Dimension;
25+
import java.util.Vector;
26+
import javax.swing.ComboBoxModel;
27+
import javax.swing.JComboBox;
28+
29+
/**
30+
*
31+
* @author jbudynk
32+
*/
33+
public class WiderJComboBox extends JComboBox{
34+
35+
public WiderJComboBox() {
36+
}
37+
38+
public WiderJComboBox(final Object items[]){
39+
super(items);
40+
}
41+
42+
public WiderJComboBox(Vector items) {
43+
super(items);
44+
}
45+
46+
public WiderJComboBox(ComboBoxModel aModel) {
47+
super(aModel);
48+
}
49+
50+
private boolean layingOut = false;
51+
52+
@Override
53+
public void doLayout(){
54+
try{
55+
layingOut = true;
56+
super.doLayout();
57+
}finally{
58+
layingOut = false;
59+
}
60+
}
61+
62+
@Override
63+
public Dimension getSize(){
64+
Dimension dim = super.getSize();
65+
if(!layingOut)
66+
dim.width = Math.max(dim.width, getPreferredSize().width);
67+
return dim;
68+
}
69+
}

0 commit comments

Comments
 (0)