@Override @OverridingMethodsMustInvokeSuper protected void preRenderCallback(T entity, float partialTickTime) { this.playerModel.getModel().isSneak = false; this.playerModel.getModel().isFlying = false; this.playerModel.getModel().isSleeping = false; ResourceLocation loc = getEntityTexture(entity); this.playerModel.apply(MineLittlePony.getInstance().getManager().getPony(loc).getMetadata()); if (mainModel.isChild) { this.shadowSize = 0.25F; } else if (MineLittlePony.getConfig().showscale) { this.shadowSize = 0.4F; } else { this.shadowSize = 0.5F; } }
/** * Parses the command line input. Returns the tool instance to be run (which may or may not be this instance). * <p> * IMPORTANT: When overriding this method, you must remove any option (arg starting with "-") * that you have already handled to avoid getting an "unknown option" failure. * * @see #removeFirst(String, String...) */ @OverridingMethodsMustInvokeSuper protected Tool parseArguments(String[] args) throws Exception { for (String arg : options(args)) { if (arg.equals("--debug")) { checkArgument(verbosity == Level.DEFAULT, "Specify one of: --quiet --verbose --debug"); setVerbosity(Level.DEBUG); } else if (arg.equals("--verbose")) { checkArgument(verbosity == Level.DEFAULT, "Specify one of: --quiet --verbose --debug"); setVerbosity(Level.VERBOSE); } else if (arg.equals("--quiet")) { checkArgument(verbosity == Level.DEFAULT, "Specify one of: --quiet --verbose --debug"); setVerbosity(Level.QUIET); } else if (arg.equals("--pretty")) { setPretty(true); } else { return unknownOption(arg); } } return this; }
/** * Called by {@link #load(IAllocationRequest)} right before exiting.<br> * In this method, implementors can do final polishing because the loader exits. * <p> * <b>IMPORTANT:</b> overriding methods should invoke {@code super}, unless they know what they do. * <p> * gh #460: this implementation handles aggregate HU and updates their PackingMaterial items. * Afterwards it invokes {@link IMutableAllocationResult#aggregateTransactions()} to combine all trx candidates that belong to the same (aggregate) VHU. * * @param result_IGNORED current result (that will be also returned by {@link #load(IAllocationRequest)} method); won't be changed by this method, but maybe by overriding methods. */ @OverridingMethodsMustInvokeSuper protected void loadFinished(final IMutableAllocationResult result_IGNORED, final IHUContext huContext) { // TODO: i think we can move this stuff or something better into a model interceptor that is fired when item.qty is changed _createdHUs.forEach( hu -> { final IAttributeStorage attributeStorage = huContext.getHUAttributeStorageFactory().getAttributeStorage(hu); final IWeightable weightable = Services.get(IWeightableFactory.class).createWeightableOrNull(attributeStorage); final I_M_Attribute weightTareAttribute = weightable.getWeightTareAttribute(); if (attributeStorage.hasAttribute(weightTareAttribute)) { final BigDecimal tareOfHU = WeightTareAttributeValueCallout.calculateWeightTare(hu); final BigDecimal taresOfChildren = attributeStorage .getChildAttributeStorages(true) // loadIfNeeded=true because we need to make sure to have all tares that exist. not matter if those storages are already on memory or no. .stream() .filter(s -> s.hasAttribute(weightTareAttribute)) .map(s -> s.getValueAsBigDecimal(weightTareAttribute)) .reduce(BigDecimal.ZERO, BigDecimal::add); attributeStorage .setValue(weightTareAttribute, tareOfHU.add(taresOfChildren)); } }); }
@Override @OverridingMethodsMustInvokeSuper public void dispose() { _lines = Collections.emptyList(); _linesAll = Collections.emptyList(); if (rowsTableModel != null) { if (rowTableModelListener != null) { rowsTableModel.removeTerminalTableModelListener(rowTableModelListener); rowTableModelListener = null; } } disposed = true; }
@Override @OverridingMethodsMustInvokeSuper public void dispose() { if (isDisposed()) { return; // nothing to do } modelListener = null; // because it's the last reference, we expect this listener to expire in model if (model != null) { // NOTE: we are not disposing it because we did not create it model = null; } disposed = true; }
@Override @OverridingMethodsMustInvokeSuper public void dispose() { super.dispose(); _nameBuilder = NullHUKeyNameBuilder.instance; // // Clear properties properties.clear(); // // Unlink from parent, but just unset the reference. setParent(null) causes a lot of listeners etc being fired and properties being update that we don't need. // this.parent is also an IHUKey (i.e. IDisposable), so be can assume that it will be disposed too, and we don't have to try to ensure it from here. // setParent(null); this.parent = null; }
@Override @OverridingMethodsMustInvokeSuper public void dispose() { if (isDisposed()) { return; // nothing to do } // pcs.clear(); // not needed since pcs was created by the terminalContext // not needed since they added themselves as disposable components in their constructors // DisposableHelper.disposeAll(breadcrumbKeyLayout, _huKeyFilterModel, handlingUnitsKeyLayout, propertiesPanelModel); rootHUKey = null; _currentKey = null; _selectedKeyIds.clear(); clearCache(); disposed = true; }
@Override @OverridingMethodsMustInvokeSuper protected void initialize() { setupMRP(); setupHandlingUnits(); setupPOS(); setupMiscWorkaroundsAndMocks(); // Misc masterdata bpartner_Customer01 = createBPartner("BP_Customer01"); bpartner_Customer01.setIsCustomer(true); bpartner_Customer01.setIsVendor(false); InterfaceWrapperHelper.save(bpartner_Customer01); // Get misc services: ddOrderDAO = Services.get(IDDOrderDAO.class); ddOrderBL = Services.get(IDDOrderBL.class); LogManager.setLoggerLevel(logger, Level.INFO); }
/** * Flush queued events and stop queuing. */ @OverridingMethodsMustInvokeSuper public QueueableForwardingEventBus flushAndStopQueuing() { if (!queuing) { return this; } this.queuing = false; // make sure our queue is empty flush(); return this; }
@Override @OverridingMethodsMustInvokeSuper public void updateSpecialColumnsName(final PO to) { if (!isBase()) { final POInfo poInfo = to.getPOInfo(); if (poInfo.hasColumnName(COLUMNNAME_Name) && DisplayType.isText(poInfo.getColumnDisplayType(COLUMNNAME_Name))) { makeUnique(to, COLUMNNAME_Name); } if (poInfo.hasColumnName(COLUMNNAME_Value)) { makeUnique(to, COLUMNNAME_Value); } } }
/** * Sets parameter. * * @param name parameter name * @param value parameter value or <code>null</code> if you want the parameter to be removed. */ @OverridingMethodsMustInvokeSuper public AdempiereException setParameter(@NonNull final String name, @Nullable final Object value) { // avoid setting null values because it will fail on getParameters() which is returning an ImmutableMap if (value == null) { // remove the parameter if any if (parameters != null) { parameters.remove(name); } return this; } if (parameters == null) { parameters = new LinkedHashMap<>(); } parameters.put(name, value); resetMessageBuilt(); return this; }
@Override @OverridingMethodsMustInvokeSuper public void dispose() { buttonActionListener = null; // not created here, so we don't dispose them caller = NullTerminalKeyListener.instance; renderer = DefaultKeyPanelRenderer.instance; keyLayout = null; if (keyLayoutInfoMap != null) { keyLayoutInfoMap.clear(); } disposed = true; }
/** * Checks the stuff that shall be the same among all subclasses/tests. */ @Override @OverridingMethodsMustInvokeSuper protected void step_validate_before_aggregation(List<I_C_Invoice_Candidate> invoiceCandidates, List<I_M_InOutLine> inOutLines) { final I_C_Invoice_Candidate ic = invoiceCandidates.get(0); if (config_getQualityDiscount_Override() == null) { assertThat(InterfaceWrapperHelper.isNull(ic, I_C_Invoice_Candidate.COLUMNNAME_QualityDiscountPercent_Override), is(true)); } else { assertThat(InterfaceWrapperHelper.isNull(ic, I_C_Invoice_Candidate.COLUMNNAME_QualityDiscountPercent_Override), is(false)); assertThat(ic.getQualityDiscountPercent_Override(), comparesEqualTo(config_getQualityDiscount_Override())); } // Required because QualityDiscountPercent_Override will be applied to the QtyDelivered, and if we have invoiceRule "immediate", then qtyDelivered make a difference at all. assertThat((String)InterfaceWrapperHelper.getValueOverrideOrValue(ic, I_C_Invoice_Candidate.COLUMNNAME_InvoiceRule), is(X_C_Invoice_Candidate.INVOICERULE_NachLieferung)); }
@Override @OverridingMethodsMustInvokeSuper protected void step_validate_after_aggregation(List<I_C_Invoice_Candidate> invoiceCandidates, List<I_M_InOutLine> inOutLines, List<IInvoiceHeader> invoices) { assertEquals("We are expecting one invoice: " + invoices, 1, invoices.size()); final IInvoiceHeader invoice1 = invoices.get(0); // don't remove, because the subclass implementation might also want to get it. assertThat(invoice1.getPOReference(), is(IC_PO_REFERENCE)); assertThat(invoice1.getDateAcct(), is(IC_DATE_ACCT)); assertThat(invoice1.isSOTrx(), is(false)); final List<IInvoiceLineRW> invoiceLines1 = getInvoiceLines(invoice1); assertEquals("We are expecting one invoice line: " + invoiceLines1, 1, invoiceLines1.size()); final IInvoiceLineRW il1 = getSingleForInOutLine(invoiceLines1, iol11); assertNotNull("Missing IInvoiceLineRW for iol111=" + iol11, il1); assertThat(il1.getC_InvoiceCandidate_InOutLine_IDs().size(), equalTo(1)); }
@Before @OverridingMethodsMustInvokeSuper public void init() { final Properties ctx = Env.getCtx(); Env.setContext(ctx, Env.CTXNAME_AD_Client_ID, 1); Env.setContext(ctx, Env.CTXNAME_AD_Language, "de_CH"); manualHandler = InterfaceWrapperHelper.create(ctx, I_C_ILCandHandler.class, Trx.createTrxName()); manualHandler.setTableName(ManualCandidateHandler.MANUAL); manualHandler.setClassname(ManualCandidateHandler.class.getName()); InterfaceWrapperHelper.save(manualHandler); // registerModelInterceptors(); doesn't work well with the legacy tests. Only register then in AbstractNewAggregationEngineTests LogManager.setLevel(Level.DEBUG); }
/** * Populate model which values from this expectation * * @param inoutLine */ @OverridingMethodsMustInvokeSuper protected void populateModel(final I_M_InOutLine inoutLine) { if (product != null) { inoutLine.setM_Product_ID(product.getM_Product_ID()); } inoutLine.setQtyEntered(qtyEntered); inoutLine.setMovementQty(movementQty); if (inDispute != null) { inoutLine.setIsInDispute(inDispute); } inoutLine.setQualityDiscountPercent(qualityDiscountPercent); inoutLine.setQualityNote(qualityNote); }
/** * Line Account from Product (or Charge). * * @param AcctType see ProductCost.ACCTTYPE_* (0..3) * @param as Accounting schema * @return Requested Product Account */ @OverridingMethodsMustInvokeSuper public MAccount getAccount(ProductAcctType AcctType, MAcctSchema as) { if (getM_Product_ID() <= 0 && getC_Charge_ID() > 0) { final MAccount acct; if (!m_doc.isSOTrx()) { acct = getChargeAccount(as, new BigDecimal(+1)); // Expense (+) } else { acct = getChargeAccount(as, new BigDecimal(-1)); // Revenue (-) } if (acct != null) { return acct; } } // Product Account return getProductCost().getAccount(AcctType, as); }
@OverridingMethodsMustInvokeSuper @Override public InvoiceCandidateExpectation<ParentExpectationType> assertExpected(final ErrorMessage message, final I_C_Invoice_Candidate actual) { final de.metas.materialtracking.model.I_C_Invoice_Candidate actualExt = InterfaceWrapperHelper.create(actual, de.metas.materialtracking.model.I_C_Invoice_Candidate.class); final ErrorMessage messageToUse = derive(message) .addContextInfo(actual); if (groupTypeSet) { final QualityInvoiceLineGroupType actualGroupType = QualityInvoiceLineGroupType.ofAD_Ref_List_Value(actualExt.getQualityInvoiceLineGroupType()); assertEquals(messageToUse.expect("QualityInvoiceLineGroupType"), groupType, actualGroupType); } // call the base class only now, because a failing group type might be a stringer indicator of a problem.. super.assertExpected(message, actual); return this; }
@OverridingMethodsMustInvokeSuper public boolean isEqualContent (@Nullable final IMicroNode o) { if (o == this) return true; if (o == null || !getClass ().equals (o.getClass ())) return false; final AbstractMicroNodeWithChildren rhs = (AbstractMicroNodeWithChildren) o; if (m_aChildren == null && rhs.m_aChildren == null) return true; if (m_aChildren == null || rhs.m_aChildren == null) return false; final int nMax = m_aChildren.size (); final int nMaxRhs = rhs.m_aChildren.size (); if (nMax != nMaxRhs) return false; for (int i = 0; i < nMax; ++i) { final IMicroNode aChild1 = m_aChildren.get (i); final IMicroNode aChild2 = rhs.m_aChildren.get (i); if (!aChild1.isEqualContent (aChild2)) return false; } return true; }
@Nonnull @OverridingMethodsMustInvokeSuper public EChange clearCache () { m_aRWLock.writeLock ().lock (); try { if (m_aCache == null || m_aCache.isEmpty ()) return EChange.UNCHANGED; m_aCache.clear (); m_aCacheClearStats.increment (); } finally { m_aRWLock.writeLock ().unlock (); } if (s_aLogger.isDebugEnabled ()) s_aLogger.debug ("Cache '" + m_sName + "' was cleared"); return EChange.CHANGED; }
@Override @OverridingMethodsMustInvokeSuper public boolean isValidValue (@Nullable final String sValue) { if (sValue == null) return false; // Split by whitespaces " a b " results in { "a", "b" } final String [] aParts = RegExHelper.getSplitToArray (sValue.trim (), "\\s+"); if (aParts.length < getMinimumArgumentCount () || aParts.length > getMaximumArgumentCount ()) return false; // Check each value for (final String aPart : aParts) { final String sTrimmedPart = aPart.trim (); if (!super.isValidValue (sTrimmedPart) && !CSSColorHelper.isColorValue (sTrimmedPart)) return false; } return true; }
@Override @OverridingMethodsMustInvokeSuper public boolean isValidValue (@Nullable final String sValue) { if (super.isValidValue (sValue)) return true; if (sValue == null) return false; // Split by whitespaces final String [] aParts = RegExHelper.getSplitToArray (sValue.trim (), "\\s+"); if (aParts.length < m_nMinNumbers || aParts.length > m_nMaxNumbers) return false; // Check if each part is a valid number for (final String sPart : aParts) if (!CSSNumberHelper.isValueWithUnit (sPart.trim (), m_bWithPercentage)) return false; return true; }
@Override @OverridingMethodsMustInvokeSuper public boolean isValidValue (@Nullable final String sValue) { if (sValue == null) return false; // Split by whitespaces " a b " results in { "a", "b" } final String [] aParts = RegExHelper.getSplitToArray (sValue.trim (), "\\s+"); if (aParts.length < getMinimumArgumentCount () || aParts.length > getMaximumArgumentCount ()) return false; for (final String sPart : aParts) if (!super.isValidValue (sPart.trim ())) return false; return true; }
@Override @OverridingMethodsMustInvokeSuper public boolean isValidValue (@Nullable final String sValue) { if (sValue == null) return false; // Split by whitespaces " a b " results in { "a", "b" } final String [] aParts = RegExHelper.getSplitToArray (sValue.trim (), "\\s+"); if (aParts.length < m_nMinNumbers || aParts.length > m_nMaxNumbers) return false; for (final String aPart : aParts) { final String sTrimmedPart = aPart.trim (); if (!super.isValidValue (sTrimmedPart) && !CSSNumberHelper.isValueWithUnit (sTrimmedPart, m_bWithPercentage)) return false; } return true; }
@Override @Nonnull @OverridingMethodsMustInvokeSuper protected SizeSpec getRenderSize (@Nonnull final SizeSpec aPreparedSize) { ValueEnforcer.notNull (aPreparedSize, "Size"); // Consider min size here float fRealWidth = Math.max (m_aMinSize.getWidth (), aPreparedSize.getWidth ()); float fRealHeight = Math.max (m_aMinSize.getHeight (), aPreparedSize.getHeight ()); // Consider max size here fRealWidth = Math.min (m_aMaxSize.getWidth (), fRealWidth); fRealHeight = Math.min (m_aMaxSize.getHeight (), fRealHeight); return new SizeSpec (fRealWidth, fRealHeight); }
@Before @OverridingMethodsMustInvokeSuper public void setUp() throws IOException { data = DATA.clone(); final FsTestConfig config = FsTestConfig.push(); config.setDataSize(data.length * 4 / 3); // account for archive type specific overhead config.setPool(null); // reset }
@Before @OverridingMethodsMustInvokeSuper public void setUp() throws IOException { file = createTempFile(TEMP_FILE_PREFIX, null); delete(file); data = DATA.clone(); }
@After @OverridingMethodsMustInvokeSuper public void tearDown() { try { deleteIfExists(file); } catch (final IOException ex) { logger.trace( "Failed to clean up test file (this may be just an implication of the root cause):", ex); } }
@OverridingMethodsMustInvokeSuper @Override public void serialize(SerializationData data) { data.add("type", this.type); data.add("name", this.namee); data.addNumber("age", this.age, 3); data.add("special", this.special); data.add("displayName", this.displayName); data.add("specialEnum", this.specialEnum); data.addMappedList("metaObjects", MetaObject.class, this.metaObjects, o -> o.name); data.addMapAsListWithKeys("uuidMetaObjectMap", this.uuidMetaObjectMap, MetaObject.class, "uuid"); data.addCollection("propertiesCollection", this.propertiesCollection, SomeProperties.class); }
@Override @OverridingMethodsMustInvokeSuper public void notifyRecordsChanged(@NonNull final Set<TableRecordReference> recordRefs) { final ImmutableList<DocumentId> changedDocumentIds = extractDocumentIds(recordRefs); if (changedDocumentIds.isEmpty()) { return; // nothing to do } rowsData.invalidateAll(); ViewChangesCollector .getCurrentOrAutoflush() .collectRowsChanged(this, DocumentIdsSelection.of(changedDocumentIds)); }
@OverridingMethodsMustInvokeSuper protected DocumentFilterDescriptorsProvider createFilterDescriptorsProvider() { final DocumentEntityDescriptor huEntityDescriptor = getHUEntityDescriptor(); final Collection<DocumentFilterDescriptor> huStandardFilters = huEntityDescriptor.getFilterDescriptors().getAll(); return ImmutableDocumentFilterDescriptorsProvider.builder() .addDescriptors(huStandardFilters) .addDescriptor(HUBarcodeSqlDocumentFilterConverter.createDocumentFilterDescriptor()) .build(); }
@OverridingMethodsMustInvokeSuper protected IViewRow getSingleSelectedRow() { final DocumentIdsSelection selectedRowIds = getSelectedRowIds(); final DocumentId documentId = selectedRowIds.getSingleDocumentId(); return getView().getById(documentId); }
/** * This method can be overridden to add extra stuff to the theme map, after * it has been loaded from properties or whatnot. */ @OverridingMethodsMustInvokeSuper public void augmentThemeMap(@Nonnull IScriptScope ss) throws Exception { ss.put("util", new ThemeCssUtils(ss)); ss.eval(Object.class, "function url(x) { return util.url(x);};", "internal"); m_themeApplicationProperties.forEach((key, value) -> ss.put(key, value)); }
/** * This destroys all existing nodes and causes this node to be rebuilt the next time the * tree is rendered. */ @Override @OverridingMethodsMustInvokeSuper final public void forceRebuild() { //-- If we have nodes destroy 'm all m_delegate = null; // FIXME URGENT Wrong!!!!! removeAllChildren(); // Remove all old crap treeChanging(); super.forceRebuild(); }
@OverridingMethodsMustInvokeSuper public void initiateEntityPet() { this.resetEntitySize(); getBukkitEntity().setMaxHealth(getPet().getPetType().getMaxHealth()); getBukkitEntity().setHealth((float) getPet().getPetType().getMaxHealth()); jumpHeight = EchoPet.getOptions().getRideJumpHeight(this.getPet().getPetType()); rideSpeed = EchoPet.getOptions().getRideSpeed(this.getPet().getPetType()); this.setPathfinding(); }
/** @see java.io.FilterOutputStream#write(int) */ @Override @OverridingMethodsMustInvokeSuper public void write(int b) throws IOException { out.write(b); ++count; }
/** @see java.io.FilterOutputStream#write(byte[], int, int) */ @Override @OverridingMethodsMustInvokeSuper public void write(byte[] b, int off, int len) throws IOException { out.write(b, off, len); count += len; }
@Override @OverridingMethodsMustInvokeSuper public int read() throws IOException { int result = in.read(); if (result != -1) { count++; } return result; }
@Override @OverridingMethodsMustInvokeSuper public int read(byte[] b, int off, int len) throws IOException { int result = in.read(b, off, len); if (result != -1) { count += result; } return result; }
@OverridingMethodsMustInvokeSuper @Override public void serialize(SerializationData data) { data.add("type", this.type); data.add("name", this.namee); data.addNumber("age", this.age, 3); data.add("special", this.special); data.add("displayName", this.displayName); data.addMappedList("metaObjects", MetaObject.class, this.metaObjects, o -> o.name); data.addMapAsListWithKeys("uuidMetaObjectMap", this.uuidMetaObjectMap, MetaObject.class, "uuid"); data.addCollection("propertiesCollection", this.propertiesCollection, SomeProperties.class); }