Search in sources :

Example 51 with SWTSkinObject

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

the class SBC_DiskOpsView method skinObjectShown.

@Override
public Object skinObjectShown(SWTSkinObject skinObject, Object params) {
    super.skinObjectShown(skinObject, params);
    SWTSkinObject soDeviceList = getSkinObject("disk-ops");
    if (soDeviceList != null) {
        initTable((Composite) soDeviceList.getControl());
    }
    core.addOperationListener(this);
    updateSelectedContent();
    return null;
}
Also used : SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject)

Example 52 with SWTSkinObject

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

the class SBC_DevicesView method deviceChanged.

@Override
public void deviceChanged(Device device) {
    String name = device.getName();
    if (!name.equals(device_name)) {
        device_name = name;
        // ensure name is up to date
        SWTSkinObject soTitle = getSkinObject("title");
        if (soTitle instanceof SWTSkinObjectText) {
            ((SWTSkinObjectText) soTitle).setTextID("device.view.heading", new String[] { name });
        }
    }
}
Also used : SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) SWTSkinObjectText(com.biglybt.ui.swt.skin.SWTSkinObjectText)

Example 53 with SWTSkinObject

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

the class SBC_DevicesView method skinObjectInitialShow.

// @see SkinView#skinObjectInitialShow(SWTSkinObject, java.lang.Object)
@Override
public Object skinObjectInitialShow(SWTSkinObject skinObject, Object params) {
    CoreFactory.addCoreRunningListener(new CoreRunningListener() {

        @Override
        public void coreRunning(Core core) {
            initColumns(core);
        }
    });
    device_manager = DeviceManagerFactory.getSingleton();
    transcode_manager = device_manager.getTranscodeManager();
    transcode_queue = transcode_manager.getQueue();
    MultipleDocumentInterfaceSWT mdi = UIFunctionsManagerSWT.getUIFunctionsSWT().getMDISWT();
    if (mdi != null) {
        mdiEntry = mdi.getCurrentEntry();
        Object ds = mdiEntry.getDataSource();
        if (!(ds instanceof Device)) {
            return (null);
        }
        device = (Device) ds;
    }
    if (device instanceof TranscodeTarget) {
        transTarget = (TranscodeTarget) device;
    }
    if (device == null) {
        new InfoBarUtil(skinObject, "devicesview.infobar", false, "DeviceView.infobar", "v3.deviceview.infobar") {

            @Override
            public boolean allowShow() {
                return true;
            }
        };
    } else if (device instanceof DeviceMediaRenderer) {
        DeviceMediaRenderer renderer = (DeviceMediaRenderer) device;
        int species = renderer.getRendererSpecies();
        String speciesID = null;
        switch(species) {
            case DeviceMediaRenderer.RS_ITUNES:
                speciesID = "itunes";
                break;
            case DeviceMediaRenderer.RS_PS3:
                speciesID = "ps3";
                break;
            case DeviceMediaRenderer.RS_XBOX:
                speciesID = "xbox";
                break;
            case DeviceMediaRenderer.RS_OTHER:
                {
                    String classification = renderer.getClassification();
                    if (classification.equals("sony.PSP")) {
                        speciesID = "psp";
                    } else if (classification.startsWith("tivo.")) {
                        speciesID = "tivo";
                    } else if (classification.toLowerCase().contains("android")) {
                        speciesID = "android";
                    }
                }
            default:
                break;
        }
        if (speciesID != null) {
            final String fSpeciesID = speciesID;
            new InfoBarUtil(skinObject, "devicesview.infobar", false, "DeviceView.infobar." + speciesID, "v3.deviceview.infobar") {

                @Override
                public boolean allowShow() {
                    return true;
                }

                // @see InfoBarUtil#created(SWTSkinObject)
                @Override
                protected void created(SWTSkinObject parent) {
                    SWTSkinObjectText soLine1 = (SWTSkinObjectText) skin.getSkinObject("line1", parent);
                    soLine1.setTextID("v3.deviceview.infobar.line1.generic", new String[] { device.getName() });
                    SWTSkinObjectText soLine2 = (SWTSkinObjectText) skin.getSkinObject("line2", parent);
                    soLine2.setTextID("v3.deviceview.infobar.line2." + fSpeciesID);
                }
            };
        }
    }
    SWTSkinObject soAdvInfo = getSkinObject("advinfo");
    if (soAdvInfo != null) {
        initAdvInfo(soAdvInfo);
    }
    if (device != null) {
        device_name = device.getName();
        SWTSkinObject soTitle = getSkinObject("title");
        if (soTitle instanceof SWTSkinObjectText) {
            ((SWTSkinObjectText) soTitle).setTextID("device.view.heading", new String[] { device_name });
        }
    }
    return null;
}
Also used : SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) SWTSkinObjectText(com.biglybt.ui.swt.skin.SWTSkinObjectText) CoreRunningListener(com.biglybt.core.CoreRunningListener) MultipleDocumentInterfaceSWT(com.biglybt.ui.swt.mdi.MultipleDocumentInterfaceSWT) SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) InfoBarUtil(com.biglybt.ui.swt.views.skin.InfoBarUtil) Core(com.biglybt.core.Core)

Example 54 with SWTSkinObject

use of com.biglybt.ui.swt.skin.SWTSkinObject 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;
        area.setLayout(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 55 with SWTSkinObject

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

the class MainMenuV3 method createQuickLinksMenuItem.

public static MenuItem createQuickLinksMenuItem(final SWTSkin skin, Menu viewMenu, final String textID, final String configID, final String viewID) {
    if (!ConfigurationDefaults.getInstance().doesParameterDefaultExist(configID)) {
        COConfigurationManager.setBooleanDefault(configID, true);
    }
    MenuItem item = MenuFactory.addMenuItem(viewMenu, SWT.CHECK, textID, new Listener() {

        @Override
        public void handleEvent(Event event) {
            SWTSkinObject skinObject = skin.getSkinObject(viewID);
            if (skinObject != null) {
                boolean newVisibility = !skinObject.isVisible();
                QuickLinksView.setVisible(newVisibility);
            }
        }
    });
    item.setEnabled(COConfigurationManager.getBooleanParameter("IconBar.enabled"));
    final ParameterListener listener = new ParameterListener() {

        @Override
        public void parameterChanged(String parameterName) {
            item.setSelection(COConfigurationManager.getBooleanParameter(parameterName));
        }
    };
    COConfigurationManager.addAndFireParameterListener(configID, listener);
    item.addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent e) {
            COConfigurationManager.removeParameterListener(configID, listener);
        }
    });
    return item;
}
Also used : SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) ParameterListener(com.biglybt.core.config.ParameterListener) UIToolBarActivationListener(com.biglybt.pif.ui.toolbar.UIToolBarActivationListener) ParameterListener(com.biglybt.core.config.ParameterListener)

Aggregations

SWTSkinObject (com.biglybt.ui.swt.skin.SWTSkinObject)57 SWTSkinObjectContainer (com.biglybt.ui.swt.skin.SWTSkinObjectContainer)13 SWTSkinObjectListener (com.biglybt.ui.swt.skin.SWTSkinObjectListener)7 FormData (org.eclipse.swt.layout.FormData)7 SWTSkinButtonUtility (com.biglybt.ui.swt.skin.SWTSkinButtonUtility)6 SWTSkinObjectText (com.biglybt.ui.swt.skin.SWTSkinObjectText)6 GridLayout (org.eclipse.swt.layout.GridLayout)6 FormAttachment (org.eclipse.swt.layout.FormAttachment)5 CoreRunningListener (com.biglybt.core.CoreRunningListener)4 ParameterListener (com.biglybt.core.config.ParameterListener)4 UIToolBarActivationListener (com.biglybt.pif.ui.toolbar.UIToolBarActivationListener)4 SWTSkin (com.biglybt.ui.swt.skin.SWTSkin)4 Point (org.eclipse.swt.graphics.Point)4 GridData (org.eclipse.swt.layout.GridData)4 Control (org.eclipse.swt.widgets.Control)4 Core (com.biglybt.core.Core)3 ToolBarItem (com.biglybt.ui.common.ToolBarItem)3 MultipleDocumentInterface (com.biglybt.ui.mdi.MultipleDocumentInterface)3 ImageLoader (com.biglybt.ui.swt.imageloader.ImageLoader)3 Composite (org.eclipse.swt.widgets.Composite)3