/** Refreshes the user interface in response to display changes such as Language. */ protected void refreshGUI() { super.refreshGUI(); messageLabel.setText(ControlsRes.getString("OSPControl.Messages")); clearLabel.setText(ControlsRes.getString("OSPControl.Clear")); inputLabel.setText(ControlsRes.getString("OSPControl.Input_Parameters")); table.refresh(); }
/** * Constructs an OSPControl. * * @param _model */ public OSPControl(Object _model) { super(ControlsRes.getString("OSPControl.Default_Title")); // $NON-NLS-1$ model = _model; if (model != null) { // added by D Brown 2006-09-10 // modified by D Brown 2007-10-17 if (OSPRuntime.translator != null) OSPRuntime.translator.associate(this, model.getClass()); String name = model.getClass().getName(); setTitle( name.substring(1 + name.lastIndexOf(".")) + ControlsRes.getString("OSPControl.Controller")); // $NON-NLS-1$ //$NON-NLS-2$ } ToolsRes.addPropertyChangeListener("locale", this); Font labelFont = new Font("Dialog", Font.BOLD, 12); // $NON-NLS-1$ inputLabel = new JLabel( ControlsRes.getString("OSPControl.Input_Parameters"), SwingConstants.CENTER); // $NON-NLS-1$ inputLabel.setFont(labelFont); messageTextArea = new JTextArea(5, 5); JScrollPane messageScrollPane = new JScrollPane(messageTextArea); // contains a view of the control JPanel topPanel = new JPanel(new BorderLayout()); topPanel.add(inputLabel, BorderLayout.NORTH); topPanel.add(controlScrollPane, BorderLayout.CENTER); buttonPanel.setVisible(true); topPanel.add(buttonPanel, BorderLayout.SOUTH); // buttons are added using addButton method. // clear panel acts like a button to clear the message area JPanel clearPanel = new JPanel(new BorderLayout()); clearPanel.addMouseListener(new ClearMouseAdapter()); clearLabel = new JLabel(ControlsRes.getString("OSPControl.Clear")); // $NON-NLS-1$ clearLabel.setFont(new Font(clearLabel.getFont().getFamily(), Font.PLAIN, 9)); clearLabel.setForeground(Color.black); clearPanel.add(clearLabel, BorderLayout.WEST); // contains the messages JPanel bottomPanel = new JPanel(new BorderLayout()); messageLabel = new JLabel( ControlsRes.getString("OSPControl.Messages"), SwingConstants.CENTER); // $NON-NLS-1$ messageLabel.setFont(labelFont); bottomPanel.add(messageLabel, BorderLayout.NORTH); bottomPanel.add(messageScrollPane, BorderLayout.CENTER); bottomPanel.add(clearPanel, BorderLayout.SOUTH); Container cp = getContentPane(); splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topPanel, bottomPanel); splitPane.setOneTouchExpandable(true); cp.add(splitPane, BorderLayout.CENTER); messageTextArea.setEditable(false); controlScrollPane.setPreferredSize(new Dimension(350, 200)); controlScrollPane.setMinimumSize(new Dimension(0, 50)); messageScrollPane.setPreferredSize(new Dimension(350, 75)); if (OSPRuntime.translator != null && model != null) { OSPRuntime.translator.associate(table, model.getClass()); } Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); setLocation( (d.width - getSize().width) / 2, (d.height - getSize().height) / 2); // center the frame init(); }
/** * Adds a Display menu to the menu bar. Overrides OSPFrame method. * * @return the display menu */ protected JMenu loadDisplayMenu() { JMenuBar menuBar = getJMenuBar(); if (menuBar == null) { return null; } JMenu menu = super.loadDisplayMenu(); translateItem = new JMenuItem(); translateItem.setText(ControlsRes.getString("OSPControl.Translate")); // $NON-NLS-1$ // changed by D Brown 2007-10-17 if (OSPRuntime.translator != null) { translateItem.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { OSPRuntime.translator.showProperties(model.getClass()); if (OSPRuntime.translator instanceof Hidable) ((Hidable) OSPRuntime.translator).setKeepHidden(false); OSPRuntime.translator.setVisible(true); } }); translateItem.setEnabled(OSPRuntime.isAuthorMode()); languageMenu.add(translateItem, 0); } // changed by D Brown 2006-09-10 if (languageMenu.getItemCount() > 1) languageMenu.insertSeparator(1); return menu; }
/** * Method mouseExited * * @param evt */ public void mouseExited(java.awt.event.MouseEvent evt) { clearLabel.setFont(new Font(clearLabel.getFont().getFamily(), Font.PLAIN, 9)); clearLabel.setText(ControlsRes.getString("OSPControl.Clear")); // $NON-NLS-1$ }
/** * Method mouseEntered * * @param evt */ public void mouseEntered(java.awt.event.MouseEvent evt) { clearLabel.setFont(new Font(clearLabel.getFont().getFamily(), Font.BOLD, 10)); clearLabel.setText(ControlsRes.getString("OSPControl.Click_to_clear_message")); // $NON-NLS-1$ }