Search in sources :

Example 6 with SWTSkin

use of com.biglybt.ui.swt.skin.SWTSkin in project BiglyBT by BiglySoftware.

the class PlayerInstallWindow method open.

public void open() {
    box = new VuzeMessageBox("", "", null, 0);
    box.setSubTitle(MessageText.getString("dlg.player.install.subtitle"));
    box.addResourceBundle(PlayerInstallWindow.class, SkinPropertiesImpl.PATH_SKIN_DEFS, "skin3_dlg_register");
    box.setIconResource("image.player.dlg.header");
    this.progressText = MessageText.getString("dlg.player.install.description");
    box.setListener(new VuzeMessageBoxListener() {

        @Override
        public void shellReady(Shell shell, SWTSkinObjectContainer soExtra) {
            SWTSkin skin = soExtra.getSkin();
            skin.createSkinObject("dlg.register.install", "dlg.register.install", soExtra);
            SWTSkinObjectContainer soProgressBar = (SWTSkinObjectContainer) skin.getSkinObject("progress-bar");
            if (soProgressBar != null) {
                progressBar = new ProgressBar(soProgressBar.getComposite(), SWT.HORIZONTAL);
                progressBar.setMinimum(0);
                progressBar.setMaximum(100);
                progressBar.setLayoutData(Utils.getFilledFormData());
            }
            soInstallPct = (SWTSkinObjectText) skin.getSkinObject("install-pct");
            soProgressText = (SWTSkinObjectText) skin.getSkinObject("progress-text");
            if (soProgressText != null && progressText != null) {
                soProgressText.setText(progressText);
            }
        }
    });
    box.open(new UserPrompterResultListener() {

        @Override
        public void prompterClosed(int result) {
            installer.setListener(null);
            installer.cancel();
        }
    });
}
Also used : Shell(org.eclipse.swt.widgets.Shell) UserPrompterResultListener(com.biglybt.ui.UserPrompterResultListener) SWTSkinObjectText(com.biglybt.ui.swt.skin.SWTSkinObjectText) SWTSkinObjectContainer(com.biglybt.ui.swt.skin.SWTSkinObjectContainer) VuzeMessageBoxListener(com.biglybt.ui.swt.views.skin.VuzeMessageBoxListener) VuzeMessageBox(com.biglybt.ui.swt.views.skin.VuzeMessageBox) SWTSkin(com.biglybt.ui.swt.skin.SWTSkin) ProgressBar(org.eclipse.swt.widgets.ProgressBar)

Example 7 with SWTSkin

use of com.biglybt.ui.swt.skin.SWTSkin in project BiglyBT by BiglySoftware.

the class DeviceTemplateChooser method createDeviceTemplateList2.

private void createDeviceTemplateList2(SWTSkinObjectContainer soList) {
    DeviceTemplate[] devices = mf.getDeviceTemplates();
    if (devices.length == 0) {
        noDevices();
        return;
    }
    Arrays.sort(devices, new Comparator<DeviceTemplate>() {

        @Override
        public int compare(DeviceTemplate o1, DeviceTemplate o2) {
            return o1.getName().compareToIgnoreCase(o2.getName());
        }
    });
    Composite parent = soList.getComposite();
    if (parent.getChildren().length > 0) {
        Utils.disposeComposite(parent, false);
    }
    SWTSkin skin = skinnedDialog.getSkin();
    RowLayout layout = new RowLayout(SWT.HORIZONTAL);
    layout.spacing = 0;
    layout.marginLeft = layout.marginRight = 0;
    layout.wrap = true;
    layout.justify = true;
    layout.fill = true;
    parent.setLayout(layout);
    Listener clickListener = new Listener() {

        boolean down = false;

        @Override
        public void handleEvent(Event event) {
            if (event.type == SWT.MouseDown) {
                down = true;
            } else if (event.type == SWT.MouseUp && down) {
                Widget widget = (event.widget instanceof Label) ? ((Label) event.widget).getParent() : event.widget;
                selectedDeviceTemplate = (DeviceTemplate) widget.getData("obj");
                if (selectedDeviceTemplate == null) {
                    Debug.out("selectedDeviceTemplate is null!");
                }
                skinnedDialog.close();
                down = false;
            }
        }
    };
    for (DeviceTemplate deviceTemplate : devices) {
        if (deviceTemplate.isAuto()) {
            continue;
        }
        // deviceTemplate.getIconURL();
        String iconURL = null;
        TranscodeChooser.addImageBox(parent, clickListener, null, deviceTemplate, iconURL, deviceTemplate.getName());
    }
    SWTSkinObjectText soTitle = (SWTSkinObjectText) skin.getSkinObject("title");
    if (soTitle != null) {
        soTitle.setTextID("devices.choose.device.title");
    }
    SWTSkinObjectText soSubTitle = (SWTSkinObjectText) skin.getSkinObject("subtitle");
    if (soSubTitle != null) {
        soSubTitle.setTextID("label.clickone");
    }
    Shell shell = skinnedDialog.getShell();
    Point computeSize = shell.computeSize(shell.getSize().x, SWT.DEFAULT, true);
    shell.setSize(computeSize);
    UIFunctionsSWT uiFunctionsSWT = UIFunctionsManagerSWT.getUIFunctionsSWT();
    if (uiFunctionsSWT != null) {
        Shell mainShell = uiFunctionsSWT.getMainShell();
        Utils.centerWindowRelativeTo(shell, mainShell);
    }
}
Also used : SkinnedDialogClosedListener(com.biglybt.ui.swt.views.skin.SkinnedDialog.SkinnedDialogClosedListener) SWTSkinObjectText(com.biglybt.ui.swt.skin.SWTSkinObjectText) UIFunctionsSWT(com.biglybt.ui.swt.UIFunctionsSWT) Point(org.eclipse.swt.graphics.Point) SWTSkin(com.biglybt.ui.swt.skin.SWTSkin) MessageBoxShell(com.biglybt.ui.swt.shells.MessageBoxShell) DeviceTemplate(com.biglybt.core.devices.DeviceTemplate) RowLayout(org.eclipse.swt.layout.RowLayout)

Example 8 with SWTSkin

use of com.biglybt.ui.swt.skin.SWTSkin in project BiglyBT by BiglySoftware.

the class ManufacturerChooser method open.

public void open(ClosedListener l) {
    this.listener = l;
    skinnedDialog = new SkinnedDialog("skin3_dlg_deviceadd_mfchooser", "shell", SWT.TITLE | SWT.BORDER);
    skinnedDialog.addCloseListener(new SkinnedDialogClosedListener() {

        @Override
        public void skinDialogClosed(SkinnedDialog dialog) {
            if (listener != null) {
                listener.MfChooserClosed(chosenMF);
            }
        }
    });
    SWTSkin skin = skinnedDialog.getSkin();
    SWTSkinObject so = skin.getSkinObject("list");
    if (so instanceof SWTSkinObjectContainer) {
        SWTSkinObjectContainer soList = (SWTSkinObjectContainer) so;
        Composite parent = soList.getComposite();
        Canvas centerCanvas = new Canvas(parent, SWT.NONE);
        FormData fd = Utils.getFilledFormData();
        fd.bottom = null;
        fd.height = 0;
        centerCanvas.setLayoutData(fd);
        Composite area = new Composite(parent, SWT.NONE);
        RowLayout rowLayout = new RowLayout(SWT.VERTICAL);
        rowLayout.fill = true;
        Utils.setLayout(area, rowLayout);
        fd = Utils.getFilledFormData();
        fd.left = new FormAttachment(centerCanvas, 50, SWT.CENTER);
        fd.right = null;
        area.setLayoutData(fd);
        Listener btnListener = new Listener() {

            @Override
            public void handleEvent(Event event) {
                chosenMF = (DeviceManufacturer) event.widget.getData("mf");
                skinnedDialog.close();
            }
        };
        DeviceManager deviceManager = DeviceManagerFactory.getSingleton();
        DeviceManufacturer[] mfs = deviceManager.getDeviceManufacturers(Device.DT_MEDIA_RENDERER);
        for (DeviceManufacturer mf : mfs) {
            DeviceTemplate[] deviceTemplates = mf.getDeviceTemplates();
            boolean hasNonAuto = false;
            for (DeviceTemplate deviceTemplate : deviceTemplates) {
                if (!deviceTemplate.isAuto()) {
                    hasNonAuto = true;
                    break;
                }
            }
            if (!hasNonAuto) {
                continue;
            }
            Button button = new Button(area, SWT.PUSH);
            button.setText(mf.getName());
            button.setData("mf", mf);
            button.addListener(SWT.MouseUp, btnListener);
        }
    }
    skinnedDialog.getShell().pack();
    skinnedDialog.open();
}
Also used : FormData(org.eclipse.swt.layout.FormData) SkinnedDialogClosedListener(com.biglybt.ui.swt.views.skin.SkinnedDialog.SkinnedDialogClosedListener) SWTSkin(com.biglybt.ui.swt.skin.SWTSkin) SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) SWTSkinObjectContainer(com.biglybt.ui.swt.skin.SWTSkinObjectContainer) RowLayout(org.eclipse.swt.layout.RowLayout) DeviceManufacturer(com.biglybt.core.devices.DeviceManager.DeviceManufacturer) SkinnedDialog(com.biglybt.ui.swt.views.skin.SkinnedDialog) SkinnedDialogClosedListener(com.biglybt.ui.swt.views.skin.SkinnedDialog.SkinnedDialogClosedListener) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 9 with SWTSkin

use of com.biglybt.ui.swt.skin.SWTSkin in project BiglyBT by BiglySoftware.

the class SBC_SearchResultsView method showDownloadFTUX.

protected static void showDownloadFTUX(SearchSubsResultBase entry, final UserPrompterResultListener listener) {
    if (entry instanceof SBC_SubscriptionResult) {
        listener.prompterClosed(0);
        return;
    }
    if (RememberedDecisionsManager.getRememberedDecision("searchsubs.dl.ftux") == 1) {
        listener.prompterClosed(0);
        return;
    }
    final VuzeMessageBox box = new VuzeMessageBox(MessageText.getString("searchsubs.dl.ftux.title"), null, new String[] { MessageText.getString("Button.ok"), MessageText.getString("Button.cancel") }, 0);
    box.setSubTitle(MessageText.getString("searchsubs.dl.ftux.heading"));
    final boolean[] check_state = new boolean[] { true };
    box.setListener(new VuzeMessageBoxListener() {

        @Override
        public void shellReady(Shell shell, SWTSkinObjectContainer soExtra) {
            SWTSkin skin = soExtra.getSkin();
            addResourceBundle(skin, "com/biglybt/ui/swt/columns/searchsubs/", "skin3_dl_ftux");
            String id = "searchsubs.dlftux.shell";
            skin.createSkinObject(id, id, soExtra);
            final SWTSkinObjectCheckbox cb = (SWTSkinObjectCheckbox) skin.getSkinObject("agree-checkbox");
            cb.setChecked(true);
            cb.addSelectionListener(new SWTSkinCheckboxListener() {

                @Override
                public void checkboxChanged(SWTSkinObjectCheckbox so, boolean checked) {
                    check_state[0] = checked;
                }
            });
        }
    });
    box.open(new UserPrompterResultListener() {

        @Override
        public void prompterClosed(int result) {
            if (result == 0 && check_state[0]) {
                RememberedDecisionsManager.setRemembered("searchsubs.dl.ftux", 1);
            }
            listener.prompterClosed(result);
        }
    });
}
Also used : SWTSkinCheckboxListener(com.biglybt.ui.swt.skin.SWTSkinCheckboxListener) SWTSkinObjectCheckbox(com.biglybt.ui.swt.skin.SWTSkinObjectCheckbox) SWTSkin(com.biglybt.ui.swt.skin.SWTSkin) Shell(org.eclipse.swt.widgets.Shell) UserPrompterResultListener(com.biglybt.ui.UserPrompterResultListener) SWTSkinObjectContainer(com.biglybt.ui.swt.skin.SWTSkinObjectContainer) VuzeMessageBoxListener(com.biglybt.ui.swt.views.skin.VuzeMessageBoxListener) VuzeMessageBox(com.biglybt.ui.swt.views.skin.VuzeMessageBox) SBC_SubscriptionResult(com.biglybt.ui.swt.subscriptions.SBC_SubscriptionResult)

Example 10 with SWTSkin

use of com.biglybt.ui.swt.skin.SWTSkin in project BiglyBT by BiglySoftware.

the class SimplePluginInstallWindow method open.

public void open() {
    box = new VuzeMessageBox("", "", null, 0);
    box.setSubTitle(MessageText.getString(resource_prefix + ".subtitle"));
    box.addResourceBundle(SimplePluginInstallWindow.class, SkinPropertiesImpl.PATH_SKIN_DEFS, "skin3_dlg_register");
    box.setIconResource(resource_prefix + ".image");
    this.progressText = MessageText.getString(resource_prefix + ".description");
    box.setListener(new VuzeMessageBoxListener() {

        @Override
        public void shellReady(Shell shell, SWTSkinObjectContainer soExtra) {
            SWTSkin skin = soExtra.getSkin();
            skin.createSkinObject("dlg.register.install", "dlg.register.install", soExtra);
            SWTSkinObjectContainer soProgressBar = (SWTSkinObjectContainer) skin.getSkinObject("progress-bar");
            if (soProgressBar != null) {
                progressBar = new ProgressBar(soProgressBar.getComposite(), SWT.HORIZONTAL);
                progressBar.setMinimum(0);
                progressBar.setMaximum(100);
                progressBar.setLayoutData(Utils.getFilledFormData());
            }
            soInstallPct = (SWTSkinObjectText) skin.getSkinObject("install-pct");
            soProgressText = (SWTSkinObjectText) skin.getSkinObject("progress-text");
            if (soProgressText != null && progressText != null) {
                soProgressText.setText(progressText);
            }
        }
    });
    box.open(new UserPrompterResultListener() {

        @Override
        public void prompterClosed(int result) {
            installer.setListener(null);
            try {
                installer.cancel();
            } catch (Exception e) {
                Debug.out(e);
            }
        }
    });
}
Also used : Shell(org.eclipse.swt.widgets.Shell) UserPrompterResultListener(com.biglybt.ui.UserPrompterResultListener) SWTSkinObjectText(com.biglybt.ui.swt.skin.SWTSkinObjectText) SWTSkinObjectContainer(com.biglybt.ui.swt.skin.SWTSkinObjectContainer) VuzeMessageBoxListener(com.biglybt.ui.swt.views.skin.VuzeMessageBoxListener) VuzeMessageBox(com.biglybt.ui.swt.views.skin.VuzeMessageBox) SWTSkin(com.biglybt.ui.swt.skin.SWTSkin) ProgressBar(org.eclipse.swt.widgets.ProgressBar)

Aggregations

SWTSkin (com.biglybt.ui.swt.skin.SWTSkin)11 SWTSkinObjectContainer (com.biglybt.ui.swt.skin.SWTSkinObjectContainer)8 UserPrompterResultListener (com.biglybt.ui.UserPrompterResultListener)4 SWTSkinObject (com.biglybt.ui.swt.skin.SWTSkinObject)4 VuzeMessageBox (com.biglybt.ui.swt.views.skin.VuzeMessageBox)4 VuzeMessageBoxListener (com.biglybt.ui.swt.views.skin.VuzeMessageBoxListener)4 MessageBoxShell (com.biglybt.ui.swt.shells.MessageBoxShell)3 SWTSkinObjectText (com.biglybt.ui.swt.skin.SWTSkinObjectText)3 SkinnedDialogClosedListener (com.biglybt.ui.swt.views.skin.SkinnedDialog.SkinnedDialogClosedListener)3 SelectionEvent (org.eclipse.swt.events.SelectionEvent)3 UIFunctionsSWT (com.biglybt.ui.swt.UIFunctionsSWT)2 SkinnedDialog (com.biglybt.ui.swt.views.skin.SkinnedDialog)2 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2 FormData (org.eclipse.swt.layout.FormData)2 RowLayout (org.eclipse.swt.layout.RowLayout)2 Shell (org.eclipse.swt.widgets.Shell)2 Core (com.biglybt.core.Core)1 CoreRunningListener (com.biglybt.core.CoreRunningListener)1 ParameterListener (com.biglybt.core.config.ParameterListener)1 DeviceManufacturer (com.biglybt.core.devices.DeviceManager.DeviceManufacturer)1