QueryBuilder(Main_Frame parent, String path, ArrayList<String> tableNames) { // Constructor Instances. String pathDirectory, localeDirectory; MenuActionListener pluginMenuListener; // Setup the Main panel and the plugin's components. queryBuilderMainPanel = new JPanel(new BorderLayout()); // file & http, locale resource not in jar pathDirectory = path + "/" + "QueryBuilder" + "/"; localeDirectory = "locale/"; imagesDirectory = "images/icons/"; // file & http, locale resource in jar // pathDirectory = path + "/" + "QueryBuilder.jar"; // localeDirectory = "lib/plugins/QueryBuilder/locale/"; // imagesDirectory = "lib/plugins/QueryBuilder/images/icons/"; resourceBundle = new AResourceBundle(pathDirectory, Ajqvue.getDebug()); resourceBundle.setLocaleResource(localeDirectory, "QueryBuilder", Ajqvue.getLocaleString()); tabIcon = resourceBundle.getResourceImage(imagesDirectory + "queryBuilderIcon.png"); // QueryBuilder Pane. queryBuilderPane = new QueryBuilderPane(imagesDirectory, resourceBundle, tableNames); queryBuilderPane.setBorder(BorderFactory.createLoweredBevelBorder()); queryBuilderMainPanel.add(queryBuilderPane, BorderLayout.CENTER); // Setup the MenuBar and ToolBar to be used by the plugin. pluginMenuListener = new MenuActionListener(parent, queryBuilderPane, resourceBundle); menuBar = new QueryBuilder_MenuBar(parent, resourceBundle, pluginMenuListener); toolBar = new QueryBuilder_ToolBar( "QueryBuilder ToolBar", parent, imagesDirectory, resourceBundle, pluginMenuListener); }
protected Mapper_ToolBar( String title, Main_Frame parent, String path, AResourceBundle resourceBundle, MenuActionListener plugin) { super(title); mainFrame = parent; menuListener = plugin; // Constructor Instances String iconsDirectory, resource; ImageIcon openIcon, exitIcon; ImageIcon editPreferencesIcon; ImageIcon csvIcon; ImageIcon sqlQueryBucketIcon; JButton buttonItem; // Setting up icons directory and other instances. buttonItem = null; iconsDirectory = "images/icons/"; // Tool Bar Configuration. setBorder(BorderFactory.createLoweredBevelBorder()); setFloatable(false); // =============== // File Menu openIcon = resourceBundle.getResourceImage(iconsDirectory + "openIcon.png"); resource = resourceBundle.getResourceString("Mapper_ToolBar.menu.Open", "Open"); buttonItem = buttonItem(resource, openIcon, Mapper_MenuBar.ACTION_FILE_OPEN); add(buttonItem); // Exit exitIcon = resourceBundle.getResourceImage(iconsDirectory + "exitIcon.png"); buttonItem = new JButton(exitIcon); buttonItem.setFocusable(false); buttonItem.setMargin(new Insets(0, 0, 0, 0)); buttonItem.setActionCommand(MenuActionCommands.ACTION_EXIT); buttonItem.addActionListener(mainFrame); resource = resourceBundle.getResourceString("Mapper_ToolBar.menu.Exit", "Exit"); buttonItem.setToolTipText(resource); add(buttonItem); addSeparator(); // =============== // Edit Preferences editPreferencesIcon = resourceBundle.getResourceImage(iconsDirectory + "preferencesIcon.png"); resource = resourceBundle.getResourceString( "Mapper_ToolBar.menu.SingleVariablePlots", "Single Variable Plots"); buttonItem = buttonItem( resource, editPreferencesIcon, Mapper_MenuBar.ACTION_EDIT_PREFERENCES_SINGLE_VARIABLE_PLOTS); add(buttonItem); addSeparator(); // =============== // Data Menu csvIcon = resourceBundle.getResourceImage(iconsDirectory + "csvImportIcon.png"); resource = resourceBundle.getResourceString("Mapper_ToolBar.menu.ImportCSVFile", "Import CSV File"); buttonItem = buttonItem(resource, csvIcon, Mapper_MenuBar.ACTION_DATA_IMPORT_CSV); add(buttonItem); addSeparator(); // =============== // Tool Menu // SQL Query Bucket sqlQueryBucketIcon = resourceBundle.getResourceImage(iconsDirectory + "sqlQueryBucketIcon.png"); buttonItem = new JButton(sqlQueryBucketIcon); buttonItem.setFocusable(false); buttonItem.setMargin(new Insets(0, 0, 0, 0)); buttonItem.setActionCommand(MenuActionCommands.ACTION_SQL_QUERY_BUCKET); buttonItem.addActionListener(mainFrame); resource = resourceBundle.getResourceString("Mapper_ToolBar.menu.SQLQueryBucket", "SQL Query Bucket"); buttonItem.setToolTipText(resource); add(buttonItem); }