Пример #1
0
 @Override
 public void buttonClick(Button.ClickEvent clickEvent) {
   if (clickEvent.getButton() == myGraphicsMagickHomepageButton) {
     getWindow().open(new ExternalResource("http://www.graphicsmagick.org"));
   } else if (clickEvent.getButton() == myGraphicsMagickBinarySelect) {
     File dir =
         StringUtils.isNotBlank((CharSequence) myGraphicsMagickBinary.getValue())
             ? new File((String) myGraphicsMagickBinary.getValue())
             : null;
     new ServerSideFileChooserWindow(
         50,
         Sizeable.UNITS_EM,
         null,
         getBundleString("miscConfigPanel.caption.selectGraphicsMagickBinary"),
         dir,
         null,
         ServerSideFileChooser.PATTERN_ALL,
         false,
         getApplication().getServerSideFileChooserLabels()) {
       @Override
       protected void onFileSelected(File file) {
         myGraphicsMagickBinary.setValue(file.getAbsolutePath());
         getWindow().getParent().removeWindow(this);
       }
     }.show(getWindow());
   } else {
     super.buttonClick(clickEvent);
   }
 }
Пример #2
0
 @Override
 public void buttonClick(final Button.ClickEvent clickEvent) {
   if (clickEvent.getButton() == myVlcHomepageButton) {
     getWindow().open(new ExternalResource("http://www.videolan.org"));
   } else if (clickEvent.getButton() == myVlcBinarySelect) {
     File dir =
         StringUtils.isNotBlank((CharSequence) myVlcBinary.getValue())
             ? new File((String) myVlcBinary.getValue())
             : null;
     new ServerSideFileChooserWindow(
         50,
         Sizeable.UNITS_EM,
         null,
         getBundleString("streamingConfigPanel.caption.selectVlcBinary"),
         dir,
         null,
         ServerSideFileChooser.PATTERN_ALL,
         false,
         getApplication().getServerSideFileChooserLabels()) {
       @Override
       protected void onFileSelected(File file) {
         myVlcBinary.setValue(file.getAbsolutePath());
         getWindow().getParent().removeWindow(this);
       }
     }.show(getWindow());
   } else if (clickEvent.getButton() == myAddTranscoder) {
     final TranscoderConfig config = new TranscoderConfig();
     config.setName(
         getBundleString(
             "transcoderConfigPanel.defaultName", myTranscoderNumberGenerator.getAndIncrement()));
     editTranscoderConfig(
         config,
         new Runnable() {
           @Override
           public void run() {
             myTranscoderConfigs.add(config);
           }
         });
   } else if (clickEvent.getButton() == myClearAllCachesButton) {
     boolean success =
         MyTunesRss.TRANSCODER_CACHE.clear()
             & MyTunesRss.HTTP_LIVE_STREAMING_CACHE.clear()
             & MyTunesRss.TEMP_CACHE.clear();
     if (success) {
       ((MainWindow) VaadinUtils.getApplicationWindow(this))
           .showInfo("streamingConfigPanel.clearAllCaches.done");
     } else {
       ((MainWindow) VaadinUtils.getApplicationWindow(this))
           .showWarning("streamingConfigPanel.clearAllCaches.warn");
     }
   } else {
     super.buttonClick(clickEvent);
   }
 }
Пример #3
0
  @Override
  public void attach() {
    super.attach();
    init(
        getBundleString("streamingConfigPanel.caption"),
        getComponentFactory().createGridLayout(1, 5, true, true));
    myVlcEnabled = getComponentFactory().createCheckBox("streamingConfigPanel.vlcEnabled");
    myVlcBinary =
        getComponentFactory()
            .createTextField(
                "streamingConfigPanel.vlcBinary",
                new VlcExecutableFileValidator(
                    getBundleString("streamingConfigPanel.vlcBinary.invalidBinary")));
    myVlcBinary.setImmediate(false);
    myVlcBinarySelect =
        getComponentFactory().createButton("streamingConfigPanel.vlcBinary.select", this);
    myVlcHomepageButton =
        getComponentFactory().createButton("streamingConfigPanel.vlcHomepage", this);
    myVlcForm = getComponentFactory().createForm(null, true);
    myVlcForm.addField(myVlcEnabled, myVlcEnabled);
    myVlcForm.addField(myVlcBinary, myVlcBinary);
    myVlcForm.addField(myVlcBinarySelect, myVlcBinarySelect);
    myVlcForm.addField(myVlcHomepageButton, myVlcHomepageButton);
    Panel vlcPanel =
        getComponentFactory()
            .surroundWithPanel(
                myVlcForm,
                FORM_PANEL_MARGIN_INFO,
                getBundleString("streamingConfigPanel.caption.vlc"));
    addComponent(vlcPanel);
    Panel transcoderPanel = new Panel(getBundleString("streamingConfigPanel.caption.transcoder"));
    transcoderPanel.setContent(getComponentFactory().createVerticalLayout(true, true));
    Panel addTranscoderButtons = new Panel();
    addTranscoderButtons.addStyleName("light");
    addTranscoderButtons.setContent(
        getApplication().getComponentFactory().createHorizontalLayout(false, true));
    myAddTranscoder =
        getComponentFactory().createButton("streamingConfigPanel.transcoder.add", this);
    addTranscoderButtons.addComponent(myAddTranscoder);
    myTranscoderTable = new Table();
    myTranscoderTable.setCacheRate(50);
    myTranscoderTable.addContainerProperty(
        "name",
        String.class,
        null,
        getBundleString("streamingConfigPanel.transcoder.name"),
        null,
        null);
    myTranscoderTable.addContainerProperty("edit", Button.class, null, "", null, null);
    myTranscoderTable.addContainerProperty("delete", Button.class, null, "", null, null);
    myTranscoderTable.setSortContainerPropertyId("name");
    transcoderPanel.addComponent(myTranscoderTable);
    transcoderPanel.addComponent(addTranscoderButtons);
    addComponent(transcoderPanel);
    myCacheForm = getComponentFactory().createForm(null, true);
    myTranscodingCacheMaxGiB =
        getComponentFactory()
            .createTextField(
                "streamingConfigPanel.cache.transcodingCacheMaxGiB",
                getApplication().getValidatorFactory().createMinMaxValidator(1, 1024));
    myCacheForm.addField("limitTranscoding", myTranscodingCacheMaxGiB);
    myHttpLiveStreamCacheMaxGiB =
        getComponentFactory()
            .createTextField(
                "streamingConfigPanel.cache.httpLiveStreamCacheMaxGiB",
                getApplication().getValidatorFactory().createMinMaxValidator(1, 1024));
    myCacheForm.addField("limitHttpLiveStream", myHttpLiveStreamCacheMaxGiB);
    myClearAllCachesButton =
        getComponentFactory().createButton("streamingConfigPanel.clearAllCaches", this);
    myCacheForm.addField(myClearAllCachesButton, myClearAllCachesButton);
    addComponent(
        getComponentFactory()
            .surroundWithPanel(
                myCacheForm,
                FORM_PANEL_MARGIN_INFO,
                getBundleString("streamingConfigPanel.caption.cache")));

    addDefaultComponents(0, 4, 0, 4, false);

    initFromConfig();
  }
Пример #4
0
  @Override
  public void attach() {
    super.attach();
    init(
        getBundleString("miscConfigPanel.caption"),
        getComponentFactory().createGridLayout(1, 6, true, true));
    myMainWindowForm = getComponentFactory().createForm(null, true);
    myMyTunesRssComForm = getComponentFactory().createForm(null, true);
    myWebInterfaceForm = getComponentFactory().createForm(null, true);
    myProxyForm = getComponentFactory().createForm(null, true);
    mySmtpForm = getComponentFactory().createForm(null, true);
    myWebLoginMessage = getComponentFactory().createTextField("miscConfigPanel.webLoginMessage");
    myWebWelcomeMessage =
        getComponentFactory().createTextField("miscConfigPanel.webWelcomeMessage");
    myServerBrowserActive =
        getComponentFactory().createCheckBox("miscConfigPanel.serverBrowserActive");
    myOpenIdActive = getComponentFactory().createCheckBox("miscConfigPanel.openIdActive");
    myProxyHost = getComponentFactory().createTextField("miscConfigPanel.proxyHost");
    myProxyPort =
        getComponentFactory()
            .createTextField(
                "miscConfigPanel.proxyPort",
                getApplication().getValidatorFactory().createPortValidator());
    myMailHost = getComponentFactory().createTextField("miscConfigPanel.mailHost");
    myMailPort =
        getComponentFactory()
            .createTextField(
                "miscConfigPanel.mailPort",
                getApplication().getValidatorFactory().createPortValidator());
    mySmtpProtocol =
        getComponentFactory()
            .createSelect(
                "miscConfigPanel.smtpProtocol",
                Arrays.asList(SmtpProtocol.PLAINTEXT, SmtpProtocol.STARTTLS, SmtpProtocol.SSL));
    myMailLogin = getComponentFactory().createTextField("miscConfigPanel.mailLogin");
    myMailPassword = getComponentFactory().createPasswordTextField("miscConfigPanel.mailPassword");
    myMailSender =
        getComponentFactory()
            .createTextField(
                "miscConfigPanel.mailSender",
                getApplication().getValidatorFactory().createEmailValidator());
    myHeadless = getComponentFactory().createCheckBox("miscConfigPanel.headless");
    myMainWindowForm.addField(myHeadless, myHeadless);
    Panel mainWindowPanel =
        getComponentFactory()
            .surroundWithPanel(
                myMainWindowForm,
                FORM_PANEL_MARGIN_INFO,
                getBundleString("miscConfigPanel.caption.mainWindow"));
    addComponent(mainWindowPanel);
    myProxyForm.addField(myProxyHost, myProxyHost);
    myProxyForm.addField(myProxyPort, myProxyPort);
    Panel proxyPanel =
        getComponentFactory()
            .surroundWithPanel(
                myProxyForm,
                FORM_PANEL_MARGIN_INFO,
                getBundleString("miscConfigPanel.caption.proxy"));
    addComponent(proxyPanel);
    mySmtpForm.addField(myMailHost, myMailHost);
    mySmtpForm.addField(myMailPort, myMailPort);
    mySmtpForm.addField(mySmtpProtocol, mySmtpProtocol);
    mySmtpForm.addField(myMailLogin, myMailLogin);
    mySmtpForm.addField(myMailPassword, myMailPassword);
    mySmtpForm.addField(myMailSender, myMailSender);
    Panel smtpPanel =
        getComponentFactory()
            .surroundWithPanel(
                mySmtpForm,
                FORM_PANEL_MARGIN_INFO,
                getBundleString("miscConfigPanel.caption.smtp"));
    addComponent(smtpPanel);
    myWebInterfaceForm.addField(myWebLoginMessage, myWebLoginMessage);
    myWebInterfaceForm.addField(myWebWelcomeMessage, myWebWelcomeMessage);
    myWebInterfaceForm.addField(myServerBrowserActive, myServerBrowserActive);
    myWebInterfaceForm.addField(myOpenIdActive, myOpenIdActive);
    Panel webInterfacePanel =
        getComponentFactory()
            .surroundWithPanel(
                myWebInterfaceForm,
                FORM_PANEL_MARGIN_INFO,
                getBundleString("miscConfigPanel.caption.webInterface"));
    addComponent(webInterfacePanel);
    myGraphicsMagickEnabled =
        getComponentFactory().createCheckBox("miscConfigPanel.graphicsMagickEnabled");
    myGraphicsMagickBinary =
        getComponentFactory()
            .createTextField(
                "miscConfigPanel.graphicsMagickBinary",
                new GraphicsMagickExecutableFileValidator(
                    getBundleString("miscConfigPanel.graphicsMagickBinary.invalidBinary")));
    myGraphicsMagickBinary.setImmediate(false);
    myGraphicsMagickBinarySelect =
        getComponentFactory().createButton("miscConfigPanel.graphicsMagickBinary.select", this);
    myGraphicsMagickHomepageButton =
        getComponentFactory().createButton("miscConfigPanel.graphicsMagickHomepage", this);
    myGraphicsMagickForm = getComponentFactory().createForm(null, true);
    myGraphicsMagickForm.addField(myGraphicsMagickEnabled, myGraphicsMagickEnabled);
    myGraphicsMagickForm.addField(myGraphicsMagickBinary, myGraphicsMagickBinary);
    myGraphicsMagickForm.addField(myGraphicsMagickBinarySelect, myGraphicsMagickBinarySelect);
    myGraphicsMagickForm.addField(myGraphicsMagickHomepageButton, myGraphicsMagickHomepageButton);
    Panel graphicsMagickPanel =
        getComponentFactory()
            .surroundWithPanel(
                myGraphicsMagickForm,
                FORM_PANEL_MARGIN_INFO,
                getBundleString("miscConfigPanel.caption.GraphicsMagick"));
    addComponent(graphicsMagickPanel);

    addDefaultComponents(0, 5, 0, 5, false);

    initFromConfig();
  }