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;
}
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 });
}
}
}
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;
}
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();
}
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;
}
Aggregations