### Install Dependencies Source: https://github.com/greendelta/olca-app/blob/master/olca-app-html/README.md Navigate to the olca-app-html folder and install required Node.js modules using npm. ```bash cd olca-app-html npm install ``` -------------------------------- ### Install Node.js Modules Source: https://github.com/greendelta/olca-app/blob/master/README.md Installs the necessary Node.js modules for building the HTML pages of the user interface using npm. ```bash npm install ``` -------------------------------- ### Runtime Configurations Source: https://github.com/greendelta/olca-app/blob/master/olca-app/README.md Defines the configurations for runtime plugins, including auto-start and start levels. ```xml ``` -------------------------------- ### Package Release Module Source: https://github.com/greendelta/olca-app/blob/master/olca-app-build/README.md Execute the packaging module to create the release package. Optional flags can be used to create a Windows installer or package the MKL native library. ```bash cd olca-app-build python -m package ``` -------------------------------- ### Sign, Validate, and Upload Mac App to App Store Source: https://github.com/greendelta/olca-app/blob/master/olca-app-build/README.md Utilize the mac_dist.sh script to sign, validate, and upload the Mac application package to the Apple App Store. This requires specifying both application and installer certificate full names, along with the Apple user ID. ```bash cd olca-app-build ./mac_dist.sh \ --store-id-app \ --store-id-installer \ --user pkg ``` -------------------------------- ### Build Database Templates Source: https://github.com/greendelta/olca-app/blob/master/README.md Navigates to the refdata project and runs the Maven build to create database templates. ```bash cd olca-app/olca-refdata mvn package ``` -------------------------------- ### Create Development Directory Source: https://github.com/greendelta/olca-app/blob/master/README.md Creates a new directory for development and navigates into it. Ensure the path does not contain whitespaces. ```bash mkdir olca cd olca ``` -------------------------------- ### Prepare Release Script Source: https://github.com/greendelta/olca-app/blob/master/olca-app-build/README.md Run the prepare-release.py script to update olca-modules, create database templates, update HTML pages, and generate Jython bindings. ```bash cd olca-app python prepare-release.py ``` -------------------------------- ### Using Message Keys for Dialogs Source: https://github.com/greendelta/olca-app/blob/master/olca-app/src/org/openlca/app/README.MD Demonstrates how to use message keys from `org.openlca.app.M` and corresponding descriptive strings for dialog prompts. This approach ensures that dialogs can be easily translated. ```java var a = Question.ask(M.DeleteLibraryQ, M.DeleteLibraryQuestion); ``` -------------------------------- ### Build Distribution Package Source: https://github.com/greendelta/olca-app/blob/master/olca-app-html/README.md Invoke the build process using npm to create the distribution package in the 'dist' folder. ```bash npm run build ``` -------------------------------- ### Generate Windows .ico Icon Source: https://github.com/greendelta/olca-app/blob/master/olca-app/icons/logo/README.md Combine multiple BMP icon files into a single Windows .ico file using the 'convert' command. Ensure all specified BMP files are prepared according to the preceding steps. ```bash convert 16_8bit.bmp 16_32bit.bmp 32_8bit.bmp 32_32bit.bmp 48_8bit.bmp 48_32bit.bmp 256_32bit.bmp logo.ico ``` -------------------------------- ### Sign, Notarize, and Staple Mac App Source: https://github.com/greendelta/olca-app/blob/master/olca-app-build/README.md Use the mac_dist.sh script to sign, notarize, and staple the Mac application bundle for independent distribution. Ensure the correct certificate full name is provided. ```bash cd olca-app-build ./mac_dist.sh --dev-id-app dmg ``` -------------------------------- ### Development Build with Watch Mode Source: https://github.com/greendelta/olca-app/blob/master/olca-app-html/README.md Run webpack in watch mode for development, which also generates source maps for debugging. ```bash npm run dev ``` -------------------------------- ### Handling Parameters in Strings Source: https://github.com/greendelta/olca-app/blob/master/olca-app/src/org/openlca/app/README.MD Illustrates preferred methods for incorporating dynamic values into translatable strings, avoiding colons and favoring hyphens or parentheses for better cross-language compatibility. ```java M.OpenInEditor + " - " + name ``` ```java M.UpstreamTotal + " (" + percentage + "%)" ``` -------------------------------- ### Package Maven Modules Source: https://github.com/greendelta/olca-app/blob/master/README.md Packages the Maven modules, copying core modules and dependencies to the 'libs' folder. ```bash mvn package ``` -------------------------------- ### Clone openLCA Application Source Source: https://github.com/greendelta/olca-app/blob/master/README.md Clones the openLCA application source code from the GitHub repository using Git. ```bash git clone https://github.com/GreenDelta/olca-app.git ``` -------------------------------- ### Handle Exception Method Source: https://github.com/greendelta/olca-app/blob/master/olca-app/src/org/openlca/app/README.MD This method is part of the org.openlca.app.collaboration.navigation.actions package. It is used for managing and processing exceptions that occur within the application's collaboration features. ```java org.openlca.app.collaboration.navigation.actions.Actions.handleException ``` -------------------------------- ### JavaScript Event Handler for License Details Source: https://github.com/greendelta/olca-app/blob/master/olca-app-build/credits/about_template.html Attaches click event listeners to elements with 'data-action-id' to toggle the visibility of license details. This is used to show or hide license information when a user interacts with specific UI elements. ```javascript attachHandlers(); function attachHandlers() { const allActionNodes = Array.from( document.querySelectorAll("[data-action-id]") ); allActionNodes.forEach(function (node) { const actionIdx = node.getAttribute("data-action-id"); node.addEventListener("click", function () { const licenceDetailsNode = document.querySelector( `[data-description="licence-content"][data-id="${actionIdx}"]` ); if (!licenceDetailsNode) return; if (node.innerHTML.trim().match("show licence")) { node.innerHTML = "hide licence"; licenceDetailsNode.classList.remove("hide"); } else if (node.innerHTML.trim().match("hide licence")) { node.innerHTML = "show licence"; licenceDetailsNode.classList.add("hide"); } }); }); } ``` -------------------------------- ### Common Methods Using Internationalized Messages Source: https://github.com/greendelta/olca-app/blob/master/olca-app/src/org/openlca/app/README.MD A list of common methods and UI components within the olca-app that are expected to use internationalized strings. This list aids in searching for potential internationalization issues. ```bash org.openlca.app.util.UI.header org.eclipse.swt.widgets.Button.setText org.eclipse.swt.widgets.Group.setText org.openlca.app.util.UI.labeledText org.eclipse.jface.wizard.WizardPage.setErrorMessage org.eclipse.jface.action.IAction.setText org.openlca.app.collaboration.viewers.json.olca.PropertyLabels.put org.openlca.app.editors.ModelPage.multiText org.openlca.app.viewers.trees.Trees.createViewer org.openlca.app.util.UI.formSection org.eclipse.jface.action.Action.setText org.eclipse.jface.viewers.ColumnLabelProvider.getText org.eclipse.core.runtime.IProgressMonitor.subTask org.openlca.app.util.Question.ask org.openlca.app.viewers.tables.AbstractTableViewer.getColumnHeaders org.eclipse.jface.viewers.ITableLabelProvider.getColumnText org.eclipse.jface.viewers.LabelProvider.getText org.eclipse.ui.forms.widgets.Hyperlink.setText org.eclipse.gef.commands.Command.setLabel org.eclipse.jface.viewers.ColumnViewer.setColumnProperties org.eclipse.ui.forms.widgets.FormToolkit.createButton org.eclipse.ui.actions.RetargetAction.RetargetAction org.eclipse.jface.action.Action.setToolTipText org.openlca.app.util.UI.button org.openlca.app.util.DQUI.appendTableHeaders org.openlca.app.editors.ModelPage.text org.openlca.app.results.InfoSection.text org.eclipse.swt.widgets.Label.setText org.eclipse.ui.forms.editor.FormPage.FormPage org.openlca.app.viewers.tables.modify.ModifySupport.bind org.eclipse.draw2d.Label org.eclipse.jface.viewers.ILabelProvider.getText org.openlca.app.util.UI.checkbox org.eclipse.jface.wizard.WizardPage.setTitle org.openlca.app.navigation.elements.Group.of org.openlca.app.navigation.elements.Group.Group org.eclipse.ui.forms.widgets.FormToolkit.createLabel org.openlca.app.util.UI.radio org.eclipse.core.runtime.IProgressMonitor.beginTask org.eclipse.jface.action.MenuManager org.eclipse.swt.widgets.Shell.setText org.openlca.app.App.runWithProgress ``` -------------------------------- ### Generate macOS .icns Icon Source: https://github.com/greendelta/olca-app/blob/master/olca-app/icons/logo/README.md Use this script to generate the .icns file for macOS distributions from a 1024x1024 PNG image. ```bash create_icns.sh logo.png ``` -------------------------------- ### Eclipse RCP Platform Update URL Source: https://github.com/greendelta/olca-app/blob/master/olca-app/README.md The URL for the current Eclipse RCP platform release. ```text https://download.eclipse.org/eclipse/updates/4.21/ ``` -------------------------------- ### Set Module Version with Maven Versions Plugin Source: https://github.com/greendelta/olca-app/blob/master/versioning.md Use the Maven versions plugin to set a new version for the olca-modules. This command updates the version across parent and sub-modules. Ensure you are in the 'olca-modules' directory before running. ```bash cd olca-modules mvn versions:set -DnewVersion=2.0.1-SNAPSHOT -DgenerateBackupPoms=false ``` -------------------------------- ### Eclipse Update Site URL Source: https://github.com/greendelta/olca-app/blob/master/olca-app/README.md The base URL for Eclipse update sites. ```text https://download.eclipse.org/eclipse/updates ``` -------------------------------- ### Eclipse RCP Platform Repository Location Source: https://github.com/greendelta/olca-app/blob/master/olca-app/README.md Specifies the repository location for Eclipse RCP platform components within the platform definition file. ```xml ``` -------------------------------- ### Format openLCA Reference Data CSV Source: https://github.com/greendelta/olca-app/blob/master/olca-refdata/README.md This Python script formats openLCA reference data CSV files to ensure consistent tracking of changes via Git. It handles custom quoting for empty values and converts specific columns to integers if they represent whole numbers. ```Python """ format openLCA reference data CSV files to track changes via git empty values are currently quoted, see http://stackoverflow.com/questions/19315366/csv-writer-in-python-with-custom-quoting for custom quoting """ import csv file = 'locations' num_cols = [4, 5] rows = [] with open(file + '_raw.csv', 'r', encoding='utf8', newline='\n') as f: reader = csv.reader(f, delimiter=';') handled = {} for row in reader: uid = row[0] if uid in handled: print('Duplicate: ' + uid) continue for num_col in num_cols: fval = float(row[num_col]) if abs(fval - int(fval)) < 1e-16: row[num_col] = int(fval) else: row[num_col] = fval handled[uid] = True rows.append(row) rows.sort(key=lambda row: row[0]) with open(file + '.csv', 'w', encoding='utf8', newline='\n') as f: writer = csv.writer(f, delimiter=';', quoting=csv.QUOTE_NONNUMERIC) for row in rows: writer.writerow(row) print('Converted to %s.csv' % file) ``` -------------------------------- ### Data Call Placeholder for Report Export Source: https://github.com/greendelta/olca-app/blob/master/olca-app-html/src/report/report.html This is a placeholder comment indicating where a data call will be inserted when the report is exported. It should not be deleted as it is dynamically replaced. ```javascript // do not delete the line below; it is // replaced with a data call when a // report is exported //{{set_data_call}} ``` -------------------------------- ### JavaScript Error Handling for Browser Support Source: https://github.com/greendelta/olca-app/blob/master/olca-app-html/src/report/report.html This snippet sets up a window.onerror handler to inform users if their browser does not support JavaScript execution required for the report. It appends a message to the body and ensures the message is added only once. ```javascript var errorMessageAdded = false; window.onerror = function () { if (errorMessageAdded) { return; } var p = document.createElement("p"); p.setAttribute("style", "color: #44475a; margin: 20px") p.textContent = "Seems like your system browser does not support the execution" + " of JavaScript that is used in this report. You can export the" + " report with the export button in the toolbar and open it with" + " an alternative browser. On Windows, you can also configure" + " openLCA to use WebView2 with Edge, if this is installed" + " under File > Settings > Configuration."; document.body.appendChild(p); errorMessageAdded = true; }; ``` -------------------------------- ### LCI and Impact Assessment Calculation Source: https://github.com/greendelta/olca-app/blob/master/olca-app/src/org/openlca/app/editors/systems/MatrixExport_README.md Formulas for calculating the Life Cycle Inventory (LCI) result 'g' and the impact assessment result 'h' using the exported matrices. ```text g = B * (A^-1 * f) h = C * g ``` -------------------------------- ### Add Comment to UI Source: https://github.com/greendelta/olca-app/blob/master/olca-app-html/src/comments.html Appends a new comment entry to the document body. It handles adding a separator if multiple comments exist and populates the comment's details from the provided comment object. It also sets CSS classes based on comment status and attaches a click handler to dataset links. ```javascript function add(comment) { if ($('.comment-entry').length > 1) { $('body').append('
'); } var template = $('#comment-entry-template').clone(); template.attr('id', comment.id); $('.username', template).html(comment.user); $('.date', template).html(comment.date); $('.comment-text', template).html(comment.text); if (comment.label) { $('.dataset-info', template).html(" on '" + comment.label + "'"); } if (comment.fullPath) { $('.dataset-link', template).html(comment.fullPath); $('.dataset-icon', template).attr('src', 'images/' + comment.type.toLowerCase() + '.png'); $('.dataset-details', template).removeAttr('style'); } if (comment.released) { template.addClass('released'); } if (comment.approved) { template.addClass('approved'); } if (comment.replyTo) { template.addClass('reply'); } template.removeAttr('style'); $('body').append(template); $('.dataset-link', template).on('click', function (event) { event.preventDefault(); window.openModel(comment.type, comment.refId); }); } ``` -------------------------------- ### Regex for Searching Non-Internationalized Strings Source: https://github.com/greendelta/olca-app/blob/master/olca-app/src/org/openlca/app/README.MD A regular expression pattern designed to identify strings within the codebase that may not be properly internationalized. This regex helps in finding hardcoded strings that should be managed through message keys. ```regexp (?