/* public String getWindowTitle () { return "What's new in this version - " + Environment.getQuollWriterVersion (); } public String getHeaderTitle () { return this.getWindowTitle (); } public String getHeaderIconType () { return null;//"whatsnew"; } */ public String getFirstHelpText() { return String.format( "Welcome to version <b>%s</b>. This window describes the various changes that have been made since the last version and lets you setup new features. You can also see the <a href='help://version-changes/%s'>full list of changes online</a>.", Environment.getQuollWriterVersion().getVersion(), Environment.getQuollWriterVersion().getVersion().replace('.', '_')); }
public void init() { super.init(); try { Environment.setUserProperty( Constants.WHATS_NEW_VERSION_VIEWED_PROPERTY_NAME, new StringProperty( Constants.WHATS_NEW_VERSION_VIEWED_PROPERTY_NAME, Environment.getQuollWriterVersion().getVersion())); } catch (Exception e) { Environment.logError("Unable to set the whats new version viewed property", e); } }
public WhatsNew(AbstractProjectViewer pv, boolean onlyShowCurrentVersion) throws GeneralException { super(pv); String wn = Environment.getProperty(Constants.WHATS_NEW_VERSION_VIEWED_PROPERTY_NAME); if (wn == null) { wn = "0"; } // Get the current whats new version (i.e. old). Version lastWhatsNewVersion = new Version(wn); boolean betasAllowed = Environment.getUserProperties() .getPropertyAsBoolean(Constants.OPTIN_TO_BETA_VERSIONS_PROPERTY_NAME); try { String whatsNew = Environment.getResourceFileAsString(Constants.WHATS_NEW_FILE); // Load up all the whats new for greater versions. Element root = JDOMUtils.getStringAsElement(whatsNew); java.util.List verEls = JDOMUtils.getChildElements(root, XMLConstants.version, false); // Assume they are in the right order // TODO: Enforce the order and/or sort. for (int i = 0; i < verEls.size(); i++) { Element vEl = (Element) verEls.get(i); String id = JDOMUtils.getAttributeValue(vEl, XMLConstants.id, true); Version v = new Version(id); /* if ((v.isBeta ()) && (!betasAllowed) ) { // Ignore, the user isn't interested in betas. continue; } */ if ((lastWhatsNewVersion.isNewer(v)) || ((onlyShowCurrentVersion) && (v.isSame(Environment.getQuollWriterVersion())))) { String c = WhatsNewComponentProvider.class.getName(); int ind = c.lastIndexOf("."); if (ind > 0) { c = c.substring(0, ind); } WhatsNewComponentProvider compProv = null; String cl = JDOMUtils.getAttributeValue(vEl, XMLConstants.clazz, false); if (!cl.equals("")) { Class clz = null; try { clz = Class.forName(cl); if (WhatsNewComponentProvider.class.isAssignableFrom(clz)) { compProv = (WhatsNewComponentProvider) clz.newInstance(); } } catch (Exception e) { } } // This is a version we are interested in. java.util.List itemEls = JDOMUtils.getChildElements(vEl, WhatsNewItem.XMLConstants.root, true); java.util.List<WhatsNewItem> its = new ArrayList(); for (int j = 0; j < itemEls.size(); j++) { Element itEl = (Element) itemEls.get(j); WhatsNewItem it = new WhatsNewItem(itEl, compProv, pv); if (it.onlyIfCurrentVersion) { if (!Environment.getQuollWriterVersion().isSame(v)) { continue; } } if ((it.description == null) && (it.component == null)) { Environment.logMessage( "Whats new item has no description or component, referenced by: " + JDOMUtils.getPath(itEl)); continue; } its.add(it); } if (its.size() > 0) { this.items.put(v, its); } } } } catch (Exception e) { throw new GeneralException("Unable to init whats new", e); } }