use of com.biglybt.ui.swt.skin.SWTSkinObject in project BiglyBT by BiglySoftware.
the class TopBarView method skinObjectInitialShow.
@Override
public Object skinObjectInitialShow(SWTSkinObject skinObject, Object params) {
this.skin = skinObject.getSkin();
skin.addListener("topbar-plugins", new SWTSkinObjectListener() {
@Override
public Object eventOccured(SWTSkinObject skinObject, int eventType, Object params) {
if (eventType == SWTSkinObjectListener.EVENT_SHOW) {
skin.removeListener("topbar-plugins", this);
// building needs UISWTInstance, which needs core.
CoreFactory.addCoreRunningListener(new CoreRunningListener() {
@Override
public void coreRunning(Core core) {
Utils.execSWTThreadLater(0, new AERunnable() {
@Override
public void runSupport() {
buildTopBarViews();
}
});
}
});
}
return null;
}
});
// trigger autobuild and hook in events
skin.getSkinObject("topbar-area-plugin").addListener(new SWTSkinObjectListener() {
@Override
public Object eventOccured(SWTSkinObject skinObject, int eventType, Object params) {
if (eventType == SWTSkinObjectListener.EVENT_SHOW) {
if (activeTopBar != null) {
activeTopBar.triggerEvent(UISWTViewEvent.TYPE_FOCUSGAINED, null);
}
} else if (eventType == SWTSkinObjectListener.EVENT_HIDE) {
if (activeTopBar != null) {
activeTopBar.triggerEvent(UISWTViewEvent.TYPE_FOCUSLOST, null);
}
}
return (null);
}
});
return null;
}
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.getCurrentEntrySWT();
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 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 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();
}
use of com.biglybt.ui.swt.skin.SWTSkinObject in project BiglyBT by BiglySoftware.
the class BaseMDI method getEntryBySkinView.
/**
* @param skinView
* @return
*
* @since 3.1.1.1
*/
@Override
public MdiEntry getEntryBySkinView(Object skinView) {
SWTSkinObject so = ((SkinView) skinView).getMainSkinObject();
BaseMdiEntry[] sideBarEntries = getEntries(new BaseMdiEntry[0]);
for (int i = 0; i < sideBarEntries.length; i++) {
BaseMdiEntry entry = sideBarEntries[i];
SWTSkinObject entrySO = entry.getSkinObject();
SWTSkinObject entrySOParent = entrySO == null ? entrySO : entrySO.getParent();
if (entrySO == so || entrySO == so.getParent() || entrySOParent == so) {
return entry;
}
}
return null;
}
Aggregations