プロットの開示と手札をあげるアクションを実装
@@ -1,41 +0,0 @@ | ||
1 | -/* ExchangePlotAction.java | |
2 | - * 作成日: 2004/09/30 | |
3 | - */ | |
4 | -package jp.sf.chaplet.nova.server; | |
5 | - | |
6 | -import java.io.IOException; | |
7 | - | |
8 | -import jp.sf.chaplet.ActionResult; | |
9 | -import jp.sf.chaplet.core.server.ClientProxy; | |
10 | -import jp.sf.chaplet.core.server.ServerAction; | |
11 | - | |
12 | -/** | |
13 | - * ExchangePlotAction<br> | |
14 | - * | |
15 | - * @author koe | |
16 | - * @version $Id$ | |
17 | - */ | |
18 | -public class ExchangePlotAction extends ServerAction { | |
19 | - | |
20 | - /** | |
21 | - * @see jp.sf.chaplet.core.server.ServerAction#execute(java.lang.String[], jp.sf.chaplet.core.server.ClientProxy) | |
22 | - */ | |
23 | - public ActionResult execute(String[] request, ClientProxy proxy) | |
24 | - throws IOException { | |
25 | - Hand myHand = ((NovaServerPlugin)getPlugin()).getHandManager().getHandOf(proxy.getSessionId()); | |
26 | - int toNo = Integer.parseInt(request[1]); | |
27 | - if(myHand.removeCard(0, request[2])){ | |
28 | - myHand.addCard(0, request[3]); | |
29 | - myHand.addCard(toNo, request[2]); | |
30 | - request[0] = "ok/" + request[1]; | |
31 | - proxy.sendMessage(request); | |
32 | - sendStatus(); | |
33 | - return ActionResult.OK_NEXT; | |
34 | - } else { | |
35 | - String[] resp = {"ng/" + request[0]}; | |
36 | - proxy.sendMessage(resp); | |
37 | - return ActionResult.ERROR; | |
38 | - } | |
39 | - } | |
40 | - | |
41 | -} |
@@ -9,7 +9,6 @@ | ||
9 | 9 | import java.io.FileReader; |
10 | 10 | import java.io.IOException; |
11 | 11 | import java.util.ArrayList; |
12 | -import java.util.Iterator; | |
13 | 12 | import java.util.Map; |
14 | 13 | |
15 | 14 | /** |
@@ -222,9 +221,9 @@ | ||
222 | 221 | return card; |
223 | 222 | } |
224 | 223 | |
225 | - public void setThrownAway(ArrayList cards){ | |
226 | - for (Iterator iter = cards.iterator(); iter.hasNext();) { | |
227 | - setThrownAway((String) iter.next()); | |
224 | + public void setThrownAway(ArrayList<String> cards){ | |
225 | + for (String card : cards){ | |
226 | + setThrownAway(card); | |
228 | 227 | } |
229 | 228 | } |
230 | 229 |
@@ -71,6 +71,7 @@ | ||
71 | 71 | addAction("nova:givecard", new GiveCardAction()); |
72 | 72 | addAction("nova:tohand", new PlotToHandAction()); |
73 | 73 | addAction("nova:init", new InitializeAction()); |
74 | + addAction("nova:showplot", new ShowPlotAction()); | |
74 | 75 | |
75 | 76 | NovaConfig config = (NovaConfig) StorageUtils.load(NovaConfig.NAME, NovaConfig.class); |
76 | 77 | tarotManager.setConfig(config); |
@@ -29,8 +29,7 @@ | ||
29 | 29 | |
30 | 30 | public String handString(){ |
31 | 31 | StringBuffer sb = new StringBuffer(" "); |
32 | - for(Iterator iter = cardMap.keySet().iterator(); iter.hasNext();){ | |
33 | - Integer key = (Integer) iter.next(); | |
32 | + for(Integer key : cardMap.keySet()){ | |
34 | 33 | if(key.intValue() != 0){ |
35 | 34 | ArrayList<String> list = cardMap.get(key); |
36 | 35 | int numReaction = 0; |
@@ -112,12 +111,12 @@ | ||
112 | 111 | */ |
113 | 112 | public String toString() { |
114 | 113 | StringBuffer sb = new StringBuffer(getName()); |
115 | - for(Iterator mapIter = cardMap.keySet().iterator(); mapIter.hasNext();){ | |
116 | - Integer key = (Integer) mapIter.next(); | |
117 | - ArrayList cardList = (ArrayList)cardMap.get(key); | |
114 | + for(Iterator<Integer> mapIter = cardMap.keySet().iterator(); mapIter.hasNext();){ | |
115 | + Integer key = mapIter.next(); | |
116 | + ArrayList<String> cardList = (ArrayList<String>)cardMap.get(key); | |
118 | 117 | sb.append('['); |
119 | 118 | sb.append(key.intValue()); |
120 | - for (Iterator iter = cardList.iterator(); iter.hasNext();) { | |
119 | + for (Iterator<String> iter = cardList.iterator(); iter.hasNext();) { | |
121 | 120 | sb.append(','); |
122 | 121 | sb.append(iter.next()); |
123 | 122 | } |
@@ -235,9 +234,8 @@ | ||
235 | 234 | */ |
236 | 235 | public int getProtOrder(int protNo) { |
237 | 236 | int order = 0; |
238 | - Set keySet = cardMap.keySet(); | |
239 | - for (Iterator iter = keySet.iterator(); iter.hasNext();) { | |
240 | - Integer key = (Integer) iter.next(); | |
237 | + Set<Integer> keySet = cardMap.keySet(); | |
238 | + for (Integer key : keySet){ | |
241 | 239 | if(key.intValue() == protNo){ |
242 | 240 | return order; |
243 | 241 | } else { |
@@ -285,11 +283,10 @@ | ||
285 | 283 | * @return |
286 | 284 | */ |
287 | 285 | public int[] getPlotNoList() { |
288 | - Set set = cardMap.keySet(); | |
286 | + Set<Integer> set = cardMap.keySet(); | |
289 | 287 | int[] plotNos = new int[set.size() - 1]; |
290 | 288 | int i = 0; |
291 | - for (Iterator iter = set.iterator(); iter.hasNext();) { | |
292 | - Integer element = (Integer) iter.next(); | |
289 | + for (Integer element : set){ | |
293 | 290 | if(element.intValue() > 0){ |
294 | 291 | plotNos[i] = element.intValue(); |
295 | 292 | i++; |
@@ -0,0 +1,31 @@ | ||
1 | +/** | |
2 | + * | |
3 | + */ | |
4 | +package jp.sf.chaplet.nova.server; | |
5 | + | |
6 | +import java.io.IOException; | |
7 | + | |
8 | +import jp.sf.chaplet.ActionResult; | |
9 | +import jp.sf.chaplet.core.server.ClientProxy; | |
10 | +import jp.sf.chaplet.core.server.ServerAction; | |
11 | + | |
12 | +/** | |
13 | + * ShowPlotAction<br> | |
14 | + * @version $Id$ | |
15 | + */ | |
16 | +public class ShowPlotAction extends ServerAction { | |
17 | + | |
18 | + /** | |
19 | + * @see jp.sf.chaplet.core.server.ServerAction#execute(java.lang.String[], jp.sf.chaplet.core.server.ClientProxy) | |
20 | + */ | |
21 | + @Override | |
22 | + public ActionResult execute(String[] request, ClientProxy proxy) throws IOException { | |
23 | + String[] response = new String[3]; | |
24 | + response[0] = request[0]; | |
25 | + response[1] = getUserManager().getName(proxy.getSessionId()); | |
26 | + response[2] = request[1]; | |
27 | + sendLog(response); | |
28 | + return ActionResult.OK_NEXT; | |
29 | + } | |
30 | + | |
31 | +} |
@@ -99,11 +99,11 @@ | ||
99 | 99 | reset(); |
100 | 100 | } |
101 | 101 | int nextIndex = (int) (Math.random() * (reminderSet.size())); |
102 | - Iterator iterator = reminderSet.iterator(); | |
102 | + Iterator<Integer> iterator = reminderSet.iterator(); | |
103 | 103 | for(int i = 0; i < nextIndex - 1; i++){ |
104 | 104 | iterator.next(); |
105 | 105 | } |
106 | - Integer key = (Integer) iterator.next(); | |
106 | + Integer key = iterator.next(); | |
107 | 107 | |
108 | 108 | current = tarotMap.get(key); |
109 | 109 |
@@ -5,6 +5,7 @@ | ||
5 | 5 | import java.awt.GridBagConstraints; |
6 | 6 | import java.awt.GridBagLayout; |
7 | 7 | import java.awt.Insets; |
8 | +import java.awt.Rectangle; | |
8 | 9 | import java.awt.event.ActionEvent; |
9 | 10 | import java.awt.event.ActionListener; |
10 | 11 |
@@ -31,6 +32,8 @@ | ||
31 | 32 | import jp.sf.chaplet.nova.Plot; |
32 | 33 | import jp.sf.chaplet.nova.PlotChara; |
33 | 34 | import application.ApplicationContext; |
35 | +import javax.swing.JPopupMenu; | |
36 | +import javax.swing.JMenuItem; | |
34 | 37 | |
35 | 38 | /** |
36 | 39 | * NovaView。 |
@@ -67,6 +70,10 @@ | ||
67 | 70 | private JButton initButton = null; |
68 | 71 | private JButton removeCharacterButton = null; |
69 | 72 | private JButton toReactionButton = null; |
73 | + private JButton otherFuncButton = null; | |
74 | + private JPopupMenu otherFuncPopup = null; // @jve:decl-index=0:visual-constraint="398,206" | |
75 | + private JMenuItem giveCardItem = null; | |
76 | + private JMenuItem showPlotItem = null; | |
70 | 77 | |
71 | 78 | /** |
72 | 79 | * This is the default constructor |
@@ -206,6 +213,11 @@ | ||
206 | 213 | */ |
207 | 214 | private JPanel getButtonPanel() { |
208 | 215 | if (buttonPanel == null) { |
216 | + GridBagConstraints gridBagConstraints17 = new GridBagConstraints(); | |
217 | + gridBagConstraints17.gridx = 0; | |
218 | + gridBagConstraints17.fill = GridBagConstraints.HORIZONTAL; | |
219 | + gridBagConstraints17.insets = new Insets(2, 0, 2, 0); | |
220 | + gridBagConstraints17.gridy = 3; | |
209 | 221 | GridBagConstraints gridBagConstraints4 = new GridBagConstraints(); |
210 | 222 | gridBagConstraints4.gridx = 0; |
211 | 223 | gridBagConstraints4.fill = GridBagConstraints.HORIZONTAL; |
@@ -214,6 +226,7 @@ | ||
214 | 226 | GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); |
215 | 227 | gridBagConstraints3.gridx = 0; |
216 | 228 | gridBagConstraints3.insets = new Insets(2, 0, 2, 0); |
229 | + gridBagConstraints3.fill = GridBagConstraints.HORIZONTAL; | |
217 | 230 | gridBagConstraints3.gridy = 1; |
218 | 231 | GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); |
219 | 232 | gridBagConstraints2.anchor = GridBagConstraints.CENTER; |
@@ -224,6 +237,7 @@ | ||
224 | 237 | buttonPanel.add(getFeedButton(), gridBagConstraints2); |
225 | 238 | buttonPanel.add(getToPileButton(), gridBagConstraints3); |
226 | 239 | buttonPanel.add(getYamabikiButton(), gridBagConstraints4); |
240 | + buttonPanel.add(getOtherFuncButton(), gridBagConstraints17); | |
227 | 241 | } |
228 | 242 | return buttonPanel; |
229 | 243 | } |
@@ -647,6 +661,80 @@ | ||
647 | 661 | return toReactionButton; |
648 | 662 | } |
649 | 663 | |
664 | + /** | |
665 | + * This method initializes otherFuncButton | |
666 | + * | |
667 | + * @return javax.swing.JButton | |
668 | + */ | |
669 | + private JButton getOtherFuncButton() { | |
670 | + if (otherFuncButton == null) { | |
671 | + otherFuncButton = new JButton(); | |
672 | + otherFuncButton.setText("その他"); | |
673 | + otherFuncButton.addActionListener(new java.awt.event.ActionListener() { | |
674 | + public void actionPerformed(java.awt.event.ActionEvent e) { | |
675 | + Rectangle bounds = getOtherFuncButton().getBounds(); | |
676 | + getOtherFuncPopup().show(getButtonPanel(), bounds.x, bounds.y + bounds.height); | |
677 | + } | |
678 | + }); | |
679 | + } | |
680 | + return otherFuncButton; | |
681 | + } | |
682 | + | |
683 | + /** | |
684 | + * This method initializes otherFuncPopup | |
685 | + * | |
686 | + * @return javax.swing.JPopupMenu | |
687 | + */ | |
688 | + private JPopupMenu getOtherFuncPopup() { | |
689 | + if (otherFuncPopup == null) { | |
690 | + otherFuncPopup = new JPopupMenu(); | |
691 | + otherFuncPopup.add(getGiveCardItem()); | |
692 | + otherFuncPopup.add(getShowPlotItem()); | |
693 | + otherFuncPopup.addFocusListener(new java.awt.event.FocusAdapter() { | |
694 | + public void focusLost(java.awt.event.FocusEvent e) { | |
695 | + otherFuncPopup.setVisible(false); | |
696 | + } | |
697 | + }); | |
698 | + } | |
699 | + return otherFuncPopup; | |
700 | + } | |
701 | + | |
702 | + /** | |
703 | + * This method initializes giveCardItem | |
704 | + * | |
705 | + * @return javax.swing.JMenuItem | |
706 | + */ | |
707 | + private JMenuItem getGiveCardItem() { | |
708 | + if (giveCardItem == null) { | |
709 | + giveCardItem = new JMenuItem(); | |
710 | + giveCardItem.setText("手札を渡す"); | |
711 | + giveCardItem.addActionListener(new java.awt.event.ActionListener() { | |
712 | + public void actionPerformed(java.awt.event.ActionEvent e) { | |
713 | + actionMap.get("giveCard").actionPerformed(e); | |
714 | + } | |
715 | + }); | |
716 | + } | |
717 | + return giveCardItem; | |
718 | + } | |
719 | + | |
720 | + /** | |
721 | + * This method initializes showPlotItem | |
722 | + * | |
723 | + * @return javax.swing.JMenuItem | |
724 | + */ | |
725 | + private JMenuItem getShowPlotItem() { | |
726 | + if (showPlotItem == null) { | |
727 | + showPlotItem = new JMenuItem(); | |
728 | + showPlotItem.setText("プロットを見せる"); | |
729 | + showPlotItem.addActionListener(new java.awt.event.ActionListener() { | |
730 | + public void actionPerformed(java.awt.event.ActionEvent e) { | |
731 | + actionMap.get("showPlot").actionPerformed(e); | |
732 | + } | |
733 | + }); | |
734 | + } | |
735 | + return showPlotItem; | |
736 | + } | |
737 | + | |
650 | 738 | public static void main(String[] args) { |
651 | 739 | JFrame frame = new JFrame("card"); |
652 | 740 | frame.add(new NovaView()); |
@@ -1,34 +0,0 @@ | ||
1 | -/* ExchangePlotAction.java | |
2 | - * 作成日: 2004/09/30 | |
3 | - */ | |
4 | -package jp.sf.chaplet.nova.client; | |
5 | - | |
6 | -import jp.sf.chaplet.ActionResult; | |
7 | -import jp.sf.chaplet.core.client.ClientAction; | |
8 | -import jp.sf.chaplet.nova.ui.INovaView; | |
9 | - | |
10 | -/** | |
11 | - * ExchangePlotAction<br> | |
12 | - * | |
13 | - * @author koe | |
14 | - * @version $Id$ | |
15 | - */ | |
16 | -public class ExchangePlotAction extends ClientAction { | |
17 | - /** | |
18 | - * @see jp.sf.chaplet.core.client.ClientAction#responseRecieved(java.lang.String[]) | |
19 | - */ | |
20 | - public ActionResult responseRecieved(String[] response) { | |
21 | - int toNo = Integer.parseInt(response[1]); | |
22 | - String card = response[2]; | |
23 | - INovaView view = ((NovaClientPlugin)getPlugin()).getNovaView(); | |
24 | - String[] fromHand = view.getHand(); | |
25 | - for (int i = 0; i < fromHand.length; i++) { | |
26 | - if(fromHand[i].equals(response[2])){ | |
27 | - fromHand[i] = response[3]; | |
28 | - break; | |
29 | - } | |
30 | - } | |
31 | - view.exchangePlot(toNo, response[3], response[2]); | |
32 | - return ActionResult.OK_NEXT; | |
33 | - } | |
34 | -} |
@@ -3,11 +3,14 @@ | ||
3 | 3 | */ |
4 | 4 | package jp.sf.chaplet.nova.client; |
5 | 5 | |
6 | +import java.awt.Component; | |
6 | 7 | import java.util.ArrayList; |
7 | 8 | import java.util.List; |
8 | 9 | |
10 | +import javax.swing.JOptionPane; | |
9 | 11 | import javax.swing.JPanel; |
10 | 12 | |
13 | +import jp.sf.chaplet.UserStatus; | |
11 | 14 | import jp.sf.chaplet.core.client.ClientPlugin; |
12 | 15 | import jp.sf.chaplet.core.ui.IPluginView; |
13 | 16 | import jp.sf.chaplet.core.ui.IPrefView; |
@@ -46,6 +49,7 @@ | ||
46 | 49 | addAction("nova:status", new SetStatusAction()); |
47 | 50 | addAction("nova:givecard", new GiveCardAction()); |
48 | 51 | addAction("nova:tohand", new PlotToHandAction()); |
52 | + addAction("nova:showplot", new ShowPlotAction()); | |
49 | 53 | |
50 | 54 | view = new NovaView(); |
51 | 55 | view.setController(this); |
@@ -217,14 +221,6 @@ | ||
217 | 221 | getConnection().sendMessage(new String[]{"nova:init"}); |
218 | 222 | } |
219 | 223 | |
220 | - public void exchange(String handCard, String plotCard, int plotNo){ | |
221 | - getConnection().sendMessage(new String[]{"nova:exchange", String.valueOf(plotNo), handCard, plotCard}); | |
222 | - } | |
223 | - | |
224 | - public void giveCard(String card, String user){ | |
225 | - getConnection().sendMessage(new String[]{"nova:givecard", user, card}); | |
226 | - } | |
227 | - | |
228 | 224 | /** |
229 | 225 | * @see jp.sf.chaplet.core.client.ClientPlugin#getPluginView() |
230 | 226 | */ |
@@ -256,4 +252,42 @@ | ||
256 | 252 | prefList.add(new BasicPrefPanel()); |
257 | 253 | return prefList; |
258 | 254 | } |
255 | + | |
256 | + @Action | |
257 | + public void giveCard(){ | |
258 | + Card card = (Card) view.getHandList().getSelectedValue(); | |
259 | + if(card == null){ | |
260 | + return; | |
261 | + } | |
262 | + | |
263 | + UserStatus[] users = getController().getUsers(); | |
264 | + UserStatus user = (UserStatus) JOptionPane.showInputDialog((Component) getController().getView(), | |
265 | + "カードを渡すユーザを選択して下さい。", | |
266 | + "ユーザの選択", | |
267 | + JOptionPane.OK_CANCEL_OPTION, null, users, null); | |
268 | + if(user != null){ | |
269 | + getConnection().sendMessage(new String[]{"nova:givecard", user.getSessionId(), card.toString()}); | |
270 | + } | |
271 | + } | |
272 | + | |
273 | + @Action | |
274 | + public void showPlot(){ | |
275 | + int rowIndex = view.getPlotTable().getSelectedRow(); | |
276 | + if(rowIndex < 0){ | |
277 | + rowIndex = 0; | |
278 | + } | |
279 | + if(view.getPlotTable().getRowCount() < rowIndex){ | |
280 | + return; | |
281 | + } | |
282 | + PlotChara chara = view.getPlotTableModel().indexOf(rowIndex); | |
283 | + int columnIndex = view.getPlotTable().getSelectedColumn(); | |
284 | + if(columnIndex <= 0){ | |
285 | + return; | |
286 | + } | |
287 | + Plot plot = view.getPlotTableModel().getPlot(chara.getCharaNo(), columnIndex - 1); | |
288 | + | |
289 | + if(plot != null){ | |
290 | + getConnection().sendMessage(new String[]{"nova:showplot", plot.getCard().toString()}); | |
291 | + } | |
292 | + } | |
259 | 293 | } |
@@ -0,0 +1,24 @@ | ||
1 | +/** | |
2 | + * | |
3 | + */ | |
4 | +package jp.sf.chaplet.nova.client; | |
5 | + | |
6 | +import jp.sf.chaplet.ActionResult; | |
7 | +import jp.sf.chaplet.core.client.ClientAction; | |
8 | +import jp.sf.chaplet.nova.NovaUtil; | |
9 | + | |
10 | +/** | |
11 | + * ShowPlotAction<br> | |
12 | + * @version $Id$ | |
13 | + */ | |
14 | +public class ShowPlotAction extends ClientAction { | |
15 | + /** | |
16 | + * @see jp.sf.chaplet.core.client.ClientAction#messageRecieved(java.lang.String[]) | |
17 | + */ | |
18 | + @Override | |
19 | + public ActionResult messageRecieved(String[] message) { | |
20 | + appendFunctionLog("カード機能", message[1], | |
21 | + NovaUtil.toVisibleStyle(message[2]) + " (プロットを開示)"); | |
22 | + return ActionResult.OK_NEXT; | |
23 | + } | |
24 | +} |
@@ -36,6 +36,14 @@ | ||
36 | 36 | this.status.add(status); |
37 | 37 | this.sessionId = sessionId; |
38 | 38 | } |
39 | + | |
40 | + /** | |
41 | + * @see java.lang.Object#toString() | |
42 | + */ | |
43 | + @Override | |
44 | + public String toString() { | |
45 | + return name; | |
46 | + } | |
39 | 47 | |
40 | 48 | /** |
41 | 49 | * @return name |
@@ -32,6 +32,7 @@ | ||
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
35 | + @SuppressWarnings("unchecked") | |
35 | 36 | public static final Object load(String name, Class theClass){ |
36 | 37 | Object obj = load(name); |
37 | 38 | if(obj == null){ |
@@ -6,7 +6,6 @@ | ||
6 | 6 | package jp.sf.chaplet; |
7 | 7 | |
8 | 8 | import java.util.ArrayList; |
9 | -import java.util.Iterator; | |
10 | 9 | import java.util.List; |
11 | 10 | import java.util.Properties; |
12 | 11 |
@@ -140,13 +139,9 @@ | ||
140 | 139 | // } |
141 | 140 | // } |
142 | 141 | /** |
143 | - * プラグインを含むイテレータを返す。 | |
142 | + * プラグインのリストを返す。 | |
144 | 143 | * @return |
145 | 144 | */ |
146 | - public Iterator pluginIterator() { | |
147 | - return pluginList.iterator(); | |
148 | - } | |
149 | - | |
150 | 145 | public List<Plugin> getPlugins(){ |
151 | 146 | return pluginList; |
152 | 147 | } |
@@ -244,7 +244,7 @@ | ||
244 | 244 | * プロキシ一覧にアクセスするイテレータを取得する。 |
245 | 245 | * @return イテレータ |
246 | 246 | */ |
247 | - public Iterator getProxyIterator(){ | |
247 | + public Iterator<ClientProxy> getProxyIterator(){ | |
248 | 248 | return proxyList.iterator(); |
249 | 249 | } |
250 | 250 |
@@ -289,8 +289,7 @@ | ||
289 | 289 | * @return プロキシ |
290 | 290 | */ |
291 | 291 | public ClientProxy getProxy(String name){ |
292 | - for (Iterator iter = proxyList.iterator(); iter.hasNext();) { | |
293 | - ClientProxy proxy = (ClientProxy) iter.next(); | |
292 | + for (ClientProxy proxy : proxyList){ | |
294 | 293 | if(proxy.getSessionId().equals(name)){ |
295 | 294 | return proxy; |
296 | 295 | } |
@@ -347,8 +346,7 @@ | ||
347 | 346 | * サーバの開始をリスナーに伝える。 |
348 | 347 | */ |
349 | 348 | private void notifyServerStarted(){ |
350 | - for (Iterator iter = listenerList.iterator(); iter.hasNext();) { | |
351 | - IServerListener listener = (IServerListener) iter.next(); | |
349 | + for (IServerListener listener : listenerList) { | |
352 | 350 | listener.serverStarted(); |
353 | 351 | } |
354 | 352 | } |
@@ -222,8 +222,10 @@ | ||
222 | 222 | } catch (NumberFormatException e1) { |
223 | 223 | } |
224 | 224 | color = JColorChooser.showDialog(BasicPrefPanel.this, "文字色(通常)", color); |
225 | - getNormalFontColorText().setText(Integer.toHexString(color.getRGB() | 0xff000000).substring(2)); | |
226 | - changeCSS(); | |
225 | + if(color != null){ | |
226 | + getNormalFontColorText().setText(Integer.toHexString(color.getRGB() | 0xff000000).substring(2)); | |
227 | + changeCSS(); | |
228 | + } | |
227 | 229 | } |
228 | 230 | }); |
229 | 231 | } |
@@ -383,10 +383,11 @@ | ||
383 | 383 | } |
384 | 384 | } |
385 | 385 | |
386 | - public Iterator pluginIterator() { | |
386 | + public Iterator<ClientPlugin> pluginIterator() { | |
387 | 387 | return pluginMap.values().iterator(); |
388 | 388 | } |
389 | 389 | |
390 | + @SuppressWarnings("unchecked") | |
390 | 391 | @Action |
391 | 392 | public Task reload() { |
392 | 393 | return new Task() { |
@@ -796,4 +797,10 @@ | ||
796 | 797 | public void removeUser(){ |
797 | 798 | |
798 | 799 | } |
800 | + | |
801 | + public UserStatus[] getUsers(){ | |
802 | + UserStatus[] users = new UserStatus[status.length]; | |
803 | + System.arraycopy(status, 0, users, 0, status.length); | |
804 | + return users; | |
805 | + } | |
799 | 806 | } |
@@ -15,7 +15,6 @@ | ||
15 | 15 | import java.io.InputStream; |
16 | 16 | import java.util.ArrayList; |
17 | 17 | import java.util.HashMap; |
18 | -import java.util.Iterator; | |
19 | 18 | import java.util.Properties; |
20 | 19 | import java.util.jar.Attributes; |
21 | 20 | import java.util.jar.JarFile; |
@@ -260,8 +259,7 @@ | ||
260 | 259 | * プラグインオブジェクトをインスタンス化する。 |
261 | 260 | */ |
262 | 261 | void instansiatePlugins(){ |
263 | - for(Iterator iter = conf.pluginIterator(); iter.hasNext();){ | |
264 | - Plugin plugin = (Plugin) iter.next(); | |
262 | + for(Plugin plugin : conf.getPlugins()){ | |
265 | 263 | try { |
266 | 264 | plugin.instansiate(); |
267 | 265 | } catch (Exception e) { |