use of com.google.api.ads.admanager.axis.v202205.Label in project sirix by sirixdb.
the class AbstractSunburstGUI method style.
/**
* Style menu.
*/
protected void style() {
final Group ctrl = mControlP5.addGroup("menu", 15, 25, 35);
ctrl.setColorLabel(mParent.color(255));
ctrl.setColorBackground(mParent.color(100));
ctrl.close();
mParent.colorMode(PConstants.RGB, 255, 255, 255);
final int backgroundColor = 0x99ffffff;
int i = 0;
for (final Slider slider : mSliders) {
slider.setGroup(ctrl);
slider.setId(i);
final Label label = slider.getCaptionLabel();
label.toUpperCase(true);
label.setColor(mParent.color(0));
label.setColorBackground(backgroundColor);
final ControllerStyle style = label.getStyle();
style.padding(4, 0, 1, 3);
style.marginTop = -4;
style.marginLeft = 0;
style.marginRight = -14;
slider.plugTo(mControl);
i++;
}
i = 0;
for (final Range range : mRanges) {
range.setGroup(ctrl);
range.setId(i);
final Label label = range.getCaptionLabel();
label.toUpperCase(true);
label.setColor(mParent.color(0));
label.setColorBackground(backgroundColor);
final ControllerStyle style = label.getStyle();
style.padding(4, 0, 1, 3);
style.marginTop = -4;
range.plugTo(mControl);
i++;
}
i = 0;
for (final Toggle toggle : mToggles) {
toggle.setGroup(ctrl);
toggle.setId(i);
final Label label = toggle.getCaptionLabel();
label.setColor(mParent.color(0));
label.setColorBackground(backgroundColor);
final ControllerStyle style = label.getStyle();
style.padding(4, 3, 1, 3);
style.marginTop = -19;
style.marginLeft = 18;
style.marginRight = 5;
toggle.plugTo(mControl);
i++;
}
mParent.colorMode(PConstants.HSB, 360, 100, 100);
mParent.textLeading(14);
mParent.textAlign(PConstants.LEFT, PConstants.TOP);
mParent.cursor(PConstants.CROSS);
}
use of com.google.api.ads.admanager.axis.v202205.Label in project googleads-java-lib by googleads.
the class CreateLabels method runExample.
/**
* Runs the example.
*
* @param adManagerServices the services factory.
* @param session the session.
* @throws ApiException if the API request failed with one or more service errors.
* @throws RemoteException if the API request failed due to other errors.
*/
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException {
// Get the LabelService.
LabelServiceInterface labelService = adManagerServices.get(session, LabelServiceInterface.class);
// Create a competitive exclusion label.
Label competitiveExclusionLabel = new Label();
competitiveExclusionLabel.setName("Car company label #" + new Random().nextInt(Integer.MAX_VALUE));
competitiveExclusionLabel.setTypes(new LabelType[] { LabelType.COMPETITIVE_EXCLUSION });
// Create an ad unit frequency cap label.
Label adUnitFrequencyCapLabel = new Label();
adUnitFrequencyCapLabel.setName("Don't run too often label #" + new Random().nextInt(Integer.MAX_VALUE));
adUnitFrequencyCapLabel.setTypes(new LabelType[] { LabelType.AD_UNIT_FREQUENCY_CAP });
// Create the labels on the server.
Label[] labels = labelService.createLabels(new Label[] { competitiveExclusionLabel, adUnitFrequencyCapLabel });
for (Label createdLabel : labels) {
System.out.printf("A label with ID %d and name '%s' was created.%n", createdLabel.getId(), createdLabel.getName());
}
}
use of com.google.api.ads.admanager.axis.v202205.Label in project incubator-skywalking by apache.
the class MeterProcessor method read.
public void read(MeterData data) {
// Parse and save meter
switch(data.getMetricCase()) {
case SINGLEVALUE:
MeterSingleValue single = data.getSingleValue();
meters.computeIfAbsent(single.getName(), k -> new ArrayList<>()).add(SampleBuilder.builder().name(single.getName()).labels(single.getLabelsList().stream().collect(toImmutableMap(Label::getName, Label::getValue))).value(single.getValue()).build());
break;
case HISTOGRAM:
MeterHistogram histogram = data.getHistogram();
Map<String, String> baseLabel = histogram.getLabelsList().stream().collect(Collectors.toMap(Label::getName, Label::getValue));
meters.computeIfAbsent(histogram.getName(), k -> new ArrayList<>()).addAll(histogram.getValuesList().stream().map(v -> SampleBuilder.builder().name(histogram.getName()).labels(ImmutableMap.<String, String>builder().putAll(baseLabel).put("le", parseHistogramBucket(v)).build()).value(v.getCount()).build()).collect(Collectors.toList()));
break;
default:
return;
}
// Agent info
if (StringUtil.isNotEmpty(data.getService())) {
service = data.getService();
}
if (StringUtil.isNotEmpty(data.getServiceInstance())) {
serviceInstance = data.getServiceInstance();
}
if (data.getTimestamp() > 0) {
timestamp = data.getTimestamp();
}
}
use of com.google.api.ads.admanager.axis.v202205.Label in project tomee by apache.
the class Cmp2Generator method createOpenEJB_deleted.
private void createOpenEJB_deleted() {
final MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "OpenEJB_deleted", "()V", null, null);
mv.visitCode();
/* if (deleted) return; */
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(GETFIELD, implClassName, DELETED, "Z");
final Label notDeleted = new Label();
mv.visitJumpInsn(IFEQ, notDeleted);
mv.visitInsn(RETURN);
mv.visitLabel(notDeleted);
// deleted = true;
mv.visitVarInsn(ALOAD, 0);
mv.visitInsn(ICONST_1);
mv.visitFieldInsn(PUTFIELD, implClassName, DELETED, "Z");
for (final CmrField cmrField : cmrFields) {
// ${cmrField.accessor}.delete(${cmrField.name});
createOpenEJB_deleted(mv, cmrField);
}
// return;
mv.visitInsn(RETURN);
mv.visitMaxs(0, 0);
mv.visitEnd();
}
use of com.google.api.ads.admanager.axis.v202205.Label in project tomee by apache.
the class Cmp2Generator method createOpenEJB_addCmr.
private void createOpenEJB_addCmr() {
final MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "OpenEJB_addCmr", "(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object;", null, null);
mv.visitCode();
// if (deleted) return null;
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(GETFIELD, implClassName, DELETED, "Z");
final Label notDeleted = new Label();
mv.visitJumpInsn(IFEQ, notDeleted);
mv.visitInsn(ACONST_NULL);
mv.visitInsn(ARETURN);
mv.visitLabel(notDeleted);
for (final CmrField cmrField : cmrFields) {
// if ("${cmrField.name}".equals(name)) {
// ${cmrField.name}.add((${cmrField.type})value);
// return null;
// }
//
// OR
//
// if ("${cmrField.name}".equals(name)) {
// Object oldValue = ${cmrField.name};
// ${cmrField.name} = (${cmrField.type}) bean;
// return oldValue;
// }
createOpenEJB_addCmr(mv, cmrField);
}
// throw new IllegalArgumentException("Unknown cmr field " + name + " on entity bean of type " + getClass().getName());
mv.visitTypeInsn(NEW, "java/lang/IllegalArgumentException");
mv.visitInsn(DUP);
mv.visitTypeInsn(NEW, "java/lang/StringBuilder");
mv.visitInsn(DUP);
mv.visitMethodInsn(INVOKESPECIAL, "java/lang/StringBuilder", "<init>", "()V", false);
mv.visitLdcInsn("Unknown cmr field ");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/StringBuilder", "append", "(Ljava/lang/String;)Ljava/lang/StringBuilder;", false);
mv.visitVarInsn(ALOAD, 1);
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/StringBuilder", "append", "(Ljava/lang/String;)Ljava/lang/StringBuilder;", false);
mv.visitLdcInsn(" on entity bean of type ");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/StringBuilder", "append", "(Ljava/lang/String;)Ljava/lang/StringBuilder;", false);
mv.visitVarInsn(ALOAD, 0);
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Object", "getClass", "()Ljava/lang/Class;", false);
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Class", "getName", "()Ljava/lang/String;", false);
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/StringBuilder", "append", "(Ljava/lang/String;)Ljava/lang/StringBuilder;", false);
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/StringBuilder", "toString", "()Ljava/lang/String;", false);
mv.visitMethodInsn(INVOKESPECIAL, "java/lang/IllegalArgumentException", "<init>", "(Ljava/lang/String;)V", false);
mv.visitInsn(ATHROW);
mv.visitMaxs(0, 0);
mv.visitEnd();
}
Aggregations