@Override protected void writeToConfig() { int maxGiB = myTranscodingCacheMaxGiB.getIntegerValue(1); MyTunesRss.CONFIG.setTranscodingCacheMaxGiB(maxGiB); MyTunesRss.TRANSCODER_CACHE.setMaxSizeBytes((long) maxGiB * 1024L * 1024L * 1024L); maxGiB = myHttpLiveStreamCacheMaxGiB.getIntegerValue(5); MyTunesRss.CONFIG.setHttpLiveStreamCacheMaxGiB(maxGiB); MyTunesRss.HTTP_LIVE_STREAMING_CACHE.setMaxSizeBytes((long) maxGiB * 1024L * 1024L * 1024L); String vlcBinary = myVlcBinary.getStringValue(null); File vlcExecutable = vlcBinary != null ? new File(vlcBinary) : null; if (vlcExecutable != null && vlcExecutable.isDirectory() && SystemUtils.IS_OS_MAC_OSX && "vlc.app".equalsIgnoreCase(vlcExecutable.getName())) { vlcExecutable = new File(vlcExecutable, "Contents/MacOS/VLC"); } MyTunesRss.CONFIG.setVlcExecutable(vlcExecutable); MyTunesRss.CONFIG.setVlcEnabled(myVlcEnabled.booleanValue()); Set<TranscoderConfig> deletedTranscoders = new HashSet<>(); for (TranscoderConfig transcoderConfig : MyTunesRss.CONFIG.getTranscoderConfigs()) { deletedTranscoders.add(transcoderConfig); } for (TranscoderConfig transcoderConfig : myTranscoderConfigs) { deletedTranscoders.remove(transcoderConfig); } for (TranscoderConfig deletedTranscoder : deletedTranscoders) { LOGGER.debug( "Transcoder config \"" + deletedTranscoder.getName() + "\" has been removed, truncating cache."); MyTunesRss.TRANSCODER_CACHE.deleteByPrefix(deletedTranscoder.getCacheFilePrefix()); } MyTunesRss.CONFIG.setTranscoderConfigs(myTranscoderConfigs); MyTunesRss.CONFIG.save(); }
public boolean onBack() { boolean allowed = allowBack.booleanValue(); if (!allowed) { Notification.show("Not allowed, sorry"); layout.addComponent(new Label("Not allowed, sorry")); } return allowed; }
@Override protected void writeToConfig() { MyTunesRss.CONFIG.setWebLoginMessage(myWebLoginMessage.getStringValue(null)); MyTunesRss.CONFIG.setWebWelcomeMessage(myWebWelcomeMessage.getStringValue(null)); MyTunesRss.CONFIG.setServerBrowserActive(myServerBrowserActive.booleanValue()); MyTunesRss.CONFIG.setOpenIdActive(myOpenIdActive.booleanValue()); MyTunesRss.CONFIG.setProxyHost(myProxyHost.getStringValue(null)); MyTunesRss.CONFIG.setProxyPort(myProxyPort.getIntegerValue(-1)); MyTunesRss.CONFIG.setMailHost(myMailHost.getStringValue(null)); MyTunesRss.CONFIG.setMailPort(myMailPort.getIntegerValue(-1)); MyTunesRss.CONFIG.setSmtpProtocol((SmtpProtocol) mySmtpProtocol.getValue()); MyTunesRss.CONFIG.setMailLogin(myMailLogin.getStringValue(null)); MyTunesRss.CONFIG.setMailPassword(myMailPassword.getStringValue(null)); MyTunesRss.CONFIG.setMailSender(myMailSender.getStringValue(null)); MyTunesRss.CONFIG.setHeadless(myHeadless.booleanValue()); String gmBinary = myGraphicsMagickBinary.getStringValue(null); MyTunesRss.CONFIG.setGmExecutable(gmBinary != null ? new File(gmBinary) : null); MyTunesRss.CONFIG.setGmEnabled(myGraphicsMagickEnabled.booleanValue()); MyTunesRss.CONFIG.save(); }
private String getNumberWithLeadingZeroesAsString(Integer number) { StringBuilder sb = new StringBuilder(); String numberString = number.toString(); if (sequenceNumCheckBox.booleanValue()) { Integer numOfZeros = (Integer) leadingZerosSelect.getValue(); int numOfZerosNeeded = numOfZeros - numberString.length(); if (numOfZerosNeeded > 0) { for (int i = 0; i < numOfZerosNeeded; i++) { sb.append("0"); } } } sb.append(number); return sb.toString(); }
@Override protected boolean beforeSave() { boolean valid = VaadinUtils.isValid( myGraphicsMagickForm, myMainWindowForm, myMyTunesRssComForm, myWebInterfaceForm, myProxyForm, mySmtpForm); if (!valid) { ((MainWindow) VaadinUtils.getApplicationWindow(this)).showError("error.formInvalid"); } else { if (MyTunesRss.CONFIG.isHeadless() != myHeadless.booleanValue()) { ((MainWindow) VaadinUtils.getApplicationWindow(this)) .showWarning("miscConfigPanel.warning.headlessChanged"); } } return valid; }
private void performSearch() { String searchTerm = (String) tf.getValue(); if (searchTerm == null || searchTerm.equals("")) { getWindow() .showNotification("Search term cannot be empty!", Notification.TYPE_WARNING_MESSAGE); return; } SearchFilter searchFilter = new SearchFilter(fieldToSearch.getValue(), searchTerm, (String) searchName.getValue()); if (saveSearch.booleanValue()) { if (searchName.getValue() == null || searchName.getValue().equals("")) { getWindow() .showNotification( "Please enter a name for your search!", Notification.TYPE_WARNING_MESSAGE); return; } app.saveSearch(searchFilter); } app.search(searchFilter); }
// Enables / disables UI elements for specifying Cross Name details private void enableSpecifyCrossNameComponents(boolean enabled) { for (AbstractComponent component : otherToggableComponents) { component.setEnabled(enabled); } enableSpecifyLeadingZerosComponents(enabled && sequenceNumCheckBox.booleanValue()); }