public void setPopupMenuVisible(boolean vis) { if (vis) { removeAll(); JMenuItem miHelpHelp = new JMenuItem( LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.templateHelp")); // $NON-NLS-1$ miHelpHelp.setMnemonic( (LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.templateHelpMnemonic")) .charAt(0)); // $NON-NLS-1$ add(miHelpHelp); if (mainHB != null && mainHS != null) { if (miHelpHelp != null) { mainHB.enableHelpOnButton(miHelpHelp, "basics.templates", mainHS); // $NON-NLS-1$ } } File main = new File("Templates"); // $NON-NLS-1$ File templates[] = main.listFiles(); if (templates.length > 0) { processTemplateFolder(templates, this); } } super.setPopupMenuVisible(vis); }
/** Process a cut operation. */ public void processCut() { if (getSelectedText() != null) { cut(); } else { ProjectCompendium.APP.displayMessage( LanguageProperties.getString(LanguageProperties.UI_GENERAL_BUNDLE, "UITextArea.tryAgain"), LanguageProperties.getString( LanguageProperties.UI_GENERAL_BUNDLE, "UITextArea.title1")); //$NON-NLS-1$ //$NON-NLS-2$ } }
/** Open the new project and log the user in. */ private boolean openProject(String sDatabase, String sUserName, String sUserPassword) { ProjectCompendium.APP.setWaitCursor(); boolean bDefaultLoginSucessful = false; ProjectCompendium.APP.sFriendlyName = sDatabase; String sModel = null; try { sModel = ProjectCompendium.APP.adminDatabase.getDatabaseName(sDatabase); } catch (Exception e) { } if (sModel == null) { ProjectCompendium.APP.displayError( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.newProjectLost") + sDatabase); //$NON-NLS-1$ } else { try { DBDatabaseManager databaseManager = ProjectCompendium.APP.oServiceManager.getDatabaseManager(); databaseManager.openProject(sModel); DBConnection dbcon = databaseManager.requestConnection(sModel); bDefaultLoginSucessful = ProjectCompendium.APP.validateUser(sModel, sUserName, sUserPassword); if (bDefaultLoginSucessful) { if (FormatProperties.nDatabaseType == ICoreConstants.MYSQL_DATABASE) { ProjectCompendium.APP.setTitle( ICoreConstants.MYSQL_DATABASE, ProjectCompendium.APP.oCurrentMySQLConnection.getServer(), FormatProperties.sDatabaseProfile, sDatabase); } else { ProjectCompendium.APP.setDerbyTitle(sDatabase); } ProjectCompendium.APP.initializeForProject(); ProjectCompendium.APP.setDefaultCursor(); } else { ProjectCompendium.APP.displayError( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.errorLogin") + sDatabase); //$NON-NLS-1$ } databaseManager.releaseConnection(sModel, dbcon); } catch (Exception ex) { log.error("Error...", ex); } } return bDefaultLoginSucessful; }
/** * Constructor. * * @param bSimple true if the simple interface should be draw, false if the advanced. * * * @param hs the HelpSet to use for menus and menuitems. * @param hb the HelpBroker to use for menus and menuitems. */ public UIMenuTools(boolean bSimple, HelpSet hs, HelpBroker hb) { this.mainHS = hs; this.mainHB = hb; this.bSimpleInterface = bSimple; shortcutKey = ProjectCompendium.APP.shortcutKey; mnuMainMenu = new JMenu( LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.tools")); // $NON-NLS-1$ CSH.setHelpIDString(mnuMainMenu, "menus.tools"); // $NON-NLS-1$ mnuMainMenu.setMnemonic( (LanguageProperties.getString(LanguageProperties.MENUS_BUNDLE, "UIMenuTools.toolsMnemonic")) .charAt(0)); // $NON-NLS-1$ createMenuItems(bSimple); }
/** Display the forwards window history in a menu. */ private void onShowForwardHistory() { UIScrollableMenu hist = new UIScrollableMenu( LanguageProperties.getString( LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.forwardHistory"), 0); //$NON-NLS-1$ Vector views = history.getForwardHistory(); int currentIndex = history.getCurrentPosition(); int count = views.size(); if (count == 0) return; JMenuItem item = null; for (int i = 0; i < count; i++) { View view = (View) views.elementAt(i); item = new JMenuItem(view.getLabel()); final View fview = view; final int fi = (currentIndex + 1) + i; item.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { if (history.goToHistoryItem(fi)) oParent.addViewToDesktop(fview, fview.getLabel()); } }); hist.add(item); } JPopupMenu pop = hist.getPopupMenu(); pop.pack(); Point loc = pbShowForwardHistory.getLocation(); Dimension size = pbShowForwardHistory.getSize(); Dimension popsize = hist.getPreferredSize(); Point finalP = SwingUtilities.convertPoint(tbrToolBar.getParent(), loc, oParent.getDesktop()); int x = 0; int y = 0; if (oManager.getLeftToolBarController().containsBar(tbrToolBar)) { x = finalP.x + size.width; y = finalP.y; } else if (oManager.getRightToolBarController().containsBar(tbrToolBar)) { x = finalP.x - popsize.width; y = finalP.y; } else if (oManager.getTopToolBarController().containsBar(tbrToolBar)) { x = finalP.x; y = finalP.y + size.width; } else if (oManager.getBottomToolBarController().containsBar(tbrToolBar)) { x = finalP.x; y = finalP.y - popsize.height; } hist.setPopupMenuVisible(true); pop.show(oParent.getDesktop(), x, y); }
/** * Initializes and sets up the dialog. * * @param parent, the parent view for this doalog. */ public UIImportFlashMeetingXMLDialog(JFrame parent) { super(parent, true); oParent = parent; setTitle( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UIImportFlashMeetingXMLDialog.importFlashMeetingXMLTitle")); //$NON-NLS-1$ oContentPane = getContentPane(); drawDialog(); }
/** * Create a new instance of UIToolBarMain, with the given properties. * * @param oManager the IUIToolBarManager that is managing this toolbar. * @param parent the parent frame for the application. * @param nType the unique identifier for this toolbar. * @param isSimple is the user in simple interface mode. True for yes, false for advanced mode. */ public UIToolBarMain( IUIToolBarManager oManager, ProjectCompendiumFrame parent, int nType, boolean isSimple) { this.oParent = parent; this.oManager = oManager; this.nType = nType; this.bSimpleInterface = isSimple; tbrToolBar = new UIToolBar( LanguageProperties.getString( LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.mainToolbar")); // $NON-NLS-1$ tbrToolBar.setOrientation(DEFAULT_ORIENTATION); createToolBarItems(); }
public void setValueAt(Object o, int row, int col) { String sAuthor = ProjectCompendium.APP.getModel().getUserProfile().getUserName(); NodePosition np = (NodePosition) nodeData.elementAt(row); NodeSummary node = np.getNode(); switch (col) { case ListTableModel.NUMBER_COLUMN: { if (o instanceof Integer) np.setYPos((((Integer) o).intValue() + 1) * 10); break; } case ListTableModel.LABEL_COLUMN: { String oldLabel = node.getLabel(); String newLabel = (String) o; if (!oldLabel.equals(newLabel)) { try { node.setLabel(newLabel, sAuthor); } catch (Exception ex) { ProjectCompendium.APP.displayError( "Error: (ListTableModel.setValueAt)\n\n" + //$NON-NLS-1$ LanguageProperties.getString( LanguageProperties.UI_GENERAL_BUNDLE, "ListTableModel.errorLabel") + //$NON-NLS-1$ ": " + oldLabel + "\n\n" + ex.getMessage()); // $NON-NLS-1$ //$NON-NLS-2$ } } break; } } }
/** * Load the default data if any is specified in the System.ini file. * * @param sHomeViewID the id of the home view to load the data into. * @return true if completely successful. * @exception IOException if there is an IO or Zip error. */ private boolean loadDefaultData(String sHomeViewID) throws IOException { String defaultDataPath = SystemProperties.projectDefaultDataFile; if (!defaultDataPath.equals("")) { // $NON-NLS-1$ String sXMLFile = defaultDataPath; if (defaultDataPath.endsWith(".zip")) { // $NON-NLS-1$ ZipFile zipFile = new ZipFile(defaultDataPath); Enumeration entries = zipFile.entries(); ZipEntry entry = null; String sTemp = ""; // $NON-NLS-1$ while (entries.hasMoreElements()) { entry = (ZipEntry) entries.nextElement(); sTemp = entry.getName(); if (sTemp.endsWith(".xml") && sTemp.startsWith("Exports")) { // $NON-NLS-1$ //$NON-NLS-2$ sXMLFile = sTemp; } // AVOID Thumbs.db files if (sTemp.endsWith(".db")) { // $NON-NLS-1$ continue; } int len = 0; byte[] buffer = new byte[1024]; InputStream in = zipFile.getInputStream(entry); String sFileName = ""; // $NON-NLS-1$ String sLinkedFiles = "Linked Files/"; // $NON-NLS-1$ if (sTemp.startsWith(sLinkedFiles)) { sFileName = UIUtilities.sGetLinkedFilesLocation() + sTemp.substring(sLinkedFiles.length()); } else { sFileName = entry.getName(); } File file = new File(sFileName); if (file.getParentFile() != null) { file.getParentFile().mkdirs(); } OutputStream out = new BufferedOutputStream(new FileOutputStream(sFileName)); while ((len = in.read(buffer)) >= 0) { out.write(buffer, 0, len); } in.close(); out.close(); } zipFile.close(); } // IMPORT THE XML if (!sXMLFile.equals("") && sXMLFile.endsWith(".xml")) { // $NON-NLS-1$ //$NON-NLS-2$ File oXMLFile = new File(sXMLFile); if (oXMLFile.exists()) { boolean importAuthorAndDate = false; boolean includeOriginalAuthorDate = false; boolean preserveIDs = true; boolean transclude = true; boolean updateTranscludedNodes = false; File oXMLFile2 = new File(sXMLFile); if (oXMLFile2.exists()) { DBNode.setImportAsTranscluded(transclude); DBNode.setPreserveImportedIds(preserveIDs); DBNode.setUpdateTranscludedNodes(updateTranscludedNodes); DBNode.setNodesMarkedSeen(true); UIViewFrame frame = ProjectCompendium.APP.getCurrentFrame(); if (frame instanceof UIMapViewFrame) { UIMapViewFrame mapFrame = (UIMapViewFrame) frame; UIViewPane oViewPane = mapFrame.getViewPane(); ViewPaneUI oViewPaneUI = oViewPane.getUI(); if (oViewPaneUI != null) { oViewPaneUI.setSmartImport(importAuthorAndDate); oViewPaneUI.onImportXMLFile(sXMLFile, includeOriginalAuthorDate); } } else if (frame instanceof UIListViewFrame) { UIListViewFrame listFrame = (UIListViewFrame) frame; UIList uiList = listFrame.getUIList(); if (uiList != null) { uiList.getListUI().setSmartImport(importAuthorAndDate); uiList.getListUI().onImportXMLFile(sXMLFile, includeOriginalAuthorDate); } } return true; } } else { ProjectCompendium.APP.displayError( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.missingFileA") + "\n\n" + LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.missingFileB") + "\n"); //$NON-NLS-1$ return false; } } else { return true; // there is allowed to be no default data to load. } return false; } return true; }
/** Create a new database using the entered data. */ public void onCreate() { if (!userPanel.testUserData()) { return; } final UserProfile oUser = userPanel.getNewUserData(); String sNewName = ""; // $NON-NLS-1$ if (!drawSimpleForm) { sNewName = (oNameField.getText()).trim(); } else { sNewName = SystemProperties.defaultProjectName; } if (sNewName == null || sNewName.equals("")) { // $NON-NLS-1$ ProjectCompendium.APP.displayError( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.erroNoName")); // $NON-NLS-1$ oNameField.requestFocus(); } else { int count = vtProjects.size(); for (int i = 0; i < count; i++) { String next = (String) vtProjects.elementAt(i); if (next.equals(sNewName)) { ProjectCompendium.APP.displayMessage( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.errorMessage1A") + " '" + sNewName + "' " + LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.errorMessage1B") + "\n\n" + LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.errorMessage1C") + "\n", LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.newDatabaseTitle")); //$NON-NLS-1$ //$NON-NLS-2$ // //$NON-NLS-3$ oNameField.requestFocus(); return; } } boolean bIsDefaultUser = false; if (!drawSimpleForm) { bIsDefaultUser = oDefaultUser.isSelected(); } else { bIsDefaultUser = true; } boolean bIsDefaultDatabase = false; if (!drawSimpleForm) { bIsDefaultDatabase = oDefaultDatabase.isSelected(); } else { bIsDefaultDatabase = true; } final String fsNewName = sNewName; final boolean fbIsDefaultUser = bIsDefaultUser; final boolean fbIsDefaultDatabase = bIsDefaultDatabase; Thread thread = new Thread("UINewDatabaseDialog") { // $NON-NLS-1$ public void run() { setVisible(false); try { DBNewDatabase newDatabase = new DBNewDatabase( FormatProperties.nDatabaseType, ProjectCompendium.APP.adminDatabase, oUser, fbIsDefaultUser, sDatabaseLogin, sDatabasePassword, sDatabaseIP); newDatabase.addProgressListener((DBProgressListener) manager); oThread = new ProgressThread( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.progressThreadMessage"), LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.progressThreadTitle")); //$NON-NLS-1$ //$NON-NLS-2$ oThread.start(); String sHomeViewID = newDatabase.createNewDatabase(fsNewName); newDatabase.removeProgressListener((DBProgressListener) manager); ProjectCompendium.APP.updateProjects(); if (fbIsDefaultDatabase) { ProjectCompendium.APP.setDefaultDatabase(fsNewName); } if (openProject(fsNewName, oUser.getLoginName(), oUser.getPassword())) { loadDefaultData(sHomeViewID); } onCancel(); } catch ( DBDatabaseNameException ex) { // WOULD NEVER HAPPEN, BUT MUST STILL BE HANDLED progressComplete(); ProjectCompendium.APP.displayMessage( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.nameClashA") + "\n\n" + LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.nameClashB") + "\n", LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.newProject")); //$NON-NLS-1$ //$NON-NLS-2$ onCancel(); } catch (DBDatabaseTypeException ex) { progressComplete(); ProjectCompendium.APP.displayMessage( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.unknownDatabaseType") + ":\n\n" + ex.getMessage(), LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.newProject")); //$NON-NLS-1$ //$NON-NLS-2$ onCancel(); } catch (DBProjectListException ex) { progressComplete(); ProjectCompendium.APP.displayMessage( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.errorLoadingProjectList") + ":\n\n" + ex.getMessage(), LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.newProject")); //$NON-NLS-1$ //$NON-NLS-2$ onCancel(); } catch (IOException ex) { progressComplete(); ProjectCompendium.APP.displayError( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.errorLoadingDefaultDataA") + "\n" + LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.errorLoadingDefaultDataB") + ":\n\n" + ex.getMessage(), LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.newProject")); //$NON-NLS-1$ //$NON-NLS-2$ onCancel(); } catch (ClassNotFoundException ex) { progressComplete(); ProjectCompendium.APP.displayError( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.errorConnectingMySQL") + ":\n\n" + ex.getMessage(), LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.newProjectTitle")); //$NON-NLS-1$ //$NON-NLS-2$ onCancel(); } catch (SQLException ex) { progressComplete(); // log.error("Error...", ex); ProjectCompendium.APP.displayError( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.errorCreatingProject") + ":\n\n" + ex.getMessage(), LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.newProjectTitle")); //$NON-NLS-1$ //$NON-NLS-2$ onCancel(); } } }; thread.start(); } }
/** * This class has method for retrieving image files or references from various directories. * * @author Mohammed Sajid Ali / Michelle Bachler */ public class UIImages implements IUIConstants { /** class's own logger */ static final Logger log = LoggerFactory.getLogger(UIImages.class); /** The file filter to use when asking the user to select an image file */ public static final UIFileFilter IMAGE_FILTER = new UIFileFilter( new String[] {"gif", "jpg", "jpeg", "png"}, LanguageProperties.getString( LanguageProperties.UI_GENERAL_BUNDLE, "UIImages.imageFiles")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ // //$NON-NLS-5$ /** Maximum dimension for a reference node image when a graphic is specified. */ public static final int MAX_DIM = 96; /** A reference to the system file path separator. */ protected static final String sFS = System.getProperty("file.separator"); // $NON-NLS-1$ /** A reference to the main image directory. */ public static final String sPATH = "System" + sFS + "resources" + sFS + "Images" + sFS; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ /** A reference to the main image directory */ public static final String sMACPATH = sPATH + "Mac" + sFS; // $NON-NLS-1$ /** A reference to the skins default directory. */ protected static final String sDEFAULTNODEPATH = "Skins" + sFS + "Default" + sFS; // $NON-NLS-1$ //$NON-NLS-2$ /** A reference to the main skins directory. */ protected static final String sNODEPATH = "Skins" + sFS; // $NON-NLS-1$ /** A reference to the reference node image directory. */ protected static final String sREFERENCEPATH = "System" + sFS + "resources" + sFS + "ReferenceNodeIcons" + sFS; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ /** A reference to the reference node image directory on the Mac. */ protected static final String sMACREFERENCEPATH = sREFERENCEPATH + "Mac" + sFS; // $NON-NLS-1$ /** The array of images returned so far this session. */ protected static ImageIcon img[] = new ImageIcon[IUIConstants.NUM_IMAGES]; /** The array of mac specific images returned so far this session. */ protected static ImageIcon macImg[] = new ImageIcon[IUIConstants.NUM_IMAGES]; /** * Return the appropriate ImageIcon, associated with the given identifier for this platform. * * @param int idx, an identifier for the image file required. * @return the relevant ImageIcon * @see IUIConstants */ public static ImageIcon get(int idx) { ImageIcon image = null; if (ProjectCompendium.isMac && FormatProperties.currentLookAndFeel.equals("apple.laf.AquaLookAndFeel")) { // $NON-NLS-1$ image = macImg[idx]; if (image == null) { String sPath = sMACPATH + IMG_NAMES[idx]; File file = new File(sPath); if (!file.exists()) { sPath = sPATH + IMG_NAMES[idx]; } image = new ImageIcon(sPath); if (image != null) { macImg[idx] = image; } } } else { image = img[idx]; if (image == null) { image = new ImageIcon(sPATH + IMG_NAMES[idx]); if (image != null) { img[idx] = image; } } } return image; } /** * Return the path string for the given identifier for non-platform specific images. * * @param int idx, an identifier for the image file required. * @return the String of the image path. * @see IUIConstants */ public static String getPathString(int idx) { return sPATH + IMG_NAMES[idx]; } /** * Return the path associated with the given reference type. * * @param int idx, an identifier for the reference type. * @return a String representing relevant file path. * @see IUIConstants */ public static String getReferencePath(int idx) { String refPath = sREFERENCEPATH + IMG_NAMES[idx]; if (ProjectCompendium.isMac) { refPath = sMACREFERENCEPATH + IMG_NAMES[idx]; File file = new File(refPath); if (!file.exists()) { refPath = sREFERENCEPATH + IMG_NAMES[idx]; } } return refPath; } /** * Return the path associated with the given reference file. * * @param refString the file name. * @param sDefault the default file name. * @param bSmallIcon true to return the small version of the node icon, false to return the * standard size * @return a String representing relevant file path. * @see IUIConstants */ public static String getReferencePath(String refString, String sDefault, boolean bSmallIcon) { if (bSmallIcon) { return UIReferenceNodeManager.getSmallReferenceIconPath(refString, sDefault); } else { return UIReferenceNodeManager.getReferenceIconPath(refString, sDefault); } } /** * Return the small ImageIcon associated with the given reference file. * * @param String refString, the file name. * @param String sDefault, the default file name. * @return a String representing relevant file path. * @see IUIConstants */ public static String getReferenceSmallPath(String refString, String sDefault) { return UIReferenceNodeManager.getSmallReferenceIconPath(refString, sDefault); } /** * Used to get the reference icons for right-click menus. * * @param refString, the name of the image to return the icon for. * @return ImageIcon, the icon for the given image exctension type. */ public static ImageIcon getSmallReferenceIcon(String refString) { return UIReferenceNodeManager.getSmallReferenceIcon(refString); } /** * Return the ImageIcon associated with the given reference type. * * @param int idx, an identifier for the reference type. * @return the relevant ImageIcon. * @see IUIConstants */ public static ImageIcon getReferenceIcon(int idx) { ImageIcon image = img[idx]; if (image == null) { image = new ImageIcon(getReferencePath(idx)); img[idx] = image; } return image; } /** * Return the standard size icon for the given node type. * * @param type, the node type to return the icon for. * @return ImageIcon, the icon for the given node type. */ public static ImageIcon getNodeImage(int type) { return UINodeTypeManager.getNodeImage(type); } /** * Return the ImageIcon associated with the given node type. * * @param idx the identifier for the image location for the node type. * @return the relevant ImageIcon. * @see IUIConstants */ public static ImageIcon getNodeIcon(int idx) { String sPath = ""; // $NON-NLS-1$ String skin = FormatProperties.skin; // Old skins sets have gif files, new ones have png - so need to check. // Also handle skin missing by getting image from images folder. // Check if the icon is a png file sPath = sNODEPATH + skin + sFS + DEFAULT_IMG_NAMES[idx]; File fileCheck1 = new File(sPath); if (!fileCheck1.exists()) { // check if file is a gif sPath = sNODEPATH + skin + sFS + IMG_NAMES[idx]; File fileCheck = new File(sPath); if (!fileCheck.exists()) { // if image not found, try getting the image from the default skin sPath = sDEFAULTNODEPATH + sFS + DEFAULT_IMG_NAMES[idx]; fileCheck = new File(sPath); if (!fileCheck.exists()) { // If all else fails, get the backup images in the images folder sPath = sPATH + DEFAULT_IMG_NAMES[idx]; } } } ImageIcon image = new ImageIcon(sPath); return image; } /** * Return the path of the given icon file. * * @param type The node type. * @param bSmallIcon true for returning the small version of the node icon, false for the standard * size. * @return a String representing the path to the given icon file. * @see IUIConstants */ public static String getPath(int type, boolean bSmallIcon) { if (bSmallIcon) { return getSmallPath(type); } else { int idx = UINodeTypeManager.getImageIndexForType(type); String sPath = ""; // $NON-NLS-1$ String skin = FormatProperties.skin; // Old skins sets have gif files, new ones have png - so need to check. // Also handle skin missing by getting image from images folder. // Check if the icon is a png file sPath = sNODEPATH + skin + sFS + DEFAULT_IMG_NAMES[idx]; File fileCheck1 = new File(sPath); if (!fileCheck1.exists()) { // check if file is a gif sPath = sNODEPATH + skin + sFS + IMG_NAMES[idx]; File fileCheck = new File(sPath); if (!fileCheck.exists()) { // if image not found, try getting the image from the default skin sPath = sDEFAULTNODEPATH + sFS + DEFAULT_IMG_NAMES[idx]; fileCheck = new File(sPath); if (!fileCheck.exists()) { // If all else fails, get the backup images in the images folder sPath = sPATH + DEFAULT_IMG_NAMES[idx]; } } } return sPath; } } /** * Return the path of the given icon file small image. * * @param type The node type * @return a String representing the path to the given icon file. * @see IUIConstants */ public static String getSmallPath(int type) { int idx = UINodeTypeManager.getImageIndexForType(type); String sPath = ""; // $NON-NLS-1$ String skin = FormatProperties.skin; // Old skins sets have gif files, new ones have png - so need to check. // Also handle skin missing by getting image from images folder. // Check if the icon is a png file sPath = sNODEPATH + skin + sFS + DEFAULT_IMG_NAMES[idx]; File fileCheck1 = new File(sPath); if (!fileCheck1.exists()) { // check if file is a gif sPath = sNODEPATH + skin + sFS + IMG_NAMES[idx]; File fileCheck = new File(sPath); if (!fileCheck.exists()) { // if image not found, try getting the image from the default skin sPath = sDEFAULTNODEPATH + sFS + DEFAULT_IMG_NAMES[idx]; fileCheck = new File(sPath); if (!fileCheck.exists()) { // If all else fails, get the backup images in the images folder sPath = sPATH + DEFAULT_IMG_NAMES[idx]; } } } return sPath; } /** * If required scale the given icon and return the scaled version. * * @param imageString, the image icon file name to create and scale the icon from. * @return ImageIcon, the scaled image icon. */ public static ImageIcon thumbnailIcon(String imageString) { ImageIcon inImage = createImageIcon(imageString); if (inImage == null) { return inImage; } return thumbnailIcon(inImage); } /** * If required scale the given icon and return the scaled version (96x96 max). * * @param imageString, the image icon file name to create and scale the icon from. * @return ImageIcon, the scaled image icon. */ public static ImageIcon thumbnailIcon(ImageIcon inImage) { if (inImage == null) { return inImage; } Image icon = inImage.getImage(); int imgWidth = icon.getWidth(null); int imgHeight = icon.getHeight(null); // DON'T SCALE IF IMAGE SMALLER THAN MAXDIM if (imgWidth < MAX_DIM && imgHeight < MAX_DIM) { return inImage; } else { // Determine the scale. double scale = (double) MAX_DIM / (double) imgHeight; if (imgWidth > imgHeight) { scale = (double) MAX_DIM / (double) imgWidth; } // Determine size of new image. // One of them should equal MAX_DIM. int scaledW = (int) (scale * imgWidth); int scaledH = (int) (scale * imgHeight); return scaleIcon(inImage, new Dimension(scaledW, scaledH)); } } /** * If required scale the given icon and return the scaled version. * * @param imageString, the image icon file name to create and scale the icon from. * @return ImageIcon, the scaled image icon. */ public static ImageIcon scaleIcon(ImageIcon inImage, Dimension newSize) { if (inImage == null) { return inImage; } Image icon = inImage.getImage(); ImageFilter filter = new AreaAveragingScaleFilter(newSize.width, newSize.height); FilteredImageSource filteredSource = new FilteredImageSource((ImageProducer) icon.getSource(), filter); JLabel comp = new JLabel(); icon = comp.createImage(filteredSource); return new ImageIcon(icon); } /** * Get the new Dinmension for this image ig it was scaled. * * @param refString the filename for the image to get the new dimension for. * @return Dimension the scaled size of the image with the given string. */ public static Dimension thumbnailImage(String refString, int defaultWidth, int defaultHeight) { int width = defaultWidth; int height = defaultHeight; if (refString != null) { if (isImage(refString)) { // determine scale of new image // Get the image from a file. ImageIcon inImageIcon = createImageIcon(refString); if (inImageIcon == null) { return new Dimension(width, height); } // if (!(new File(refString)).exists()) { // return new Dimension(width, height); // } Image inImage = inImageIcon.getImage(); int imgWidth = inImage.getWidth(null); int imgHeight = inImage.getHeight(null); // DON'T DO IT IF IMAGE SMALLER THAN MAX_DIM if (imgWidth < MAX_DIM && imgHeight < MAX_DIM) return new Dimension(imgWidth, imgHeight); // Determine the scale. double scale = (double) MAX_DIM / (double) imgHeight; if (imgWidth > imgHeight) { scale = (double) MAX_DIM / (double) imgWidth; } // Determine size of new image. // One of them should equal MAX_DIM. width = (int) (scale * imgWidth); height = (int) (scale * imgHeight); } } return new Dimension(width, height); } /** * Return the size the image produced from the given icon file name. * * @param refString, the name of the image to return the size for. * @return Dimenaion, the size of the given image. */ public static Dimension getImageSize(String refString) { int width = -1; int height = -1; // Get the image from a file. ImageIcon inImageIcon = createImageIcon(refString); if (inImageIcon == null) { return new Dimension(width, height); } // if (!(new File(refString)).exists()) { // return new Dimension(width, height); // } Image inImage = inImageIcon.getImage(); width = inImage.getWidth(null); height = inImage.getHeight(null); return new Dimension(width, height); } /** * Check if the given string is the name of a supported image file (jpg, jpeg, gif, png, tiff, * tif). * * @param refString, the name of the image to check. * @return boolean, true if the file if a supported image type else false. */ public static boolean isImage(String refString) { if (refString != null) { String ref = refString.toLowerCase(); if (ref.endsWith(".gif") || ref.endsWith(".jpg") || ref.endsWith(".jpeg") || ref.endsWith(".png") || ref.endsWith(".tiff") || ref.endsWith(".tif")) { return true; } } return false; } /** * Check if the given string is the name of a supported movie file (avi, swf, spl, mov). * * @param refString, the name of the movie to check. * @return boolean, true if the file if a supported movie else false. */ /*public static boolean isMovie(String refString) { if (refString != null) { String ref = refString.toLowerCase(); if ( ref.endsWith(".avi") || ref.endsWith(".swf") //$NON-NLS-1$ //$NON-NLS-2$ || ref.endsWith(".spl") || ref.endsWith(".mov") //$NON-NLS-1$ //$NON-NLS-2$ || ref.endsWith(".mp4")) { return true; } } return false; }*/ /** * Take the given file path and create an ImageIcon file from it. If it is a image on the web, * load appropriately. * * @param sImagePath the path or URI of the image to load into an ImageIcon class. * @return the Image icon, or null, if not successfully loaded. */ public static final ImageIcon createImageIcon(String sImagePath) { if (sImagePath.startsWith("www.")) { // $NON-NLS-1$ sImagePath = "http://" + sImagePath; // $NON-NLS-1$ } ImageIcon oIcon = null; URI oImageUri = null; String scheme = null; String path = null; try { oImageUri = new URI(sImagePath); scheme = oImageUri.getScheme(); path = oImageUri.getPath(); } catch (URISyntaxException ex) { // ok, path is no URI oImageUri = null; } if (scheme != null) { if (scheme.equals("http") || scheme.equals("https")) { // $NON-NLS-1$ //$NON-NLS-2$ try { URL url = new URL(sImagePath); Image image = Toolkit.getDefaultToolkit().getImage(sImagePath); if (url != null && image != null) { oIcon = new ImageIcon(url); if (oIcon.getImageLoadStatus() == MediaTracker.ERRORED) { oIcon = null; } } } catch (Exception ex) { log.error("Error...", ex); log.info( "Exception URL trying to turn into image " + sImagePath + "\n\ndue to: " + ex.getMessage()); // $NON-NLS-1$ //$NON-NLS-2$ System.out.flush(); } } else if (scheme.equals("file")) { // $NON-NLS-1$ oIcon = createImageIcon(path); } else if (scheme.equals("linkedFile")) { // $NON-NLS-1$ Model oModel = (Model) ProjectCompendium.APP.getModel(); PCSession oSession = oModel.getSession(); LinkedFile linked = new LinkedFileDatabase(oImageUri); linked.initialize(oSession, oModel); try { oIcon = createImageIcon(linked.getFile(ProjectCompendium.temporaryDirectory).getPath()); } catch (Exception e) { log.error("Error...", e); log.info( "Exception trying to load image from database " + sImagePath + "\n\ndue to: " + e.getLocalizedMessage()); // $NON-NLS-1$ //$NON-NLS-2$ } } else { log.info("createImageIcon: unknown URI scheme: " + scheme); // $NON-NLS-1$ System.out.flush(); // Note mrudolf: this is more restrictive than before. As it was, // it would pass the URI path straight through to the non-Uri part below. // I can imagine that on Linux there might be URIs such as fish:// that // may have worked before... oIcon = null; } } else { // non-URI try { oIcon = new ImageIcon(sImagePath); if (oIcon.getImageLoadStatus() == MediaTracker.ERRORED) { oIcon = null; } } catch (Exception ex) { log.error("Error...", ex); log.info( "Exception trying to turn into image " + sImagePath + "\n\ndue to: " + ex.getLocalizedMessage()); // $NON-NLS-1$ //$NON-NLS-2$ } } return oIcon; } /** * Get the contents of a URL and return it as an image. * * @return a String representing the path the file was actually saved to, or empty string if * something failed. */ public static String loadWebImageToLinkedFiles(String address, String sFileName, String sPath) throws Exception { ProjectCompendium.APP.setWaitCursor(); File newFile = new File(sPath + sFileName); String imgAddress = address.toLowerCase(); if ((imgAddress.startsWith("www") || imgAddress.startsWith("http") || imgAddress.startsWith("https")) // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ && isImage(imgAddress)) { // $NON-NLS-1$ if (newFile.exists()) { int response = JOptionPane.showConfirmDialog( ProjectCompendium.APP, LanguageProperties.getString( LanguageProperties.UI_GENERAL_BUNDLE, "UIImages.nameExistsMessage1a") + "\n" + //$NON-NLS-1$ //$NON-NLS-2$ LanguageProperties.getString( LanguageProperties.UI_GENERAL_BUNDLE, "UIImages.nameExistsMessage1b") + "\n\n" + //$NON-NLS-1$ //$NON-NLS-2$ "(" + LanguageProperties.getString( LanguageProperties.UI_GENERAL_BUNDLE, "UIImages.nameExistsMessage1c") + ")\n\n", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ LanguageProperties.getString( LanguageProperties.UI_GENERAL_BUNDLE, "UIImages.externalDragAndDrop"), JOptionPane.YES_NO_OPTION); // $NON-NLS-1$ if (response == JOptionPane.YES_OPTION) { UIFileChooser fileDialog = new UIFileChooser(); fileDialog.setDialogType(JFileChooser.SAVE_DIALOG); fileDialog.setDialogTitle( LanguageProperties.getString( LanguageProperties.UI_GENERAL_BUNDLE, "UIImages.changeFileName")); // $NON-NLS-1$ fileDialog.setApproveButtonText( LanguageProperties.getString( LanguageProperties.UI_GENERAL_BUNDLE, "UIImages.saveButton")); // $NON-NLS-1$ fileDialog.setCurrentDirectory(new File(newFile.getParent() + ProjectCompendium.sFS)); fileDialog.setSelectedFile(newFile); UIUtilities.centerComponent(fileDialog, ProjectCompendium.APP); int retval = fileDialog.showSaveDialog(ProjectCompendium.APP); if (retval == JFileChooser.APPROVE_OPTION) { if ((fileDialog.getSelectedFile()) != null) { String fileName2 = fileDialog.getSelectedFile().getName(); if (fileName2 != null) { sFileName = fileName2; File fileDir = fileDialog.getCurrentDirectory(); if (ProjectCompendium.isMac) sPath = fileDir.getAbsolutePath() + ProjectCompendium.sFS; else sPath = fileDir.getPath(); } } } else { return new String(""); // $NON-NLS-1$ } } } URL url = new URL(address); URLConnection conn = url.openConnection(); conn.connect(); DataInputStream stream = new DataInputStream(new BufferedInputStream(conn.getInputStream())); FileOutputStream output = new FileOutputStream(sPath + sFileName); int count = conn.getContentLength(); if (count > 0) { for (int i = 0; i < count; i++) { output.write(stream.read()); } } else { sFileName = ""; // $NON-NLS-1$ } stream.close(); output.flush(); output.close(); ProjectCompendium.APP.setDefaultCursor(); return sPath + sFileName; } else { ProjectCompendium.APP.setDefaultCursor(); return new String(""); // $NON-NLS-1$ } } // Load an image from the image library. /*static synchronized public Image fetchImage(String name) { Image image=null; byte[] bits; bits = ImageLib.getImage(name); if (bits==null) return null; image = Toolkit.getDefaultToolkit().createImage(bits); try { // wait for image MediaTracker imageTracker = new MediaTracker(panel); imageTracker.addImage(image, 0); imageTracker.waitForID(0); } catch (InterruptedException e) { log.error("ImageLoader: Interrupted at waitForID"); } return image; }*/ /* public static BufferedImage toCompatibleImage(BufferedImage image, GraphicsConfiguration gc) { if (gc == null) gc = UIUtilities.getDefaultConfiguration(); int w = image.getWidth(); int h = image.getHeight(); int transparency = image.getColorModel().getTransparency(); BufferedImage result = gc.createCompatibleImage(w, h, transparency); Graphics2D g2 = result.createGraphics(); g2.drawRenderedImage(image, null); g2.dispose(); return result; } public static BufferedImage copy(BufferedImage source, BufferedImage target) { Graphics2D g2 = target.createGraphics(); g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); double scalex = (double) target.getWidth()/ source.getWidth(); double scaley = (double) target.getHeight()/ source.getHeight(); AffineTransform xform = AffineTransform.getScaleInstance(scalex, scaley); g2.drawRenderedImage(source, xform); g2.dispose(); return target; } public static BufferedImage getScaledInstance(BufferedImage image, int width, int height, GraphicsConfiguration gc) { if (gc == null) gc = UIUtilities.getDefaultConfiguration(); int transparency = image.getColorModel().getTransparency(); return copy(image, gc.createCompatibleImage(width, height, transparency)); } public static void loadImage(Image image, Component c) { try { if (image instanceof BufferedImage) return; //already buffered MediaTracker tracker = new MediaTracker(c); tracker.addImage(image, 0); tracker.waitForID(0); if (MediaTracker.COMPLETE != tracker.statusID(0, false)) throw new IllegalStateException("image loading fails"); } catch (InterruptedException e) { throw new RuntimeException("interrupted", e); } } public static ColorModel getColorModel(Image image) { try { PixelGrabber grabby = new PixelGrabber(image, 0, 0, 1, 1, false); if (!grabby.grabPixels()) throw new RuntimeException("pixel grab fails"); return grabby.getColorModel(); } catch (InterruptedException e) { throw new RuntimeException("interrupted", e); } } public static BufferedImage toBufferedImage(Image image, GraphicsConfiguration gc) { if (image instanceof BufferedImage) return (BufferedImage) image; loadImage(image, new Label()); int w = image.getWidth(null); int h = image.getHeight(null); int transparency = getColorModel(image).getTransparency(); if (gc == null) gc = getDefaultConfiguration(); BufferedImage result = gc.createCompatibleImage(w, h, transparency); Graphics2D g = result.createGraphics(); g.drawImage(image, 0, 0, null); g.dispose(); return result; } */ }
/** * Get the contents of a URL and return it as an image. * * @return a String representing the path the file was actually saved to, or empty string if * something failed. */ public static String loadWebImageToLinkedFiles(String address, String sFileName, String sPath) throws Exception { ProjectCompendium.APP.setWaitCursor(); File newFile = new File(sPath + sFileName); String imgAddress = address.toLowerCase(); if ((imgAddress.startsWith("www") || imgAddress.startsWith("http") || imgAddress.startsWith("https")) // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ && isImage(imgAddress)) { // $NON-NLS-1$ if (newFile.exists()) { int response = JOptionPane.showConfirmDialog( ProjectCompendium.APP, LanguageProperties.getString( LanguageProperties.UI_GENERAL_BUNDLE, "UIImages.nameExistsMessage1a") + "\n" + //$NON-NLS-1$ //$NON-NLS-2$ LanguageProperties.getString( LanguageProperties.UI_GENERAL_BUNDLE, "UIImages.nameExistsMessage1b") + "\n\n" + //$NON-NLS-1$ //$NON-NLS-2$ "(" + LanguageProperties.getString( LanguageProperties.UI_GENERAL_BUNDLE, "UIImages.nameExistsMessage1c") + ")\n\n", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ LanguageProperties.getString( LanguageProperties.UI_GENERAL_BUNDLE, "UIImages.externalDragAndDrop"), JOptionPane.YES_NO_OPTION); // $NON-NLS-1$ if (response == JOptionPane.YES_OPTION) { UIFileChooser fileDialog = new UIFileChooser(); fileDialog.setDialogType(JFileChooser.SAVE_DIALOG); fileDialog.setDialogTitle( LanguageProperties.getString( LanguageProperties.UI_GENERAL_BUNDLE, "UIImages.changeFileName")); // $NON-NLS-1$ fileDialog.setApproveButtonText( LanguageProperties.getString( LanguageProperties.UI_GENERAL_BUNDLE, "UIImages.saveButton")); // $NON-NLS-1$ fileDialog.setCurrentDirectory(new File(newFile.getParent() + ProjectCompendium.sFS)); fileDialog.setSelectedFile(newFile); UIUtilities.centerComponent(fileDialog, ProjectCompendium.APP); int retval = fileDialog.showSaveDialog(ProjectCompendium.APP); if (retval == JFileChooser.APPROVE_OPTION) { if ((fileDialog.getSelectedFile()) != null) { String fileName2 = fileDialog.getSelectedFile().getName(); if (fileName2 != null) { sFileName = fileName2; File fileDir = fileDialog.getCurrentDirectory(); if (ProjectCompendium.isMac) sPath = fileDir.getAbsolutePath() + ProjectCompendium.sFS; else sPath = fileDir.getPath(); } } } else { return new String(""); // $NON-NLS-1$ } } } URL url = new URL(address); URLConnection conn = url.openConnection(); conn.connect(); DataInputStream stream = new DataInputStream(new BufferedInputStream(conn.getInputStream())); FileOutputStream output = new FileOutputStream(sPath + sFileName); int count = conn.getContentLength(); if (count > 0) { for (int i = 0; i < count; i++) { output.write(stream.read()); } } else { sFileName = ""; // $NON-NLS-1$ } stream.close(); output.flush(); output.close(); ProjectCompendium.APP.setDefaultCursor(); return sPath + sFileName; } else { ProjectCompendium.APP.setDefaultCursor(); return new String(""); // $NON-NLS-1$ } }
/** * Initialises and sets up the dialog. * * @param parent the parent frame for this dialog. * @param projects a list of the current database project names. * @param sMySQLName the username to use when connecting to MySQL to create the new database. * @param sMySQLPassword the password to use when connecting to MySQL to create the new database. * @param sMySQLIP the ip address or hostname to use when connecting to the database to create the * new project. */ public UINewDatabaseDialog( JFrame parent, Vector projects, String sMySQLName, String sMySQLPassword, String sMySQLIP) { super(parent, true); if (!ProjectCompendium.APP.projectsExist() && SystemProperties.createDefaultProject) { drawSimpleForm = true; } else { drawSimpleForm = false; } if (!drawSimpleForm) { this.setTitle( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.createNewProjectTitle")); //$NON-NLS-1$ } else { this.setTitle( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.compendiumSetupTitle")); //$NON-NLS-1$ } // this.setTitle(LanguageProperties.getString(LanguageProperties.DIALOGS_BUNDLE, // "UINewDatabaseDialog.createNewProjectTitle")); //$NON-NLS-1$ CSH.setHelpIDString(this, "basic.databases"); // $NON-NLS-1$ oParent = parent; manager = this; this.sDatabaseLogin = sMySQLName; this.sDatabasePassword = sMySQLPassword; if (sMySQLIP != null && !sMySQLIP.equals("")) { // $NON-NLS-1$ this.sDatabaseIP = sMySQLIP; } vtProjects = projects; oContentPane = getContentPane(); JPanel oMainPanel = new JPanel(new BorderLayout()); oMainPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); oContentPane.setLayout(new BorderLayout()); oContentPane.add(oMainPanel); oDetailsPanel = new JPanel(); oDetailsPanel.setBorder(new EmptyBorder(10, 10, 5, 10)); grid = new GridBagLayout(); oDetailsPanel.setLayout(grid); GridBagConstraints gc = new GridBagConstraints(); gc.insets = new Insets(5, 5, 5, 5); gc.anchor = GridBagConstraints.WEST; if (!drawSimpleForm) { oNameLabel = new JLabel( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.projectName") + ": * "); //$NON-NLS-1$ grid.setConstraints(oNameLabel, gc); oNameField = new JTextField(); oNameField.setColumns(25); oNameLabel.setLabelFor(oNameField); gc.gridwidth = GridBagConstraints.REMAINDER; grid.setConstraints(oNameField, gc); oDetailsPanel.add(oNameLabel); oDetailsPanel.add(oNameField); oDefaultDatabase = new JCheckBox( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.setAsDefault")); //$NON-NLS-1$ oDefaultDatabase.addItemListener(this); grid.setConstraints(oDefaultDatabase, gc); oDetailsPanel.add(oDefaultDatabase); // oDefaultUser = new // JCheckBox(LanguageProperties.getString(LanguageProperties.DIALOGS_BUNDLE, // "UINewDatabaseDialog.defaultUser")); //$NON-NLS-1$ // oDefaultUser.addItemListener(this); // grid.setConstraints(oDefaultUser, gc); // oDetailsPanel.add(oDefaultUser); // JLabel label = new JLabel(LanguageProperties.getString(LanguageProperties.DIALOGS_BUNDLE, // "UINewDatabaseDialog.administrator")); //$NON-NLS-1$ // grid.setConstraints(label, gc); // oDetailsPanel.add(label); } oButtonPanel = new UIButtonPanel(); pbCreate = new UIButton( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.createButton")); //$NON-NLS-1$ pbCreate.setMnemonic( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.createButtonMnemonic") .charAt(0)); // $NON-NLS-1$ pbCreate.addActionListener(this); getRootPane().setDefaultButton(pbCreate); oButtonPanel.addButton(pbCreate); if (!drawSimpleForm) { pbCancel = new UIButton( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.cancelButton")); //$NON-NLS-1$ pbCancel.setMnemonic( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.cancelButtonMnemonic") .charAt(0)); // $NON-NLS-1$ pbCancel.addActionListener(this); oButtonPanel.addButton(pbCancel); pbHelp = new UIButton( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.helpButton")); //$NON-NLS-1$ pbHelp.setMnemonic( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.helpButtonMnemonic") .charAt(0)); // $NON-NLS-1$ ProjectCompendium.APP.mainHB.enableHelpOnButton( pbHelp, "basics.databasescreate", ProjectCompendium.APP.mainHS); // $NON-NLS-1$ oButtonPanel.addHelpButton(pbHelp); } JPanel oHoldingPanel = new JPanel(new BorderLayout()); userPanel = new UINewUserPanel(true); userPanel.setBorder( new TitledBorder( new BevelBorder(BevelBorder.LOWERED), LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.administrator"))); oHoldingPanel.add(userPanel, BorderLayout.CENTER); if (!drawSimpleForm) { oDefaultUser = new JCheckBox( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.defaultUser")); //$NON-NLS-1$ oDefaultUser.addItemListener(this); oDefaultUser.setSelected(true); grid.setConstraints(oDefaultUser, gc); oHoldingPanel.add(oDefaultUser, BorderLayout.SOUTH); } oMainPanel.add(oDetailsPanel, BorderLayout.NORTH); oMainPanel.add(oHoldingPanel, BorderLayout.CENTER); oMainPanel.add(oButtonPanel, BorderLayout.SOUTH); oProgressBar = new JProgressBar(); oProgressBar.setMinimum(0); oProgressBar.setMaximum(100); pack(); setResizable(false); }
/** Handle the import action request. */ public void onImport() { String finalFile = ""; // $NON-NLS-1$ if (file == null) { UIFileFilter filter = new UIFileFilter(new String[] {"xml"}, "XML Files"); // $NON-NLS-1$ //$NON-NLS-2$ UIFileChooser fileDialog = new UIFileChooser(); fileDialog.setDialogTitle( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UIImportFlashMeetingXMLDialog.chooseFile2")); //$NON-NLS-1$ fileDialog.setFileFilter(filter); fileDialog.setApproveButtonText( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UIImportFlashMeetingXMLDialog.importButton")); //$NON-NLS-1$ fileDialog.setRequiredExtension(".xml"); // $NON-NLS-1$ // FIX FOR MAC - NEEDS '/' ON END TO DENOTE A FOLDER if (!UIImportFlashMeetingXMLDialog.lastFileDialogDir.equals("")) { // $NON-NLS-1$ File file = new File(UIImportFlashMeetingXMLDialog.lastFileDialogDir + ProjectCompendium.sFS); if (file.exists()) { fileDialog.setCurrentDirectory(file); } } UIUtilities.centerComponent(fileDialog, ProjectCompendium.APP); int retval = fileDialog.showOpenDialog(ProjectCompendium.APP); if (retval == JFileChooser.APPROVE_OPTION) { if ((fileDialog.getSelectedFile()) != null) { String fileName = fileDialog.getSelectedFile().getAbsolutePath(); File fileDir = fileDialog.getCurrentDirectory(); String dir = fileDir.getPath(); if (fileName != null) { UIImportFlashMeetingXMLDialog.lastFileDialogDir = dir; finalFile = fileName; } } } } else { finalFile = file.getAbsolutePath(); } if (finalFile != null) { if ((new File(finalFile)).exists()) { setVisible(false); Vector choices = new Vector(); if (cbIncludeKeywords.isSelected()) { choices.addElement(FlashMeetingXMLImport.KEYWORDS_LABEL); } if (cbIncludeAttendees.isSelected()) { choices.addElement(FlashMeetingXMLImport.ATTENDEE_LABEL); } if (cbIncludePlayList.isSelected()) { choices.addElement(FlashMeetingXMLImport.PLAYLIST_LABEL); } if (cbIncludeURLs.isSelected()) { choices.addElement(FlashMeetingXMLImport.URL_LABEL); } if (cbIncludeChats.isSelected()) { choices.addElement(FlashMeetingXMLImport.CHAT_LABEL); } if (cbIncludeWhiteboard.isSelected()) { choices.addElement(FlashMeetingXMLImport.WHITEBOARD_LABEL); } if (cbIncludeFileData.isSelected()) { choices.addElement(FlashMeetingXMLImport.FILEDATA_LABEL); } if (cbIncludeAnnotations.isSelected()) { choices.addElement(FlashMeetingXMLImport.ANNOTATIONS_LABEL); } if (cbIncludeVotes.isSelected()) { choices.addElement(FlashMeetingXMLImport.VOTING_LABEL); } DBNode.setNodesMarkedSeen(cbMarkSeen.isSelected()); FlashMeetingXMLImport xmlImport = new FlashMeetingXMLImport(finalFile, ProjectCompendium.APP.getModel(), choices); xmlImport.start(); dispose(); ProjectCompendium.APP.setStatus(""); // $NON-NLS-1$ } } }
/** * Creates and return the main toolbar (for example, cut/copy/paste/open/close etc.). * * @return UIToolBar, the toolbar with all the main options. */ private UIToolBar createToolBarItems() { if (!bSimpleInterface) { pbOpen = tbrToolBar.createToolBarButton( LanguageProperties.getString( LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.open"), UIImages.get(OPEN_ICON)); // $NON-NLS-1$ pbOpen.addActionListener(this); pbOpen.setEnabled(false); tbrToolBar.add(pbOpen); CSH.setHelpIDString(pbOpen, "toolbars.main"); // $NON-NLS-1$ pbClose = tbrToolBar.createToolBarButton( LanguageProperties.getString( LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.close"), UIImages.get(CLOSE_ICON)); // $NON-NLS-1$ pbClose.addActionListener(this); pbClose.setEnabled(true); tbrToolBar.add(pbClose); CSH.setHelpIDString(pbClose, "toolbars.main"); // $NON-NLS-1$ tbrToolBar.addSeparator(); } pbCut = tbrToolBar.createToolBarButton( LanguageProperties.getString(LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.cut"), UIImages.get(CUT_ICON)); // $NON-NLS-1$ pbCut.addActionListener(this); pbCut.setEnabled(false); tbrToolBar.add(pbCut); CSH.setHelpIDString(pbCut, "toolbars.main"); // $NON-NLS-1$ pbCopy = tbrToolBar.createToolBarButton( LanguageProperties.getString(LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.copy"), UIImages.get(COPY_ICON)); // $NON-NLS-1$ pbCopy.addActionListener(this); pbCopy.setEnabled(false); tbrToolBar.add(pbCopy); CSH.setHelpIDString(pbCopy, "toolbars.main"); // $NON-NLS-1$ pbPaste = tbrToolBar.createToolBarButton( LanguageProperties.getString(LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.paste"), UIImages.get(PASTE_ICON)); // $NON-NLS-1$ pbPaste.addActionListener(this); pbPaste.setEnabled(false); tbrToolBar.add(pbPaste); CSH.setHelpIDString(pbPaste, "toolbars.main"); // $NON-NLS-1$ pbDelete = tbrToolBar.createToolBarButton( LanguageProperties.getString( LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.delete"), UIImages.get(DELETE_ICON)); // $NON-NLS-1$ pbDelete.addActionListener(this); pbDelete.setEnabled(false); tbrToolBar.add(pbDelete); CSH.setHelpIDString(pbDelete, "toolbars.main"); // $NON-NLS-1$ tbrToolBar.addSeparator(); pbUndo = tbrToolBar.createToolBarButton( LanguageProperties.getString(LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.undo"), UIImages.get(UNDO_ICON)); // $NON-NLS-1$ pbUndo.addActionListener(this); pbUndo.setEnabled(false); tbrToolBar.add(pbUndo); CSH.setHelpIDString(pbUndo, "toolbars.main"); // $NON-NLS-1$ pbRedo = tbrToolBar.createToolBarButton( LanguageProperties.getString(LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.redo"), UIImages.get(REDO_ICON)); // $NON-NLS-1$ pbRedo.addActionListener(this); pbRedo.setEnabled(false); tbrToolBar.add(pbRedo); CSH.setHelpIDString(pbRedo, "toolbars.main"); // $NON-NLS-1$ tbrToolBar.addSeparator(); pbShowBackHistory = tbrToolBar.createToolBarButton( LanguageProperties.getString( LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.backTo"), UIImages.get(PREVIOUS_ICON)); // $NON-NLS-1$ pbShowBackHistory.addActionListener(this); pbShowBackHistory.setEnabled(false); tbrToolBar.add(pbShowBackHistory); CSH.setHelpIDString(pbShowBackHistory, "toolbars.main"); // $NON-NLS-1$ pbBack = tbrToolBar.createToolBarButton( LanguageProperties.getString(LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.back"), UIImages.get(BACK_ICON)); // $NON-NLS-1$ pbBack.addActionListener(this); pbBack.setEnabled(false); tbrToolBar.add(pbBack); CSH.setHelpIDString(pbBack, "toolbars.main"); // $NON-NLS-1$ pbForward = tbrToolBar.createToolBarButton( LanguageProperties.getString( LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.forward"), UIImages.get(FORWARD_ICON)); // $NON-NLS-1$ pbForward.addActionListener(this); pbForward.setEnabled(false); tbrToolBar.add(pbForward); CSH.setHelpIDString(pbForward, "toolbars.main"); // $NON-NLS-1$ pbShowForwardHistory = tbrToolBar.createToolBarButton( LanguageProperties.getString( LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.forwardTo"), UIImages.get(NEXT_ICON)); // $NON-NLS-1$ pbShowForwardHistory.addActionListener(this); pbShowForwardHistory.setEnabled(false); tbrToolBar.add(pbShowForwardHistory); CSH.setHelpIDString(pbShowForwardHistory, "toolbars.main"); // $NON-NLS-1$ tbrToolBar.addSeparator(); pbImageRollover = tbrToolBar.createToolBarButton( LanguageProperties.getString( LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.imageRollover"), UIImages.get(IMAGE_ROLLOVER_ICON)); // $NON-NLS-1$ pbImageRollover.addActionListener(this); pbImageRollover.setEnabled(true); tbrToolBar.add(pbImageRollover); CSH.setHelpIDString(pbImageRollover, "toolbars.main"); // $NON-NLS-1$ pbSearch = tbrToolBar.createToolBarButton( LanguageProperties.getString( LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.search"), UIImages.get(SEARCH_ICON)); // $NON-NLS-1$ pbSearch.addActionListener(this); pbSearch.setEnabled(true); tbrToolBar.add(pbSearch); CSH.setHelpIDString(pbSearch, "toolbars.main"); // $NON-NLS-1$ pbHelp = tbrToolBar.createToolBarButton( LanguageProperties.getString( LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.helpOnItem"), UIImages.get(HELP_ICON)); // $NON-NLS-1$ if (((UIToolBarManager) oManager).getHelpBroker() != null) { pbHelp.addActionListener( new CSH.DisplayHelpAfterTracking(((UIToolBarManager) oManager).getHelpBroker())); } pbHelp.setEnabled(true); tbrToolBar.add(pbHelp); return tbrToolBar; }
/** Draw the contents of the dialog. */ private void drawDialog() { JPanel oCenterPanel = new JPanel(); GridBagLayout gb = new GridBagLayout(); GridBagConstraints gc = new GridBagConstraints(); gc.anchor = GridBagConstraints.WEST; oCenterPanel.setLayout(gb); gc.insets = new Insets(5, 5, 5, 5); int y = 0; cbIncludeKeywords = new JCheckBox( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UIImportFlashMeetingXMLDialog.importKeywordData")); //$NON-NLS-1$ cbIncludeKeywords.setSelected(true); cbIncludeKeywords.addActionListener(this); gc.gridy = y; y++; gb.setConstraints(cbIncludeKeywords, gc); oCenterPanel.add(cbIncludeKeywords); cbIncludePlayList = new JCheckBox( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UIImportFlashMeetingXMLDialog.importPlayListData")); //$NON-NLS-1$ cbIncludePlayList.setSelected(true); cbIncludePlayList.addActionListener(this); gc.gridy = y; y++; gb.setConstraints(cbIncludePlayList, gc); oCenterPanel.add(cbIncludePlayList); cbIncludeURLs = new JCheckBox( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UIImportFlashMeetingXMLDialog.importURLData")); //$NON-NLS-1$ cbIncludeURLs.setSelected(true); cbIncludeURLs.addActionListener(this); gc.gridy = y; y++; gb.setConstraints(cbIncludeURLs, gc); oCenterPanel.add(cbIncludeURLs); cbIncludeAttendees = new JCheckBox( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UIImportFlashMeetingXMLDialog.importAttendeeData")); //$NON-NLS-1$ cbIncludeAttendees.setSelected(true); cbIncludeAttendees.addActionListener(this); gc.gridy = y; y++; gb.setConstraints(cbIncludeAttendees, gc); oCenterPanel.add(cbIncludeAttendees); cbIncludeChats = new JCheckBox( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UIImportFlashMeetingXMLDialog.imortChatData")); //$NON-NLS-1$ cbIncludeChats.setSelected(true); cbIncludeChats.addActionListener(this); gc.gridy = y; y++; gb.setConstraints(cbIncludeChats, gc); oCenterPanel.add(cbIncludeChats); cbIncludeWhiteboard = new JCheckBox( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UIImportFlashMeetingXMLDialog.importWhiteBoardData")); //$NON-NLS-1$ cbIncludeWhiteboard.setSelected(true); cbIncludeWhiteboard.addActionListener(this); gc.gridy = y; y++; gb.setConstraints(cbIncludeWhiteboard, gc); oCenterPanel.add(cbIncludeWhiteboard); cbIncludeAnnotations = new JCheckBox( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UIImportFlashMeetingXMLDialog.importAnnotationData")); //$NON-NLS-1$ cbIncludeAnnotations.setSelected(true); cbIncludeAnnotations.addActionListener(this); gc.gridy = y; y++; gb.setConstraints(cbIncludeAnnotations, gc); oCenterPanel.add(cbIncludeAnnotations); cbIncludeFileData = new JCheckBox( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UIImportFlashMeetingXMLDialog.importFileData")); //$NON-NLS-1$ cbIncludeFileData.setSelected(true); cbIncludeFileData.addActionListener(this); gc.gridy = y; y++; gb.setConstraints(cbIncludeFileData, gc); oCenterPanel.add(cbIncludeFileData); cbIncludeVotes = new JCheckBox( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UIImportFlashMeetingXMLDialog.importVotingData")); //$NON-NLS-1$ cbIncludeVotes.setSelected(true); cbIncludeVotes.addActionListener(this); gc.gridy = y; y++; gb.setConstraints(cbIncludeVotes, gc); oCenterPanel.add(cbIncludeVotes); // Add spacer label JLabel spacer = new JLabel(" "); // $NON-NLS-1$ gc.gridy = y; y++; gb.setConstraints(spacer, gc); oCenterPanel.add(spacer); // flag to mark seen/unseen on import cbMarkSeen = new JCheckBox( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UIImportFlashMeetingXMLDialog.markSeen")); //$NON-NLS-1$ cbMarkSeen.setSelected(true); cbMarkSeen.addActionListener(this); gc.gridy = y; y++; gb.setConstraints(cbMarkSeen, gc); oCenterPanel.add(cbMarkSeen); // Add spacer label spacer = new JLabel(" "); // $NON-NLS-1$ gc.gridy = y; y++; gb.setConstraints(spacer, gc); oCenterPanel.add(spacer); gc.gridwidth = 1; UIButtonPanel oButtonPanel = new UIButtonPanel(); pbImport = new UIButton( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UIImportFlashMeetingXMLDialog.importMainButton")); //$NON-NLS-1$ pbImport.setMnemonic( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UIImportFlashMeetingXMLDialog.importMainButtonMnemonic") .charAt(0)); pbImport.addActionListener(this); getRootPane().setDefaultButton(pbImport); oButtonPanel.addButton(pbImport); pbClose = new UIButton( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UIImportFlashMeetingXMLDialog.cancelButton")); //$NON-NLS-1$ pbClose.setMnemonic( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UIImportFlashMeetingXMLDialog.cancelButtonMnemonic") .charAt(0)); pbClose.addActionListener(this); oButtonPanel.addButton(pbClose); pbHelp = new UIButton( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UIImportFlashMeetingXMLDialog.helpButton")); //$NON-NLS-1$ pbHelp.setMnemonic( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UIImportFlashMeetingXMLDialog.helpButtonMnemonic") .charAt(0)); ProjectCompendium.APP.mainHB.enableHelpOnButton( pbHelp, "io.import_flashmeeting_xml", ProjectCompendium.APP.mainHS); // $NON-NLS-1$ oButtonPanel.addHelpButton(pbHelp); // other initializations oContentPane.setLayout(new BorderLayout()); oContentPane.add(oCenterPanel, BorderLayout.CENTER); oContentPane.add(oButtonPanel, BorderLayout.SOUTH); pack(); setResizable(false); return; }
/** * This class is the table model for the JTable in list views. * * @author ? / Michelle Bachler / Lakshmi Prabhakaran */ public class ListTableModel extends AbstractTableModel { /** class's own logger */ final Logger log = LoggerFactory.getLogger(getClass()); /** Serial ID */ private static final long serialVersionUID = 6863795268955672400L; public static final int NUMBER_COLUMN = 0; public static final int IMAGE_COLUMN = 1; public static final int TAGS_COLUMN = 2; public static final int VIEWS_COLUMN = 3; public static final int DETAIL_COLUMN = 4; public static final int WEIGHT_COLUMN = 5; public static final int LABEL_COLUMN = 6; public static final int CREATION_DATE_COLUMN = 7; public static final int MODIFICATION_DATE_COLUMN = 8; public static final int ID_COLUMN = 9; public static final int AUTHOR_COLUMN = 10; protected String[] columnNames = { LanguageProperties.getString( LanguageProperties.UI_GENERAL_BUNDLE, "ListTableModel.no"), // $NON-NLS-1$ LanguageProperties.getString( LanguageProperties.UI_GENERAL_BUNDLE, "ListTableModel.img"), // $NON-NLS-1$ LanguageProperties.getString( LanguageProperties.UI_GENERAL_BUNDLE, "ListTableModel.tags"), // $NON-NLS-1$ LanguageProperties.getString( LanguageProperties.UI_GENERAL_BUNDLE, "ListTableModel.views"), // $NON-NLS-1$ LanguageProperties.getString( LanguageProperties.UI_GENERAL_BUNDLE, "ListTableModel.details"), // $NON-NLS-1$ LanguageProperties.getString( LanguageProperties.UI_GENERAL_BUNDLE, "ListTableModel.weight"), // $NON-NLS-1$ LanguageProperties.getString( LanguageProperties.UI_GENERAL_BUNDLE, "ListTableModel.label"), // $NON-NLS-1$ LanguageProperties.getString( LanguageProperties.UI_GENERAL_BUNDLE, "ListTableModel.createDate"), // $NON-NLS-1$ LanguageProperties.getString( LanguageProperties.UI_GENERAL_BUNDLE, "ListTableModel.modDate"), // $NON-NLS-1$ LanguageProperties.getString( LanguageProperties.UI_GENERAL_BUNDLE, "ListTableModel.id"), // $NON-NLS-1$ LanguageProperties.getString(LanguageProperties.UI_GENERAL_BUNDLE, "ListTableModel.author") }; //$NON-NLS-1$ protected Vector nodeData = new Vector(20); protected View view; protected TableSorter sorter; public ListTableModel(View listView) { super(); view = listView; sortNodePos(); constructTableData(); } public void setSorter(TableSorter ts) { sorter = ts; } /** Reorders the views nodes and sets their yPositions. */ public void sortNodePos() { Vector vtTemp = new Vector(); for (Enumeration e = view.getPositions(); e.hasMoreElements(); ) { vtTemp.addElement((NodePosition) e.nextElement()); } for (int i = 0; i < vtTemp.size(); i++) { int yPos1 = ((NodePosition) vtTemp.elementAt(i)).getYPos(); for (int j = i + 1; j < vtTemp.size(); j++) { int yPos2 = ((NodePosition) vtTemp.elementAt(j)).getYPos(); if (yPos1 > yPos2) { Object o = vtTemp.elementAt(i); vtTemp.setElementAt(vtTemp.elementAt(j), i); vtTemp.setElementAt(o, j); yPos1 = ((NodePosition) vtTemp.elementAt(i)).getYPos(); } } } for (int i = 0; i < vtTemp.size(); i++) { ((NodePosition) vtTemp.elementAt(i)).setYPos((i + 1) * 10); } } private void updateNodePos() { for (int i = 0; i < nodeData.size(); i++) { int oldIndex = ((Integer) sorter.getValueAt(i, 0)).intValue(); sorter.setValueAt(new Integer(i), i, 0); if (oldIndex <= nodeData.size()) { NodePosition np = ((NodePosition) nodeData.elementAt(oldIndex)); if (np != null) { try { view.setNodePosition(np.getNode().getId(), new Point(np.getXPos(), (i + 1) * 10)); np.setYPos((i + 1) * 10); } catch (Exception ex) { log.error("Error...", ex); log.info("Error: Unable to update position " + ex.getMessage()); // $NON-NLS-1$ } } } } } public void constructTableData() { Vector vtTemp = new Vector(); nodeData.removeAllElements(); for (Enumeration e = view.getPositions(); e.hasMoreElements(); ) { NodePosition nodePos = (NodePosition) e.nextElement(); vtTemp.addElement(nodePos); nodeData.addElement(nodePos); } for (Enumeration e = vtTemp.elements(); e.hasMoreElements(); ) { NodePosition nodePos = (NodePosition) e.nextElement(); NodeSummary node = nodePos.getNode(); int index = nodePos.getYPos() / 10; index--; if (index < nodeData.size()) { nodeData.removeElementAt(index); nodeData.insertElementAt(nodePos, index); } } } public void refreshTable() { updateNodePos(); constructTableData(); sorter.reallocateIndexes(); } public int getColumnCount() { return columnNames.length; } public int getRowCount() { return nodeData.size(); } public String getColumnName(int col) { return columnNames[col]; } public Object getValueAt(int row, int col) { if (nodeData == null) { return null; } if (row >= nodeData.size()) { return null; } NodePosition np = (NodePosition) nodeData.elementAt(row); if (np != null) { NodeSummary node = np.getNode(); if (node != null) { switch (col) { case ListTableModel.NUMBER_COLUMN: { return new Integer(row); } case ListTableModel.IMAGE_COLUMN: { if (node.getType() == ICoreConstants.REFERENCE) { return UINode.getReferenceImageSmall(node.getSource()); } else { return UINode.getNodeImageSmall(node.getType()); } } case ListTableModel.TAGS_COLUMN: { if (node.getCodeCount() > 0) { return "T"; //$NON-NLS-1$ } else { return ""; //$NON-NLS-1$ } } case ListTableModel.VIEWS_COLUMN: { int count = node.getViewCount(); if (count == 0) { node.updateMultipleViews(); count = node.getViewCount(); } return new Integer(count); } case ListTableModel.DETAIL_COLUMN: { String sDetail = node.getDetail(); sDetail = sDetail.trim(); if (!sDetail.equals("") && !sDetail.equals(ICoreConstants.NODETAIL_STRING)) { // $NON-NLS-1$ return "*"; //$NON-NLS-1$ } else { return ""; //$NON-NLS-1$ } } case ListTableModel.WEIGHT_COLUMN: { if (node instanceof View) { View view = (View) node; int count = 0; try { count = view.getNodeCount(); } catch (Exception e) { } return new Integer(count); } return null; } case ListTableModel.LABEL_COLUMN: { return node.getLabel(); } case ListTableModel.CREATION_DATE_COLUMN: { return node.getCreationDate(); } case ListTableModel.MODIFICATION_DATE_COLUMN: { return node.getModificationDate(); } case ListTableModel.ID_COLUMN: { return node.getId(); } case ListTableModel.AUTHOR_COLUMN: { return node.getAuthor(); } default: return null; } } } return null; } public void setValueAt(Object o, int row, int col) { String sAuthor = ProjectCompendium.APP.getModel().getUserProfile().getUserName(); NodePosition np = (NodePosition) nodeData.elementAt(row); NodeSummary node = np.getNode(); switch (col) { case ListTableModel.NUMBER_COLUMN: { if (o instanceof Integer) np.setYPos((((Integer) o).intValue() + 1) * 10); break; } case ListTableModel.LABEL_COLUMN: { String oldLabel = node.getLabel(); String newLabel = (String) o; if (!oldLabel.equals(newLabel)) { try { node.setLabel(newLabel, sAuthor); } catch (Exception ex) { ProjectCompendium.APP.displayError( "Error: (ListTableModel.setValueAt)\n\n" + //$NON-NLS-1$ LanguageProperties.getString( LanguageProperties.UI_GENERAL_BUNDLE, "ListTableModel.errorLabel") + //$NON-NLS-1$ ": " + oldLabel + "\n\n" + ex.getMessage()); // $NON-NLS-1$ //$NON-NLS-2$ } } break; } } } public Class getColumnClass(int c) { switch (c) { case ListTableModel.IMAGE_COLUMN: { return new ImageIcon().getClass(); } case ListTableModel.TAGS_COLUMN: case ListTableModel.DETAIL_COLUMN: case ListTableModel.LABEL_COLUMN: case ListTableModel.ID_COLUMN: case ListTableModel.AUTHOR_COLUMN: { return new String().getClass(); } case ListTableModel.VIEWS_COLUMN: case ListTableModel.NUMBER_COLUMN: case ListTableModel.WEIGHT_COLUMN: { return new Integer(0).getClass(); } case ListTableModel.CREATION_DATE_COLUMN: case ListTableModel.MODIFICATION_DATE_COLUMN: { return new Date().getClass(); } } return null; } public boolean isCellEditable(int rowIndex, int columnIndex) { if (columnIndex == ListTableModel.LABEL_COLUMN) { return true; } else { return false; } } public NodePosition getNodePosition(int index) { return (NodePosition) nodeData.elementAt(index); } public void deleteRows(int[] rowIndexes) { Vector tempData = new Vector(nodeData.size()); for (int j = 0; j < nodeData.size(); j++) { tempData.addElement(nodeData.elementAt(j)); } if (rowIndexes.length <= nodeData.size()) { for (int i = 0; i < rowIndexes.length; i++) { int next = rowIndexes[i]; NodePosition np = (NodePosition) tempData.elementAt(next); nodeData.remove(np); } } tempData.removeAllElements(); tempData = null; sorter.reallocateIndexes(); sorter.fireTableChanged(new TableModelEvent(this)); } public void insertNodes(NodePosition[] nps, int index) { if (index > nodeData.size()) index = nodeData.size(); for (int i = 0; i < nps.length; i++) { if (nps[i] != null) { if (index > nodeData.size()) { nodeData.addElement(nps[i]); } else { nodeData.insertElementAt(nps[i], index + i); } } } sorter.reallocateIndexes(); sorter.fireTableChanged(new TableModelEvent(this)); } public void insertNode(NodePosition np, int index) { if (np != null) { if (index > nodeData.size()) { nodeData.addElement(np); } else { nodeData.insertElementAt(np, index); } sorter.reallocateIndexes(); sorter.fireTableChanged(new TableModelEvent(this)); } } public boolean contains(NodePosition np) { return nodeData.contains(np); } }
/** * Used by <code>getUndoPresentationName</code> and <code>getRedoPresentationName</code> to * construct the strings they return. * * @return the presentation name for this edit. */ public String getPresentationName() { return LanguageProperties.getString(LanguageProperties.EDITS_BUNDLE, "ArrangeEdit.arrange"); } //$NON-NLS-1$
/** Create the menus holding the currently available template sets. */ private void processTemplateFolder(File[] templates, JMenu mnuNext) { Vector vtTemplates = new Vector(templates.length); for (int i = 0; i < templates.length; i++) { vtTemplates.add(templates[i]); } vtTemplates = CoreUtilities.sortList(vtTemplates); int count = vtTemplates.size(); for (int i = 0; i < count; i++) { final File nextFile = (File) vtTemplates.elementAt(i); String sName = nextFile.getName(); sName = sName.replace("_", " "); if (nextFile.isDirectory()) { File subs[] = nextFile.listFiles(); if (subs.length > 0) { JMenu mnuSubMenu = null; if (subs.length > 20) { mnuSubMenu = new UIScrollableMenu(sName, 0, 20); } else { mnuSubMenu = new JMenu(sName); } mnuNext.add(mnuSubMenu); processTemplateFolder(subs, mnuSubMenu); } } else { if ((sName.toLowerCase()).endsWith(".xml")) { // $NON-NLS-1$ String sShortName = sName.substring(0, sName.length() - 4); sShortName = sShortName.replace("_", " "); JMenuItem item = new JMenuItem(sShortName); ActionListener oAction = new ActionListener() { public void actionPerformed(ActionEvent evt) { ProjectCompendium.APP.onTemplateImport(nextFile.getAbsolutePath()); } }; item.addActionListener(oAction); mnuNext.add(item); } else if ((sName.toLowerCase()).endsWith(".html")) { // $NON-NLS-1$ String sShortName = sName.substring(0, sName.length() - 5); sShortName = sShortName.replace("_", " "); ImageIcon icon = UIImages.createImageIcon(UIImages.sPATH + "template-help.png"); JMenuItem item = new JMenuItem(sShortName, icon); item.setToolTipText( LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.templatehelp")); ActionListener oAction = new ActionListener() { public void actionPerformed(ActionEvent evt) { ExecuteControl.launch(nextFile.getAbsolutePath()); } }; // item.addActionListener(oAction); if (sShortName.equals(mnuNext.getText())) { try { mnuNext.insert(item, 0); } catch (Exception e) { log.info("Exception:" + e.getLocalizedMessage()); } } else { mnuNext.add(item); } } } } }
/** * Create and return the Tools menu. * * @return JMenu the Tools menu. */ private JMenu createMenuItems(boolean bSimple) { miUsers = new JMenuItem( LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.userManager")); // $NON-NLS-1$ miUsers.setMnemonic( (LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.userManagerMnemonic")) .charAt(0)); // $NON-NLS-1$ miUsers.addActionListener(this); mnuMainMenu.add(miUsers); miLinkedFilesFileBrowser = new JMenuItem( LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.linkedFilesBrowser")); // $NON-NLS-1$ miLinkedFilesFileBrowser.setMnemonic( (LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.linkedFilesBrowserMnemonic")) .charAt(0)); // $NON-NLS-1$ miLinkedFilesFileBrowser.addActionListener(this); mnuMainMenu.add(miLinkedFilesFileBrowser); // miCodes = new JMenuItem(LanguageProperties.getString(LanguageProperties.MENUS_BUNDLE, // "UIMenuTools.tags")); //$NON-NLS-1$ // miCodes.setMnemonic((LanguageProperties.getString(LanguageProperties.MENUS_BUNDLE, // "UIMenuTools.tagsMnemonic")).charAt(0)); //$NON-NLS-1$ // miCodes.addActionListener(this); // mnuMainMenu.add(miCodes); mnuMainMenu.addSeparator(); mnuTemplates = new JTemplateMenu(); mnuTemplates.setText( LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.templates")); // $NON-NLS-1$ mnuTemplates.setMnemonic( (LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.templatesMnemonic")) .charAt(0)); // $NON-NLS-1$ mnuMainMenu.add(mnuTemplates); separator1 = new JPopupMenu.Separator(); mnuMainMenu.add(separator1); mnuMemetic = new JMenu( LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.memetic")); // $NON-NLS-1$ CSH.setHelpIDString(mnuMemetic, "menus.memetic"); // $NON-NLS-1$ mnuMemetic.setMnemonic( (LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.memeticMnemonic")) .charAt(0)); // $NON-NLS-1$ mnuMainMenu.add(mnuMemetic); // miMeetingSetup = new JMenuItem("Access Grid Meeting Setup"); // miMeetingSetup.setMnemonic(KeyEvent.VK_P); // miMeetingSetup.addActionListener(this); // mnuMemetic.add(miMeetingSetup); miMeetingRecording = new JMenuItem( LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.memeticManualStop")); // $NON-NLS-1$ miMeetingRecording.setToolTipText( LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.memeticManualStopTip")); // $NON-NLS-1$ miMeetingRecording.setMnemonic( (LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.memeticManualStopMnemonic")) .charAt(0)); // $NON-NLS-1$ miMeetingRecording.addActionListener(this); mnuMemetic.add(miMeetingRecording); // miMeetingReplay = new JMenuItem("Replay Access Grid Meeting"); // miMeetingReplay.setMnemonic(KeyEvent.VK_P); // miMeetingReplay.addActionListener(this); // mnuMemetic.add(miMeetingReplay); miMeetingUpload = new JMenuItem( LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.memeticManualUpload")); // $NON-NLS-1$ miMeetingUpload.setToolTipText( LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.memeticManualUploadTip")); // $NON-NLS-1$ miMeetingUpload.setMnemonic( (LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.memeticManualUploadMnemonic")) .charAt(0)); // $NON-NLS-1$ miMeetingUpload.addActionListener(this); CSH.setHelpIDString(miMeetingUpload, "menus.memetic"); // $NON-NLS-1$ mnuMemetic.add(miMeetingUpload); separator2 = new JPopupMenu.Separator(); mnuMainMenu.add(separator2); /* miStartScreenCapture = new JMenuItem("Start Screen Capture"); miStartScreenCapture.setMnemonic(KeyEvent.VK_N); miStartScreenCapture.addActionListener(this); mnuMainMenu.add(miStartScreenCapture); miStopScreenCapture = new JMenuItem("Stop Screen Capture"); miStopScreenCapture.setMnemonic(KeyEvent.VK_P); miStopScreenCapture.addActionListener(this); mnuMainMenu.add(miStopScreenCapture); mnuMainMenu.addSeparator(); */ // STENCILS miStencilManagement = new JMenuItem( LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.stencilsManage")); // $NON-NLS-1$ miStencilManagement.setMnemonic( (LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.stencilsManageMnemonic")) .charAt(0)); // $NON-NLS-1$ miStencilManagement.addActionListener(this); mnuMainMenu.add(miStencilManagement); mnuStencils = new JMenu( LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.stencilsOpen")); // $NON-NLS-1$ mnuStencils.setMnemonic( (LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.stencilsOpenMnemonic")) .charAt(0)); // $NON-NLS-1$ mnuMainMenu.add(mnuStencils); createStencilMenu(); mnuMainMenu.addSeparator(); miLinkGroupManagement = new JMenuItem( LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.linkGroupsManage")); // $NON-NLS-1$ miLinkGroupManagement.setMnemonic( (LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.linkGroupsManageMnemonic")) .charAt(0)); // $NON-NLS-1$ miLinkGroupManagement.addActionListener(this); mnuMainMenu.add(miLinkGroupManagement); miLinkGroupDefault = new JMenuItem( LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.linkGroupsDefault")); // $NON-NLS-1$ miLinkGroupDefault.setMnemonic( (LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.linkGroupsDefaultMnemonic")) .charAt(0)); // $NON-NLS-1$ miLinkGroupDefault.addActionListener(this); mnuMainMenu.add(miLinkGroupDefault); mnuMainMenu.addSeparator(); mnuScribble = new JMenu( LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.scribblePad")); // $NON-NLS-1$ mnuScribble.setMnemonic( (LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.scribblePadMnemonic")) .charAt(0)); // $NON-NLS-1$ mnuMainMenu.add(mnuScribble); miShowScribblePad = new JMenuItem( LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.scribblePadActivate")); // $NON-NLS-1$ miShowScribblePad.setMnemonic( (LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.scribblePadActivateMnemonic")) .charAt(0)); // $NON-NLS-1$ miShowScribblePad.setEnabled(false); miShowScribblePad.addActionListener(this); mnuScribble.add(miShowScribblePad); miHideScribblePad = new JMenuItem( LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.scribblePadDeactivate")); //$NON-NLS-1$ miHideScribblePad.setMnemonic( (LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.scribblePadDeactivateMnemonic")) .charAt(0)); // $NON-NLS-1$ miHideScribblePad.setEnabled(false); miHideScribblePad.addActionListener(this); mnuScribble.add(miHideScribblePad); miSaveScribblePad = new JMenuItem( LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.scribblePadSave")); // $NON-NLS-1$ miSaveScribblePad.setEnabled(false); miSaveScribblePad.setMnemonic( (LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.scribblePadSaveMnemonic")) .charAt(0)); // $NON-NLS-1$ miSaveScribblePad.addActionListener(this); mnuScribble.add(miSaveScribblePad); miClearScribblePad = new JMenuItem( LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.scribblePadClear")); // $NON-NLS-1$ miClearScribblePad.setMnemonic( (LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.scribblePadClearMnemonic")) .charAt(0)); // $NON-NLS-1$ miClearScribblePad.setEnabled(false); miClearScribblePad.addActionListener(this); mnuScribble.add(miClearScribblePad); mnuMainMenu.addSeparator(); /*if (!bSimpleInterface) { //miLimboNode = new JMenuItem("Show Lost Nodes..."); //miLimboNode.setMnemonic(KeyEvent.VK_I); //miLimboNode.addActionListener(this); //mnuMainMenu.add(miLimboNode); }*/ // mnuMainMenu.addSeparator(); // miShowCodes = new JMenuItem("Show Tags"); // miShowCodes.setMnemonic(KeyEvent.VK_W); // miShowCodes.addActionListener(this); // mnuMainMenu.add(miShowCodes); // miHideCodes = new JMenuItem("Hide Tags"); // miHideCodes.setMnemonic(KeyEvent.VK_H); // miHideCodes.addActionListener(this); // mnuMainMenu.add(miHideCodes); // miRefreshCache = new JMenuItem("Refresh Data"); // miRefreshCache.setMnemonic(KeyEvent.VK_U); // miRefreshCache.addActionListener(this); // mnuMainMenu.add(miRefreshCache); // mnuMainMenu.addSeparator(); if (ProjectCompendium.isMac) miProjectOptions = new JMenuItem( LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.projectOptionsMac")); // $NON-NLS-1$ else miProjectOptions = new JMenuItem( LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.projectOptions")); // $NON-NLS-1$ miProjectOptions.setMnemonic( (LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.projectOptionsMnemonic")) .charAt(0)); // $NON-NLS-1$ miProjectOptions.addActionListener(this); mnuMainMenu.add(miProjectOptions); if (ProjectCompendium.isMac) miOptions = new JMenuItem( LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.userOptionsMac")); // $NON-NLS-1$ else miOptions = new JMenuItem( LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.userOptions")); // $NON-NLS-1$ miOptions.setMnemonic( (LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.userOptionsMnemonic")) .charAt(0)); // $NON-NLS-1$ miOptions.addActionListener(this); mnuMainMenu.add(miOptions); mnuMainMenu.addSeparator(); miFocusFrames = new JMenuItem( LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.focusFrame")); // $NON-NLS-1$ miFocusFrames.setToolTipText( LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.focusFrameTip")); // $NON-NLS-1$ miFocusFrames.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F11, shortcutKey)); miFocusFrames.setMnemonic( (LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.focusFrameMnemonic")) .charAt(0)); // $NON-NLS-1$ miFocusFrames.addActionListener(this); mnuMainMenu.add(miFocusFrames); miFocusTabs = new JMenuItem( LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.focusLeftTabs")); // $NON-NLS-1$ miFocusTabs.setToolTipText( LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.focusLeftTabsTip")); // $NON-NLS-1$ miFocusTabs.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F12, shortcutKey)); miFocusTabs.setMnemonic( (LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.focusLeftTabsMnemonic")) .charAt(0)); // $NON-NLS-1$ miFocusTabs.addActionListener(this); mnuMainMenu.add(miFocusTabs); if (bSimple) { addExtenderButton(); setDisplay(bSimple); } return mnuMainMenu; }
/** * Initializes and draws the dialog. * * @param parent the parent frame for this dialog. * @param sKey the property string associated with this message - used to set FormatProperties * when user ticks box. */ public UIHintDialog(JFrame parent, int nType) { super(parent, true); setTitle("Hint"); this.nType = nType; if (nType == PASTE_HINT) { this.sMessage = LanguageProperties.getString(LanguageProperties.DIALOGS_BUNDLE, "UIHintDialog.pasteHint1") + "\n\n" + LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UIHintDialog.pasteHint2") + "\n\n" + LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UIHintDialog.pasteHint3"); } oContentPane = getContentPane(); oContentPane.setLayout(new BorderLayout()); oDetailsPanel = new JPanel(new BorderLayout()); JPanel imagePanel = new JPanel(); imagePanel.setBorder(new EmptyBorder(10, 10, 10, 0)); oImage = UIImages.getNodeImage(ICoreConstants.POSITION); oImageLabel = new JLabel(oImage); oImageLabel.setVerticalAlignment(SwingConstants.TOP); imagePanel.add(oImageLabel); oDetailsPanel.add(imagePanel, BorderLayout.WEST); oTextArea = new JTextArea(sMessage); oTextArea.setEditable(false); oTextArea.setFont(new Font("Dialog", Font.PLAIN, 12)); // $NON-NLS-1$ oTextArea.setBackground(oDetailsPanel.getBackground()); oTextArea.setColumns(35); oTextArea.setLineWrap(true); oTextArea.setWrapStyleWord(true); oTextArea.setSize(oTextArea.getPreferredSize()); JPanel textPanel = new JPanel(); textPanel.setBorder(new EmptyBorder(10, 10, 20, 10)); textPanel.setBorder(new EmptyBorder(10, 10, 20, 10)); textPanel.add(oTextArea); JPanel oCheckBoxPanel = new JPanel(); cbShowPasteHint = new JCheckBox(); cbShowPasteHint.setText( LanguageProperties.getString(LanguageProperties.DIALOGS_BUNDLE, "UIHintDialog.hideHint")); cbShowPasteHint.setSelected(false); cbShowPasteHint.setHorizontalAlignment(SwingConstants.LEFT); oCheckBoxPanel.add(cbShowPasteHint); oDetailsPanel.add(textPanel, BorderLayout.CENTER); oDetailsPanel.add(oCheckBoxPanel, BorderLayout.SOUTH); oButtonPanel = new UIButtonPanel(); pbClose = new UIButton( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UIHintDialog.closeButton")); // $NON-NLS-1$ pbClose.setMnemonic( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UIHintDialog.closeButtonMnemonic") .charAt(0)); pbClose.addActionListener(this); oButtonPanel.addButton(pbClose); oContentPane.add(oDetailsPanel, BorderLayout.CENTER); oContentPane.add(oButtonPanel, BorderLayout.SOUTH); pack(); setResizable(false); }
/** * Handles most menu action event for this application. * * @param evt the generated action event to be handled. */ public void actionPerformed(ActionEvent evt) { ProjectCompendium.APP.setWaitCursor(); Object source = evt.getSource(); if (source.equals(miStencilManagement)) { UIStencilDialog dlg = new UIStencilDialog(ProjectCompendium.APP, ProjectCompendium.APP.oStencilManager); UIUtilities.centerComponent(dlg, ProjectCompendium.APP); dlg.setVisible(true); } else if (source.equals(miLinkGroupManagement)) { UILinkManagementDialog dlg = new UILinkManagementDialog( ProjectCompendium.APP, ProjectCompendium.APP.oLinkGroupManager); UIUtilities.centerComponent(dlg, ProjectCompendium.APP); dlg.setVisible(true); } else if (source.equals(miLinkGroupDefault)) { ProjectCompendium.APP.oLinkGroupManager.createDefaultLinkGroup(); } else if (source.equals(miLinkGroupManagement)) { ProjectCompendium.APP.oLinkGroupManager.createDefaultLinkGroup(); ProjectCompendium.APP.oLinkGroupManager.refreshTree(); } else if (source.equals(miUsers)) ProjectCompendium.APP.onUsers(); else if (source.equals(miLinkedFilesFileBrowser)) ProjectCompendium.APP.onLinkedFilesBrowser(); else if (source.equals(miMeetingRecording)) { ProjectCompendium.APP.displayError( LanguageProperties.getString( LanguageProperties.MENUS_BUNDLE, "UIMenuTools.memeticMessage1")); // $NON-NLS-1$ } else if (source.equals(miMeetingUpload)) { } else if (source.equals(miCodes)) ProjectCompendium.APP.onCodes(); else if (source.equals(miShowCodes)) ProjectCompendium.APP.onShowCodes(); else if (source.equals(miHideCodes)) ProjectCompendium.APP.onHideCodes(); else if (source.equals(miShowScribblePad)) { ProjectCompendium.APP.onShowScribblePad(); miShowScribblePad.setEnabled(false); miHideScribblePad.setEnabled(true); miSaveScribblePad.setEnabled(true); miClearScribblePad.setEnabled(true); } else if (source.equals(miHideScribblePad)) { ProjectCompendium.APP.onHideScribblePad(); miShowScribblePad.setEnabled(true); miHideScribblePad.setEnabled(false); miSaveScribblePad.setEnabled(false); miClearScribblePad.setEnabled(false); } else if (source.equals(miSaveScribblePad)) ProjectCompendium.APP.onSaveScribblePad(); else if (source.equals(miClearScribblePad)) ProjectCompendium.APP.onClearScribblePad(); else if (source.equals(miProjectOptions)) { UIProjectOptionsDialog dialog = new UIProjectOptionsDialog(ProjectCompendium.APP, ProjectCompendium.APP.getModel()); dialog.setVisible(true); } else if (source.equals(miOptions)) { UIOptionsDialog dialog = new UIOptionsDialog(ProjectCompendium.APP); dialog.setVisible(true); } else if (source.equals(miFocusFrames)) { JDesktopPane pane = ProjectCompendium.APP.getDesktop(); JInternalFrame frame = pane.getSelectedFrame(); if (frame instanceof UIMapViewFrame) { UIMapViewFrame mapframe = (UIMapViewFrame) frame; mapframe.getViewPane().requestFocus(); } else if (frame instanceof UIListViewFrame) { UIListViewFrame listframe = (UIListViewFrame) frame; listframe.getUIList().getList().requestFocus(); } } else if (source.equals(miFocusTabs)) { JTabbedPane oTabbedPane = ProjectCompendium.APP.oTabbedPane; if (oTabbedPane.getTabCount() > 0) { oTabbedPane.requestFocus(); } } ProjectCompendium.APP.setDefaultCursor(); }