StatusView.java (4e7d57d8) | StatusView.java (58a988d9) |
---|---|
1/************************************************************** | 1/************************************************************** |
2 * | 2 * |
3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at | 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at |
10 * | 10 * |
11 * http://www.apache.org/licenses/LICENSE-2.0 | 11 * http://www.apache.org/licenses/LICENSE-2.0 |
12 * | 12 * |
13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. | 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. |
19 * | 19 * |
20 *************************************************************/ 21 22 23 24// __________ Imports __________ 25 26import com.sun.star.uno.UnoRuntime; 27 --- 5 unchanged lines hidden (view full) --- 33 34/** 35 * Implement a view to show status informations 36 * of currently loaded document of a document view. 37 * It use separate listener threads to get this informations 38 * and actualize it automatically if frame broadcast changes of 39 * his contained document. 40 * Threads are necessary to prevent this view against deadlocks. | 20 *************************************************************/ 21 22 23 24// __________ Imports __________ 25 26import com.sun.star.uno.UnoRuntime; 27 --- 5 unchanged lines hidden (view full) --- 33 34/** 35 * Implement a view to show status informations 36 * of currently loaded document of a document view. 37 * It use separate listener threads to get this informations 38 * and actualize it automatically if frame broadcast changes of 39 * his contained document. 40 * Threads are necessary to prevent this view against deadlocks. |
41 * These deadlocks can occure if a listener will be notified | 41 * These deadlocks can occur if a listener will be notified |
42 * by the office in an "oneway" method and try to call back 43 * to the office by using a synchronous method. 44 * UNO must guarantee order of all these calls ... and if 45 * the source of arrived event holds a mutex and our synchronous | 42 * by the office in an "oneway" method and try to call back 43 * to the office by using a synchronous method. 44 * UNO must guarantee order of all these calls ... and if 45 * the source of arrived event holds a mutex and our synchronous |
46 * call needs this mutex too => a deadlock occure. | 46 * call needs this mutex too => a deadlock occur. |
47 * Why? UNO had created a new thread for our synchronous call 48 * inside the office process and so exist different threads | 47 * Why? UNO had created a new thread for our synchronous call 48 * inside the office process and so exist different threads |
49 * for this constallation. | 49 * for this constellation. |
50 * 51 * @author Andreas Schlüns 52 * @created 20.06.2002 15:08 53 */ 54public class StatusView extends JPanel 55 implements IShutdownListener 56{ 57 // ____________________ --- 134 unchanged lines hidden (view full) --- 192 m_laBoldValue.setText (BOLD_OFF ); 193 m_laItalicValue.setText (ITALIC_OFF ); 194 m_laUnderlineValue.setText(UNDERLINE_OFF); 195 } 196 197 // ____________________ 198 199 /** | 50 * 51 * @author Andreas Schlüns 52 * @created 20.06.2002 15:08 53 */ 54public class StatusView extends JPanel 55 implements IShutdownListener 56{ 57 // ____________________ --- 134 unchanged lines hidden (view full) --- 192 m_laBoldValue.setText (BOLD_OFF ); 193 m_laItalicValue.setText (ITALIC_OFF ); 194 m_laUnderlineValue.setText(UNDERLINE_OFF); 195 } 196 197 // ____________________ 198 199 /** |
200 * Set new frame for this view and start listening for events imedatly. 201 * We create one status listener for every control we whish to update. | 200 * Set new frame for this view and start listening for events immediately. 201 * We create one status listener for every control we wish to update. |
202 * And because the environment of the frame can be changed - these 203 * listener refresh himself internally for frame action events too. 204 * So we register it as such frame action listener only here. 205 * Rest is done automatically ... 206 * 207 * @param xFrame 208 * will be used as source of possible status events 209 */ 210 public void setFrame(com.sun.star.frame.XFrame xFrame) 211 { 212 if (xFrame==null) 213 return; 214 215 // create some listener on given frame for available status events 216 // Created listener instances will register herself on this frame and | 202 * And because the environment of the frame can be changed - these 203 * listener refresh himself internally for frame action events too. 204 * So we register it as such frame action listener only here. 205 * Rest is done automatically ... 206 * 207 * @param xFrame 208 * will be used as source of possible status events 209 */ 210 public void setFrame(com.sun.star.frame.XFrame xFrame) 211 { 212 if (xFrame==null) 213 return; 214 215 // create some listener on given frame for available status events 216 // Created listener instances will register herself on this frame and |
217 // show her received informations automatically on setted UI controls. | 217 // show her received informations automatically on set UI controls. |
218 m_aFontListener = new StatusListener(m_laFontValue ,FONT_ON ,FONT_OFF ,xFrame, FEATUREURL_FONT ); 219 m_aSizeListener = new StatusListener(m_laSizeValue ,SIZE_ON ,SIZE_OFF ,xFrame, FEATUREURL_SIZE ); 220 m_aBoldListener = new StatusListener(m_laBoldValue ,BOLD_ON ,BOLD_OFF ,xFrame, FEATUREURL_BOLD ); 221 m_aItalicListener = new StatusListener(m_laItalicValue ,ITALIC_ON ,ITALIC_OFF ,xFrame, FEATUREURL_ITALIC ); 222 m_aUnderlineListener = new StatusListener(m_laUnderlineValue,UNDERLINE_ON,UNDERLINE_OFF,xFrame, FEATUREURL_UNDERLINE); 223 224 m_aFontListener.startListening(); 225 m_aSizeListener.startListening(); --- 30 unchanged lines hidden --- | 218 m_aFontListener = new StatusListener(m_laFontValue ,FONT_ON ,FONT_OFF ,xFrame, FEATUREURL_FONT ); 219 m_aSizeListener = new StatusListener(m_laSizeValue ,SIZE_ON ,SIZE_OFF ,xFrame, FEATUREURL_SIZE ); 220 m_aBoldListener = new StatusListener(m_laBoldValue ,BOLD_ON ,BOLD_OFF ,xFrame, FEATUREURL_BOLD ); 221 m_aItalicListener = new StatusListener(m_laItalicValue ,ITALIC_ON ,ITALIC_OFF ,xFrame, FEATUREURL_ITALIC ); 222 m_aUnderlineListener = new StatusListener(m_laUnderlineValue,UNDERLINE_ON,UNDERLINE_OFF,xFrame, FEATUREURL_UNDERLINE); 223 224 m_aFontListener.startListening(); 225 m_aSizeListener.startListening(); --- 30 unchanged lines hidden --- |