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